From 714119dbe6e1e7bd7590bb0d620da2a0392b387c Mon Sep 17 00:00:00 2001
From: Nikos Kouremenos <kourem@gmail.com>
Date: Sat, 26 Mar 2005 21:09:49 +0000
Subject: [PATCH] finally up

---
 plugins/gtkgui/config.py        |  17 +-
 plugins/gtkgui/gtkgui.glade     | 337 +++++++++++++++++---------------
 plugins/gtkgui/gtkgui.py        |  21 +-
 plugins/gtkgui/roster_window.py |  11 +-
 4 files changed, 205 insertions(+), 181 deletions(-)

diff --git a/plugins/gtkgui/config.py b/plugins/gtkgui/config.py
index 3b644d48ee..51e1713759 100644
--- a/plugins/gtkgui/config.py
+++ b/plugins/gtkgui/config.py
@@ -35,12 +35,16 @@ import gtkgui
 GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
 
 
-class preferences_window:
+class Preferences_window:
 	"""Class for Preferences window"""
-	def delete_event(self, widget):
-		"""close window"""
-		del self.plugin.windows['preferences']
 	
+	def on_delete_event(self, widget, event):
+		self.window.hide()
+		return True # do NOT destory the window
+	
+	def on_close_button_clicked(self, widget):
+		self.window.hide()		
+
 	def on_tray_icon_checkbutton_toggled(self, widget):
 		"""On Tray Icon Checkbutton Toggled"""
 		if widget.get_active():
@@ -436,10 +440,6 @@ class preferences_window:
 		else:
 			self.config_logger['lognotsep'] = 0
 		self.plugin.send('CONFIG', None, ('Logger', self.config_logger, 'GtkGui'))
-		
-	def on_close_button_clicked(self, widget):
-		"""When The close button is clicked"""
-		widget.get_toplevel().destroy()
 
 	def fill_msg_treeview(self):
 		i = 0
@@ -969,6 +969,7 @@ class preferences_window:
 			self.on_msg_treemodel_row_deleted)
 		
 		self.xml.signal_autoconnect(self)
+		#self.window.show_all()
 
 class Account_modification_window:
 	"""Class for account informations"""
diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade
index 53ecd425f8..8aa4b4aba8 100644
--- a/plugins/gtkgui/gtkgui.glade
+++ b/plugins/gtkgui/gtkgui.glade
@@ -2272,39 +2272,46 @@
       <property name="spacing">0</property>
 
       <child>
-	<widget class="GtkHButtonBox" id="hbuttonbox13">
+	<widget class="GtkHBox" id="hbox2942">
 	  <property name="visible">True</property>
-	  <property name="layout_style">GTK_BUTTONBOX_START</property>
+	  <property name="homogeneous">False</property>
 	  <property name="spacing">5</property>
 
 	  <child>
-	    <widget class="GtkButton" id="register_button">
+	    <widget class="GtkLabel" id="label224">
 	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label" translatable="yes">Re_gister</property>
+	      <property name="label" translatable="yes">_Address:</property>
 	      <property name="use_underline">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <signal name="clicked" handler="on_register_button_clicked" last_modification_time="Sat, 04 Sep 2004 20:59:29 GMT"/>
+	      <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>
+	      <property name="mnemonic_widget">address_comboboxentry</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="join_button">
+	    <widget class="GtkComboBoxEntry" id="address_comboboxentry">
 	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label" translatable="yes">_Join</property>
-	      <property name="use_underline">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="focus_on_click">True</property>
-	      <signal name="clicked" handler="on_join_button_clicked" last_modification_time="Sat, 04 Sep 2004 20:59:36 GMT"/>
 	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
 	  </child>
 	</widget>
 	<packing>
-	  <property name="padding">2</property>
+	  <property name="padding">0</property>
 	  <property name="expand">False</property>
 	  <property name="fill">True</property>
 	</packing>
@@ -2418,74 +2425,43 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkButton" id="close_button">
+	    <widget class="GtkButton" id="register_button">
 	      <property name="visible">True</property>
 	      <property name="can_default">True</property>
 	      <property name="has_default">True</property>
 	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">Re_gister</property>
