From 897f2273ce00176dcf7d061c207b31f4b9abefd1 Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 20 May 2010 00:16:10 -0400 Subject: [PATCH] Got all the buttons, signals, etc linked up for follow and at, I think... --- mytwitter.py | 10 ++++++++++ twitterwidgets.py | 11 +++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/mytwitter.py b/mytwitter.py index eaaa419..0f25857 100755 --- a/mytwitter.py +++ b/mytwitter.py @@ -433,6 +433,16 @@ class MyTwitter(): self.add_to_notebook('@' + user_name) + def on_follow_button_clicked(self, widget, follow): + user_name = re.sub('^user: ', '', widget.get_list_name()) + + thread = apithreads.ChangeFriendship(self.api, current_pane, user_name, follow) + thread.sig_proxy.connect('friendship-changed', self.on_friendship_changed) + thread.sig_proxy.connect('friendship-changed', widget.user_box.on_friendship_changed) + thread.start() + + + def global_key_press_handler(self, widget, event): keyname = gtk.gdk.keyval_name(event.keyval) if keyname == 'w' and event.state & gtk.gdk.CONTROL_MASK: diff --git a/twitterwidgets.py b/twitterwidgets.py index de39fb9..049b21b 100644 --- a/twitterwidgets.py +++ b/twitterwidgets.py @@ -467,6 +467,8 @@ gobject.signal_new("show-user", TweetBox, class UserBox(gtk.VBox): def __init__(self): + gtk.VBox.__init__(self) + self.data_lock = RLock() self.user_name = None @@ -490,10 +492,10 @@ class UserBox(gtk.VBox): button_row = gtk.HBox() button_row.pack_start(self.follow_button) button_row.pack_start(at_button) - self.pack_start(self.button_row) + self.pack_start(button_row) at_button.connect('clicked', self.on_at_clicked) - follow_button.connect('clicked', self.on_follow_clicked) + self.follow_button.connect('clicked', self.on_follow_clicked) self.show_all() self.verified_label.hide() @@ -528,6 +530,11 @@ class UserBox(gtk.VBox): self.emit('follow-clicked', follow) + def on_friendship_changed(self, widget, data): + if data['success']: + self.set_following(data['follow'] +) + def on_at_clicked(self, widget): self.emit('at-clicked', self.user_name)