From c96c3c123ecc15189ab6f55159abacc1624dc483 Mon Sep 17 00:00:00 2001
From: Nikos Kouremenos <kourem@gmail.com>
Date: Tue, 7 Jun 2005 21:28:21 +0000
Subject: [PATCH] chat window mockup and related code by Dennis Craven

---
 src/chat.py               |   9 +-
 src/config.py             |   2 +
 src/gtkgui.glade          | 445 ++++++++++++++++++++++++++------------
 src/roster_window.py      |   7 +
 src/tabbed_chat_window.py | 137 ++++++++----
 5 files changed, 409 insertions(+), 191 deletions(-)

diff --git a/src/chat.py b/src/chat.py
index 277c39d1dd..71ce0d853f 100644
--- a/src/chat.py
+++ b/src/chat.py
@@ -44,6 +44,7 @@ class Chat:
 	def __init__(self, plugin, account, widget_name):
 		self.xml = gtk.glade.XML(GTKGUI_GLADE, widget_name, APP)
 		self.window = self.xml.get_widget(widget_name)
+
 		self.widget_name = widget_name
 		self.notebook = self.xml.get_widget('chat_notebook')
 		self.notebook.remove_page(0)
@@ -199,14 +200,6 @@ def on_chat_notebook_switch_page(self, notebook, page, page_num):
 				if self.plugin.systray_enabled:
 					self.plugin.systray.remove_jid(new_jid, self.account)
 		
-		if self.widget_name == 'tabbed_chat_window':
-			nontabbed_status_image = self.xmls[jid].get_widget(
-				'nontabbed_status_image')
-			if len(self.xmls) > 1:
-				nontabbed_status_image.hide()
-			else:
-				nontabbed_status_image.show()
-		
 		conversation_textview.grab_focus()
 
 	def set_active_tab(self, jid):
diff --git a/src/config.py b/src/config.py
index 75e0cfe0a7..b3dd3b7c33 100644
--- a/src/config.py
+++ b/src/config.py
@@ -580,6 +580,8 @@ def on_theme_combobox_changed(self, widget):
 				self.on_widget_font_set(widg, font_widgets[w])
 				
 		gajim.config.set('roster_theme', theme)
+		# begin repainting themed widgets throughout
+		self.plugin.roster.repaint_themed_widgets()
 		self.plugin.save_config()
 		self.plugin.roster.draw_roster()
 
diff --git a/src/gtkgui.glade b/src/gtkgui.glade
index 7c74c5854a..ddca6a94a8 100644
--- a/src/gtkgui.glade
+++ b/src/gtkgui.glade
@@ -9867,8 +9867,8 @@ Custom</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
   <property name="window_position">GTK_WIN_POS_NONE</property>
   <property name="modal">False</property>
-  <property name="default_width">400</property>
-  <property name="default_height">320</property>
+  <property name="default_width">460</property>
+  <property name="default_height">430</property>
   <property name="resizable">True</property>
   <property name="destroy_with_parent">False</property>
   <property name="decorated">True</property>
@@ -9882,9 +9882,10 @@ Custom</property>
 
   <child>
     <widget class="GtkNotebook" id="chat_notebook">
+      <property name="border_width">1</property>
       <property name="visible">True</property>
       <property name="show_tabs">False</property>
-      <property name="show_border">False</property>
+      <property name="show_border">True</property>
       <property name="tab_pos">GTK_POS_TOP</property>
       <property name="scrollable">True</property>
       <property name="enable_popup">True</property>
@@ -9893,83 +9894,34 @@ Custom</property>
 
       <child>
 	<widget class="GtkVBox" id="chats_vbox">
-	  <property name="border_width">4</property>
+	  <property name="border_width">3</property>
 	  <property name="visible">True</property>
 	  <property name="can_focus">True</property>
 	  <property name="homogeneous">False</property>
 	  <property name="spacing">1</property>
 
 	  <child>
-	    <widget class="GtkHBox" id="actions_hbox">
+	    <widget class="GtkHBox" id="banner_hbox">
+	      <property name="border_width">3</property>
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
-	      <property name="spacing">5</property>
+	      <property name="spacing">0</property>
 
 	      <child>
