Cleaned up handling of status bar messages

This commit is contained in:
Anna 2010-04-11 01:44:44 -04:00
parent a06d47cfcc
commit 7c06ad8c40

View File

@ -49,6 +49,7 @@ class MyTwitter():
self.update_entry = self.widget_tree.get_widget('update_entry') self.update_entry = self.widget_tree.get_widget('update_entry')
self.update_count = self.widget_tree.get_widget('update_count') self.update_count = self.widget_tree.get_widget('update_count')
self.status_bar = self.widget_tree.get_widget('status_bar') self.status_bar = self.widget_tree.get_widget('status_bar')
self.context_id = self.status_bar.get_context_id('message')
# Build us some labels... # Build us some labels...
for i in range(0, self.num_entries): for i in range(0, self.num_entries):
@ -98,9 +99,12 @@ class MyTwitter():
self.tweets[i].clear_status() self.tweets[i].clear_status()
self.latest_tweet = statuses[0].id self.latest_tweet = statuses[0].id
self.status_bar.pop(self.status_bar.get_context_id('new_tweets')) self.status_bar.pop(self.context_id)
if num_new_tweets > 0: if num_new_tweets > 0:
self.status_bar.push(self.status_bar.get_context_id('new_tweets'), str(num_new_tweets) + ' new tweets') status_text = str(num_new_tweets) + ' new tweet'
if num_new_tweets > 1:
status_text += 's'
self.status_bar.push(self.context_id, status_text)
def update_window_callback(self, widget): def update_window_callback(self, widget):
@ -112,8 +116,7 @@ class MyTwitter():
self.update_entry.set_text("") self.update_entry.set_text("")
self.api.PostUpdate(text, in_reply_to_status_id=self.reply_id) self.api.PostUpdate(text, in_reply_to_status_id=self.reply_id)
self.reply_id = None self.reply_id = None
self.status_bar.push(self.status_bar.get_context_id('update'), self.status_bar.push(self.context_id, 'Tweet Posted')
'Tweet Posted')
def update_status_callback(self, widget): def update_status_callback(self, widget):