[f-spot] Removing obsolete OptionMenu in favor of Gtk.ComboBox



commit bf387b6796f3a7a056bcfd7072ab6a6a977768c8
Author: Tim Howard <timothy howard gmail com>
Date:   Tue Nov 23 00:58:06 2010 -0500

    Removing obsolete OptionMenu in favor of Gtk.ComboBox
    
    https://bugzilla.gnome.org/show_bug.cgi?id=635585

 .../MainApp/FSpot.UI.Dialog/EditTagDialog.cs       |   33 +++++++++---
 .../MainApp/FSpot.UI.Dialog/ui/EditTagDialog.ui    |    2 +-
 .../FSpot.Exporters.Gallery/GalleryAddAlbum.cs     |   20 +++-----
 .../FSpot.Exporters.Gallery/GalleryExport.cs       |   45 ++++++-----------
 .../FSpot.Exporters.PicasaWeb/PicasaWebExport.cs   |   53 ++++++++++----------
 .../FSpot.Exporters.SmugMug/SmugMugExport.cs       |   43 ++++++----------
 6 files changed, 91 insertions(+), 105 deletions(-)
---
diff --git a/src/Clients/MainApp/FSpot.UI.Dialog/EditTagDialog.cs b/src/Clients/MainApp/FSpot.UI.Dialog/EditTagDialog.cs
index 9acd11f..ef3031e 100644
--- a/src/Clients/MainApp/FSpot.UI.Dialog/EditTagDialog.cs
+++ b/src/Clients/MainApp/FSpot.UI.Dialog/EditTagDialog.cs
@@ -44,8 +44,7 @@ namespace FSpot.UI.Dialog
 		[GtkBeans.Builder.Object] Entry tag_name_entry;
 		[GtkBeans.Builder.Object] Label already_in_use_label;
 		[GtkBeans.Builder.Object] Gtk.Image icon_image;
-		[GtkBeans.Builder.Object] OptionMenu category_option_menu;
-
+		[GtkBeans.Builder.Object] Gtk.ComboBox category_option_menu;
 
 		public EditTagDialog (Db db, Tag t, Gtk.Window parent_window) : base ("EditTagDialog.ui", "edit_tag_dialog")
 		{
@@ -76,7 +75,7 @@ namespace FSpot.UI.Dialog
 		}
 
 		public Category TagCategory {
-			get { return categories [category_option_menu.History] as Category;}
+			get { return categories [category_option_menu.Active] as Category;}
 		}
 
 		ArrayList categories;
@@ -156,7 +155,18 @@ namespace FSpot.UI.Dialog
 			categories.Add (root);
 			PopulateCategories (categories, root);
 
-			Menu menu = new Menu ();
+            category_option_menu.Clear();
+
+            CellRendererPixbuf cell2 = new CellRendererPixbuf();
+            category_option_menu.PackStart(cell2, false);
+            category_option_menu.AddAttribute(cell2, "pixbuf", 0);
+
+            CellRendererText cell = new CellRendererText();
+            category_option_menu.PackStart(cell, true);
+            category_option_menu.AddAttribute(cell, "text", 1);
+
+            ListStore store = new ListStore(new[] {typeof (Gdk.Pixbuf), typeof(string)});
+            category_option_menu.Model = store;
 
 			foreach (Category category in categories) {
 				if (t.Category == category)
@@ -164,14 +174,21 @@ namespace FSpot.UI.Dialog
 
 				i++;
 
-				menu.Append (TagMenu.TagMenuItem.IndentedItem (category));
+                string categoryName = category.Name;
+                Gdk.Pixbuf categoryImage = category.Icon;
+
+                store.AppendValues( new object[] {
+                    categoryImage,
+                    categoryName
+                });
 			}
 
 			category_option_menu.Sensitive = true;
 
