Removed useless code paths, made the follow button work correctly

This commit is contained in:
Anna 2010-05-20 00:21:21 -04:00
parent 897f2273ce
commit 46e63c7c3d
3 changed files with 6 additions and 12 deletions

View File

@ -337,9 +337,9 @@ class ChangeFriendship(ApiThread):
gtk.gdk.threads_enter()
try:
if self.follow:
self.pane.set_following(success)
self.pane.user_box.set_following(success)
else:
self.pane.set_following(not success)
self.pane.user_box.set_following(not success)
finally:
gtk.gdk.threads_leave()

View File

@ -436,9 +436,8 @@ class MyTwitter():
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 = apithreads.ChangeFriendship(self.api, widget, 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()

View File

@ -508,7 +508,7 @@ class UserBox(gtk.VBox):
try:
with AvCache().lock:
self.avatar.set_from_pixbuf(AvCache().map[status.user.screen_name])
self.avatar.set_from_pixbuf(AvCache().map[user.screen_name])
self.avatar.show()
except KeyError:
self.avatar.hide()
@ -530,11 +530,6 @@ 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)
@ -553,10 +548,10 @@ class UserBox(gtk.VBox):
with self.data_lock:
self.following = following
if following:
self.follow_button.set_text('Unfollow')
self.follow_button.set_label('Unfollow')
self.follow_label.show()
else:
self.follow_button.set_text('Follow')
self.follow_button.set_label('Follow')
self.follow_label.hide()
# end class UserBox