Removed useless code paths, made the follow button work correctly
This commit is contained in:
parent
897f2273ce
commit
46e63c7c3d
|
@ -337,9 +337,9 @@ class ChangeFriendship(ApiThread):
|
||||||
gtk.gdk.threads_enter()
|
gtk.gdk.threads_enter()
|
||||||
try:
|
try:
|
||||||
if self.follow:
|
if self.follow:
|
||||||
self.pane.set_following(success)
|
self.pane.user_box.set_following(success)
|
||||||
else:
|
else:
|
||||||
self.pane.set_following(not success)
|
self.pane.user_box.set_following(not success)
|
||||||
finally:
|
finally:
|
||||||
gtk.gdk.threads_leave()
|
gtk.gdk.threads_leave()
|
||||||
|
|
||||||
|
|
|
@ -436,9 +436,8 @@ class MyTwitter():
|
||||||
def on_follow_button_clicked(self, widget, follow):
|
def on_follow_button_clicked(self, widget, follow):
|
||||||
user_name = re.sub('^user: ', '', widget.get_list_name())
|
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', self.on_friendship_changed)
|
||||||
thread.sig_proxy.connect('friendship-changed', widget.user_box.on_friendship_changed)
|
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -508,7 +508,7 @@ class UserBox(gtk.VBox):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with AvCache().lock:
|
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()
|
self.avatar.show()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.avatar.hide()
|
self.avatar.hide()
|
||||||
|
@ -530,11 +530,6 @@ 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)
|
||||||
|
|
||||||
|
@ -553,10 +548,10 @@ class UserBox(gtk.VBox):
|
||||||
with self.data_lock:
|
with self.data_lock:
|
||||||
self.following = following
|
self.following = following
|
||||||
if following:
|
if following:
|
||||||
self.follow_button.set_text('Unfollow')
|
self.follow_button.set_label('Unfollow')
|
||||||
self.follow_label.show()
|
self.follow_label.show()
|
||||||
else:
|
else:
|
||||||
self.follow_button.set_text('Follow')
|
self.follow_button.set_label('Follow')
|
||||||
self.follow_label.hide()
|
self.follow_label.hide()
|
||||||
|
|
||||||
# end class UserBox
|
# end class UserBox
|
||||||
|
|
Reference in New Issue
Block a user