-		<widget class="GtkButton" id="history_button">
+		<widget class="GtkEventBox" id="banner_status_eventbox">
+		  <property name="width_request">40</property>
+		  <property name="height_request">40</property>
 		  <property name="visible">True</property>
-		  <property name="tooltip" translatable="yes">Click to see past conversations with this contact</property>
-		  <property name="relief">GTK_RELIEF_NONE</property>
-		  <property name="focus_on_click">False</property>
-		  <signal name="clicked" handler="on_history_button_clicked" last_modification_time="Wed, 02 Mar 2005 17:03:17 GMT"/>
+		  <property name="visible_window">True</property>
+		  <property name="above_child">False</property>
 
 		  <child>
-		    <widget class="GtkAlignment" id="alignment47">
+		    <widget class="GtkImage" id="banner_status_image">
 		      <property name="visible">True</property>
 		      <property name="xalign">0.5</property>
 		      <property name="yalign">0.5</property>
-		      <property name="xscale">0</property>
-		      <property name="yscale">0</property>
-		      <property name="top_padding">0</property>
-		      <property name="bottom_padding">0</property>
-		      <property name="left_padding">0</property>
-		      <property name="right_padding">0</property>
-
-		      <child>
-			<widget class="GtkHBox" id="hbox2924">
-			  <property name="visible">True</property>
-			  <property name="homogeneous">False</property>
-			  <property name="spacing">2</property>
-
-			  <child>
-			    <widget class="GtkImage" id="image412">
-			      <property name="visible">True</property>
-			      <property name="stock">gtk-justify-fill</property>
-			      <property name="icon_size">4</property>
-			      <property name="xalign">0.5</property>
-			      <property name="yalign">0.5</property>
-			      <property name="xpad">0</property>
-			      <property name="ypad">0</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
-
-			  <child>
-			    <widget class="GtkLabel" id="label205">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_History</property>
-			      <property name="use_underline">True</property>
-			      <property name="use_markup">False</property>
-			      <property name="justify">GTK_JUSTIFY_LEFT</property>
-			      <property name="wrap">False</property>
-			      <property name="selectable">False</property>
-			      <property name="xalign">0.5</property>
-			      <property name="yalign">0.5</property>
-			      <property name="xpad">0</property>
-			      <property name="ypad">0</property>
-			    </widget>
-			    <packing>
-			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
-			    </packing>
-			  </child>
-			</widget>
-		      </child>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
 		    </widget>
 		  </child>
 		</widget>
@@ -9981,99 +9933,64 @@ Custom</property>
 	      </child>
 
 	      <child>
