[tomboy] Fix awkward spacing in Sync tab of Prefs dialog (BGO #574155)



commit 0dc33b0c64398ad7763159af4c26b29934094000
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Mon Aug 10 11:04:15 2009 -0700

    Fix awkward spacing in Sync tab of Prefs dialog (BGO #574155)

 .../FileSystemSyncServiceAddin.cs                  |   12 ++++-
 .../Addins/SshSyncService/SshSyncServiceAddin.cs   |   48 ++++++++++++--------
 .../WebDavSyncService/WebDavSyncServiceAddin.cs    |   46 +++++++++++-------
 Tomboy/PreferencesDialog.cs                        |    6 +-
 4 files changed, 70 insertions(+), 42 deletions(-)
---
diff --git a/Tomboy/Addins/FileSystemSyncService/FileSystemSyncServiceAddin.cs b/Tomboy/Addins/FileSystemSyncService/FileSystemSyncServiceAddin.cs
index f692767..133a608 100644
--- a/Tomboy/Addins/FileSystemSyncService/FileSystemSyncServiceAddin.cs
+++ b/Tomboy/Addins/FileSystemSyncService/FileSystemSyncServiceAddin.cs
@@ -82,6 +82,8 @@ namespace Tomboy.Sync
 		public override Gtk.Widget CreatePreferencesControl ()
 		{
 			Gtk.Table table = new Gtk.Table (1, 3, false);
+			table.RowSpacing = 5;
+			table.ColumnSpacing = 10;
 
 			// Read settings out of gconf
 			string syncPath;
@@ -90,11 +92,17 @@ namespace Tomboy.Sync
 
 			Label l = new Label (Catalog.GetString ("_Folder Path:"));
 			l.Xalign = 1;
-			table.Attach (l, 0, 1, 0, 1);
+			table.Attach (l, 0, 1, 0, 1,
+			              Gtk.AttachOptions.Fill,
+			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
+			              0, 0);
 
 			pathEntry = new Entry ();
 			pathEntry.Text = syncPath;
-			table.Attach (pathEntry, 1, 2, 0, 1);
+			table.Attach (pathEntry, 1, 2, 0, 1,
+			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
+			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
+			              0, 0);
 			l.MnemonicWidget = pathEntry;
 
 			Image browseImage = new Image (Stock.Open, IconSize.Button);
diff --git a/Tomboy/Addins/SshSyncService/SshSyncServiceAddin.cs b/Tomboy/Addins/SshSyncService/SshSyncServiceAddin.cs
index f0f66d6..c2e2862 100644
--- a/Tomboy/Addins/SshSyncService/SshSyncServiceAddin.cs
+++ b/Tomboy/Addins/SshSyncService/SshSyncServiceAddin.cs
@@ -26,6 +26,8 @@ namespace Tomboy.Sync
 		public override Gtk.Widget CreatePreferencesControl ()
 		{
 			Gtk.Table table = new Gtk.Table (3, 2, false);
+			table.RowSpacing = 5;
+			table.ColumnSpacing = 10;
 
 			// Read settings out of gconf
 			string server, folder, username;
@@ -40,37 +42,22 @@ namespace Tomboy.Sync
 			if (username == null)
 				username = string.Empty;
 
-			Label l = new Label (Catalog.GetString ("Se_rver:"));
-			l.Xalign = 1;
-			table.Attach (l, 0, 1, 0, 1);
-
 			serverEntry = new Entry ();
-			l.MnemonicWidget = serverEntry;
 			serverEntry.Text = server;
-			table.Attach (serverEntry, 1, 2, 0, 1);
-
-			l = new Label (Catalog.GetString ("User_name:"));
-			l.Xalign = 1;
-			table.Attach (l, 0, 1, 1, 2);
+			AddRow (table, serverEntry, Catalog.GetString ("Se_rver:"), 0);
 
 			usernameEntry = new Entry ();
-			l.MnemonicWidget = usernameEntry;
 			usernameEntry.Text = username;
-			table.Attach (usernameEntry, 1, 2, 1, 2);
-
-			l = new Label (Catalog.GetString ("_Folder Path (optional):"));
-			l.Xalign = 1;
-			table.Attach (l, 0, 1, 2, 3);
+			AddRow (table, usernameEntry, Catalog.GetString ("User_name:"), 1);
 
 			folderEntry = new Entry ();
-			l.MnemonicWidget = folderEntry;
 			folderEntry.Text = folder;
-			table.Attach (folderEntry, 1, 2, 2, 3);
+			AddRow (table, folderEntry, Catalog.GetString ("_Folder Path (optional):"), 2);
 
 			// Text for label describing setup required for SSH sync addin to work
 			string sshInfo = Catalog.GetString ("SSH synchronization requires an existing SSH key for this " +
 			                                    "server and user, added to a running SSH daemon.");
-			l = new Label ();
+			Label l = new Label ();
 			l.UseMarkup = true;
 			l.Markup = string.Format ("<span size=\"small\">{0}</span>",
 			                          sshInfo);
@@ -233,6 +220,29 @@ namespace Tomboy.Sync
 			return !string.IsNullOrEmpty (server)
 			       && !string.IsNullOrEmpty (username);
 		}
+
+		// TODO: Centralize duplicated code
+		private void AddRow (Gtk.Table table, Gtk.Widget widget, string labelText, uint row)
+		{
+			Gtk.Label l = new Gtk.Label (labelText);
+			l.UseUnderline = true;
+			l.Xalign = 0.0f;
+			l.Show ();
+			table.Attach (l, 0, 1, row, row + 1,
+			              Gtk.AttachOptions.Fill,
+			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
+			              0, 0);
+
+			widget.Show ();
+			table.Attach (widget, 1, 2, row, row + 1,
+			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
+			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
+			              0, 0);
+
+			l.MnemonicWidget = widget;
+
+			// TODO: Tooltips
+		}
 		#endregion // Private Methods
 	}
 }
diff --git a/Tomboy/Addins/WebDavSyncService/WebDavSyncServiceAddin.cs b/Tomboy/Addins/WebDavSyncService/WebDavSyncServiceAddin.cs
index 5bcc45d..307354c 100644
--- a/Tomboy/Addins/WebDavSyncService/WebDavSyncServiceAddin.cs
+++ b/Tomboy/Addins/WebDavSyncService/WebDavSyncServiceAddin.cs
@@ -36,6 +36,8 @@ namespace Tomboy.Sync
 		public override Gtk.Widget CreatePreferencesControl ()
 		{
 			Gtk.Table table = new Gtk.Table (3, 2, false);
+			table.RowSpacing = 5;
+			table.ColumnSpacing = 10;
 
 			// Read settings out of gconf
 			string url, username, password;
@@ -48,33 +50,18 @@ namespace Tomboy.Sync
 			if (password == null)
 				password = string.Empty;
 
-			Label l = new Label (Catalog.GetString ("_URL:"));
-			l.Xalign = 1;
-			table.Attach (l, 0, 1, 0, 1);
-
 			urlEntry = new Entry ();
-			l.MnemonicWidget = urlEntry;
 			urlEntry.Text = url;
-			table.Attach (urlEntry, 1, 2, 0, 1);
-
-			l = new Label (Catalog.GetString ("User_name:"));
-			l.Xalign = 1;
-			table.Attach (l, 0, 1, 1, 2);
+			AddRow (table, urlEntry, Catalog.GetString ("_URL:"), 0);
 
 			usernameEntry = new Entry ();
-			l.MnemonicWidget = usernameEntry;
 			usernameEntry.Text = username;
-			table.Attach (usernameEntry, 1, 2, 1, 2);
-
-			l = new Label (Catalog.GetString ("_Password:"));
-			l.Xalign = 1;
-			table.Attach (l, 0, 1, 2, 3);
+			AddRow (table, usernameEntry, Catalog.GetString ("User_name:"), 1);
 
 			passwordEntry = new Entry ();
-			l.MnemonicWidget = passwordEntry;
 			passwordEntry.Text = password;
 			passwordEntry.Visibility = false;
-			table.Attach (passwordEntry, 1, 2, 2, 3);
+			AddRow (table, passwordEntry, Catalog.GetString ("_Password:"), 2);
 
 			table.ShowAll ();
 			return table;
@@ -293,6 +280,29 @@ namespace Tomboy.Sync
 				}
 			}
 		}