-			menu.ShowAll ();
-			category_option_menu.Menu = menu;
-			category_option_menu.SetHistory ((uint)history);
+            category_option_menu.Active = history;
+
+ 			//category_option_menu.SetHistory ((uint)history);
+            //category_option_menu.Active = (uint)history;
 		}
 	}
 }
diff --git a/src/Clients/MainApp/FSpot.UI.Dialog/ui/EditTagDialog.ui b/src/Clients/MainApp/FSpot.UI.Dialog/ui/EditTagDialog.ui
index 947464a..20f7429 100644
--- a/src/Clients/MainApp/FSpot.UI.Dialog/ui/EditTagDialog.ui
+++ b/src/Clients/MainApp/FSpot.UI.Dialog/ui/EditTagDialog.ui
@@ -66,7 +66,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkOptionMenu" id="category_option_menu">
+              <object class="GtkComboBox" id="category_option_menu">
                 <property name="width_request">150</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
diff --git a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryAddAlbum.cs b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryAddAlbum.cs
index 9e2d6c4..e8a99e6 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryAddAlbum.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryAddAlbum.cs
@@ -50,7 +50,7 @@ namespace FSpot.Exporters.Gallery
 	public class GalleryAddAlbum
 	{
 		[GtkBeans.Builder.Object] Gtk.Dialog add_album_dialog;
-		Gtk.OptionMenu album_optionmenu;
+		Gtk.ComboBox album_optionmenu;
 
 		[GtkBeans.Builder.Object] Gtk.Entry name_entry;
 		[GtkBeans.Builder.Object] Gtk.Entry description_entry;
@@ -72,7 +72,7 @@ namespace FSpot.Exporters.Gallery
 			add_album_dialog = new Gtk.Dialog (builder.GetRawObject ("gallery_add_album_dialog"));
 			add_album_dialog.Modal = true;
 
-			album_optionmenu = new Gtk.OptionMenu ();
+			album_optionmenu = new Gtk.ComboBox ();
 			(name_entry.Parent as Gtk.Table).Attach (album_optionmenu, 1, 2, 1, 2);
 			album_optionmenu.Show ();
 
@@ -104,34 +104,28 @@ namespace FSpot.Exporters.Gallery
 				}
 				label_builder.Append (album.Title);
 
-				Gtk.MenuItem item = new Gtk.MenuItem (label_builder.ToString ());
-				((Gtk.Label)item.Child).UseUnderline = false;
-				menu.Append (item);
+                album_optionmenu.AppendText(label_builder.ToString());
 
 				AlbumPermission create_sub = album.Perms & AlbumPermission.CreateSubAlbum;
-
-				if (create_sub == 0)
-					item.Sensitive = false;
 			}
 
 			album_optionmenu.Sensitive = true;
 			menu.ShowAll ();