-		<widget class="GtkButton" id="clear_button">
-		  <property name="visible">True</property>
-		  <property name="tooltip" translatable="yes">Click to clear conversation (won't delete it from history)</property>
-		  <property name="label">gtk-clear</property>
-		  <property name="use_stock">True</property>
-		  <property name="relief">GTK_RELIEF_NONE</property>
-		  <property name="focus_on_click">False</property>
-		  <signal name="clicked" handler="on_clear_button_clicked" last_modification_time="Wed, 02 Mar 2005 17:03:09 GMT"/>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkImage" id="nontabbed_status_image">
-		  <property name="stock">gtk-no</property>
-		  <property name="icon_size">4</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkToggleButton" id="gpg_togglebutton">
+		<widget class="GtkEventBox" id="banner_name_eventbox">
 		  <property name="visible">True</property>
-		  <property name="relief">GTK_RELIEF_NONE</property>
-		  <property name="focus_on_click">False</property>
-		  <property name="active">False</property>
-		  <property name="inconsistent">False</property>
+		  <property name="visible_window">True</property>
+		  <property name="above_child">False</property>
 
 		  <child>
-		    <widget class="GtkImage" id="image433">
+		    <widget class="GtkLabel" id="banner_name_label">
 		      <property name="visible">True</property>
-		      <property name="stock">gtk-dialog-authentication</property>
-		      <property name="icon_size">4</property>
-		      <property name="xalign">0.5</property>
+		      <property name="label">&lt;span weight=&quot;heavy&quot; size=&quot;large&quot;&gt;Contact: name&lt;/span&gt;
+JID: whatever@jabber.org</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">True</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0.0900000035763</property>
 		      <property name="yalign">0.5</property>
 		      <property name="xpad">0</property>
-		      <property name="ypad">0</property>
+		      <property name="ypad">5</property>
 		    </widget>
 		  </child>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
 		</packing>
 	      </child>
 
 	      <child>
-		<widget class="GtkFixed" id="fixed">
-		  <property name="width_request">20</property>
+		<widget class="GtkEventBox" id="banner_avatar_eventbox">
+		  <property name="width_request">40</property>
+		  <property name="height_request">40</property>
 		  <property name="visible">True</property>
+		  <property name="visible_window">True</property>
+		  <property name="above_child">False</property>
 
 		  <child>
-		    <widget class="GtkButton" id="contact_button">
-		      <property name="width_request">0</property>
-		      <property name="height_request">0</property>
+		    <widget class="GtkImage" id="image614">
 		      <property name="visible">True</property>
-		      <property name="tooltip" translatable="yes">Click for contact's extented information</property>
-		      <property name="label" translatable="yes">Anonymous &lt;nick@server/res&gt;</property>
-		      <property name="use_underline">True</property>
-		      <property name="relief">GTK_RELIEF_NONE</property>
-		      <property name="focus_on_click">False</property>
-		      <signal name="clicked" handler="on_contact_button_clicked" last_modification_time="Wed, 02 Mar 2005 21:04:43 GMT"/>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
 		    </widget>
-		    <packing>
-		      <property name="x">0</property>
-		      <property name="y">2</property>
-		    </packing>
 		  </child>
 		</widget>
 		<packing>
 		  <property name="padding">0</property>
-		  <property name="expand">True</property>
-		  <property name="fill">True</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
 		</packing>
 	      </child>
 	    </widget>
 	    <packing>
-	      <property name="padding">0</property>
+	      <property name="padding">6</property>
 	      <property name="expand">False</property>
-	      <property name="fill">True</property>
+	      <property name="fill">False</property>
 	    </packing>
 	  </child>
 
@@ -10084,6 +10001,7 @@ Custom</property>
 
 	      <child>
 		<widget class="GtkScrolledWindow" id="conversation_scrolledwindow">
+		  <property name="border_width">3</property>
 		  <property name="visible">True</property>
 		  <property name="can_focus">True</property>
 		  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@@ -10093,6 +10011,7 @@ Custom</property>
 
 		  <child>
 		    <widget class="GtkTextView" id="conversation_textview">
+		      <property name="border_width">1</property>
 		      <property name="visible">True</property>
 		      <property name="can_focus">True</property>
 		      <property name="editable">False</property>
@@ -10128,23 +10047,10 @@ Custom</property>
 		  <property name="homogeneous">False</property>
 		  <property name="spacing">0</property>
 
-		  <child>
-		    <widget class="GtkImage" id="avatar_image">
-		      <property name="xalign">0.5</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xpad">0</property>
-		      <property name="ypad">0</property>
-		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">False</property>
-		    </packing>
-		  </child>
-
 		  <child>
 		    <widget class="GtkScrolledWindow" id="scrolledwindow31">
-		      <property name="height_request">45</property>
+		      <property name="border_width">3</property>
+		      <property name="height_request">53</property>
 		      <property name="visible">True</property>
 		      <property name="can_focus">True</property>
 		      <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
@@ -10154,6 +10060,7 @@ Custom</property>
 
 		      <child>
 			<widget class="GtkTextView" id="message_textview">
+			  <property name="border_width">1</property>
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
 			  <property name="editable">True</property>
@@ -10192,6 +10099,258 @@ Custom</property>
 	      <property name="fill">True</property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkHBox" id="actions_hbox">
+	      <property name="border_width">3</property>
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">5</property>
+
+	      <child>
+		<widget class="GtkToggleButton" id="gpg_togglebutton">
+		  <property name="visible">True</property>
+		  <property name="tooltip" translatable="yes">Toggle OpenPGP encryption</property>
+		  <property name="relief">GTK_RELIEF_NONE</property>
+		  <property name="focus_on_click">False</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+
+		  <child>
+		    <widget class="GtkImage" id="image433">
+		      <property name="visible">True</property>
+		      <property name="stock">gtk-dialog-authentication</property>
+		      <property name="icon_size">4</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="label314">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes"></property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkButton" id="contact_button">
+		  <property name="visible">True</property>
+		  <property name="tooltip" translatable="yes">Click to get contact's extended information</property>
+		  <property name="can_focus">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <signal name="clicked" handler="on_contact_button_clicked" last_modification_time="Tue, 07 Jun 2005 19:49:24 GMT"/>
+
+		  <child>
+		    <widget class="GtkImage" id="image612">
+		      <property name="visible">True</property>
+		      <property name="stock">gtk-dialog-info</property>
+		      <property name="icon_size">4</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkButton" id="history_button">
+		  <property name="visible">True</property>
+		  <property name="tooltip" translatable="yes">Click to see past conversations with this contact</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">False</property>
+		  <signal name="clicked" handler="on_history_button_clicked" last_modification_time="Wed, 02 Mar 2005 17:03:17 GMT"/>
+
+		  <child>
+		    <widget class="GtkAlignment" id="alignment47">
+		      <property name="visible">True</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xscale">0</property>
+		      <property name="yscale">0</property>
+		      <property name="top_padding">0</property>
+		      <property name="bottom_padding">0</property>
+		      <property name="left_padding">0</property>
+		      <property name="right_padding">0</property>
+
+		      <child>
+			<widget class="GtkHBox" id="hbox2924">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">2</property>
+
+			  <child>
+			    <widget class="GtkImage" id="image412">
+			      <property name="visible">True</property>
+			      <property name="stock">gtk-justify-fill</property>
+			      <property name="icon_size">4</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkLabel" id="label205">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">_History</property>
+			      <property name="use_underline">True</property>
+			      <property name="use_markup">False</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkVSeparator" id="vseparator1">
+		  <property name="visible">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkButton" id="send_button">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <signal name="clicked" handler="on_send_button_clicked" last_modification_time="Tue, 07 Jun 2005 20:31:28 GMT"/>
+
+		  <child>
+		    <widget class="GtkAlignment" id="alignment71">
+		      <property name="visible">True</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xscale">0</property>
+		      <property name="yscale">0</property>
+		      <property name="top_padding">0</property>
+		      <property name="bottom_padding">0</property>
+		      <property name="left_padding">0</property>
+		      <property name="right_padding">0</property>
+
+		      <child>
+			<widget class="GtkHBox" id="hbox2964">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">2</property>
+
+			  <child>
+			    <widget class="GtkImage" id="image611">
+			      <property name="visible">True</property>
+			      <property name="stock">gtk-jump-to</property>
+			      <property name="icon_size">4</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkLabel" id="label313">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">_Send</property>
+			      <property name="use_underline">True</property>
+			      <property name="use_markup">False</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="tab_expand">False</property>
diff --git a/src/roster_window.py b/src/roster_window.py
index 5816935c49..080e60cfa0 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -1316,6 +1316,13 @@ def reload_jabber_state_images(self):
 					self.plugin.windows[account]['gc'][jid].update_state_images()
 		self.update_status_comboxbox()
 
+	def repaint_themed_widgets(self):
+		"""Notify windows that contain themed widgets to repaint them"""
+		for account in gajim.connections:
+			# Update opened chat windows/tabs
+			for jid in self.plugin.windows[account]['chats']:
+				self.plugin.windows[account]['chats'][jid].repaint_colored_widgets()
+
 	def on_show_offline_contacts_menuitem_activate(self, widget):
 		'''when show offline option is changed:
 		redraw the treeview'''
diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py
index 897d8cbcf1..f52d930380 100644
--- a/src/tabbed_chat_window.py
+++ b/src/tabbed_chat_window.py
@@ -77,18 +77,46 @@ def draw_widgets(self, user):
 		self.set_state_image(jid)
 		contact_button = self.xmls[jid].get_widget('contact_button')
 		contact_button.set_use_underline(False)
-		contact_button.set_label(user.name + ' <' + jid + '>')
 		if not user.keyID:
 			self.xmls[jid].get_widget('gpg_togglebutton').set_sensitive(False)
 		else:
 			self.xmls[jid].get_widget('gpg_togglebutton').set_sensitive(True)
 
-		nontabbed_status_image = self.xmls[jid].get_widget(
-			'nontabbed_status_image')
-		if len(self.xmls) > 1:
-			nontabbed_status_image.hide()
-		else:
-			nontabbed_status_image.show()
+		# add the fat line at the top
+		self.draw_name_banner(user.name, jid)
+
+	def draw_name_banner(self, name, jid):
+		'''Draw the fat line at the top of the window that 
+		houses the status icon, name, jid, and avatar'''
+
+		# this is the text for the big brown bar
+		label_text = '<span weight="heavy" size="x-large">%s</span>\n%s' \
+			% (name, jid)
+
+		# get the bg color of the bar from the current theme colors
+		bgcolor = gajim.config.get('accountbgcolor')
+
+		# the backgrounds are colored by using eventboxes and 
+		# setting the bg color of the eventboxes. There is a
+		# separate event box for each component (name label and
+		# status icon). The avatar has one too in the glade file.
+
+		# setup the label that holds name and jid
+		banner_name_label = self.xmls[jid].get_widget('banner_name_label')
+		banner_name_label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
+		banner_name_label.set_markup(label_text)
+		# setup the eventbox that holds the above label, and colour it
+		banner_name_eventbox = self.xmls[jid].get_widget('banner_name_eventbox')
+		banner_name_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
+
+		# setup the eventbox that holds the status icon and colour it
+		banner_status_eventbox = self.xmls[jid].get_widget('banner_status_eventbox')
+		banner_status_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
+
+		# setup the eventbox that holds the avatar and colour it
+		banner_avatar_eventbox = self.xmls[jid].get_widget('banner_avatar_eventbox')
+		banner_avatar_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
+
 
 	def set_state_image(self, jid):
 		prio = 0
@@ -109,18 +137,34 @@ def set_state_image(self, jid):
 		status_image = self.notebook.get_tab_label(child).get_children()[0]
 		state_images = self.plugin.roster.get_appropriate_state_images(jid)
 		image = state_images[show]
-		non_tabbed_status_image = self.xmls[jid].get_widget(
-			'nontabbed_status_image')
+		banner_status_image = self.xmls[jid].get_widget('banner_status_image')
 		if keyID:
 			self.xmls[jid].get_widget('gpg_togglebutton').set_sensitive(True)
 		else:
 			self.xmls[jid].get_widget('gpg_togglebutton').set_sensitive(False)
 		if image.get_storage_type() == gtk.IMAGE_ANIMATION:
-			non_tabbed_status_image.set_from_animation(image.get_animation())
+			banner_status_image.set_from_animation(image.get_animation())
 			status_image.set_from_animation(image.get_animation())
 		elif image.get_storage_type() == gtk.IMAGE_PIXBUF:
-			non_tabbed_status_image.set_from_pixbuf(image.get_pixbuf())
-			status_image.set_from_pixbuf(image.get_pixbuf())
+            # make a copy because one will be scaled, one not (tab icon)
+			pix = image.get_pixbuf()
+			scaled_pix = pix.scale_simple(32, 32, gtk.gdk.INTERP_BILINEAR)
+			banner_status_image.set_from_pixbuf(scaled_pix)
+			status_image.set_from_pixbuf(pix)
+
+	def repaint_colored_widgets(self):
+		"""Repaint widgets (banner) in the window/tab with theme color"""
+		# get the bg color of the bar from the current theme colors
+		bgcolor = gajim.config.get('accountbgcolor')
+
+		# iterate through tabs/windows and repaint
+		for jid in self.xmls:
+			banner_status_eventbox = self.xmls[jid].get_widget('banner_status_eventbox')
+			banner_status_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
+			banner_name_eventbox = self.xmls[jid].get_widget('banner_name_eventbox')
+			banner_name_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
+			banner_avatar_eventbox = self.xmls[jid].get_widget('banner_avatar_eventbox')
+			banner_avatar_eventbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(bgcolor))
 
 	def on_tabbed_chat_window_delete_event(self, widget, event):
 		"""close window"""