+
+		// TODO: Centralize duplicated code
+		private void AddRow (Gtk.Table table, Gtk.Widget widget, string labelText, uint row)
+		{
+			Gtk.Label l = new Gtk.Label (labelText);
+			l.UseUnderline = true;
+			l.Xalign = 0.0f;
+			l.Show ();
+			table.Attach (l, 0, 1, row, row + 1,
+			              Gtk.AttachOptions.Fill,
+			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
+			              0, 0);
+
+			widget.Show ();
+			table.Attach (widget, 1, 2, row, row + 1,
+			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
+			              Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
+			              0, 0);
+
+			l.MnemonicWidget = widget;
+
+			// TODO: Tooltips
+		}
 		#endregion // Private Methods
 	}
 }
diff --git a/Tomboy/PreferencesDialog.cs b/Tomboy/PreferencesDialog.cs
index 2792dd2..a0493b2 100644
--- a/Tomboy/PreferencesDialog.cs
+++ b/Tomboy/PreferencesDialog.cs
@@ -446,9 +446,9 @@ namespace Tomboy
 
 			syncAddinPrefsWidget.Show ();
 			syncAddinPrefsContainer = new Gtk.VBox (false, 0);
-			syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, true, true, 0);
+			syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0);
 			syncAddinPrefsContainer.Show ();
-			vbox.PackStart (syncAddinPrefsContainer, true, true, 0);
+			vbox.PackStart (syncAddinPrefsContainer, true, true, 10);
 
 			Gtk.HButtonBox bbox = new Gtk.HButtonBox ();
 			bbox.Spacing = 4;
@@ -1035,7 +1035,7 @@ namespace Tomboy
 					}
 
 					syncAddinPrefsWidget.Show ();
-					syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, true, true, 0);
+					syncAddinPrefsContainer.PackStart (syncAddinPrefsWidget, false, false, 0);
 
 					resetSyncAddinButton.Sensitive = false;
 					saveSyncAddinButton.Sensitive = true;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]