From ee7b16c4050ea5a252c834a7804c25317a743fa6 Mon Sep 17 00:00:00 2001
From: Jean-Marie Traissard <jim@lapin.org>
Date: Mon, 25 Sep 2006 14:36:24 +0000
Subject: [PATCH] Do not set tab to active color when we shouldn't, fix bug in
 [6914]

---
 src/chat_control.py      |  2 +-
 src/groupchat_control.py | 15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/chat_control.py b/src/chat_control.py
index 037b1b5347..7b19fc5639 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -1283,7 +1283,7 @@ class ChatControl(ChatControlBase):
 			if chatstate in ('inactive', 'gone') and\
 			self.parent_win.get_active_control() != self:
 				color = self.lighten_color(color)
-		else: # active or no chatstate
+		elif chatstate == 'active' : # active, get color from gtk
 			color = self.parent_win.notebook.style.fg[gtk.STATE_ACTIVE]
 		
 
diff --git a/src/groupchat_control.py b/src/groupchat_control.py
index dd7d582613..ed1000f64e 100644
--- a/src/groupchat_control.py
+++ b/src/groupchat_control.py
@@ -363,23 +363,24 @@ class GroupchatControl(ChatControlBase):
 
 		has_focus = self.parent_win.window.get_property('has-toplevel-focus')
 		current_tab = self.parent_win.get_active_control() == self
+		color_name = None
 		color = None
 		theme = gajim.config.get('roster_theme')
 		if chatstate == 'attention' and (not has_focus or not current_tab):
 			self.attention_flag = True
-			color = gajim.config.get_per('themes', theme,
+			color_name = gajim.config.get_per('themes', theme,
 							'state_muc_directed_msg_color')
 		elif chatstate:
 			if chatstate == 'active' or (current_tab and has_focus):
 				self.attention_flag = False
+				# get active color from gtk
+				color = self.parent_win.notebook.style.fg[gtk.STATE_ACTIVE]
 			elif chatstate == 'newmsg' and (not has_focus or not current_tab) and\
 					not self.attention_flag:
-				color = gajim.config.get_per('themes', theme, 'state_muc_msg_color')
-		if color:
-			color = gtk.gdk.colormap_get_system().alloc_color(color)
-		else:
-			color = self.parent_win.notebook.style.fg[gtk.STATE_ACTIVE]
-
+				color_name = gajim.config.get_per('themes', theme, 'state_muc_msg_color')
+		if color_name:
+			color = gtk.gdk.colormap_get_system().alloc_color(color_name)
+			
 		label_str = self.name
 		return (label_str, color)
 
-- 
GitLab