Improve handling for marking tweets read

This commit is contained in:
Anna 2010-05-18 15:33:39 -04:00
parent d0c7bd6443
commit 6e881a4f38

View File

@ -64,6 +64,7 @@ class TweetPane(gtk.ScrolledWindow):
self.tweets[i].connect('in-reply-to', self.on_tweet_reply_to)
self.tweets[i].connect('conversation', self.on_tweet_conversation)
self.tweets[i].connect('show-user', self.on_show_user)
self.tweets[i].connect('tweet-read', self.set_tweets_read_callback)
viewport.add(tweet_box)
@ -305,6 +306,7 @@ class TweetBox(gtk.HBox):
if gtk.gtk_version[0] > 2 or (gtk.gtk_version[0] == 2 and gtk.gtk_version[1] >= 18):
self.text.connect('activate-link', self.on_url_clicked)
self.text.connect('button-press-event', self.on_mouse_clicked)
self.text_eb.connect('button-press-event', self.on_mouse_clicked)
# Build the buttons
button_box_align = gtk.Alignment()
@ -400,23 +402,29 @@ class TweetBox(gtk.HBox):
gtk.gdk.color_parse("#dbffdb"))
def on_reply_clicked(self, widget):
self.set_read()
self.emit('reply')
def on_retweet_clicked(self, widget):
self.set_read()
self.emit('retweet')
def on_in_reply_to_clicked(self, widget):
self.set_read()
self.emit('in-reply-to', {'id': self.in_reply_to_id, 'name': self.in_reply_to_screen_name})
def on_conversation_clicked(self, widget):
self.set_read()
self.emit('conversation', {'id': self.id, 'name': 'conversation'})
def on_user_clicked(self, widget):
self.set_read()
self.emit('show-user', self.screen_name)
@ -428,6 +436,7 @@ class TweetBox(gtk.HBox):
def on_url_clicked(self, widget, event):
self.set_read()
# fixme: we're catching this signal just to debug why it doesn't get emitted
# seems to be related to EventBox?
print 'debug: on_url_clicked()'
@ -442,6 +451,9 @@ gobject.signal_new("reply", TweetBox,
gobject.signal_new("retweet", TweetBox,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, ())
gobject.signal_new("tweet-read", TweetBox,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, ())
gobject.signal_new("in-reply-to", TweetBox,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))