set GC theme color for group row

This commit is contained in:
Dimitur Kirov 2006-04-11 21:54:15 +00:00
parent bd7b4bc035
commit c6de60d13c
1 changed files with 18 additions and 4 deletions

View File

@ -207,17 +207,31 @@ class GroupchatControl(ChatControlBase):
'''When window gets focus''' '''When window gets focus'''
if self.parent_win.get_active_jid() == self.room_jid: if self.parent_win.get_active_jid() == self.room_jid:
self.allow_focus_out_line = True self.allow_focus_out_line = True
def set_renderer_color(self, renderer, set_background = True):
'''set style for group row, using PRELIGHT system color'''
if set_background:
bgcolor = self.list_treeview.style.bg[gtk.STATE_PRELIGHT]
renderer.set_property('cell-background-gdk', bgcolor)
else:
fgcolor = self.list_treeview.style.fg[gtk.STATE_PRELIGHT]
renderer.set_property('foreground-gdk', fgcolor)
def tree_cell_data_func(self, column, renderer, model, iter, data=None): def tree_cell_data_func(self, column, renderer, model, iter, data=None):
theme = gajim.config.get('roster_theme') theme = gajim.config.get('roster_theme')
if model.iter_parent(iter): if model.iter_parent(iter):
bgcolor = gajim.config.get_per('themes', theme, 'contactbgcolor') bgcolor = gajim.config.get_per('themes', theme, 'contactbgcolor')
if bgcolor:
renderer.set_property('cell-background', bgcolor)
else:
renderer.set_property('cell-background', None)
else: # it is root (eg. group) else: # it is root (eg. group)
bgcolor = gajim.config.get_per('themes', theme, 'groupbgcolor') bgcolor = gajim.config.get_per('themes', theme, 'groupbgcolor')
if bgcolor: if bgcolor:
renderer.set_property('cell-background', bgcolor) renderer.set_property('cell-background', bgcolor)
else: else:
renderer.set_property('cell-background', None) self.set_renderer_color(renderer)
#FIXME, we don't drow theme text color
def avatar_cell_data_func(self, column, renderer, model, iter, data=None): def avatar_cell_data_func(self, column, renderer, model, iter, data=None):
self.tree_cell_data_func(column, renderer, model, iter, data) self.tree_cell_data_func(column, renderer, model, iter, data)