From 80906889c2d0c7db9a69ca5d2e3a7657effd311b Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@src.gnome.org>
Date: Fri, 21 Feb 2003 19:05:57 +0000
Subject: Use tables instead of vboxes, so that groups of label/entry pairs (as
 in

	* mail-account-gui.c (mail_account_gui_build_extra_conf): Use
	tables instead of vboxes, so that groups of label/entry pairs (as
	in Connector's config page) can line up nicely.

	* mail-config.glade: Turn extra_vbox and extra_mailcheck_vbox into
	tables.

	* mail-config-druid.c (get_fn): s/extra_vbox/extra_table/

	* Makefile.am (libevolution_mail_la_LIBADD):
	s/libcomposer.a/libcomposer.la/

svn path=/trunk/; revision=19993
---
 mail/ChangeLog           |  14 +++++++
 mail/Makefile.am         |   2 +-
 mail/mail-account-gui.c  | 105 +++++++++++++++++++++++++++--------------------
 mail/mail-config-druid.c |   2 +-
 mail/mail-config.glade   |  63 ++++++++++++++++------------
 5 files changed, 113 insertions(+), 73 deletions(-)

diff --git a/mail/ChangeLog b/mail/ChangeLog
index 0a523f4a16..18f733a239 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,17 @@
+2003-02-21  Dan Winship  <danw@ximian.com>
+
+	* mail-account-gui.c (mail_account_gui_build_extra_conf): Use
+	tables instead of vboxes, so that groups of label/entry pairs (as
+	in Connector's config page) can line up nicely.
+
+	* mail-config.glade: Turn extra_vbox and extra_mailcheck_vbox into
+	tables.
+
+	* mail-config-druid.c (get_fn): s/extra_vbox/extra_table/
+
+	* Makefile.am (libevolution_mail_la_LIBADD):
+	s/libcomposer.a/libcomposer.la/
+
 2003-02-20  Jeffrey Stedfast  <fejj@ximian.com>
 
 	* mail-callbacks.c (mark_all_as_seen): Use
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 422fdba2f2..c748e0557e 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -156,7 +156,7 @@ libevolution_mail_la_LIBADD =					\
 	$(top_builddir)/camel/libcamel.la			\
 	$(top_builddir)/e-util/libeutil.la			\
 	$(top_builddir)/shell/libeshell.la			\
-	$(top_builddir)/composer/libcomposer.a			\
+	$(top_builddir)/composer/libcomposer.la			\
 	$(top_builddir)/widgets/misc/libemiscwidgets.la		\
 	$(top_builddir)/widgets/misc/libefilterbar.la		\
 	$(top_builddir)/addressbook/backend/ebook/libebook.la	\
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 3d9488faf0..a2896f6017 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -726,13 +726,14 @@ void
 mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
 {
 	CamelURL *url;
-	GtkWidget *mailcheck_frame, *main_vbox, *cur_vbox;
+	GtkWidget *mailcheck_frame, *mailcheck_hbox;
 	GtkWidget *hostname_label, *username_label, *path_label;
 	GtkWidget *hostname, *username, *path;
+	GtkTable *main_table, *cur_table;
 	CamelProviderConfEntry *entries;
 	GList *children, *child;
 	char *name;
-	int i;
+	int i, rows;
 	
 	if (url_string)
 		url = camel_url_new (url_string, NULL);
@@ -751,44 +752,41 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
 	gtk_label_set_text_with_mnemonic (GTK_LABEL (path_label), _("_Path:"));
 	path = glade_xml_get_widget (gui->xml, "source_path");
 	
-	main_vbox = glade_xml_get_widget (gui->xml, "extra_vbox");
-	
+	/* Remove the contents of the extra_table except for the
+	 * mailcheck_frame.
+	 */
+	main_table = (GtkTable *)glade_xml_get_widget (gui->xml, "extra_table");
 	mailcheck_frame = glade_xml_get_widget (gui->xml, "extra_mailcheck_frame");
-	
-	/* Remove any additional mailcheck items. */
-	children = gtk_container_get_children(GTK_CONTAINER (mailcheck_frame));
-	if (children) {
-		cur_vbox = children->data;
-		g_list_free (children);
-		children = gtk_container_get_children(GTK_CONTAINER (cur_vbox));
-		for (child = children; child; child = child->next) {
-			if (child != children) {
-				gtk_container_remove (GTK_CONTAINER (cur_vbox),
-						      child->data);
-			}
+	children = gtk_container_get_children (GTK_CONTAINER (main_table));
+	for (child = children; child; child = child->next) {
+		if (child->data != (gpointer)mailcheck_frame) {
+			gtk_container_remove (GTK_CONTAINER (main_table),
+					      child->data);
 		}
-		g_list_free (children);
 	}
+	g_list_free (children);
+	gtk_table_resize (main_table, 1, 2);
 	
-	/* Remove the contents of the extra_vbox except for the
-	 * mailcheck_frame.
-	 */
-	children = gtk_container_get_children(GTK_CONTAINER (main_vbox));
+	/* Remove any additional mailcheck items. */
+	cur_table = (GtkTable *)glade_xml_get_widget (gui->xml, "extra_mailcheck_table");
+	mailcheck_hbox = glade_xml_get_widget (gui->xml, "extra_mailcheck_hbox");
+	children = gtk_container_get_children (GTK_CONTAINER (cur_table));
 	for (child = children; child; child = child->next) {
-		if (child != children) {
-			gtk_container_remove (GTK_CONTAINER (main_vbox),
+		if (child->data != (gpointer)mailcheck_hbox) {
+			gtk_container_remove (GTK_CONTAINER (cur_table),
 					      child->data);
 		}
 	}
 	g_list_free (children);
-	
+	gtk_table_resize (cur_table, 1, 2);
+
 	if (!gui->source.provider) {
-		gtk_widget_set_sensitive (main_vbox, FALSE);
+		gtk_widget_set_sensitive (GTK_WIDGET (main_table), FALSE);
 		if (url)
 			camel_url_free (url);
 		return;
 	} else
-		gtk_widget_set_sensitive (main_vbox, TRUE);
+		gtk_widget_set_sensitive (GTK_WIDGET (main_table), TRUE);
 	
 	/* Set up our hash table. */
 	if (gui->extra_config)
@@ -799,7 +797,8 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
 	if (!entries)
 		goto done;
 	
-	cur_vbox = main_vbox;
+	cur_table = main_table;
+	rows = main_table->nrows;
 	for (i = 0; ; i++) {
 		switch (entries[i].type) {
 		case CAMEL_PROVIDER_CONF_SECTION_START:
@@ -807,18 +806,27 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
 			GtkWidget *frame;
 			
 			if (entries[i].name && !strcmp (entries[i].name, "mailcheck"))
-				cur_vbox = glade_xml_get_widget (gui->xml, "extra_mailcheck_vbox");
+				cur_table = (GtkTable *)glade_xml_get_widget (gui->xml, "extra_mailcheck_table");
 			else {
 				frame = gtk_frame_new (entries[i].text);
-				gtk_box_pack_start (GTK_BOX (main_vbox), frame, FALSE, FALSE, 0);
-				cur_vbox = gtk_vbox_new (FALSE, 4);
-				gtk_container_set_border_width (GTK_CONTAINER (cur_vbox), 4);
-				gtk_container_add (GTK_CONTAINER (frame), cur_vbox);
+				gtk_container_set_border_width (GTK_CONTAINER (frame), 3);
+				gtk_table_attach (main_table, frame, 0, 2,
+						  rows, rows + 1,
+						  GTK_EXPAND | GTK_FILL, 0, 0, 0);
+
+				cur_table = (GtkTable *)gtk_table_new (0, 2, FALSE);
+				rows = 0;
+				gtk_table_set_row_spacings (cur_table, 4);
+				gtk_table_set_col_spacings (cur_table, 8);
+				gtk_container_set_border_width (GTK_CONTAINER (cur_table), 3);
+
+				gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (cur_table));
 			}
 			break;
 		}
 		case CAMEL_PROVIDER_CONF_SECTION_END:
-			cur_vbox = main_vbox;
+			cur_table = main_table;
+			rows = main_table->nrows;
 			break;
 			
 		case CAMEL_PROVIDER_CONF_LABEL:
@@ -834,7 +842,10 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
 				} else {
 					/* make a new label */
 					label = gtk_label_new (entries[i].text);
-					gtk_box_pack_start (GTK_BOX (cur_vbox), label, FALSE, FALSE, 0);
+					gtk_table_resize (cur_table, cur_table->nrows + 1, 2);
+					gtk_table_attach (cur_table, label, 0, 2, rows, rows + 1,
+							  GTK_EXPAND | GTK_FILL, 0, 0, 0);
+					rows++;
 				}
 			}
 			break;
@@ -850,7 +861,10 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
 			else
 				active = atoi (entries[i].value);
 			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), active);
-			gtk_box_pack_start (GTK_BOX (cur_vbox), checkbox, FALSE, FALSE, 0);
+
+			gtk_table_attach (cur_table, checkbox, 0, 2, rows, rows + 1,
+					  GTK_EXPAND | GTK_FILL, 0, 0, 0);
+			rows++;
 			g_hash_table_insert (gui->extra_config, entries[i].name, checkbox);
 			if (entries[i].depname)
 				setup_toggle (checkbox, entries[i].depname, gui);
@@ -859,7 +873,7 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
 		
 		case CAMEL_PROVIDER_CONF_ENTRY:
 		{
-			GtkWidget *hbox, *label, *entry;
+			GtkWidget *label, *entry;
 			const char *text;
 			
 			if (!strcmp (entries[i].name, "username")) {
@@ -876,15 +890,16 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
 				entry = path;
 			} else {
 				/* make a new text entry with label */
-				hbox = gtk_hbox_new (FALSE, 8);
 				label = gtk_label_new (entries[i].text);
+				gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.0);
 				entry = gtk_entry_new ();
-				
-				gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-				gtk_box_pack_end (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
-				
-				gtk_box_pack_start (GTK_BOX (cur_vbox), hbox, FALSE, FALSE, 0);
 				g_hash_table_insert (gui->extra_config, entries[i].name, entry);
+				
+				gtk_table_attach (cur_table, label, 0, 1, rows, rows + 1,
+						  GTK_FILL, 0, 0, 0);
+				gtk_table_attach (cur_table, entry, 1, 2, rows, rows + 1,
+						  GTK_EXPAND | GTK_FILL, 0, 0, 0);
+				rows++;
 			}
 			
 			if (url)
@@ -952,7 +967,9 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
 			gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, FALSE, 0);
 			gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 4);
 			
-			gtk_box_pack_start (GTK_BOX (cur_vbox), hbox, FALSE, FALSE, 0);
+			gtk_table_attach (cur_table, hbox, 0, 2, rows, rows + 1,
+					  GTK_EXPAND | GTK_FILL, 0, 0, 0);
+			rows++;
 			g_hash_table_insert (gui->extra_config, entries[i].name, checkbox);
 			name = g_strdup_printf ("%s_value", entries[i].name);
 			g_hash_table_insert (gui->extra_config, name, spin);
@@ -970,7 +987,7 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
 	}
 	
  done:
-	gtk_widget_show_all (main_vbox);
+	gtk_widget_show_all (GTK_WIDGET (main_table));
 	if (url)
 		camel_url_free (url);
 }
diff --git a/mail/mail-config-druid.c b/mail/mail-config-druid.c
index 15a44b8b69..85d5b1bfb6 100644
--- a/mail/mail-config-druid.c
+++ b/mail/mail-config-druid.c
@@ -851,7 +851,7 @@ get_fn (EvolutionWizard *wizard,
 	case 2:
 		widget = create_label ("extra_html");
 		gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0);
-		widget = glade_xml_get_widget (gui->gui->xml, "extra_vbox");
+		widget = glade_xml_get_widget (gui->gui->xml, "extra_table");
 		gtk_widget_reparent (widget, vbox);
 		break;
 	case 3:
diff --git a/mail/mail-config.glade b/mail/mail-config.glade
index 5a3935884e..b8944cbcb9 100644
--- a/mail/mail-config.glade
+++ b/mail/mail-config.glade
@@ -38,9 +38,9 @@ Click &quot;Forward&quot; to begin. </property>
 	<widget class="GnomeDruidPageStandard" id="identity_page">
 	  <property name="visible">True</property>
 	  <property name="title" translatable="yes">Identity</property>
-	  <property name="title_foreground">#e5d0bfffe388</property>
-	  <property name="background">#bdb00817e388</property>
-	  <property name="logo_background">#e7d80816532c</property>
+	  <property name="title_foreground">#0b100829e878</property>
+	  <property name="background">#8af8081ce878</property>
+	  <property name="logo_background">#eac0bfffe858</property>
 	  <property name="logo">mail-config-druid-identity.png</property>
 
 	  <child internal-child="vbox">
@@ -62,9 +62,9 @@ Click &quot;Forward&quot; to begin. </property>
 	<widget class="GnomeDruidPageStandard" id="source_page">
 	  <property name="visible">True</property>
 	  <property name="title" translatable="yes">Receiving Email</property>
-	  <property name="title_foreground">#e5d0bfffe388</property>
-	  <property name="background">#bdb00817e388</property>
-	  <property name="logo_background">#e7d80816532c</property>
+	  <property name="title_foreground">#3f780829e878</property>
+	  <property name="background">#8af8081ce878</property>
+	  <property name="logo_background">#eac0bfffe858</property>
 	  <property name="logo">mail-config-druid-receive.png</property>
 
 	  <child internal-child="vbox">
@@ -86,9 +86,9 @@ Click &quot;Forward&quot; to begin. </property>
 	<widget class="GnomeDruidPageStandard" id="extra_page">
 	  <property name="visible">True</property>
 	  <property name="title" translatable="yes">Receiving Email</property>
-	  <property name="title_foreground">#e5d0bfffe388</property>
-	  <property name="background">#bdb00817e388</property>
-	  <property name="logo_background">#e7d80816532c</property>
+	  <property name="title_foreground">#59280829e878</property>
+	  <property name="background">#8af8081ce878</property>
+	  <property name="logo_background">#eac0bfffe858</property>
 	  <property name="logo">mail-config-druid-receive.png</property>
 
 	  <child internal-child="vbox">
@@ -110,9 +110,9 @@ Click &quot;Forward&quot; to begin. </property>
 	<widget class="GnomeDruidPageStandard" id="transport_page">
 	  <property name="visible">True</property>
 	  <property name="title" translatable="yes">Sending Email</property>
-	  <property name="title_foreground">#e5d0bfffe388</property>
-	  <property name="background">#bdb00817e388</property>
-	  <property name="logo_background">#e7d80816532c</property>
+	  <property name="title_foreground">#4f60082ce878</property>
+	  <property name="background">#8af8081ce878</property>
+	  <property name="logo_background">#eac0bfffe858</property>
 	  <property name="logo">mail-config-druid-send.png</property>
 
 	  <child internal-child="vbox">
@@ -134,9 +134,9 @@ Click &quot;Forward&quot; to begin. </property>
 	<widget class="GnomeDruidPageStandard" id="management_page">
 	  <property name="visible">True</property>
 	  <property name="title" translatable="yes">Account Management</property>
-	  <property name="title_foreground">#e5d0bfffe388</property>
-	  <property name="background">#bdb00817e388</property>
-	  <property name="logo_background">#e7d80816532c</property>
+	  <property name="title_foreground">#6c18082ce878</property>
+	  <property name="background">#8af8081ce878</property>
+	  <property name="logo_background">#eac0bfffe858</property>
 	  <property name="logo">mail-config-druid-account-name.png</property>
 
 	  <child internal-child="vbox">
@@ -1403,11 +1403,14 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
       </child>
 
       <child>
-	<widget class="GtkVBox" id="extra_vbox">
-	  <property name="border_width">4</property>
+	<widget class="GtkTable" id="extra_table">
+	  <property name="border_width">3</property>
 	  <property name="visible">True</property>
+	  <property name="n_rows">1</property>
+	  <property name="n_columns">2</property>
 	  <property name="homogeneous">False</property>
-	  <property name="spacing">0</property>
+	  <property name="row_spacing">4</property>
+	  <property name="column_spacing">8</property>
 
 	  <child>
 	    <widget class="GtkFrame" id="extra_mailcheck_frame">
@@ -1418,14 +1421,17 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
 	      <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
 
 	      <child>
-		<widget class="GtkVBox" id="extra_mailcheck_vbox">
+		<widget class="GtkTable" id="extra_mailcheck_table">
 		  <property name="border_width">3</property>
 		  <property name="visible">True</property>
+		  <property name="n_rows">1</property>
+		  <property name="n_columns">2</property>
 		  <property name="homogeneous">False</property>
-		  <property name="spacing">0</property>
+		  <property name="row_spacing">4</property>
+		  <property name="column_spacing">8</property>
 
 		  <child>
-		    <widget class="GtkHBox" id="hbox53">
+		    <widget class="GtkHBox" id="extra_mailcheck_hbox">
 		      <property name="visible">True</property>
 		      <property name="homogeneous">False</property>
 		      <property name="spacing">0</property>
@@ -1511,9 +1517,10 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
 		      </child>
 		    </widget>
 		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">True</property>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">2</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
 		    </packing>
 		  </child>
 		</widget>
@@ -1539,9 +1546,11 @@ For example: &quot;Work&quot; or &quot;Personal&quot;</property>
 	      </child>
 	    </widget>
 	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">True</property>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">0</property>
+	      <property name="bottom_attach">1</property>
+	      <property name="y_options">fill</property>
 	    </packing>
 	  </child>
 	</widget>
-- 
cgit