+	      <property name="use_underline">True</property>
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
-	      <signal name="clicked" handler="on_close_button_clicked" last_modification_time="Tue, 01 Mar 2005 14:17:35 GMT"/>
-
-	      <child>
-		<widget class="GtkAlignment" id="alignment15">
-		  <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="hbox19">
-		      <property name="visible">True</property>
-		      <property name="homogeneous">False</property>
-		      <property name="spacing">2</property>
+	      <signal name="clicked" handler="on_register_button_clicked" last_modification_time="Sat, 26 Mar 2005 15:07:31 GMT"/>
+	    </widget>
+	  </child>
 
-		      <child>
-			<widget class="GtkImage" id="image104">
-			  <property name="visible">True</property>
-			  <property name="stock">gtk-close</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="GtkButton" id="join_button">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">_Join</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <signal name="clicked" handler="on_join_button_clicked" last_modification_time="Sat, 26 Mar 2005 15:08:01 GMT"/>
+	    </widget>
+	  </child>
 
-		      <child>
-			<widget class="GtkLabel" id="label28">
-			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">_Close</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>
+	  <child>
+	    <widget class="GtkButton" id="close_button">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="has_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-close</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <signal name="clicked" handler="on_close_button_clicked" last_modification_time="Sat, 26 Mar 2005 15:05:59 GMT"/>
 	    </widget>
 	  </child>
 	</widget>
@@ -2724,7 +2700,6 @@
   <property name="border_width">4</property>
   <property name="width_request">500</property>
   <property name="height_request">384</property>
-  <property name="visible">True</property>
   <property name="title" translatable="yes">Preferences</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
   <property name="window_position">GTK_WIN_POS_NONE</property>
@@ -2736,7 +2711,7 @@
   <property name="skip_pager_hint">False</property>
   <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <signal name="destroy" handler="delete_event" last_modification_time="Sat, 05 Mar 2005 16:24:38 GMT"/>
+  <signal name="delete_event" handler="on_delete_event" last_modification_time="Fri, 25 Mar 2005 21:02:26 GMT"/>
 
   <child>
     <widget class="GtkVBox" id="vbox13">
@@ -5293,7 +5268,7 @@ Custom</property>
 	      <property name="use_stock">True</property>
 	      <property name="relief">GTK_RELIEF_NORMAL</property>
 	      <property name="focus_on_click">True</property>
-	      <signal name="clicked" handler="on_close_button_clicked" last_modification_time="Sun, 06 Mar 2005 13:49:57 GMT"/>
+	      <signal name="clicked" handler="on_close_button_clicked" last_modification_time="Fri, 25 Mar 2005 21:02:58 GMT"/>
 	    </widget>
 	  </child>
 	</widget>
@@ -7246,16 +7221,101 @@ Custom</property>
 	<widget class="GtkTable" id="table15">
 	  <property name="border_width">5</property>
 	  <property name="visible">True</property>
-	  <property name="n_rows">4</property>
+	  <property name="n_rows">5</property>
 	  <property name="n_columns">2</property>
 	  <property name="homogeneous">False</property>
 	  <property name="row_spacing">5</property>
 	  <property name="column_spacing">10</property>
 
 	  <child>
