protected void HandleEditResponse(object sender, Gtk.ResponseArgs args) { if (args.ResponseId == Gtk.ResponseType.Ok) { account.Name = name; account.Url = url; account.Username = username; account.Password = password; GalleryAccountManager.GetInstance().MarkChanged(true, account); } else if (args.ResponseId == Gtk.ResponseType.Reject) { // NOTE we are using Reject to signal the remove action. GalleryAccountManager.GetInstance().RemoveAccount(account); } Dialog.Destroy(); }
public void Run(IBrowsableCollection selection) { this.items = selection.Items; album_button.Sensitive = false; IconView view = new IconView(selection); view.DisplayDates = false; view.DisplayTags = false; Dialog.Modal = false; Dialog.TransientFor = null; thumb_scrolledwindow.Add(view); view.Show(); Dialog.Show(); GalleryAccountManager manager = GalleryAccountManager.GetInstance(); manager.AccountListChanged += PopulateGalleryOptionMenu; PopulateGalleryOptionMenu(manager, null); if (edit_button != null) { edit_button.Clicked += HandleEditGallery; } Dialog.Response += HandleResponse; connect = true; HandleSizeActive(null, null); Connect(); LoadPreference(Preferences.EXPORT_GALLERY_SCALE); LoadPreference(Preferences.EXPORT_GALLERY_SIZE); LoadPreference(Preferences.EXPORT_GALLERY_BROWSER); LoadPreference(Preferences.EXPORT_GALLERY_META); LoadPreference(Preferences.EXPORT_GALLERY_ROTATE); }
protected void HandleAddResponse(object sender, Gtk.ResponseArgs args) { if (args.ResponseId == Gtk.ResponseType.Ok) { try { Uri uri = new Uri(url); if (uri.Scheme != Uri.UriSchemeHttp && uri.Scheme != Uri.UriSchemeHttps) { throw new System.UriFormatException(); } GalleryAccount created = new GalleryAccount(name, url, username, password); created.Connect(); GalleryAccountManager.GetInstance().AddAccount(created); account = created; } catch (System.UriFormatException) { HigMessageDialog md = new HigMessageDialog(Dialog, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Invalid URL"), Catalog.GetString("The gallery URL entry does not appear to be a valid URL")); md.Run(); md.Destroy(); return; } catch (GalleryRemote.GalleryException e) { HigMessageDialog md = new HigMessageDialog(Dialog, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Error while connecting to Gallery"), String.Format(Catalog.GetString("The following error was encountered while attempting to log in: {0}"), e.Message)); if (e.ResponseText != null) { System.Console.WriteLine(e.Message); System.Console.WriteLine(e.ResponseText); } md.Run(); md.Destroy(); return; } catch (System.Net.WebException we) { HigMessageDialog md = new HigMessageDialog(Dialog, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Error while connecting to Gallery"), String.Format(Catalog.GetString("The following error was encountered while attempting to log in: {0}"), we.Message)); md.Run(); md.Destroy(); return; } } Dialog.Destroy(); }