Implemented #1356
This commit is contained in:
parent
fada255296
commit
2e5fe5173b
2 changed files with 16 additions and 18 deletions
|
@ -48,7 +48,7 @@ class MessageControl:
|
||||||
self.compact_view_current = False
|
self.compact_view_current = False
|
||||||
self.nb_unread = 0
|
self.nb_unread = 0
|
||||||
self.print_time_timeout_id = None
|
self.print_time_timeout_id = None
|
||||||
# FIXME: Make this a member
|
|
||||||
gajim.last_message_time[self.account][contact.jid] = 0
|
gajim.last_message_time[self.account][contact.jid] = 0
|
||||||
|
|
||||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, widget_name, APP)
|
self.xml = gtk.glade.XML(GTKGUI_GLADE, widget_name, APP)
|
||||||
|
|
|
@ -176,33 +176,30 @@ class MessageWindow:
|
||||||
'''When close button is pressed: close a tab'''
|
'''When close button is pressed: close a tab'''
|
||||||
self.remove_tab(contact)
|
self.remove_tab(contact)
|
||||||
|
|
||||||
def show_title(self, urgent = True):
|
def show_title(self, urgent = True, control = None):
|
||||||
'''redraw the window's title'''
|
'''redraw the window's title'''
|
||||||
|
print "show_title"
|
||||||
unread = 0
|
unread = 0
|
||||||
for ctl in self._controls.values():
|
for ctl in self._controls.values():
|
||||||
unread += ctl.nb_unread
|
unread += ctl.nb_unread
|
||||||
start = ''
|
unread_str = ''
|
||||||
if unread > 1:
|
if unread > 1:
|
||||||
start = '[' + unicode(unread) + '] '
|
unread_str = '[' + unicode(unread) + '] '
|
||||||
elif unread == 1:
|
elif unread == 1:
|
||||||
start = '* '
|
unread_str = '* '
|
||||||
|
|
||||||
ctl = self.get_active_control()
|
if not control:
|
||||||
if len(self._controls) > 1: # if more than one tab in the same window
|
control = self.get_active_control()
|
||||||
add = ctl.display_name
|
if control.type_id == message_control.TYPE_GC:
|
||||||
|
title = control.room_jid
|
||||||
|
elif control.contact.name:
|
||||||
|
title = control.contact.name
|
||||||
else:
|
else:
|
||||||
add = ctl.contact.name
|
title = control.contact.jid
|
||||||
# FIXME: This is for GC only
|
|
||||||
# elif self.widget_name == 'groupchat_window':
|
|
||||||
# name = gajim.get_nick_from_jid(jid)
|
|
||||||
# add = name
|
|
||||||
|
|
||||||
title = start + add
|
title = unread_str + title
|
||||||
if len(gajim.connections) >= 2: # if we have 2 or more accounts
|
|
||||||
title += ' (' + _('account: ') + ctl.account + ')'
|
|
||||||
|
|
||||||
# Update UI
|
|
||||||
self.window.set_title(title)
|
self.window.set_title(title)
|
||||||
|
|
||||||
if urgent:
|
if urgent:
|
||||||
gtkgui_helpers.set_unset_urgency_hint(self.window, unread)
|
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 = self._widget_to_control(notebook.get_nth_page(page_num))
|
||||||
new_ctl.set_control_active(True)
|
new_ctl.set_control_active(True)
|
||||||
|
self.show_title(control = new_ctl)
|
||||||
|
|
||||||
def _on_notebook_key_press(self, widget, event):
|
def _on_notebook_key_press(self, widget, event):
|
||||||
st = '1234567890' # alt+1 means the first tab (tab 0)
|
st = '1234567890' # alt+1 means the first tab (tab 0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue