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



commit fbc3849782d5edde8f86da8ccd4b76f560247649
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 3068623..4408a88 100644
--- a/src/Clients/MainApp/FSpot.UI.Dialog/EditTagDialog.cs
+++ b/src/Clients/MainApp/FSpot.UI.Dialog/EditTagDialog.cs
@@ -28,8 +28,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")
 		{
@@ -60,7 +59,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;
@@ -140,7 +139,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)
@@ -148,14 +158,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 eb4cb3e..ccf5e27 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
@@ -21,7 +21,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;
@@ -43,7 +43,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 ();
 
@@ -75,34 +75,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 fa3bff0..9a64e1c 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
@@ -29,12 +29,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 ();
@@ -94,8 +94,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;
@@ -131,7 +131,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 ();
@@ -221,14 +221,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 {
@@ -237,17 +236,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 ()
@@ -260,7 +256,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;
 
@@ -288,14 +284,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;
 				}
 			}
 		}
@@ -314,16 +310,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;
@@ -340,23 +333,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 e30c26b..36faabc 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
@@ -39,8 +39,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);
@@ -111,8 +111,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;
@@ -149,7 +149,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 ();
@@ -270,33 +270,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 ()
@@ -314,7 +321,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;
 
@@ -369,14 +376,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;
 				}
 			}
 		}
@@ -393,16 +400,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;
@@ -417,18 +421,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)
@@ -436,7 +435,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 f568d43..9b9fd17 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
@@ -38,8 +38,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);
@@ -101,8 +101,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;
@@ -139,7 +139,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 ();
@@ -238,14 +238,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 {
@@ -254,17 +253,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 ()
@@ -282,7 +279,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;
 
@@ -310,14 +307,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;
 				}
 			}
 		}
@@ -334,16 +331,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;
@@ -354,9 +348,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;
@@ -364,8 +356,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]