Ejemplo n.º 1
0
        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.Sensitive = false;
                edit_button.Sensitive        = false;
            }
            else
            {
                int i = 0;
                foreach (GalleryAccount account in accounts)
                {
                    if (account == changed_account)
                    {
                        pos = i;
                    }

                    Gtk.MenuItem item = new Gtk.MenuItem(account.Name);
                    menu.Append(item);
                    i++;
                }
                gallery_optionmenu.Sensitive = true;
                edit_button.Sensitive        = true;
            }

            menu.ShowAll();
            gallery_optionmenu.Menu = menu;
            gallery_optionmenu.SetHistory((uint)pos);
        }
		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.Sensitive = false;
				edit_button.Sensitive = false;
			} else {
				int i = 0;
				foreach (GalleryAccount account in accounts) {
					if (account == changed_account)
						pos = i;
					
					Gtk.MenuItem item = new Gtk.MenuItem (account.Name);
					menu.Append (item);		
					i++;
				}
				gallery_optionmenu.Sensitive = true;
				edit_button.Sensitive = true;
			}

			menu.ShowAll ();
			gallery_optionmenu.Menu = menu;
			gallery_optionmenu.SetHistory ((uint)pos);
		}