-	    <widget class="GtkLabel" id="label142">
+	    <widget class="GtkEntry" id="password_entry">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="editable">True</property>
+	      <property name="visibility">False</property>
+	      <property name="max_length">0</property>
+	      <property name="text" translatable="yes"></property>
+	      <property name="has_frame">True</property>
+	      <property name="invisible_char">*</property>
+	      <property name="activates_default">True</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">4</property>
+	      <property name="bottom_attach">5</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkEntry" id="server_entry">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="editable">True</property>
+	      <property name="visibility">True</property>
+	      <property name="max_length">0</property>
+	      <property name="text" translatable="yes"></property>
+	      <property name="has_frame">True</property>
+	      <property name="invisible_char">*</property>
+	      <property name="activates_default">True</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">3</property>
+	      <property name="bottom_attach">4</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkEntry" id="room_entry">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="has_focus">True</property>
+	      <property name="editable">True</property>
+	      <property name="visibility">True</property>
+	      <property name="max_length">0</property>
+	      <property name="text" translatable="yes"></property>
+	      <property name="has_frame">True</property>
+	      <property name="invisible_char">*</property>
+	      <property name="activates_default">True</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">2</property>
+	      <property name="bottom_attach">3</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkEntry" id="nickname_entry">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="editable">True</property>
+	      <property name="visibility">True</property>
+	      <property name="max_length">0</property>
+	      <property name="text" translatable="yes"></property>
+	      <property name="has_frame">True</property>
+	      <property name="invisible_char">*</property>
+	      <property name="activates_default">True</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">1</property>
+	      <property name="bottom_attach">2</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkLabel" id="label145">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Nickname</property>
+	      <property name="label" translatable="yes">Password:</property>
 	      <property name="use_underline">False</property>
 	      <property name="use_markup">False</property>
 	      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -7269,17 +7329,17 @@ Custom</property>
 	    <packing>
 	      <property name="left_attach">0</property>
 	      <property name="right_attach">1</property>
-	      <property name="top_attach">0</property>
-	      <property name="bottom_attach">1</property>
+	      <property name="top_attach">4</property>
+	      <property name="bottom_attach">5</property>
 	      <property name="x_options">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
 
 	  <child>
-	    <widget class="GtkLabel" id="label143">
+	    <widget class="GtkLabel" id="label144">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Room</property>
+	      <property name="label" translatable="yes">Server:</property>
 	      <property name="use_underline">False</property>
 	      <property name="use_markup">False</property>
 	      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -7293,17 +7353,17 @@ Custom</property>
 	    <packing>
 	      <property name="left_attach">0</property>
 	      <property name="right_attach">1</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
+	      <property name="top_attach">3</property>
+	      <property name="bottom_attach">4</property>
 	      <property name="x_options">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
 
 	  <child>
-	    <widget class="GtkLabel" id="label144">
+	    <widget class="GtkLabel" id="label143">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Server</property>
+	      <property name="label" translatable="yes">Room:</property>
 	      <property name="use_underline">False</property>
 	      <property name="use_markup">False</property>
 	      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -7325,9 +7385,9 @@ Custom</property>
 	  </child>
 
 	  <child>
-	    <widget class="GtkLabel" id="label145">
+	    <widget class="GtkLabel" id="label142">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">Password</property>
+	      <property name="label" translatable="yes">Nickname:</property>
 	      <property name="use_underline">False</property>
 	      <property name="use_markup">False</property>
 	      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -7341,95 +7401,48 @@ Custom</property>
 	    <packing>
 	      <property name="left_attach">0</property>
 	      <property name="right_attach">1</property>
-	      <property name="top_attach">3</property>
-	      <property name="bottom_attach">4</property>
+	      <property name="top_attach">1</property>
+	      <property name="bottom_attach">2</property>
 	      <property name="x_options">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
 
 	  <child>
-	    <widget class="GtkEntry" id="nickname_entry">
+	    <widget class="GtkLabel" id="label225">
 	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="editable">True</property>
-	      <property name="visibility">True</property>
-	      <property name="max_length">0</property>
-	      <property name="text" translatable="yes"></property>
-	      <property name="has_frame">True</property>
-	      <property name="invisible_char">*</property>
-	      <property name="activates_default">True</property>
+	      <property name="label" translatable="yes">Recently:</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</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
 	    </widget>
 	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">1</property>
 	      <property name="top_attach">0</property>
 	      <property name="bottom_attach">1</property>
+	      <property name="x_options">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
 
 	  <child>
-	    <widget class="GtkEntry" id="room_entry">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="has_focus">True</property>
-	      <property name="editable">True</property>
-	      <property name="visibility">True</property>
-	      <property name="max_length">0</property>
-	      <property name="text" translatable="yes"></property>
-	      <property name="has_frame">True</property>
-	      <property name="invisible_char">*</property>
-	      <property name="activates_default">True</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkEntry" id="server_entry">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="editable">True</property>
-	      <property name="visibility">True</property>
-	      <property name="max_length">0</property>
-	      <property name="text" translatable="yes"></property>
-	      <property name="has_frame">True</property>
-	      <property name="invisible_char">*</property>
-	      <property name="activates_default">True</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
-	      <property name="top_attach">2</property>
-	      <property name="bottom_attach">3</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkEntry" id="password_entry">
+	    <widget class="GtkComboBox" id="recently_combobox">
 	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="editable">True</property>
