Fix for #854 and display chatstates when unread and no focus.

This commit is contained in:
Travis Shirk 2005-09-08 02:08:31 +00:00
parent 585a007c2a
commit 90cb506c3c
3 changed files with 13 additions and 9 deletions

View File

@ -164,8 +164,11 @@ class Chat:
'''redraw the label of the tab
if chatstate is given that means we have HE SENT US a chatstate'''
unread = ''
if self.nb_unread[jid] > 1:
unread = '[' + unicode(self.nb_unread[jid]) + '] '
num_unread = self.nb_unread[jid]
if num_unread == 1 and not gajim.config.get('show_unread_tab_icon'):
unread = '* '
elif num_unread > 1:
unread = '[' + unicode(num_unread) + '] '
# Update status images
self.set_state_image(jid)
@ -185,12 +188,6 @@ class Chat:
if chatstate == 'composing':
color = gajim.config.get_per('themes', theme,
'state_composing_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')
elif chatstate == 'inactive':
color = gajim.config.get_per('themes', theme,
'state_inactive_color')
@ -200,6 +197,12 @@ class Chat:
elif chatstate == 'paused':
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:
color = gajim.config.get_per('themes', theme,
'state_active_color')

View File

@ -148,6 +148,7 @@ class Config:
'avatar_height': [opt_int, 52],
'quit_on_roster_x_button': [opt_bool, False, _('If True, quits Gajim when X button of Window Manager is clicked. This option make sense only if trayicon is used.')],
'set_xmpp://_handler_everytime': [opt_bool, False, _('If True, Gajim registers for xmpp:// on each startup.')],
'show_unread_tab_icon': [opt_bool, False, _('If True, Gajim will display an icon on each tab containing unread messages. Depending on the theme, this icon may be animated.')],
}
__options_per_key = {

View File

@ -256,7 +256,7 @@ timestamp, contact):
banner_status_image.set_from_pixbuf(scaled_pix)
# Set tab image; unread messages show the 'message' image
if self.nb_unread[jid]:
if self.nb_unread[jid] and gajim.config.get('show_unread_tab_icon'):
tab_image = state_images['message']
else:
tab_image = banner_image