-			album_optionmenu.Menu = menu;
 		}
 
 		private void HandleChanged (object sender, EventArgs args)
 		{
 			if (gallery.Version == GalleryVersion.Version1) {
-				if (gallery.Albums.Count == 0 || album_optionmenu.History <= 0) {
+				if (gallery.Albums.Count == 0 || album_optionmenu.Active <= 0) {
 					parent = String.Empty;
 				} else {
-					parent = ((Album) gallery.Albums [album_optionmenu.History-1]).Name;
+					parent = ((Album) gallery.Albums [album_optionmenu.Active-1]).Name;
 				}
 			} else {
-				if (gallery.Albums.Count == 0 || album_optionmenu.History < 0) {
+				if (gallery.Albums.Count == 0 || album_optionmenu.Active < 0) {
 					parent = String.Empty;
 				} else {
-					parent = ((Album) gallery.Albums [album_optionmenu.History]).Name;
+					parent = ((Album) gallery.Albums [album_optionmenu.Active]).Name;
 				}
 			}
 			name = name_entry.Text;
diff --git a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryExport.cs b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryExport.cs
index 792a743..8b02abb 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryExport.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.Gallery/FSpot.Exporters.Gallery/GalleryExport.cs
@@ -62,12 +62,12 @@ namespace FSpot.Exporters.Gallery
 			builder.Autoconnect (this);
 			export_dialog = new Gtk.Dialog (builder.GetRawObject ("gallery_export_dialog"));
 
-			album_optionmenu = new Gtk.OptionMenu ();
+			album_optionmenu = new Gtk.ComboBox ();
 			(album_button.Parent as Gtk.HBox).PackStart (album_optionmenu);
 			(album_button.Parent as Gtk.HBox).ReorderChild (album_optionmenu, 1);
 			album_optionmenu.Show ();
 
-			gallery_optionmenu = new Gtk.OptionMenu ();
+			gallery_optionmenu = new Gtk.ComboBox ();
 			(edit_button.Parent as Gtk.HBox).PackStart (gallery_optionmenu);
 			(edit_button.Parent as Gtk.HBox).ReorderChild (gallery_optionmenu, 1);
 			gallery_optionmenu.Show ();
@@ -127,8 +127,8 @@ namespace FSpot.Exporters.Gallery
 
 		// Widgets
 		[GtkBeans.Builder.Object] Gtk.Dialog export_dialog;
-		Gtk.OptionMenu gallery_optionmenu;
-		Gtk.OptionMenu album_optionmenu;
+		Gtk.ComboBox gallery_optionmenu;
+		Gtk.ComboBox album_optionmenu;
 
 		[GtkBeans.Builder.Object] Gtk.CheckButton browser_check;
 		[GtkBeans.Builder.Object] Gtk.CheckButton scale_check;
@@ -164,7 +164,7 @@ namespace FSpot.Exporters.Gallery
 
 			if (account != null) {
 				//System.Console.WriteLine ("history = {0}", album_optionmenu.History);
-				album = (Album) account.Gallery.Albums [Math.Max (0, album_optionmenu.History)];
+				album = (Album) account.Gallery.Albums [Math.Max (0, album_optionmenu.Active)];
 				photo_index = 0;
 
 				export_dialog.Destroy ();
@@ -254,14 +254,13 @@ namespace FSpot.Exporters.Gallery
 
 		private void PopulateGalleryOptionMenu (GalleryAccountManager manager, GalleryAccount changed_account)
 		{
-			Gtk.Menu menu = new Gtk.Menu ();
 			this.account = changed_account;
 			int pos = -1;
 
 			accounts = manager.GetAccounts ();
 			if (accounts == null || accounts.Count == 0) {
-				Gtk.MenuItem item = new Gtk.MenuItem (Catalog.GetString ("(No Gallery)"));
-				menu.Append (item);
+                gallery_optionmenu.AppendText(Catalog.GetString("(No Gallery)"));
+
 				gallery_optionmenu.Sensitive = false;
 				edit_button.Sensitive = false;
 			} else {
@@ -270,17 +269,14 @@ namespace FSpot.Exporters.Gallery
 					if (account == changed_account)
 						pos = i;
 
-					Gtk.MenuItem item = new Gtk.MenuItem (account.Name);
-					menu.Append (item);
+                    gallery_optionmenu.AppendText(account.Name);
 					i++;
 				}
 				gallery_optionmenu.Sensitive = true;
 				edit_button.Sensitive = true;
 			}
 
-			menu.ShowAll ();
-			gallery_optionmenu.Menu = menu;
-			gallery_optionmenu.SetHistory ((uint)pos);
+            gallery_optionmenu.Active = pos;
 		}
 
 		private void Connect ()
@@ -293,7 +289,7 @@ namespace FSpot.Exporters.Gallery
 			try {
 				if (accounts.Count != 0 && connect) {
 					if (selected == null)
-						account = (GalleryAccount) accounts [gallery_optionmenu.History];
+						account = (GalleryAccount) accounts [gallery_optionmenu.Active];
 					else
 						account = selected;
 
@@ -321,14 +317,14 @@ namespace FSpot.Exporters.Gallery
 		}
 
 		public void HandleAlbumAdded (string title) {
-			GalleryAccount account = (GalleryAccount) accounts [gallery_optionmenu.History];
+			GalleryAccount account = (GalleryAccount) accounts [gallery_optionmenu.Active];
 			PopulateAlbumOptionMenu (account.Gallery);
 
 			// make the newly created album selected
 			ArrayList albums = account.Gallery.Albums;
 			for (int i=0; i < albums.Count; i++) {
 				if (((Album)albums[i]).Title == title) {
-					album_optionmenu.SetHistory((uint)i);
+                    album_optionmenu.Active = i;
 				}
 			}
 		}
@@ -347,16 +343,13 @@ namespace FSpot.Exporters.Gallery
 				}
 			}
 
-			Gtk.Menu menu = new Gtk.Menu ();
-
 			bool disconnected = gallery == null || !account.Connected || albums == null;
 
 			if (disconnected || albums.Count == 0) {
 				string msg = disconnected ? Catalog.GetString ("(Not Connected)")
 					: Catalog.GetString ("(No Albums)");
 
-				Gtk.MenuItem item = new Gtk.MenuItem (msg);
-				menu.Append (item);
+                album_optionmenu.AppendText(msg);
 
 				export_button.Sensitive = false;
 				album_optionmenu.Sensitive = false;
@@ -373,23 +366,15 @@ namespace FSpot.Exporters.Gallery
 					}
 					label_builder.Append (album.Title);
 
-					Gtk.MenuItem item = new Gtk.MenuItem (label_builder.ToString ());
-					((Gtk.Label)item.Child).UseUnderline = false;
-					menu.Append (item);
+                    album_optionmenu.AppendText(label_builder.ToString());
 
-				        AlbumPermission add_permission = album.Perms & AlbumPermission.Add;
-
-					if (add_permission == 0)
-						item.Sensitive = false;
+				    AlbumPermission add_permission = album.Perms & AlbumPermission.Add;
 				}
 
 				export_button.Sensitive = items.Length > 0;
 				album_optionmenu.Sensitive = true;
 				album_button.Sensitive = true;
 			}
