Unread messages cause tab label to display bold; closes #1155
This commit is contained in:
parent
a2e68a1fc2
commit
fb31c2478c
21
src/chat.py
21
src/chat.py
|
@ -206,25 +206,24 @@ class Chat:
|
||||||
# Update status images
|
# Update status images
|
||||||
self.set_state_image(jid)
|
self.set_state_image(jid)
|
||||||
|
|
||||||
|
unread = ''
|
||||||
|
num_unread = 0
|
||||||
child = self.childs[jid]
|
child = self.childs[jid]
|
||||||
hb = self.notebook.get_tab_label(child).get_children()[0]
|
hb = self.notebook.get_tab_label(child).get_children()[0]
|
||||||
if self.widget_name == 'tabbed_chat_window':
|
if self.widget_name == 'tabbed_chat_window':
|
||||||
nickname = hb.get_children()[1]
|
nickname = hb.get_children()[1]
|
||||||
close_button = hb.get_children()[2]
|
close_button = hb.get_children()[2]
|
||||||
|
|
||||||
unread = ''
|
|
||||||
num_unread = self.nb_unread[jid]
|
num_unread = self.nb_unread[jid]
|
||||||
if num_unread == 1 and not gajim.config.get('show_unread_tab_icon'):
|
if num_unread == 1 and not gajim.config.get('show_unread_tab_icon'):
|
||||||
unread = '* '
|
unread = '*'
|
||||||
elif num_unread > 1:
|
elif num_unread > 1:
|
||||||
unread = '[' + unicode(num_unread) + '] '
|
unread = '[' + unicode(num_unread) + ']'
|
||||||
|
|
||||||
# Draw tab label using chatstate
|
# Draw tab label using chatstate
|
||||||
theme = gajim.config.get('roster_theme')
|
theme = gajim.config.get('roster_theme')
|
||||||
color = None
|
color = None
|
||||||
if unread and chatstate == 'active':
|
if chatstate is not None:
|
||||||
color = gajim.config.get_per('themes', theme, 'state_unread_color')
|
|
||||||
elif chatstate is not None:
|
|
||||||
if chatstate == 'composing':
|
if chatstate == 'composing':
|
||||||
color = gajim.config.get_per('themes', theme,
|
color = gajim.config.get_per('themes', theme,
|
||||||
'state_composing_color')
|
'state_composing_color')
|
||||||
|
@ -235,10 +234,6 @@ class Chat:
|
||||||
color = gajim.config.get_per('themes', theme, 'state_gone_color')
|
color = gajim.config.get_per('themes', theme, 'state_gone_color')
|
||||||
elif chatstate == 'paused':
|
elif chatstate == 'paused':
|
||||||
color = gajim.config.get_per('themes', theme, 'state_paused_color')
|
color = gajim.config.get_per('themes', theme, 'state_paused_color')
|
||||||
elif unread and self.window.get_property('has-toplevel-focus'):
|
|
||||||
color = gajim.config.get_per('themes', theme, 'state_active_color')
|
|
||||||
elif unread:
|
|
||||||
color = gajim.config.get_per('themes', theme, 'state_unread_color')
|
|
||||||
else:
|
else:
|
||||||
color = gajim.config.get_per('themes', theme, 'state_active_color')
|
color = gajim.config.get_per('themes', theme, 'state_active_color')
|
||||||
if color:
|
if color:
|
||||||
|
@ -258,7 +253,6 @@ class Chat:
|
||||||
nickname = hb.get_children()[0]
|
nickname = hb.get_children()[0]
|
||||||
close_button = hb.get_children()[1]
|
close_button = hb.get_children()[1]
|
||||||
|
|
||||||
unread = ''
|
|
||||||
has_focus = self.window.get_property('has-toplevel-focus')
|
has_focus = self.window.get_property('has-toplevel-focus')
|
||||||
current_tab = (self.notebook.page_num(child) == self.notebook.get_current_page())
|
current_tab = (self.notebook.page_num(child) == self.notebook.get_current_page())
|
||||||
color = None
|
color = None
|
||||||
|
@ -289,7 +283,10 @@ class Chat:
|
||||||
close_button.hide()
|
close_button.hide()
|
||||||
|
|
||||||
nickname.set_max_width_chars(10)
|
nickname.set_max_width_chars(10)
|
||||||
nickname.set_text(unread + self.names[jid])
|
lbl = self.names[jid]
|
||||||
|
if num_unread:
|
||||||
|
lbl = "<b>" + unread + lbl + "</b>"
|
||||||
|
nickname.set_markup(lbl)
|
||||||
|
|
||||||
def get_message_type(self, jid):
|
def get_message_type(self, jid):
|
||||||
if self.widget_name == 'groupchat_window':
|
if self.widget_name == 'groupchat_window':
|
||||||
|
|
|
@ -11326,7 +11326,7 @@ Status message</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes"></property>
|
<property name="label" translatable="yes"></property>
|
||||||
<property name="use_underline">False</property>
|
<property name="use_underline">False</property>
|
||||||
<property name="use_markup">False</property>
|
<property name="use_markup">True</property>
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
<property name="wrap">False</property>
|
<property name="wrap">False</property>
|
||||||
<property name="selectable">False</property>
|
<property name="selectable">False</property>
|
||||||
|
|
Loading…
Reference in New Issue