public static GoogleAccountManager GetInstance() { if (instance == null) { instance = new GoogleAccountManager (); } return instance; }
protected void HandleAddResponse(object sender, Gtk.ResponseArgs args) { if (args.ResponseId == Gtk.ResponseType.Ok) { GoogleAccount account = new GoogleAccount(username, password); GoogleAccountManager.GetInstance().AddAccount(account); } Dialog.Destroy(); }
public static GoogleAccountManager GetInstance() { if (instance == null) { instance = new GoogleAccountManager(); } return(instance); }
public void Run(IBrowsableCollection selection) { builder = new GtkBeans.Builder(null, "google_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; thumb_scrolledwindow.Add(view); view.Show(); Dialog.Show(); GoogleAccountManager manager = GoogleAccountManager.GetInstance(); manager.AccountListChanged += PopulateGoogleOptionMenu; PopulateGoogleOptionMenu(manager, null); album_optionmenu.Changed += HandleAlbumOptionMenuChanged; 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); LoadPreference(TAG_KEY); }
protected void HandleEditResponse(object sender, Gtk.ResponseArgs args) { if (args.ResponseId == Gtk.ResponseType.Ok) { account.Username = username; account.Password = password; account.Token = token; account.UnlockCaptcha = captcha_entry.Text; GoogleAccountManager.GetInstance().MarkChanged(true, account); } else if (args.ResponseId == Gtk.ResponseType.Reject) { // NOTE we are using Reject to signal the remove action. GoogleAccountManager.GetInstance().RemoveAccount(account); } Dialog.Destroy(); }
private void PopulateGoogleOptionMenu(GoogleAccountManager manager, GoogleAccount changed_account) { this.account = changed_account; int pos = -1; accounts = manager.GetAccounts(); if (accounts == null || accounts.Count == 0) { 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; } gallery_optionmenu.AppendText(account.Username); i++; } gallery_optionmenu.Sensitive = true; edit_button.Sensitive = true; } Log.DebugFormat("Setting gallery_optionmenu.Active = {0}", pos); gallery_optionmenu.Active = pos; }