-
-			menu.ShowAll ();
-			album_optionmenu.Menu = menu;
 		}
 
 		public void HandleAddGallery (object sender, System.EventArgs args)
diff --git a/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/PicasaWebExport.cs b/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/PicasaWebExport.cs
index c372f57..1ddefcf 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/PicasaWebExport.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.PicasaWeb/FSpot.Exporters.PicasaWeb/PicasaWebExport.cs
@@ -68,8 +68,8 @@ namespace FSpot.Exporters.PicasaWeb {
 			builder = new GtkBeans.Builder (null, "google_export_dialog.ui", null);
 			builder.Autoconnect (this);
 
-            gallery_optionmenu = new Gtk.OptionMenu ();
-            album_optionmenu = new Gtk.OptionMenu ();
+            gallery_optionmenu = Gtk.ComboBox.NewText();
+            album_optionmenu = Gtk.ComboBox.NewText();
 
             (edit_button.Parent as Gtk.HBox).PackStart (gallery_optionmenu);
             (album_button.Parent as Gtk.HBox).PackStart (album_optionmenu);
@@ -140,8 +140,8 @@ namespace FSpot.Exporters.PicasaWeb {
 
 		// widgets
 		[GtkBeans.Builder.Object] Gtk.Dialog dialog;
-		Gtk.OptionMenu gallery_optionmenu;
-		Gtk.OptionMenu album_optionmenu;
+		Gtk.ComboBox gallery_optionmenu;
+		Gtk.ComboBox album_optionmenu;
 
 		[GtkBeans.Builder.Object] Gtk.Label status_label;
 		[GtkBeans.Builder.Object] Gtk.Label album_status_label;
@@ -178,7 +178,7 @@ namespace FSpot.Exporters.PicasaWeb {
 			export_tag = tag_check.Active;
 
 			if (account != null) {
-				album = (PicasaAlbum) account.Picasa.GetAlbums() [Math.Max (0, album_optionmenu.History)];
+				album = (PicasaAlbum) account.Picasa.GetAlbums() [Math.Max (0, album_optionmenu.Active)];
 				photo_index = 0;
 
 				Dialog.Destroy ();
@@ -299,33 +299,40 @@ namespace FSpot.Exporters.PicasaWeb {
 
 		private void PopulateGoogleOptionMenu (GoogleAccountManager manager, GoogleAccount changed_account)
 		{
-			Gtk.Menu menu = new Gtk.Menu ();
 			this.account = changed_account;
 			int pos = -1;
 
 			accounts = manager.GetAccounts ();
 			if (accounts == null || accounts.Count == 0) {
-				Gtk.MenuItem item = new Gtk.MenuItem (Catalog.GetString ("(No Gallery)"));
-				menu.Append (item);
+
+                if (accounts==null)
+                    Log.Debug("accounts == null");
+                else
+                    Log.Debug("accounts != null");
+
+                Log.DebugFormat("accounts.Count = {0}", accounts.Count);
+
+                gallery_optionmenu.AppendText (Catalog.GetString ("(No Gallery)"));
 				gallery_optionmenu.Sensitive = false;
 				edit_button.Sensitive = false;
+
+                pos = 0;
 			} else {
 				int i = 0;
+                pos = 0;
 				foreach (GoogleAccount account in accounts) {
 					if (account == changed_account)
 						pos = i;
 
-					Gtk.MenuItem item = new Gtk.MenuItem (account.Username);
-					menu.Append (item);
+                    gallery_optionmenu.AppendText (account.Username);
 					i++;
 				}
 				gallery_optionmenu.Sensitive = true;
 				edit_button.Sensitive = true;
 			}
 
-			menu.ShowAll ();
-			gallery_optionmenu.Menu = menu;
-			gallery_optionmenu.SetHistory ((uint)pos);
+            Log.DebugFormat("Setting gallery_optionmenu.Active = {0}", pos);
+            gallery_optionmenu.Active = pos;
 		}
 
 		private void Connect ()
@@ -343,7 +350,7 @@ namespace FSpot.Exporters.PicasaWeb {
 			try {
 				if (accounts.Count != 0 && connect) {
 					if (selected == null)
-						account = (GoogleAccount) accounts [gallery_optionmenu.History];
+						account = (GoogleAccount) accounts [gallery_optionmenu.Active];
 					else
 						account = selected;
 
@@ -398,14 +405,14 @@ namespace FSpot.Exporters.PicasaWeb {
 		}
 
 		public void HandleAlbumAdded (string title) {
-			GoogleAccount account = (GoogleAccount) accounts [gallery_optionmenu.History];
+			GoogleAccount account = (GoogleAccount) accounts [gallery_optionmenu.Active];
 			PopulateAlbumOptionMenu (account.Picasa);
 
 			// make the newly created album selected
 //			PicasaAlbumCollection albums = account.Picasa.GetAlbums();
 			for (int i=0; i < albums.Count; i++) {
 				if (((PicasaAlbum)albums[i]).Title == title) {
-					album_optionmenu.SetHistory((uint)i);
+					album_optionmenu.Active = i;
 				}
 			}
 		}
@@ -422,16 +429,13 @@ namespace FSpot.Exporters.PicasaWeb {
 				}
 			}
 
-			Gtk.Menu menu = new Gtk.Menu ();
-
 			bool disconnected = picasa == null || !account.Connected || albums == null;
 
 			if (disconnected || albums.Count == 0) {
 				string msg = disconnected ? Catalog.GetString ("(Not Connected)")
 					: Catalog.GetString ("(No Albums)");
 
-				Gtk.MenuItem item = new Gtk.MenuItem (msg);
-				menu.Append (item);
+                album_optionmenu.AppendText(msg);
 
 				export_button.Sensitive = false;
 				album_optionmenu.Sensitive = false;
@@ -446,18 +450,13 @@ namespace FSpot.Exporters.PicasaWeb {
 					label_builder.Append (album.Title);
 					label_builder.Append (" (" + album.PicturesCount + ")");
 
-					Gtk.MenuItem item = new Gtk.MenuItem (label_builder.ToString ());
-					((Gtk.Label)item.Child).UseUnderline = false;
-					menu.Append (item);
+                    album_optionmenu.AppendText(label_builder.ToString());
 				}
 
 				export_button.Sensitive = items.Length > 0;
 				album_optionmenu.Sensitive = true;
 				album_button.Sensitive = true;
 			}
-
-			menu.ShowAll ();
-			album_optionmenu.Menu = menu;
 		}
 
 		public void HandleAlbumOptionMenuChanged (object sender, System.EventArgs args)
@@ -465,7 +464,7 @@ namespace FSpot.Exporters.PicasaWeb {
 			if (albums == null || albums.Count == 0)
 				return;
 
-			PicasaAlbum a = albums [album_optionmenu.History];
+			PicasaAlbum a = albums [album_optionmenu.Active];
 			export_button.Sensitive = a.PicturesRemaining >= items.Length;
 			if (album_status_label.Visible = !export_button.Sensitive) {
 				StringBuilder sb = new StringBuilder("<small>");
diff --git a/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugExport.cs b/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugExport.cs
index 271f1fa..eb95c90 100644
--- a/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugExport.cs
+++ b/src/Extensions/Exporters/FSpot.Exporters.SmugMug/FSpot.Exporters.SmugMug/SmugMugExport.cs
@@ -67,8 +67,8 @@ namespace FSpot.Exporters.SmugMug {
 			builder = new GtkBeans.Builder (null, "smugmug_export_dialog.ui", null);
 			builder.Autoconnect (this);
 
-            gallery_optionmenu = new Gtk.OptionMenu ();
-            album_optionmenu = new Gtk.OptionMenu ();
+            gallery_optionmenu = Gtk.ComboBox.NewText();
+            album_optionmenu = Gtk.ComboBox.NewText();
 
             (edit_button.Parent as Gtk.HBox).PackStart (gallery_optionmenu);
             (album_button.Parent as Gtk.HBox).PackStart (album_optionmenu);
@@ -130,8 +130,8 @@ namespace FSpot.Exporters.SmugMug {
 
 		// Widgets
 		[GtkBeans.Builder.Object] Gtk.Dialog dialog;
-		Gtk.OptionMenu gallery_optionmenu;
-		Gtk.OptionMenu album_optionmenu;
+		Gtk.ComboBox gallery_optionmenu;
+		Gtk.ComboBox album_optionmenu;
 
 		[GtkBeans.Builder.Object] Gtk.CheckButton browser_check;
 		[GtkBeans.Builder.Object] Gtk.CheckButton scale_check;
@@ -168,7 +168,7 @@ namespace FSpot.Exporters.SmugMug {
 			browser = browser_check.Active;
 
 			if (account != null) {
-				album = (Album) account.SmugMug.GetAlbums() [Math.Max (0, album_optionmenu.History)];
+				album = (Album) account.SmugMug.GetAlbums() [Math.Max (0, album_optionmenu.Active)];
 				photo_index = 0;
 
 				Dialog.Destroy ();
@@ -267,14 +267,13 @@ namespace FSpot.Exporters.SmugMug {
 
 		private void PopulateSmugMugOptionMenu (SmugMugAccountManager manager, SmugMugAccount changed_account)
 		{
-			Gtk.Menu menu = new Gtk.Menu ();
 			this.account = changed_account;
-			int pos = -1;
+			int pos = 0;
 
 			accounts = manager.GetAccounts ();
 			if (accounts == null || accounts.Count == 0) {
-				Gtk.MenuItem item = new Gtk.MenuItem (Mono.Unix.Catalog.GetString ("(No Gallery)"));
-				menu.Append (item);
+                gallery_optionmenu.AppendText (Mono.Unix.Catalog.GetString ("(No Gallery)"));
+
 				gallery_optionmenu.Sensitive = false;
 				edit_button.Sensitive = false;
 			} else {
@@ -283,17 +282,15 @@ namespace FSpot.Exporters.SmugMug {
 					if (account == changed_account)
 						pos = i;
 
-					Gtk.MenuItem item = new Gtk.MenuItem (account.Username);
-					menu.Append (item);
+                    gallery_optionmenu.AppendText(account.Username);
+
 					i++;
 				}
 				gallery_optionmenu.Sensitive = true;
 				edit_button.Sensitive = true;
 			}
 
-			menu.ShowAll ();
-			gallery_optionmenu.Menu = menu;
-			gallery_optionmenu.SetHistory ((uint)pos);
+            gallery_optionmenu.Active = pos;
 		}
 
 		private void Connect ()
@@ -311,7 +308,7 @@ namespace FSpot.Exporters.SmugMug {
 			try {
 				if (accounts.Count != 0 && connect) {
 					if (selected == null)
-						account = (SmugMugAccount) accounts [gallery_optionmenu.History];
+						account = (SmugMugAccount) accounts [gallery_optionmenu.Active];
 					else
 						account = selected;
 
@@ -339,14 +336,14 @@ namespace FSpot.Exporters.SmugMug {
 		}
 
 		public void HandleAlbumAdded (string title) {
-			SmugMugAccount account = (SmugMugAccount) accounts [gallery_optionmenu.History];
+			SmugMugAccount account = (SmugMugAccount) accounts [gallery_optionmenu.Active];
 			PopulateAlbumOptionMenu (account.SmugMug);
 
 			// make the newly created album selected
 			Album[] albums = account.SmugMug.GetAlbums();
 			for (int i=0; i < albums.Length; i++) {
 				if (((Album)albums[i]).Title == title) {
-					album_optionmenu.SetHistory((uint)i);
+                    album_optionmenu.Active = 1;
 				}
 			}
 		}
@@ -363,16 +360,13 @@ namespace FSpot.Exporters.SmugMug {
 				}
 			}
 
-			Gtk.Menu menu = new Gtk.Menu ();
-
 			bool disconnected = smugmug == null || !account.Connected || albums == null;
 
 			if (disconnected || albums.Length == 0) {
 				string msg = disconnected ? Mono.Unix.Catalog.GetString ("(Not Connected)")
 					: Mono.Unix.Catalog.GetString ("(No Albums)");
 
-				Gtk.MenuItem item = new Gtk.MenuItem (msg);
-				menu.Append (item);
+                album_optionmenu.AppendText(msg);
 
 				export_button.Sensitive = false;
 				album_optionmenu.Sensitive = false;
@@ -383,9 +377,7 @@ namespace FSpot.Exporters.SmugMug {
 
 					label_builder.Append (album.Title);
 
-					Gtk.MenuItem item = new Gtk.MenuItem (label_builder.ToString ());
-					((Gtk.Label)item.Child).UseUnderline = false;
-					menu.Append (item);
+                    album_optionmenu.AppendText (label_builder.ToString());
 				}
 
 				export_button.Sensitive = items.Length > 0;
@@ -393,8 +385,7 @@ namespace FSpot.Exporters.SmugMug {
 				album_button.Sensitive = true;
 			}
 
-			menu.ShowAll ();
-			album_optionmenu.Menu = menu;
+			album_optionmenu.Active = 0;
 		}
 
 		public void HandleAddGallery (object sender, System.EventArgs args)



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