From ed504a7f6e97fcfcf88e3290821574f08c0a715c Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Sat, 5 Dec 2009 21:43:46 -0200 Subject: [PATCH] Manual refresh works --- mitterlib/ui/ui_pygtk.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mitterlib/ui/ui_pygtk.py b/mitterlib/ui/ui_pygtk.py index afe17a8..e27dff0 100644 --- a/mitterlib/ui/ui_pygtk.py +++ b/mitterlib/ui/ui_pygtk.py @@ -231,6 +231,7 @@ class Interface(object): box = gtk.VBox(False, 1) box.pack_start(menu, False, True, 0) + box.pack_start(toolbar, False, False, 0) box.pack_start(update_box, True, True, 0) box.pack_start(statusbar, False, False, 0) main_window.add(box) @@ -350,7 +351,7 @@ class Interface(object): # Edit actions refresh_action = gtk.Action('Refresh', '_Refresh', 'Update the listing', gtk.STOCK_REFRESH) - #refresh_action.connect('activate', self.refresh) + refresh_action.connect('activate', self._refresh) action_group.add_action_with_accel(refresh_action, None) self._update_action = gtk.Action('Update', '_Update', @@ -583,7 +584,6 @@ class Interface(object): def _count_chars(self, text_buffer): """Count the number of chars in the edit field and update the label that shows the available space.""" - _log.debug('Counting chars') text = _buffer_text(text_buffer) count = len(text) @@ -696,6 +696,14 @@ class Interface(object): # ------------------------------------------------------------ # Network related functions # ------------------------------------------------------------ + + def _refresh(self, widget=None): + """Request a refresh. *widget* is the widget that called this + function (we basically ignore it.)""" + self._threads.add_work(self._post_get_messages, + self._exception_get_messages, + self._connection.messages) + return ### Results from the "messages" request def _post_get_messages(self, widget, results): @@ -794,7 +802,7 @@ class Interface(object): has_alpha=False, bits_per_sample=8, width=48, height=48) return - + def __call__(self): """Call function; displays the interface. This method should appear on every interface.""" @@ -804,10 +812,7 @@ class Interface(object): self._threads = _ThreadManager() # queue the first fetch - self._threads.add_work(self._post_get_messages, - self._exception_get_messages, - self._connection.messages) - + self._refresh() gtk.main() @classmethod