use STATE_PRELIGHT colors for group rows and STATE_ACTIVE for account rows

This commit is contained in:
Yann Leboulanger 2006-04-11 21:04:38 +00:00
parent ca8d4da260
commit bd7b4bc035
1 changed files with 11 additions and 11 deletions

View File

@ -2755,13 +2755,13 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
gajim.config.set('showoffline', not gajim.config.get('showoffline')) gajim.config.set('showoffline', not gajim.config.get('showoffline'))
self.draw_roster() self.draw_roster()
def set_renderer_color(self, renderer, set_background = True): def set_renderer_color(self, renderer, style, set_background = True):
'''set style for treeview cell, using PRELIGHT system color''' '''set style for treeview cell, using PRELIGHT system color'''
if set_background: if set_background:
bgcolor = self.tree.style.bg[gtk.STATE_ACTIVE] bgcolor = self.tree.style.bg[style]
renderer.set_property('cell-background-gdk', bgcolor) renderer.set_property('cell-background-gdk', bgcolor)
else: else:
fgcolor = self.tree.style.fg[gtk.STATE_ACTIVE] fgcolor = self.tree.style.fg[style]
renderer.set_property('foreground-gdk', fgcolor) renderer.set_property('foreground-gdk', fgcolor)
def iconCellDataFunc(self, column, renderer, model, iter, data = None): def iconCellDataFunc(self, column, renderer, model, iter, data = None):
@ -2772,14 +2772,14 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
if color: if color:
renderer.set_property('cell-background', color) renderer.set_property('cell-background', color)
else: else:
self.set_renderer_color(renderer) self.set_renderer_color(renderer, gtk.STATE_ACTIVE)
renderer.set_property('xalign', 0) renderer.set_property('xalign', 0)
elif model[iter][C_TYPE] == 'group': elif model[iter][C_TYPE] == 'group':
color = gajim.config.get_per('themes', theme, 'groupbgcolor') color = gajim.config.get_per('themes', theme, 'groupbgcolor')
if color: if color:
renderer.set_property('cell-background', color) renderer.set_property('cell-background', color)
else: else:
self.set_renderer_color(renderer) self.set_renderer_color(renderer, gtk.STATE_PRELIGHT)
renderer.set_property('xalign', 0.2) renderer.set_property('xalign', 0.2)
else: else:
jid = model[iter][C_JID].decode('utf-8') jid = model[iter][C_JID].decode('utf-8')
@ -2809,12 +2809,12 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
if color: if color:
renderer.set_property('foreground', color) renderer.set_property('foreground', color)
else: else:
self.set_renderer_color(renderer, False) self.set_renderer_color(renderer, gtk.STATE_ACTIVE, False)
color = gajim.config.get_per('themes', theme, 'accountbgcolor') color = gajim.config.get_per('themes', theme, 'accountbgcolor')
if color: if color:
renderer.set_property('cell-background', color) renderer.set_property('cell-background', color)
else: else:
self.set_renderer_color(renderer) self.set_renderer_color(renderer, gtk.STATE_ACTIVE)
renderer.set_property('font', renderer.set_property('font',
gtkgui_helpers.get_theme_font_for_option(theme, 'accountfont')) gtkgui_helpers.get_theme_font_for_option(theme, 'accountfont'))
renderer.set_property('xpad', 0) renderer.set_property('xpad', 0)
@ -2824,12 +2824,12 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
if color: if color:
renderer.set_property('foreground', color) renderer.set_property('foreground', color)
else: else:
self.set_renderer_color(renderer, False) self.set_renderer_color(renderer, gtk.STATE_PRELIGHT, False)
color = gajim.config.get_per('themes', theme, 'groupbgcolor') color = gajim.config.get_per('themes', theme, 'groupbgcolor')
if color: if color:
renderer.set_property('cell-background', color) renderer.set_property('cell-background', color)
else: else:
self.set_renderer_color(renderer) self.set_renderer_color(renderer, gtk.STATE_PRELIGHT)
renderer.set_property('font', renderer.set_property('font',
gtkgui_helpers.get_theme_font_for_option(theme, 'groupfont')) gtkgui_helpers.get_theme_font_for_option(theme, 'groupfont'))
renderer.set_property('xpad', 4) renderer.set_property('xpad', 4)
@ -2867,13 +2867,13 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
if color: if color:
renderer.set_property('cell-background', color) renderer.set_property('cell-background', color)
else: else:
self.set_renderer_color(renderer) self.set_renderer_color(renderer, gtk.STATE_ACTIVE)
elif model[iter][C_TYPE] == 'group': elif model[iter][C_TYPE] == 'group':
color = gajim.config.get_per('themes', theme, 'groupbgcolor') color = gajim.config.get_per('themes', theme, 'groupbgcolor')
if color: if color:
renderer.set_property('cell-background', color) renderer.set_property('cell-background', color)
else: else:
self.set_renderer_color(renderer) self.set_renderer_color(renderer, gtk.STATE_PRELIGHT)
else: # contact else: # contact
jid = model[iter][C_JID].decode('utf-8') jid = model[iter][C_JID].decode('utf-8')
account = model[iter][C_ACCOUNT].decode('utf-8') account = model[iter][C_ACCOUNT].decode('utf-8')