diff --git a/mitterlib/ui/ui_pygtk.py b/mitterlib/ui/ui_pygtk.py index 5f462d1..856ef35 100644 --- a/mitterlib/ui/ui_pygtk.py +++ b/mitterlib/ui/ui_pygtk.py @@ -225,8 +225,11 @@ class Interface(object): update_field = self._create_update_box() self._statusbar = self._create_statusbar() + self._main_tabs = gtk.Notebook() + self._main_tabs.insert_page(grid, gtk.Label('Messages')) + update_box = gtk.VPaned() - update_box.pack1(grid, resize=True, shrink=False) + update_box.pack1(self._main_tabs, resize=True, shrink=False) update_box.pack2(update_field, resize=False, shrink=True) # TODO: Save the size of the update box in the config file. @@ -238,6 +241,8 @@ class Interface(object): main_window.add(box) main_window.add_accel_group(accelerators) + self._update_tab_count() + return main_window def _create_grid(self): @@ -666,6 +671,13 @@ class Interface(object): return True + def _update_tab_count(self): + """Update the message count in the message tab.""" + child = self._main_tabs.get_nth_page(0) + self._main_tabs.set_tab_label_text(child, 'Messages (%d)' % + (self._new_message_count)) + return + # ------------------------------------------------------------ # Widget callback functions # ------------------------------------------------------------ @@ -799,6 +811,7 @@ class Interface(object): """Clear the list of posts from the grid.""" self._grid.get_model().clear() self._new_message_count = 0 + self._update_tab_count() if self._statusicon: self._statusicon.set_from_pixbuf(self._images['main']) return @@ -866,7 +879,6 @@ class Interface(object): tabs.insert_page(interface_box, gtk.Label('Interface')) - # We store the fields in a dictionary, inside dictionaries for each # NAMESPACE. To set the values, we just run the dictionaries setting # self._options. @@ -970,6 +982,7 @@ class Interface(object): message.read = True self._new_message_count -= 1 + self._update_tab_count() if self._new_message_count == 0 and self._statusicon: self._statusicon.set_from_pixbuf(self._images['main']) @@ -1012,6 +1025,7 @@ class Interface(object): self._refresh, None) self._new_message_count += len(results) + self._update_tab_count() if self._new_message_count > 0 and self._statusicon: self._statusicon.set_from_pixbuf(self._images['new-messages'])