Browse Source

Auto-refresh works

master
Julio Biason 15 years ago
parent
commit
28e67f5375
  1. 15
      mitterlib/ui/ui_pygtk.py

15
mitterlib/ui/ui_pygtk.py

@ -700,9 +700,23 @@ class Interface(object):
def _refresh(self, widget=None): def _refresh(self, widget=None):
"""Request a refresh. *widget* is the widget that called this """Request a refresh. *widget* is the widget that called this
function (we basically ignore it.)""" function (we basically ignore it.)"""
if self._refresh_id:
# "De-queue" the next refresh
_log.debug('Dequeuing next refresh')
gobject.source_remove(self._refresh_id)
self._refresh_id = None
# do the refresh
self._threads.add_work(self._post_get_messages, self._threads.add_work(self._post_get_messages,
self._exception_get_messages, self._exception_get_messages,
self._connection.messages) self._connection.messages)
# queue the next auto-refresh
interval = self._options[self.NAMESPACE]['refresh_interval']
_log.debug('Queueing next refresh in %d minutes', interval)
self._refresh_id = gobject.timeout_add(
interval * 60 * 1000,
self._refresh, None)
return return
### Results from the "messages" request ### Results from the "messages" request
@ -812,6 +826,7 @@ class Interface(object):
self._threads = _ThreadManager() self._threads = _ThreadManager()
# queue the first fetch # queue the first fetch
self._refresh_id = None # The auto-refresh manager.
self._refresh() self._refresh()
gtk.main() gtk.main()

Loading…
Cancel
Save