From 2e5fe5173b74df5e31f0b1d4099d3c24a024a2bc Mon Sep 17 00:00:00 2001 From: Travis Shirk Date: Sat, 7 Jan 2006 23:40:37 +0000 Subject: [PATCH] Implemented #1356 --- src/message_control.py | 2 +- src/message_window.py | 32 +++++++++++++++----------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/message_control.py b/src/message_control.py index dcd8515fc..babf4e210 100644 --- a/src/message_control.py +++ b/src/message_control.py @@ -48,7 +48,7 @@ class MessageControl: self.compact_view_current = False self.nb_unread = 0 self.print_time_timeout_id = None - # FIXME: Make this a member + gajim.last_message_time[self.account][contact.jid] = 0 self.xml = gtk.glade.XML(GTKGUI_GLADE, widget_name, APP) diff --git a/src/message_window.py b/src/message_window.py index 20d1bca6f..d100f363e 100644 --- a/src/message_window.py +++ b/src/message_window.py @@ -176,33 +176,30 @@ class MessageWindow: '''When close button is pressed: close a tab''' self.remove_tab(contact) - def show_title(self, urgent = True): + def show_title(self, urgent = True, control = None): '''redraw the window's title''' + print "show_title" unread = 0 for ctl in self._controls.values(): unread += ctl.nb_unread - start = '' + unread_str = '' if unread > 1: - start = '[' + unicode(unread) + '] ' + unread_str = '[' + unicode(unread) + '] ' elif unread == 1: - start = '* ' + unread_str = '* ' - ctl = self.get_active_control() - if len(self._controls) > 1: # if more than one tab in the same window - add = ctl.display_name + if not control: + control = self.get_active_control() + if control.type_id == message_control.TYPE_GC: + title = control.room_jid + elif control.contact.name: + title = control.contact.name else: - add = ctl.contact.name -# FIXME: This is for GC only -# elif self.widget_name == 'groupchat_window': -# name = gajim.get_nick_from_jid(jid) -# add = name + title = control.contact.jid - title = start + add - if len(gajim.connections) >= 2: # if we have 2 or more accounts - title += ' (' + _('account: ') + ctl.account + ')' - - # Update UI + title = unread_str + title self.window.set_title(title) + if urgent: gtkgui_helpers.set_unset_urgency_hint(self.window, unread) @@ -405,6 +402,7 @@ class MessageWindow: new_ctl = self._widget_to_control(notebook.get_nth_page(page_num)) new_ctl.set_control_active(True) + self.show_title(control = new_ctl) def _on_notebook_key_press(self, widget, event): st = '1234567890' # alt+1 means the first tab (tab 0)