@@ -142,11 +186,7 @@ def on_tabbed_chat_window_focus_in_event(self, widget, event):
 	def on_chat_notebook_key_press_event(self, widget, event):
 		chat.Chat.on_chat_notebook_key_press_event(self, widget, event)
 
-	def on_clear_button_clicked(self, widget):
-		"""When clear button is pressed:	clear the conversation"""
-		jid = self.get_active_jid()
-		textview = self.xmls[jid].get_widget('conversation_textview')
-		self.on_clear(None, textview)
+# clear button is no longer: function removed
 
 	def on_history_button_clicked(self, widget):
 		"""When history button is pressed: call history window"""
@@ -157,6 +197,20 @@ def on_history_button_clicked(self, widget):
 			self.plugin.windows['logs'][jid] = history_window.\
 				History_window(self.plugin, jid, self.account)
 
+	def on_send_button_clicked(self, widget):
+		"""When send button is pressed: send the current message"""
+		jid = self.get_active_jid()
+		message_textview = self.xmls[jid].get_widget('message_textview')
+		message_buffer = message_textview.get_buffer()
+		start_iter = message_buffer.get_start_iter()
+		end_iter = message_buffer.get_end_iter()
+		message = message_buffer.get_text(start_iter, end_iter, 0)
+
+		# send the message
+		self.send_message(message)
+
+		message_buffer.set_text('', -1)
+
 	def remove_tab(self, jid):
 		if time.time() - self.last_message_time[jid] < 2:
 			dialog = dialogs.Confirmation_dialog(
@@ -169,15 +223,6 @@ def remove_tab(self, jid):
 		if len(self.xmls) > 0:
 			del self.users[jid]
 
-		jid = self.get_active_jid() # get the new active jid  
-		if jid != '':
-			nontabbed_status_image = self.xmls[jid].get_widget(
-				'nontabbed_status_image')  
-			if len(self.xmls) > 1:  
-				nontabbed_status_image.hide()  
-			else:
-				nontabbed_status_image.show()
-
 	def new_user(self, user):
 		'''when new tab is created'''
 		self.names[user.jid] = user.name
@@ -240,20 +285,11 @@ def on_message_textview_key_press_event(self, widget, event):
 				dialogs.Error_dialog(_("A connection is not available"),
                         _("Your message can't be sent until you reconnect.")).get_response()
 				return True
-			if message != '' or message != '\n':
-				self.save_sent_message(jid, message)
-				if message == '/clear':
-					self.on_clear(None, conversation_textview) # clear conversation
-					self.on_clear(None, widget) # clear message textview too
-					return True
-				keyID = ''
-				encrypted = False
-				if self.xmls[jid].get_widget('gpg_togglebutton').get_active():
-					keyID = self.users[jid].keyID
-					encrypted = True
-				gajim.connections[self.account].send_message(jid, message, keyID)
-				message_buffer.set_text('', -1)
-				self.print_conversation(message, jid, jid, encrypted = encrypted)
+
+			# send the message
+			self.send_message(message)
+
+			message_buffer.set_text('', -1)
 			return True
 		elif event.keyval == gtk.keysyms.Up:
 			if event.state & gtk.gdk.CONTROL_MASK: #Ctrl+UP
@@ -262,6 +298,27 @@ def on_message_textview_key_press_event(self, widget, event):
 			if event.state & gtk.gdk.CONTROL_MASK: #Ctrl+Down
 				self.sent_messages_scroll(jid, 'down', widget.get_buffer())
 
+	def send_message(self, message):
+		"""Send the message given in the args"""
+		jid = self.get_active_jid()
+		conversation_textview = self.xmls[jid].get_widget('conversation_textview')
+		message_textview = self.xmls[jid].get_widget('message_textview')
+		message_buffer = message_textview.get_buffer()
+		if message != '' or message != '\n':
+			self.save_sent_message(jid, message)
+			if message == '/clear':
+				self.on_clear(None, conversation_textview) # clear conversation
+				self.on_clear(None, widget) # clear message textview too
+				return True
+			keyID = ''
+			encrypted = False
+			if self.xmls[jid].get_widget('gpg_togglebutton').get_active():
+				keyID = self.users[jid].keyID
+				encrypted = True
+			gajim.connections[self.account].send_message(jid, message, keyID)
+			message_buffer.set_text('', -1)
+			self.print_conversation(message, jid, jid, encrypted = encrypted)
+
 	def on_contact_button_clicked(self, widget):
 		jid = self.get_active_jid()
 		user = self.users[jid]
-- 
GitLab