Made posting an update a threaded action

This commit is contained in:
Anna
2010-05-18 17:41:32 -04:00
parent 8764cc77c3
commit cc99e36ed3
2 changed files with 43 additions and 12 deletions

View File

@ -260,6 +260,29 @@ class GetUserLists(ApiThread):
class PostUpdate(ApiThread):
def __init__(self, api, update, reply_id):
ApiThread.__init__(self, api)
self.sig_proxy = SigProxy()
self.update = update
self.reply_id = reply_id
def run(self):
try:
with self.api.lock:
self.api.PostUpdate(self.update, in_reply_to_status_id=self.reply_id)
success = True
except (HTTPError, URLError):
success = False
self.sig_proxy.emit('update-posted', success)
### End class PostUpdate
class SigProxy(gtk.Alignment):
"""
This little class exists just so that we can have a gtk class in our
@ -276,6 +299,10 @@ gobject.signal_new("lists-ready", SigProxy,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,gobject.TYPE_PYOBJECT))
gobject.signal_new("update-posted", SigProxy,
gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,))
# We use these classes to emulate a Status object when we need
# one to be built out of something else.