Got all the buttons, signals, etc linked up for follow and at, I think...

This commit is contained in:
Anna 2010-05-20 00:16:10 -04:00
parent 22067b4ad2
commit 897f2273ce
2 changed files with 19 additions and 2 deletions

View File

@ -433,6 +433,16 @@ class MyTwitter():
self.add_to_notebook('@' + user_name) 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): def global_key_press_handler(self, widget, event):
keyname = gtk.gdk.keyval_name(event.keyval) keyname = gtk.gdk.keyval_name(event.keyval)
if keyname == 'w' and event.state & gtk.gdk.CONTROL_MASK: if keyname == 'w' and event.state & gtk.gdk.CONTROL_MASK:

View File

@ -467,6 +467,8 @@ gobject.signal_new("show-user", TweetBox,
class UserBox(gtk.VBox): class UserBox(gtk.VBox):
def __init__(self): def __init__(self):
gtk.VBox.__init__(self)
self.data_lock = RLock() self.data_lock = RLock()
self.user_name = None self.user_name = None
@ -490,10 +492,10 @@ class UserBox(gtk.VBox):
button_row = gtk.HBox() button_row = gtk.HBox()
button_row.pack_start(self.follow_button) button_row.pack_start(self.follow_button)
button_row.pack_start(at_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) 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.show_all()
self.verified_label.hide() self.verified_label.hide()
@ -528,6 +530,11 @@ class UserBox(gtk.VBox):
self.emit('follow-clicked', follow) 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): def on_at_clicked(self, widget):
self.emit('at-clicked', self.user_name) self.emit('at-clicked', self.user_name)