private void PopulateSmugMugOptionMenu(SmugMugAccountManager manager, SmugMugAccount changed_account) { this.account = changed_account; int pos = 0; accounts = manager.GetAccounts(); if (accounts == null || accounts.Count == 0) { gallery_optionmenu.AppendText(Mono.Unix.Catalog.GetString("(No Gallery)")); gallery_optionmenu.Sensitive = false; edit_button.Sensitive = false; } else { int i = 0; foreach (SmugMugAccount account in accounts) { if (account == changed_account) { pos = i; } gallery_optionmenu.AppendText(account.Username); i++; } gallery_optionmenu.Sensitive = true; edit_button.Sensitive = true; } gallery_optionmenu.Active = pos; }
public static SmugMugAccountManager GetInstance() { if (instance == null) { instance = new SmugMugAccountManager (); } return instance; }
public static SmugMugAccountManager GetInstance() { if (instance == null) { instance = new SmugMugAccountManager(); } return(instance); }
protected void HandleAddResponse(object sender, Gtk.ResponseArgs args) { if (args.ResponseId == Gtk.ResponseType.Ok) { SmugMugAccount account = new SmugMugAccount(username, password); SmugMugAccountManager.GetInstance().AddAccount(account); } Dialog.Destroy(); }
public void Run(IBrowsableCollection selection) { builder = new GtkBeans.Builder(null, "smugmug_export_dialog.ui", null); builder.Autoconnect(this); 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); (edit_button.Parent as Gtk.HBox).ReorderChild(gallery_optionmenu, 1); (album_button.Parent as Gtk.HBox).ReorderChild(album_optionmenu, 1); gallery_optionmenu.Show(); album_optionmenu.Show(); this.items = selection.Items; album_button.Sensitive = false; var view = new TrayView(selection); view.DisplayDates = false; view.DisplayTags = false; Dialog.Modal = false; Dialog.TransientFor = null; Dialog.Close += HandleCloseEvent; thumb_scrolledwindow.Add(view); view.Show(); Dialog.Show(); SmugMugAccountManager manager = SmugMugAccountManager.GetInstance(); manager.AccountListChanged += PopulateSmugMugOptionMenu; PopulateSmugMugOptionMenu(manager, null); if (edit_button != null) { edit_button.Clicked += HandleEditGallery; } Dialog.Response += HandleResponse; connect = true; HandleSizeActive(null, null); Connect(); LoadPreference(SCALE_KEY); LoadPreference(SIZE_KEY); LoadPreference(BROWSER_KEY); }
protected void HandleEditResponse(object sender, Gtk.ResponseArgs args) { if (args.ResponseId == Gtk.ResponseType.Ok) { account.Username = username; account.Password = password; SmugMugAccountManager.GetInstance().MarkChanged(true, account); } else if (args.ResponseId == Gtk.ResponseType.Reject) { // NOTE we are using Reject to signal the remove action. SmugMugAccountManager.GetInstance().RemoveAccount(account); } Dialog.Destroy(); }