-	      <property name="visibility">False</property>
-	      <property name="max_length">0</property>
-	      <property name="text" translatable="yes"></property>
-	      <property name="has_frame">True</property>
-	      <property name="invisible_char">*</property>
-	      <property name="activates_default">True</property>
 	    </widget>
 	    <packing>
 	      <property name="left_attach">1</property>
 	      <property name="right_attach">2</property>
-	      <property name="top_attach">3</property>
-	      <property name="bottom_attach">4</property>
-	      <property name="y_options"></property>
+	      <property name="top_attach">0</property>
+	      <property name="bottom_attach">1</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options">fill</property>
 	    </packing>
 	  </child>
 	</widget>
diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index 686db430f2..df2ba26375 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -790,12 +790,16 @@ class plugin:
 			'ask_online_status':0,\
 			'ask_offline_status':0,\
 			'last_msg':'',\
-			'msg0_name':'Brb',\
-			'msg0':'Back in some minutes.',\
-			'msg1_name':'Eating',\
-			'msg1':'I\'m eating, so leave me a message.',\
-			'msg2_name':'Film',\
-			'msg2':'I\'m watching a film.',\
+			'msg0_name':'Online',\
+			'msg0':'Yep I\'m online',\
+			'msg1_name':'Brb',\
+			'msg1':'Back in some minutes.',\
+			'msg2_name':'Eating',\
+			'msg2':'I\'m eating, so leave me a message.',\
+			'msg3_name':'Film',\
+			'msg3':'I\'m watching a film.',\
+			'msg4_name':'Offline',\
+			'msg4':'I\'m just offline',\
 			'trayicon':1,\
 			'iconstyle':'sun',\
 			'inmsgcolor':'#ff0000',\
@@ -868,7 +872,7 @@ class plugin:
 				break
 		if pix:
 			gtk.window_set_default_icon(pix)
-		self.roster = roster_window(self)
+		self.roster = Roster_window(self)
 		gobject.timeout_add(100, self.read_queue)
 		gobject.timeout_add(100, self.read_sleepy)
 		self.sleeper = common.sleepy.Sleepy( \
@@ -892,6 +896,9 @@ class plugin:
 			self.show_systray()
 			
 		self.init_regex()
+		
+		# get instances for windows/dialogs that will show_all()/hide()
+		self.windows['preferences'] = Preferences_window(self)
 
 		gtk.gdk.threads_enter()
 		gobject.timeout_add(100, self.autoconnect)
diff --git a/plugins/gtkgui/roster_window.py b/plugins/gtkgui/roster_window.py
index dcfcd49c63..c70cadb743 100644
--- a/plugins/gtkgui/roster_window.py
+++ b/plugins/gtkgui/roster_window.py
@@ -1,4 +1,4 @@
-##	plugins/roster.py
+##	plugins/gtkgui/roster_window.py
 ##
 ## Gajim Team:
 ##	- Yann Le Boulanger <asterix@lagaule.org>
@@ -42,7 +42,7 @@ gtk.glade.textdomain(APP)
 
 GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
 
-class roster_window:
+class Roster_window:
 	"""Class for main window of gtkgui plugin"""
 
 	def get_account_iter(self, name):
@@ -893,8 +893,11 @@ class roster_window:
 	def on_preferences_menuitem_activate(self, widget):
 		"""When preferences is selected :
 		call the preferences_window class"""
-		if not self.plugin.windows.has_key('preferences'):
-			self.plugin.windows['preferences'] = preferences_window(self.plugin)
+		print self.plugin.windows['preferences'].window.get_property('visible')
+		if self.plugin.windows['preferences'].window.get_property('visible'):
+			self.plugin.windows['preferences'].window.present()
+		else:
+			self.plugin.windows['preferences'].window.show_all()
 
 	def on_add_contact(self, widget, account):
 		"""When add user is selected :
-- 
GitLab