Status icon flashes on new tweets

This commit is contained in:
Anna 2010-05-26 00:14:56 -04:00
parent 5a9aa09167
commit cc7011b724
3 changed files with 18 additions and 13 deletions

View File

@ -270,7 +270,7 @@ class GetUserLists(ApiThread):
lists = self.api.GetUserLists()
except (HTTPError, URLError) as exception:
print 'debug: GetUserLists had error: ' + str(exception.code)
sleep(5)
sleep(30)
done = False
self.sig_proxy.emit('lists-ready', lists, None)
@ -424,6 +424,7 @@ def results_to_statuses(results, api):
status.user.screen_name = result.from_user
status.user.name = ''
status.user.profile.image_url = result.profile_image_url
status.in_reply_to_status_id = None
status.in_reply_to_screen_name = result.to_user
# The Twitter Search API has different timestamps than the
# REST API... balls

View File

@ -329,8 +329,8 @@ class Hrafn():
entries=1
new_pane = TweetPane(name, num_entries=entries, single_tweet=single_tweet, is_user=is_user, conversation=conversation)
new_pane.connect('new-tweets', self.on_new_tweets)
new_pane.connect('tweets-read', self.on_tweets_read)
new_pane.connect('new-tweets', self.on_read_tweets_changed)
new_pane.connect('tweets-read', self.on_read_tweets_changed)
if is_user:
new_pane.connect('at-clicked', self.on_at_button_clicked)
@ -627,12 +627,16 @@ class Hrafn():
config_filehandle.close()
def on_new_tweets(self, widget, num_tweets):
pass
def on_read_tweets_changed(self, widget):
unread_tweets = 0
for i in range(self.tweet_notebook.get_n_pages()):
pane = self.tweet_notebook.get_nth_page(i)
unread_tweets += pane.num_new_tweets
def on_tweets_read(self, widget, num_tweets):
pass
if unread_tweets > 0:
self.tray_icon.set_property('blinking', True)
else:
self.tray_icon.set_property('blinking', False)
### end class Hrafn

View File

@ -124,7 +124,7 @@ class TweetPane(gtk.ScrolledWindow):
self.tweets[i].hide()
if self.num_new_tweets > 0:
self.emit('new-tweets', self.num_new_tweets)
self.emit('new-tweets')
if len(statuses) == 0:
self.message.set_label('There is no data to display')
@ -161,7 +161,7 @@ class TweetPane(gtk.ScrolledWindow):
self.last_tweet_read = self.latest_tweet
self.num_new_tweets = 0
self.update_tab_label()
self.emit('tweets-read', num_read)
self.emit('tweets-read')
@ -239,10 +239,10 @@ gobject.signal_new("at-clicked", TweetPane,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))
gobject.signal_new("new-tweets", TweetPane,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))
gobject.TYPE_NONE, ())
gobject.signal_new("tweets-read", TweetPane,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))
gobject.TYPE_NONE, ())