Beispiel #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);
        }
        public static GalleryAccountManager GetInstance()
        {
            if (instance == null) {
                instance = new GalleryAccountManager ();
            }

            return instance;
        }
        private void PopulateGalleryOptionMenu(GalleryAccountManager manager, GalleryAccount changed_account)
        {
            this.account = changed_account;
            int pos = -1;

            accounts = manager.GetAccounts ();
            if (accounts == null || accounts.Count == 0) {
                gallery_optionmenu.AppendText(Catalog.GetString("(No Gallery)"));

                gallery_optionmenu.Sensitive = false;
                edit_button.Sensitive = false;
            } else {
                int i = 0;
                foreach (GalleryAccount account in accounts) {
                    if (account == changed_account)
                        pos = i;

                    gallery_optionmenu.AppendText(account.Name);
                    i++;
                }
                gallery_optionmenu.Sensitive = true;
                edit_button.Sensitive = true;
            }

            gallery_optionmenu.Active = pos;
        }