From 7e467e04f888c24fda1a7612292474bf217eae2c Mon Sep 17 00:00:00 2001
From: Dimitur Kirov <dkirov@gmail.com>
Date: Fri, 19 May 2006 22:30:23 +0000
Subject: [PATCH] shrink account and protocol comboboxes

---
 data/glade/add_new_contact_window.glade | 141 +++++++++++++++---------
 src/dialogs.py                          |  10 +-
 2 files changed, 94 insertions(+), 57 deletions(-)

diff --git a/data/glade/add_new_contact_window.glade b/data/glade/add_new_contact_window.glade
index 77d62ceb81..bb5313a531 100644
--- a/data/glade/add_new_contact_window.glade
+++ b/data/glade/add_new_contact_window.glade
@@ -141,24 +141,6 @@
 	    </packing>
 	  </child>
 
-	  <child>
-	    <widget class="GtkComboBox" id="protocol_combobox">
-	      <property name="visible">True</property>
-	      <property name="items" translatable="yes"></property>
-	      <property name="add_tearoffs">False</property>
-	      <property name="focus_on_click">True</property>
-	      <signal name="changed" handler="on_protocol_combobox_changed" last_modification_time="Wed, 23 Mar 2005 13:13:12 GMT"/>
-	    </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="x_options">fill</property>
-	      <property name="y_options">fill</property>
-	    </packing>
-	  </child>
-
 	  <child>
 	    <widget class="GtkLabel" id="label223">
 	      <property name="visible">True</property>
@@ -245,9 +227,9 @@
 	  </child>
 
 	  <child>
-	    <widget class="GtkLabel" id="protocol_label">
+	    <widget class="GtkLabel" id="account_label">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">_Protocol:</property>
+	      <property name="label" translatable="yes">_Account:</property>
 	      <property name="use_underline">True</property>
 	      <property name="use_markup">False</property>
 	      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -265,9 +247,31 @@
 	    <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="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkEntry" id="uid_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>
+	      <signal name="changed" handler="on_uid_entry_changed" last_modification_time="Mon, 28 Feb 2005 23:05:24 GMT"/>
+	    </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="x_options">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
@@ -294,39 +298,17 @@
 	    <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">2</property>
+	      <property name="bottom_attach">3</property>
 	      <property name="x_options">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
 
 	  <child>
-	    <widget class="GtkEntry" id="uid_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>
-	      <signal name="changed" handler="on_uid_entry_changed" last_modification_time="Mon, 28 Feb 2005 23:05:24 GMT"/>
-	    </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="account_label">
+	    <widget class="GtkLabel" id="protocol_label">
 	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">_Account:</property>
+	      <property name="label" translatable="yes">_Protocol:</property>
 	      <property name="use_underline">True</property>
 	      <property name="use_markup">False</property>
 	      <property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -336,6 +318,7 @@
 	      <property name="yalign">0.5</property>
 	      <property name="xpad">0</property>
 	      <property name="ypad">0</property>
+	      <property name="mnemonic_widget">uid_entry</property>
 	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
 	      <property name="width_chars">-1</property>
 	      <property name="single_line_mode">False</property>
@@ -344,19 +327,36 @@
 	    <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">1</property>
+	      <property name="bottom_attach">2</property>
 	      <property name="x_options">fill</property>
 	      <property name="y_options"></property>
 	    </packing>
 	  </child>
 
 	  <child>
-	    <widget class="GtkComboBox" id="account_combobox">
+	    <widget class="GtkHBox" id="account_hbox">
 	      <property name="visible">True</property>
-	      <property name="items" translatable="yes"></property>
-	      <property name="add_tearoffs">False</property>
-	      <property name="focus_on_click">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+
+	      <child>
+		<widget class="GtkComboBox" id="account_combobox">
+		  <property name="visible">True</property>
+		  <property name="items" translatable="yes"></property>
+		  <property name="add_tearoffs">False</property>
+		  <property name="focus_on_click">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<placeholder/>
+	      </child>
 	    </widget>
 	    <packing>
 	      <property name="left_attach">1</property>
@@ -367,6 +367,41 @@
 	      <property name="y_options">fill</property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkHBox" id="protocol_hbox">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+
+	      <child>
+		<widget class="GtkComboBox" id="protocol_combobox">
+		  <property name="visible">True</property>
+		  <property name="items" translatable="yes"></property>
+		  <property name="add_tearoffs">False</property>
+		  <property name="focus_on_click">True</property>
+		  <signal name="changed" handler="on_protocol_combobox_changed" last_modification_time="Wed, 23 Mar 2005 13:13:12 GMT"/>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<placeholder/>
+	      </child>
+	    </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="x_options">fill</property>
+	      <property name="y_options">fill</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
diff --git a/src/dialogs.py b/src/dialogs.py
index 58ac9b086b..699987a7b3 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -378,10 +378,12 @@ class AddNewContactWindow:
 			accounts = [self.account]
 		self.xml = gtkgui_helpers.get_glade('add_new_contact_window.glade')
 		self.account_combobox = self.xml.get_widget('account_combobox')
+		self.account_hbox = self.xml.get_widget('account_hbox')
 		self.account_label = self.xml.get_widget('account_label')
 		self.window = self.xml.get_widget('add_new_contact_window')
 		self.uid_entry = self.xml.get_widget('uid_entry')
 		self.protocol_combobox = self.xml.get_widget('protocol_combobox')
+		self.protocol_hbox = self.xml.get_widget('protocol_hbox')
 		self.jid_entry = self.xml.get_widget('jid_entry')
 		self.nickname_entry = self.xml.get_widget('nickname_entry')
 		if account and len(gajim.connections) >= 2:
@@ -443,16 +445,16 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
 
 		if not jid_agents:
 			# There are no transports, so hide the protocol combobox and label
-			self.protocol_combobox.hide()
-			self.protocol_combobox.set_no_show_all(True)
+			self.protocol_hbox.hide()
+			self.protocol_hbox.set_no_show_all(True)
 			protocol_label = self.xml.get_widget('protocol_label')
 			protocol_label.hide()
 			protocol_label.set_no_show_all(True)
 		if self.account:
 			self.account_label.hide()
-			self.account_combobox.hide()
+			self.account_hbox.hide()
 			self.account_label.set_no_show_all(True)
-			self.account_combobox.set_no_show_all(True)
+			self.account_hbox.set_no_show_all(True)
 		else:
 			liststore = gtk.ListStore(str, str)
 			for acct in accounts:
-- 
GitLab