void Apply(Editor editor) { if (!SetupEditor(editor)) { return; } if (!editor.CanBeApplied) { string msg = Strings.NoSelectionAvailable; string desc = Strings.ThisToolRequiresAnActiveSelection; var md = new HigMessageDialog(App.Instance.Organizer.Window, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run(); md.Destroy(); return; } // TODO: Might need to do some nicer things for multiple selections (progress?) try { editor.Apply(); } catch (Exception e) { Log.DebugException(e); string msg = Catalog.GetPluralString(Strings.ErrorSavingAdjustedPhoto, Strings.ErrorSavingAdjustedPhotos, editor.State.Items.Length); string desc = Strings.ReceivedExceptionExNoteThatYouHaveToDevelopRawFilesInto(e.Message); var md = new HigMessageDialog(App.Instance.Organizer.Window, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, msg, desc); md.Run(); md.Destroy(); } ShowTools(); }
void Login() { try { fr = new FlickrRemote(token, current_service); fr.TryWebLogin(); CurrentState = State.Connected; } catch (Exception e) { if (e is FlickrApiException && (e as FlickrApiException).Code == 98) { Logout(); Login(); } else { var md = new HigMessageDialog(Dialog, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Unable to log on"), e.Message); md.Run(); md.Destroy(); CurrentState = State.Disconnected; } } }
public static bool ConfirmRemove(string header) { string message = Catalog.GetString("Are you sure you want to continue?"); bool remove_tracks = false; ThreadAssist.BlockingProxyToMain(() => { var md = new HigMessageDialog( ServiceManager.Get <GtkElementsService> ().PrimaryWindow, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.None, header, message ); md.AddButton("gtk-cancel", ResponseType.No, true); md.AddButton(Catalog.GetString("Remove tracks"), ResponseType.Yes, false); try { if (md.Run() == (int)ResponseType.Yes) { remove_tracks = true; } } finally { md.Destroy(); } }); return(remove_tracks); }
private void HandleOkClicked (object sender, EventArgs args) { Photo photo = view.Item.Current as Photo; if (photo == null) return; try { Gdk.Pixbuf orig = view.Pixbuf; Gdk.Pixbuf final = PixbufUtils.UnsharpMask (orig, radius_spin.Value, amount_spin.Value, threshold_spin.Value); bool create_version = photo.DefaultVersionId == Photo.OriginalVersionId; photo.SaveVersion (final, create_version); } catch (System.Exception e) { string msg = Catalog.GetString ("Error saving sharpened photo"); string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to save photo {1}"), e.Message, photo.Name); HigMessageDialog md = new HigMessageDialog (this, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run (); md.Destroy (); } Destroy (); }
private void HandleOkClicked(object sender, EventArgs args) { Photo photo = view.Item.Current as Photo; if (photo == null) { return; } try { Gdk.Pixbuf orig = view.Pixbuf; Gdk.Pixbuf final = PixbufUtils.UnsharpMask(orig, radius_spin.Value, amount_spin.Value, threshold_spin.Value); bool create_version = photo.DefaultVersion.IsProtected; photo.SaveVersion(final, create_version); } catch (System.Exception e) { string msg = Catalog.GetString("Error saving sharpened photo"); string desc = String.Format(Catalog.GetString("Received exception \"{0}\". Unable to save photo {1}"), e.Message, photo.Name); HigMessageDialog md = new HigMessageDialog(this, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run(); md.Destroy(); } Destroy(); }
internal static bool ConfirmUserAction(int tracks_to_remove) { string header = String.Format( Catalog.GetPluralString( // singular form unused b/c we know it's > 1, but we still need GetPlural "The sync operation will remove one track from your device.", "The sync operation will remove {0} tracks from your device.", tracks_to_remove), tracks_to_remove); string message = Catalog.GetString("Are you sure you want to continue?"); var md = new HigMessageDialog( ServiceManager.Get <GtkElementsService> ().PrimaryWindow, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.None, header, message ); md.AddButton("gtk-cancel", ResponseType.No, true); md.AddButton(Catalog.GetString("Remove tracks"), ResponseType.Yes, false); bool remove_tracks = false; ThreadAssist.BlockingProxyToMain(() => { try { if (md.Run() == (int)ResponseType.Yes) { remove_tracks = true; } } finally { md.Destroy(); } }); return(remove_tracks); }
protected void HandleAddResponse(object sender, Gtk.ResponseArgs args) { if (args.ResponseId == Gtk.ResponseType.Ok) { public_album = public_check.Active; try { if (public_album) { picasa.CreateAlbum(title, description, AlbumAccess.Public); } else { picasa.CreateAlbum(title, description, AlbumAccess.Private); } } catch (System.Exception e) { HigMessageDialog md = new HigMessageDialog(Dialog, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Error while creating Album"), String.Format(Catalog.GetString("The following error was encountered while attempting to create an album: {0}"), e.Message)); md.Run(); md.Destroy(); return; } export.HandleAlbumAdded(title); } Dialog.Destroy(); }
public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window) { VersionNameRequest request = new VersionNameRequest(VersionNameRequest.RequestType.Create, photo, parent_window); string name; ResponseType response = request.Run(out name); if (response != ResponseType.Ok) { return(false); } try { photo.DefaultVersionId = photo.CreateVersion(name, photo.DefaultVersionId, true); store.Commit(photo); } catch (Exception e) { string msg = Catalog.GetString("Could not create a new version"); string desc = String.Format(Catalog.GetString("Received exception \"{0}\". Unable to create version \"{1}\""), e.Message, name); HigMessageDialog md = new HigMessageDialog(parent_window, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run(); md.Destroy(); return(false); } return(true); }
public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window) { VersionNameRequest request = new VersionNameRequest (VersionNameRequest.RequestType.Create, photo, parent_window); string name; ResponseType response = request.Run (out name); if (response != ResponseType.Ok) return false; try { photo.DefaultVersionId = photo.CreateVersion (name, photo.DefaultVersionId, true); store.Commit (photo); } catch (Exception e) { string msg = Catalog.GetString ("Could not create a new version"); string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to create version \"{1}\""), e.Message, name); HigMessageDialog md = new HigMessageDialog (parent_window, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run (); md.Destroy (); return false; } return true; }
protected void HandleAddResponse(object sender, Gtk.ResponseArgs args) { if (args.ResponseId == Gtk.ResponseType.Ok) { if (!System.Text.RegularExpressions.Regex.IsMatch(name, "^[A-Za-z0-9_-]+$")) { HigMessageDialog md = new HigMessageDialog(add_album_dialog, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Invalid Gallery name"), Catalog.GetString("The gallery name contains invalid characters.\nOnly letters, numbers, - and _ are allowed")); md.Run(); md.Destroy(); return; } try { gallery.NewAlbum(parent, name, title, description); export.HandleAlbumAdded(title); } catch (GalleryCommandException e) { gallery.PopupException(e, add_album_dialog); return; } } add_album_dialog.Destroy(); }
void HandleFileSet(object o, EventArgs e) { try { string tempfilename = System.IO.Path.GetTempFileName(); System.IO.File.Copy(mdd.FileChooser.Filename, tempfilename, true); from_db.Init(tempfilename, true); FillRolls(); mdd.Rolls = new_rolls; mdd.SetSensitive(); } catch (Exception ex) { string msg = Catalog.GetString("Error opening the selected file"); string desc = String.Format(Catalog.GetString("The file you selected is not a valid or supported database.\n\nReceived exception \"{0}\"."), ex.Message); HigMessageDialog md = new HigMessageDialog(mdd.Dialog, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run(); md.Destroy(); Log.Exception(ex); } }
private void HandleResponse(object sender, Gtk.ResponseArgs args) { if (args.ResponseId != Gtk.ResponseType.Ok) { if (command_thread != null && command_thread.IsAlive) { command_thread.Abort(); } Dialog.Destroy(); return; } if (fr.CheckLogin() == null) { do_export_flickr.Sensitive = false; HigMessageDialog md = new HigMessageDialog(Dialog, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Unable to log on."), string.Format(Catalog.GetString("F-Spot was unable to log on to {0}. Make sure you have given the authentication using {0} web browser interface."), current_service.Name)); md.Run(); md.Destroy(); return; } fr.ExportTags = tag_check.Active; open = open_check.Active; scale = scale_check.Active; copy_metadata = !meta_check.Active; is_public = public_radio.Active; is_family = family_check.Active; is_friend = friend_check.Active; if (scale) { size = size_spin.ValueAsInt; } command_thread = new Thread(new ThreadStart(Upload)); command_thread.Name = Catalog.GetString("Uploading Pictures"); Dialog.Destroy(); progress_dialog = new FSpot.ThreadProgressDialog(command_thread, selection.Count); progress_dialog.Start(); // Save these settings for next time Preferences.Set(Preferences.EXPORT_FLICKR_SCALE, scale); Preferences.Set(Preferences.EXPORT_FLICKR_SIZE, size); Preferences.Set(Preferences.EXPORT_FLICKR_BROWSER, open); Preferences.Set(Preferences.EXPORT_FLICKR_TAGS, tag_check.Active); Preferences.Set(Preferences.EXPORT_FLICKR_STRIP_META, meta_check.Active); Preferences.Set(Preferences.EXPORT_FLICKR_PUBLIC, public_radio.Active); Preferences.Set(Preferences.EXPORT_FLICKR_FAMILY, family_check.Active); Preferences.Set(Preferences.EXPORT_FLICKR_FRIENDS, friend_check.Active); Preferences.Set(current_service.PreferencePath, fr.Token); }
private void InfoDialog(string title, string msg, Gtk.MessageType type) { HigMessageDialog md = new HigMessageDialog(App.Instance.Organizer.Window, DialogFlags.DestroyWithParent, type, ButtonsType.Ok, title, msg); md.Run(); md.Destroy(); }
private static void HandleException(string msg, Exception e, Gtk.Window parent_window) { Log.DebugException (e); msg = Catalog.GetString (msg); string desc = String.Format (Catalog.GetString ("Received exception \"{0}\"."), e.Message); HigMessageDialog md = new HigMessageDialog (parent_window, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run (); md.Destroy (); }
void RunGenericError(Exception e, string path, string msg) { string longmsg = Strings.ReceivedErrorXWhileAttemptingToRotateY(msg, Path.GetFileName(path)); var md = new HigMessageDialog(parentWindow, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.Ok, Strings.ErrorWhileRotatingPhoto, longmsg); md.Run(); md.Destroy(); }
static void HandleException(string msg, Exception e, Gtk.Window parent_window) { Log.DebugException(e); msg = Catalog.GetString(msg); string desc = Strings.ReceivedExceptionX(e.Message); var md = new HigMessageDialog(parent_window, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run(); md.Destroy(); }
private static bool ConfirmRemove(ITrackModelSource source, bool delete, int selCount) { if (!source.ConfirmRemoveTracks) { return(true); } bool ret = false; string header = null; string message = null; string button_label = null; if (delete) { header = String.Format( Catalog.GetPluralString( "Are you sure you want to permanently delete this item?", "Are you sure you want to permanently delete the selected {0} items?", selCount ), selCount ); message = Catalog.GetString("If you delete the selection, it will be permanently lost."); button_label = "gtk-delete"; } else { header = String.Format(Catalog.GetString("Remove selection from {0}?"), source.Name); message = String.Format( Catalog.GetPluralString( "Are you sure you want to remove the selected item from your {1}?", "Are you sure you want to remove the selected {0} items from your {1}?", selCount ), selCount, source.GenericName ); button_label = "gtk-remove"; } HigMessageDialog md = new HigMessageDialog( ServiceManager.Get <GtkElementsService> ().PrimaryWindow, DialogFlags.DestroyWithParent, delete ? MessageType.Warning : MessageType.Question, ButtonsType.None, header, message ); // Delete from Disk defaults to Cancel and the others to OK/Confirm. md.AddButton("gtk-cancel", ResponseType.No, delete); md.AddButton(button_label, ResponseType.Yes, !delete); try { if (md.Run() == (int)ResponseType.Yes) { ret = true; } } finally { md.Destroy(); } return(ret); }
void RunReadonlyError(int readonly_count) { string notice = Catalog.GetPluralString(Strings.UnableToRotatePhoto, Strings.UnableToRotateXPhotos(readonly_count), readonly_count); string desc = Catalog.GetPluralString(Strings.ThePhotoCouldNotBeRotatedBecauseItIsOnAReadonlyFileSystemOrMedia, Strings.XPhotosCouldNotBeRotatedBecauseItIsOnAReadonlyFileSystemOrMedia(readonly_count), readonly_count); var md = new HigMessageDialog(parentWindow, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, notice, desc); md.Run(); md.Destroy(); }
private static void HandleException(string msg, Exception e, Gtk.Window parent_window) { Log.DebugException(e); msg = Catalog.GetString(msg); string desc = String.Format(Catalog.GetString("Received exception \"{0}\"."), e.Message); HigMessageDialog md = new HigMessageDialog(parent_window, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run(); md.Destroy(); }
public void EasterEgg(object o, EventArgs ev) { HigMessageDialog dialog = new HigMessageDialog(this, DialogFlags.Modal | DialogFlags.NoSeparator, MessageType.Warning, ButtonsType.None, "Error 1337", "HIGcat is not amused."); dialog.AddButton("Lettuce", ResponseType.Close); dialog.AddButton("Tomato", ResponseType.Close); dialog.AddButton("Cheezburger", ResponseType.Close); dialog.Run(); dialog.Destroy(); }
public void HandleLoginClicked(object sender, EventArgs args) { account = new FacebookAccount(); Uri token = account.CreateToken(); GnomeUtil.UrlShow(token.ToString()); HigMessageDialog mbox = new HigMessageDialog(Dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, Catalog.GetString("Waiting for authentication"), Catalog.GetString("F-Spot will now launch your browser so that you can log into Facebook. Turn on the \"Save my login information\" checkbox on Facebook and F-Spot will log into Facebook automatically from now on.")); mbox.Run(); mbox.Destroy(); if (account.Authenticated == false) { HigMessageDialog error = new HigMessageDialog(Dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Error logging into Facebook"), Catalog.GetString("There was a problem logging into Facebook. Check your credentials and try again.")); error.Run(); error.Destroy(); } else { login_button.Visible = false; logout_button.Visible = true; album_info_vbox.Sensitive = true; picture_info_vbox.Sensitive = true; User me = account.Facebook.GetLoggedInUser().GetUserInfo(); // Note for translators: {0} and {1} are respectively firstname and surname of the user whoami_label.Text = String.Format(Catalog.GetString("{0} {1} is logged into Facebook"), me.FirstName, me.LastName); Friend[] friend_list = account.Facebook.GetFriends(); long[] uids = new long [friend_list.Length]; for (int i = 0; i < friend_list.Length; i++) { uids [i] = friend_list [i].UId; } User[] infos = account.Facebook.GetUserInfo(uids, new string[] { "first_name", "last_name" }); friends = new Dictionary <long, User> (); foreach (User user in infos) { friends.Add(user.UId, user); } Album[] albums = account.Facebook.GetAlbums(); AlbumStore store = new AlbumStore(albums); existing_album_combobox.Model = store; existing_album_combobox.Active = 0; } }
private void RunGenericError(System.Exception e, string path, string msg) { string longmsg = String.Format(Catalog.GetString("Received error \"{0}\" while attempting to rotate {1}"), msg, System.IO.Path.GetFileName(path)); HigMessageDialog md = new HigMessageDialog(parent_window, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.Ok, Catalog.GetString("Error while rotating photo."), longmsg); md.Run(); md.Destroy(); }
public void PopupException(GalleryCommandException e, Gtk.Dialog d) { Log.DebugFormat("{0} : {1} ({2})", e.Message, e.ResponseText, e.Status); HigMessageDialog md = new HigMessageDialog(d, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Error while creating new album"), String.Format(Catalog.GetString("The following error was encountered while attempting to perform the requested operation:\n{0} ({1})"), e.Message, e.Status)); md.Run(); md.Destroy(); }
private void ShowError(System.Exception e, Photo photo) { string msg = Catalog.GetString("Error editing photo"); string desc = String.Format(Catalog.GetString("Received exception \"{0}\". Unable to save photo {1}"), e.Message, photo.Name); HigMessageDialog md = new HigMessageDialog((Gtk.Window) this.Toplevel, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run(); md.Destroy(); }
public void Run(IBrowsableCollection selection) { CreateDialog(); items = selection.Items; if (items.Length > 60) { HigMessageDialog mbox = new HigMessageDialog(Dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Too many images to export"), Catalog.GetString("Facebook only permits 60 photographs per album. Please refine your selection and try again.")); mbox.Run(); mbox.Destroy(); return; } captions = new string [items.Length]; tags = new List <Mono.Facebook.Tag> [items.Length]; thumbnail_iconview = new FSpot.Widgets.IconView(selection); thumbnail_iconview.DisplayDates = false; thumbnail_iconview.DisplayTags = false; thumbnail_iconview.ButtonPressEvent += HandleThumbnailIconViewButtonPressEvent; thumbnail_iconview.KeyPressEvent += HandleThumbnailIconViewKeyPressEvent; thumbnail_iconview.Show(); thumbnails_scrolled_window.Add(thumbnail_iconview); login_button.Visible = true; login_button.Clicked += HandleLoginClicked; logout_button.Visible = false; logout_button.Clicked += HandleLogoutClicked; whoami_label.Text = Catalog.GetString("You are not logged in."); album_info_vbox.Sensitive = false; picture_info_vbox.Sensitive = false; create_album_radiobutton.Toggled += HandleCreateAlbumToggled; create_album_radiobutton.Active = true; existing_album_radiobutton.Toggled += HandleExistingAlbumToggled; CellRendererText cell = new CellRendererText(); existing_album_combobox.PackStart(cell, false); tag_image_eventbox.ButtonPressEvent += HandleTagImageButtonPressEvent; Dialog.Response += HandleResponse; Dialog.Show(); }
private void OnRebuildDatabase(object o, EventArgs args) { string title = Catalog.GetString("Confirm Rebuild iPod Database"); HigMessageDialog md = new HigMessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.Cancel, title, Catalog.GetString( "Rebuilding your iPod database may take some time. Also note that " + "any playlists you have on your iPod will be lost.\n\n" + "Are you sure you want to rebuild your iPod database?")); md.Title = title; md.AddButton(Catalog.GetString("Rebuild Database"), Gtk.ResponseType.Yes, true); if (md.Run() != (int)ResponseType.Yes) { md.Destroy(); return; } md.Destroy(); pane.HeaderIcon = null; pane.HeaderMarkup = null; pane.Clear(); pane.Append(String.Format("<big><b>{0}</b></big>", GLib.Markup.EscapeText(Catalog.GetString("Rebuilding iPod Database..."))), true, LargeIcon); DatabaseRebuilder rebuilder = new DatabaseRebuilder(source); rebuilder.Finished += delegate { OnRefresh(); }; }
//Run and destroy a standard confirmation dialog public static Gtk.ResponseType RunHigConfirmation(Gtk.Window parent, Gtk.DialogFlags flags, Gtk.MessageType type, string header, string msg, string ok_caption) { var hmd = new HigMessageDialog(parent, flags, type, header, msg, ok_caption); try { return((Gtk.ResponseType)hmd.Run()); } finally { hmd.Destroy(); } }
//run and destroy a standard dialog public static Gtk.ResponseType RunHigMessageDialog(Gtk.Window parent, Gtk.DialogFlags flags, Gtk.MessageType type, Gtk.ButtonsType buttons, string header, string msg) { var hmd = new HigMessageDialog(parent, flags, type, buttons, header, msg); try { return((Gtk.ResponseType)hmd.Run()); } finally { hmd.Destroy(); } }
private void Help(object obj, EventArgs args) { string address = "http://www.beagle-project.org/Getting_Started"; try { Gnome.Url.Show(address); } catch { HigMessageDialog md = new HigMessageDialog(search, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Close, Catalog.GetString("Couldn't launch web browser"), Catalog.GetString(String.Format("Please point your web browser to '{0}' manually", address))); md.Run(); md.Destroy(); } }
public void doSharpening() { progressDialog.Fraction = 0.0; // FIXME: This should probably be translated progressDialog.Message = "Photo is being sharpened"; okClicked = true; Photo photo = view.Item.Current as Photo; if (photo == null) { return; } try { Gdk.Pixbuf orig = view.Pixbuf; Gdk.Pixbuf final = PixbufUtils.UnsharpMask(orig, radius_spin.Value, amount_spin.Value, threshold_spin.Value, progressDialog); bool create_version = photo.DefaultVersion.IsProtected; photo.SaveVersion(final, create_version); photo.Changes.DataChanged = true; App.Instance.Database.Photos.Commit(photo); } catch (System.Exception e) { string msg = Catalog.GetString("Error saving sharpened photo"); string desc = String.Format(Catalog.GetString("Received exception \"{0}\". Unable to save photo {1}"), e.Message, photo.Name); HigMessageDialog md = new HigMessageDialog(this, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run(); md.Destroy(); } progressDialog.Fraction = 1.0; // FIXME: This should probably be translated progressDialog.Message = "Sharpening complete!"; progressDialog.ButtonLabel = Gtk.Stock.Ok; Destroy(); }
public void Show() { try { Gnome.Url.Show(url); } catch (Exception ge) { System.Console.WriteLine(ge.ToString()); HigMessageDialog md = new HigMessageDialog(window, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Mono.Unix.Catalog.GetString("There was an error invoking the external handler"), String.Format(Mono.Unix.Catalog.GetString("Received error:{1}\"{0}\"{1}"), ge.Message, Environment.NewLine)); md.Run(); md.Destroy(); } }
public bool Execute(PhotoStore store, Photo photo, Gtk.Window parent_window) { // FIXME HIG-ify. Dialog dialog = new Dialog(); dialog.BorderWidth = 6; dialog.TransientFor = parent_window; dialog.HasSeparator = false; dialog.Title = Catalog.GetString("Really Delete?"); dialog.AddButton(Catalog.GetString("Cancel"), (int)ResponseType.Cancel); dialog.AddButton(Catalog.GetString("Delete"), (int)ResponseType.Ok); dialog.DefaultResponse = ResponseType.Ok; string version_name = photo.GetVersionName(photo.DefaultVersionId); Label label = new Label(String.Format(Catalog.GetString("Really delete version \"{0}\"?"), version_name)); label.Show(); dialog.VBox.PackStart(label, false, true, 6);; if (dialog.Run() == (int)ResponseType.Ok) { try { photo.DeleteVersion(photo.DefaultVersionId); store.Commit(photo); } catch (Exception e) { // FIXME show error dialog. string msg = Catalog.GetString("Could not delete a version"); string desc = String.Format(Catalog.GetString("Received exception \"{0}\". Unable to delete version \"{1}\""), e.Message, photo.Name); HigMessageDialog md = new HigMessageDialog(parent_window, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run(); md.Destroy(); dialog.Destroy(); // Delete confirmation window. return(false); } dialog.Destroy(); return(true); } dialog.Destroy(); return(false); }
void ShowTranslationWarning() { HigMessageDialog dlg; dlg = new HigMessageDialog(app_window, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Warning, Gtk.ButtonsType.Ok, Translations.GetString("The level of translation of gbrainy for your language is low."), Translations.GetString("You may be exposed to partially translated games making it more difficult to play. If you prefer to play in English, there is an option for doing so in gbrainy's Preferences.")); try { dlg.Run(); } finally { dlg.Destroy(); } }
public void Run(IBrowsableCollection p) { Log.Information ("Executing ZipExport extension"); if (p.Count == 0) { HigMessageDialog md = new HigMessageDialog (App.Instance.Organizer.Window, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, Catalog.GetString ("No selection available"), Catalog.GetString ("This tool requires an active selection. Please select one or more pictures and try again")); md.Run (); md.Destroy (); return; } photos = p.Items; ShowDialog (); }
public void Show () { try { Gnome.Url.Show (url); } catch (Exception ge) { System.Console.WriteLine (ge.ToString ()); HigMessageDialog md = new HigMessageDialog (window, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Mono.Unix.Catalog.GetString ("There was an error invoking the external handler"), String.Format (Mono.Unix.Catalog.GetString ("Received error:{1}\"{0}\"{1}"), ge.Message, Environment.NewLine)); md.Run (); md.Destroy (); } }
public override bool Step (out Photo photo, out Pixbuf thumbnail, out int count) { thumbnail = null; if (import_info == null) throw new ImportException ("Prepare() was not called"); if (this.count == import_info.Count) throw new ImportException ("Already finished"); // FIXME Need to get the EXIF info etc. ImportInfo info = (ImportInfo)import_info [this.count]; bool needs_commit = false; bool abort = false; try { string destination = info.OriginalPath; if (copy) destination = ChooseLocation (info.OriginalPath, directories); // Don't copy if we are already home if (info.OriginalPath == destination) { info.DestinationPath = destination; photo = store.Create (info.DestinationPath, roll.Id, out thumbnail); } else { System.IO.File.Copy (info.OriginalPath, destination); info.DestinationPath = destination; photo = store.Create (info.DestinationPath, info.OriginalPath, roll.Id, out thumbnail); try { File.SetAttributes (destination, File.GetAttributes (info.DestinationPath) & ~FileAttributes.ReadOnly); DateTime create = File.GetCreationTime (info.OriginalPath); File.SetCreationTime (info.DestinationPath, create); DateTime mod = File.GetLastWriteTime (info.OriginalPath); File.SetLastWriteTime (info.DestinationPath, mod); } catch (IOException) { // we don't want an exception here to be fatal. } } if (tags != null) { foreach (Tag t in tags) { photo.AddTag (t); } needs_commit = true; } needs_commit |= xmptags.Import (photo, info.DestinationPath, info.OriginalPath); if (needs_commit) store.Commit(photo); info.Photo = photo; } catch (System.Exception e) { System.Console.WriteLine ("Error importing {0}{2}{1}", info.OriginalPath, e.ToString (), Environment.NewLine); if (thumbnail != null) thumbnail.Dispose (); thumbnail = null; photo = null; HigMessageDialog errordialog = new HigMessageDialog (parent, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Cancel, Catalog.GetString ("Import error"), String.Format(Catalog.GetString ("Error importing {0}{2}{2}{1}"), info.OriginalPath, e.Message, Environment.NewLine )); errordialog.AddButton ("Skip", Gtk.ResponseType.Reject, false); ResponseType response = (ResponseType) errordialog.Run (); errordialog.Destroy (); if (response == ResponseType.Cancel) abort = true; } this.count ++; count = this.count; return (!abort && count != import_info.Count); }
public void HandleClear(object o, EventArgs ev) { if(!hasChanged) { handwriting.Clear(); return; } HigMessageDialog dialog = new HigMessageDialog(this, DialogFlags.Modal | DialogFlags.NoSeparator, MessageType.Warning, ButtonsType.None, "Would you like to save the current page before clearing?", "If you clear the page without saving, it will be permanently lost."); dialog.AddButton("Clear without Saving", ResponseType.Close); dialog.AddButton(Gtk.Stock.Cancel, ResponseType.Cancel); dialog.AddButton(Gtk.Stock.SaveAs, ResponseType.Yes); ResponseType response = (ResponseType)dialog.Run(); dialog.Destroy(); switch(response) { case ResponseType.Close: handwriting.Clear(); break; case ResponseType.Yes: if(DoSaveDialog()) handwriting.Clear(); break; } updateUndo(); }
public void PopupException(GalleryCommandException e, Gtk.Dialog d) { Log.DebugFormat ("{0} : {1} ({2})", e.Message, e.ResponseText, e.Status); HigMessageDialog md = new HigMessageDialog (d, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Error while creating new album"), String.Format (Catalog.GetString ("The following error was encountered while attempting to perform the requested operation:\n{0} ({1})"), e.Message, e.Status)); md.Run (); md.Destroy (); }
public bool GrantPermission(string permission, Window parent) { if (facebookSession.HasAppPermission(permission)) return true; Uri uri = facebookSession.GetGrantUri (permission); GtkBeans.Global.ShowUri (parent.Screen, uri.ToString ()); HigMessageDialog mbox = new HigMessageDialog (parent, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, Catalog.GetString ("Waiting for authorization"), Catalog.GetString ("F-Spot will now launch your browser so that you can enable the permission you just selected.\n\nOnce you are directed by Facebook to return to this application, click \"Ok\" below." )); mbox.Run (); mbox.Destroy (); return facebookSession.HasAppPermission(permission); }
public void Save () { if (!Changed) { this.Dialog.Destroy (); return; } if (!view.Item.IsValid) return; Console.WriteLine ("Saving...."); Photo photo = (Photo)view.Item.Current; try { bool create_version = photo.DefaultVersionId == Photo.OriginalVersionId; Gdk.Pixbuf orig = view.CompletePixbuf (); Gdk.Pixbuf final = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, false, 8, orig.Width, orig.Height); Cms.Profile abs = AdjustmentProfile (); // FIXME this shouldn't use the screen as the destination profile. Cms.Profile destination = Cms.Profile.GetScreenProfile (view.Screen); if (destination == null) destination = Cms.Profile.CreateStandardRgb (); Cms.Profile [] list = new Cms.Profile [] { image_profile, abs, destination }; Cms.Transform transform = new Cms.Transform (list, PixbufUtils.PixbufCmsFormat (orig), PixbufUtils.PixbufCmsFormat (final), Cms.Intent.Perceptual, 0x0000); PixbufUtils.ColorAdjust (orig, final, transform); photo.SaveVersion (final, create_version); ((PhotoQuery)view.Query).Commit (view.Item.Index); final.Dispose (); } catch (System.Exception e) { string msg = Catalog.GetString ("Error saving adjusted photo"); string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to save photo {1}"), e.Message, photo.Name); HigMessageDialog md = new HigMessageDialog ((Gtk.Window)Dialog.Toplevel, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run (); md.Destroy (); } this.Dialog.Sensitive = false; this.Dialog.Destroy (); }
void DoLogin () { if (!account.Authenticated) { HigMessageDialog error = new HigMessageDialog (this, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Error logging into Facebook"), Catalog.GetString ("There was a problem logging into Facebook. Check your credentials and try again.")); error.Run (); error.Destroy (); DoLogout (); } else { log_buttons_hbox.Sensitive = false; dialog_action_area.Sensitive = false; LoginProgress (0.0, Catalog.GetString ("Authorizing Session")); ThreadPool.QueueUserWorkItem (delegate { try { bool perm_offline = account.HasPermission("offline_access"); bool perm_upload = photo_perm_check.Active = account.HasPermission("photo_upload"); ThreadAssist.ProxyToMain (() => { offline_perm_check.Active = perm_offline; photo_perm_check.Active = perm_upload; LoginProgress (0.2, Catalog.GetString ("Session established, fetching user info...")); }); User me = account.Facebook.GetLoggedInUser ().GetUserInfo (); ThreadAssist.ProxyToMain (() => { LoginProgress (0.4, Catalog.GetString ("Session established, fetching friend list...")); }); Friend[] friend_list = account.Facebook.GetFriends (); long[] uids = new long [friend_list.Length]; for (int i = 0; i < friend_list.Length; i++) uids [i] = friend_list [i].UId; ThreadAssist.ProxyToMain (() => { LoginProgress (0.6, Catalog.GetString ("Session established, fetching friend details...")); }); if (uids.Length > 0) { User[] infos = account.Facebook.GetUserInfo (uids, new string[] { "first_name", "last_name" }); friends = new Dictionary<long, User> (); foreach (User user in infos) friends.Add (user.uid, user); } ThreadAssist.ProxyToMain (() => { LoginProgress (0.8, Catalog.GetString ("Session established, fetching photo albums...")); }); Album[] albums = account.Facebook.GetAlbums (); ThreadAssist.ProxyToMain (() => { album_info_vbox.Sensitive = true; picture_info_vbox.Sensitive = true; permissions_hbox.Sensitive = true; login_button.Visible = false; logout_button.Visible = true; // Note for translators: {0} and {1} are respectively firstname and surname of the user LoginProgress (1.0, String.Format (Catalog.GetString ("{0} {1} is logged into Facebook"), me.first_name, me.last_name)); existing_album_combobox.Model = new AlbumStore (albums); existing_album_combobox.Active = 0; }); } catch (Exception e) { Log.DebugException (e); ThreadAssist.ProxyToMain (() => { HigMessageDialog error = new HigMessageDialog (this, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Facebook Connection Error"), String.Format (Catalog.GetString ("There was an error when downloading your information from Facebook.\n\nFacebook said: {0}"), e.Message)); error.Run (); error.Destroy (); }); account.Deauthenticate (); DoLogout (); } finally { ThreadAssist.ProxyToMain (() => { log_buttons_hbox.Sensitive = true; dialog_action_area.Sensitive = true; }); } }); } }
public static bool ConfirmRemove(string header) { string message = Catalog.GetString ("Are you sure you want to continue?"); bool remove_tracks = false; ThreadAssist.BlockingProxyToMain (() => { var md = new HigMessageDialog ( ServiceManager.Get<GtkElementsService> ().PrimaryWindow, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.None, header, message ); md.AddButton ("gtk-cancel", ResponseType.No, true); md.AddButton (Catalog.GetString ("Remove tracks"), ResponseType.Yes, false); try { if (md.Run () == (int) ResponseType.Yes) { remove_tracks = true; } } finally { md.Destroy (); } }); return remove_tracks; }
private void OpenContainingFolder(String path) { if (Banshee.IO.Directory.Exists (path)) { System.Diagnostics.Process.Start (path); return; } var md = new HigMessageDialog ( ServiceManager.Get<GtkElementsService> ().PrimaryWindow, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.None, Catalog.GetString ("The folder could not be found."), Catalog.GetString ("Please check that the track's location is accessible by the system.") ); md.AddButton ("gtk-ok", ResponseType.Ok, true); try { md.Run (); } finally { md.Destroy (); } }
public void EasterEgg(object o, EventArgs ev) { HigMessageDialog dialog = new HigMessageDialog(this, DialogFlags.Modal | DialogFlags.NoSeparator, MessageType.Warning, ButtonsType.None, "Error 1337", "HIGcat is not amused."); dialog.AddButton("Lettuce", ResponseType.Close); dialog.AddButton("Tomato", ResponseType.Close); dialog.AddButton("Cheezburger", ResponseType.Close); dialog.Run(); dialog.Destroy(); }
private void HandleResponse (object sender, Gtk.ResponseArgs args) { int size = 0; bool UserCancelled = false; // Lets remove the mail "create mail" dialog Destroy(); if (args.ResponseId != Gtk.ResponseType.Ok) { return; } ProgressDialog progress_dialog = null; progress_dialog = new ProgressDialog (Catalog.GetString ("Preparing email"), ProgressDialog.CancelButtonType.Stop, selection.Count, parent_window); size = GetScaleSize(); // Which size should we scale to. 0 --> Original // evaluate mailto command and define attachment args for cli System.Text.StringBuilder attach_arg = new System.Text.StringBuilder (); switch (Preferences.Get<string> (Preferences.GNOME_MAILTO_COMMAND)) { case "thunderbird %s": case "mozilla-thunderbird %s": case "seamonkey -mail -compose %s": case "icedove %s": attach_arg.Append(","); break; case "kmail %s": attach_arg.Append(" --attach "); break; default://evolution falls into default, since it supports mailto uri correctly attach_arg.Append("&attach="); break; } // Create a tmp directory. tmp_mail_dir = System.IO.Path.GetTempFileName (); // Create a tmp file System.IO.File.Delete (tmp_mail_dir); // Delete above tmp file System.IO.Directory.CreateDirectory (tmp_mail_dir); // Create a directory with above tmp name System.Text.StringBuilder mail_attach = new System.Text.StringBuilder (); FilterSet filters = new FilterSet (); if (size != 0) filters.Add (new ResizeFilter ((uint) size)); filters.Add (new UniqueNameFilter (new SafeUri (tmp_mail_dir))); for (int i = 0; i < selection.Count; i++) { var photo = selection [i]; if ( (photo != null) && (!UserCancelled) ) { if (progress_dialog != null) UserCancelled = progress_dialog.Update (String.Format (Catalog.GetString ("Exporting picture \"{0}\""), photo.Name)); if (UserCancelled) break; try { // Prepare a tmp_mail file name FilterRequest request = new FilterRequest (photo.DefaultVersion.Uri); filters.Convert (request); request.Preserve(request.Current); mail_attach.Append(((i == 0 && attach_arg.ToString () == ",") ? "" : attach_arg.ToString()) + request.Current.ToString ()); } catch (Exception e) { Hyena.Log.ErrorFormat ("Error preparing {0}: {1}", selection[i].Name, e.Message); HigMessageDialog md = new HigMessageDialog (parent_window, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, Catalog.GetString("Error processing image"), String.Format(Catalog.GetString("An error occured while processing \"{0}\": {1}"), selection[i].Name, e.Message)); md.Run(); md.Destroy(); UserCancelled = true; } } } // foreach if (progress_dialog != null) progress_dialog.Destroy (); // No need to keep this window if (UserCancelled) return; // Send the mail :) string mail_subject = Catalog.GetString("My Photos"); switch (Preferences.Get<string> (Preferences.GNOME_MAILTO_COMMAND)) { // openSuSE case "thunderbird %s": System.Diagnostics.Process.Start("thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\""); break; case "icedove %s": System.Diagnostics.Process.Start("icedove", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\""); break; case "mozilla-thunderbird %s": System.Diagnostics.Process.Start("mozilla-thunderbird", " -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\""); break; case "seamonkey -mail -compose %s": System.Diagnostics.Process.Start("seamonkey", " -mail -compose \"subject=" + mail_subject + ",attachment='" + mail_attach + "'\""); break; case "kmail %s": System.Diagnostics.Process.Start("kmail", " --composer --subject \"" + mail_subject + "\"" + mail_attach); break; case "evolution %s": //evo doesn't urldecode the subject GtkBeans.Global.ShowUri (Screen, "mailto:?subject=" + mail_subject + mail_attach); break; default: GtkBeans.Global.ShowUri (Screen, "mailto:?subject=" + System.Web.HttpUtility.UrlEncode(mail_subject) + mail_attach); break; } }
private void CreateTagIconFromExternalPhoto () { try { using (FSpot.ImageFile img = FSpot.ImageFile.Create(new Uri(external_photo_chooser.Uri))) { using (Gdk.Pixbuf external_image = img.Load ()) { PreviewPixbuf = PixbufUtils.TagIconFromPixbuf (external_image); PreviewPixbuf_WithoutProfile = PreviewPixbuf.Copy(); FSpot.ColorManagement.ApplyScreenProfile (PreviewPixbuf); } } } catch (Exception) { string caption = Catalog.GetString ("Unable to load image"); string message = String.Format (Catalog.GetString ("Unable to load \"{0}\" as icon for the tag"), external_photo_chooser.Uri.ToString ()); HigMessageDialog md = new HigMessageDialog (this.Dialog, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, caption, message); md.Run(); md.Destroy(); } }
public static void ShowHelp (string filename, string link_id, Gdk.Screen screen, Gtk.Window parent) { try { Gnome.Help.DisplayDesktopOnScreen ( Gnome.Program.Get (), FSpot.Global.HelpDirectory, filename, link_id, screen); } catch { string message = Mono.Unix.Catalog.GetString ("The \"F-Spot Manual\" could " + "not be found. Please verify " + "that your installation has been " + "completed successfully."); HigMessageDialog dialog = new HigMessageDialog (parent, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Mono.Unix.Catalog.GetString ("Help not found"), message); dialog.Run (); dialog.Destroy (); } }
private void Login() { try { fr = new FlickrRemote (token, current_service); fr.TryWebLogin(); CurrentState = State.Connected; } catch (Exception e) { if (e is FlickrApiException && (e as FlickrApiException).Code == 98) { Logout (); Login (); } else { HigMessageDialog md = new HigMessageDialog (Dialog, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Unable to log on"), e.Message); md.Run (); md.Destroy (); CurrentState = State.Disconnected; } } }
public void Run(IBrowsableCollection selection) { dialog = new FacebookExportDialog (selection); if (selection.Items.Length > max_photos_per_album) { HigMessageDialog mbox = new HigMessageDialog (dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Too many images to export"), String.Format (Catalog.GetString ("Facebook only permits {0} photographs per album. Please refine your selection and try again."), max_photos_per_album)); mbox.Run (); mbox.Destroy (); return; } if (dialog.Run () != (int)ResponseType.Ok) { dialog.Destroy (); return; } if (dialog.CreateAlbum) { string name = dialog.AlbumName; if (String.IsNullOrEmpty (name)) { HigMessageDialog mbox = new HigMessageDialog (dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Album must have a name"), Catalog.GetString ("Please name your album or choose an existing album.")); mbox.Run (); mbox.Destroy (); return; } string description = dialog.AlbumDescription; string location = dialog.AlbumLocation; try { album = dialog.Account.Facebook.CreateAlbum (name, description, location); } catch (FacebookException fe) { HigMessageDialog mbox = new HigMessageDialog (dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Creating a new album failed"), String.Format (Catalog.GetString ("An error occurred creating a new album.\n\n{0}"), fe.Message)); mbox.Run (); mbox.Destroy (); return; } } else { album = dialog.ActiveAlbum; } if (dialog.Account != null) { dialog.Hide (); command_thread = new System.Threading.Thread (new System.Threading.ThreadStart (Upload)); command_thread.Name = Mono.Unix.Catalog.GetString ("Uploading Pictures"); progress_dialog = new ThreadProgressDialog (command_thread, selection.Items.Length); progress_dialog.Start (); } dialog.Destroy (); }
private void OnOpenContainingFolder (object o, EventArgs args) { var source = ActiveSource as ITrackModelSource; if (source == null || source.TrackModel == null) return; var items = SelectedTracks; if (items == null || items.Count != 1) { Log.Error ("Could not open containing folder"); return; } foreach (var track in items) { var path = System.IO.Path.GetDirectoryName (track.Uri.AbsolutePath); if (Banshee.IO.Directory.Exists (path)) { System.Diagnostics.Process.Start (path); return; } } var md = new HigMessageDialog ( ServiceManager.Get<GtkElementsService> ().PrimaryWindow, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.None, Catalog.GetString ("The folder could not be found."), Catalog.GetString ("Please check that the track's location is accessible by the system.") ); md.AddButton ("gtk-ok", ResponseType.Ok, true); try { md.Run (); } finally { md.Destroy (); } }
public int ImportFromFile (PhotoStore store, string path) { this.store = store; this.CreateDialog ("import_dialog"); this.Dialog.TransientFor = main_window; this.Dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent; this.Dialog.Response += HandleDialogResponse; AllowFinish = false; this.Dialog.DefaultResponse = ResponseType.Ok; //import_folder_entry.Activated += HandleEntryActivate; recurse_check.Toggled += HandleRecurseToggled; copy_check.Toggled += HandleRecurseToggled; menu = new SourceMenu (this); source_option_menu.Menu = menu; collection = new FSpot.PhotoList (new Photo [0]); tray = new FSpot.ScalingIconView (collection); tray.Selection.Changed += HandleTraySelectionChanged; icon_scrolled.SetSizeRequest (200, 200); icon_scrolled.Add (tray); //icon_scrolled.Visible = false; tray.DisplayTags = false; tray.Show (); photo_view = new FSpot.PhotoImageView (collection); photo_scrolled.Add (photo_view); photo_scrolled.SetSizeRequest (200, 200); photo_view.Show (); //FSpot.Global.ModifyColors (frame_eventbox); FSpot.Global.ModifyColors (photo_scrolled); FSpot.Global.ModifyColors (photo_view); photo_view.Pixbuf = PixbufUtils.LoadFromAssembly ("f-spot-48.png"); photo_view.Fit = true; tag_entry = new FSpot.Widgets.TagEntry (MainWindow.Toplevel.Database.Tags, false); tag_entry.UpdateFromTagNames (new string []{}); tagentry_box.Add (tag_entry); tag_entry.Show (); this.Dialog.Show (); //source_option_menu.Changed += HandleSourceChanged; if (path != null) { SetImportPath (path); int i = menu.FindItemPosition (path); if (i > 0) { source_option_menu.SetHistory ((uint)i); } else if (Directory.Exists (path)) { SourceItem path_item = new SourceItem (new VfsSource (path)); menu.Prepend (path_item); path_item.ShowAll (); SetImportPath (path); source_option_menu.SetHistory (0); } idle_start.Start (); } ResponseType response = (ResponseType) this.Dialog.Run (); while (response == ResponseType.Ok) { try { if (Directory.Exists (this.ImportPath)) break; } catch (System.Exception e){ System.Console.WriteLine (e); break; } HigMessageDialog md = new HigMessageDialog (this.Dialog, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Ok, Catalog.GetString ("Directory does not exist."), String.Format (Catalog.GetString ("The directory you selected \"{0}\" does not exist. " + "Please choose a different directory"), this.ImportPath)); md.Run (); md.Destroy (); response = (Gtk.ResponseType) this.Dialog.Run (); } if (response == ResponseType.Ok) { this.UpdateTagStore (tag_entry.GetTypedTagNames ()); this.Finish (); if (tags_selected != null && tags_selected.Count > 0) { for (int i = 0; i < collection.Count; i++) { Photo p = collection [i] as Photo; if (p == null) continue; p.AddTag ((Tag [])tags_selected.ToArray(typeof(Tag))); store.Commit (p); } } this.Dialog.Destroy (); return collection.Count; } else { this.Cancel (); //this.Dialog.Destroy(); return 0; } }
/* public void HandleYellow(object o, EventArgs ev) { if((o as ToggleAction).Active) { handwriting.PaperColor = Handwriting.Yellow; } else { handwriting.PaperColor = Handwriting.White; } } public void HandleWideRule(object o, EventArgs ev) { if((o as ToggleAction).Active) { handwriting.RuleDistance = Handwriting.WideRule; } else { handwriting.RuleDistance = Handwriting.CollegeRule; } } public void HandleHorizontalRule(object o, EventArgs ev) { handwriting.HorizontalRule = (o as ToggleAction).Active; } public void HandleVerticalRule(object o, EventArgs ev) { handwriting.VerticalRule = (o as ToggleAction).Active; } public void HandleLeftMargin(object o, EventArgs ev) { handwriting.LeftMargin = (o as ToggleAction).Active; } public void HandleBindingHoles(object o, EventArgs ev) { handwriting.Holes = (o as ToggleAction).Active; }*/ public void HandleDelete(object o, DeleteEventArgs ev) { ev.RetVal = true; if(!hasChanged) { ev.RetVal = false; program.Quit(); return; } HigMessageDialog dialog = new HigMessageDialog(this, DialogFlags.Modal | DialogFlags.NoSeparator, MessageType.Warning, ButtonsType.None, "Would you like to save the current page before closing?", "If you close the page without saving, it will be permanently lost."); dialog.AddButton("Close without Saving", ResponseType.Close); dialog.AddButton(Gtk.Stock.Cancel, ResponseType.Cancel); dialog.AddButton(Gtk.Stock.SaveAs, ResponseType.Yes); ResponseType response = (ResponseType)dialog.Run(); dialog.Destroy(); switch(response) { case ResponseType.Close: ev.RetVal = false; program.Quit(); break; case ResponseType.Yes: if(DoSaveDialog()) { ev.RetVal = false; program.Quit(); } break; } }
private void RunReadonlyError(int readonly_count) { string notice = Catalog.GetPluralString ("Unable to rotate photo", "Unable to rotate {0} photos", readonly_count); string desc = Catalog.GetPluralString ( "The photo could not be rotated because it is on a read only file system or media such as a CDROM. Please check the permissions and try again.", "{0} photos could not be rotated because they are on a read only file system or media such as a CDROM. Please check the permissions and try again.", readonly_count ); notice = String.Format (notice, readonly_count); desc = String.Format (desc, readonly_count); HigMessageDialog md = new HigMessageDialog (parent_window, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, notice, desc); md.Run(); md.Destroy(); }
private void RunGenericError(System.Exception e, string path, string msg) { string longmsg = String.Format (Catalog.GetString ("Received error \"{0}\" while attempting to rotate {1}"), msg, System.IO.Path.GetFileName (path)); HigMessageDialog md = new HigMessageDialog (parent_window, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.Ok, Catalog.GetString ("Error while rotating photo."), longmsg); md.Run (); md.Destroy (); }
private static bool ConfirmRemove(ITrackModelSource source, bool delete, int selCount) { if (!source.ConfirmRemoveTracks) { return true; } bool ret = false; string header = null; string message = null; string button_label = null; if (delete) { header = String.Format ( Catalog.GetPluralString ( "Are you sure you want to permanently delete this item?", "Are you sure you want to permanently delete the selected {0} items?", selCount ), selCount ); message = Catalog.GetString ("If you delete the selection, it will be permanently lost."); button_label = "gtk-delete"; } else { header = String.Format (Catalog.GetString ("Remove selection from {0}?"), source.Name); message = String.Format ( Catalog.GetPluralString ( "Are you sure you want to remove the selected item from your {1}?", "Are you sure you want to remove the selected {0} items from your {1}?", selCount ), selCount, source.GenericName ); button_label = "gtk-remove"; } HigMessageDialog md = new HigMessageDialog ( ServiceManager.Get<GtkElementsService> ().PrimaryWindow, DialogFlags.DestroyWithParent, delete ? MessageType.Warning : MessageType.Question, ButtonsType.None, header, message ); // Delete from Disk defaults to Cancel and the others to OK/Confirm. md.AddButton ("gtk-cancel", ResponseType.No, delete); md.AddButton (button_label, ResponseType.Yes, !delete); try { if (md.Run () == (int) ResponseType.Yes) { ret = true; } } finally { md.Destroy (); } return ret; }
private void HandleResponse(object sender, Gtk.ResponseArgs args) { if (args.ResponseId != Gtk.ResponseType.Ok) { if (command_thread != null && command_thread.IsAlive) command_thread.Abort (); Dialog.Destroy (); return; } if (fr.CheckLogin() == null) { do_export_flickr.Sensitive = false; HigMessageDialog md = new HigMessageDialog (Dialog, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Unable to log on."), string.Format (Catalog.GetString ("F-Spot was unable to log on to {0}. Make sure you have given the authentication using {0} web browser interface."), current_service.Name)); md.Run (); md.Destroy (); return; } fr.ExportTags = tag_check.Active; fr.ExportTagHierarchy = hierarchy_check.Active; fr.ExportIgnoreTopLevel = ignore_top_level_check.Active; open = open_check.Active; scale = scale_check.Active; is_public = public_radio.Active; is_family = family_check.Active; is_friend = friend_check.Active; if (scale) size = size_spin.ValueAsInt; command_thread = new Thread (new ThreadStart (Upload)); command_thread.Name = Catalog.GetString ("Uploading Pictures"); Dialog.Destroy (); progress_dialog = new ThreadProgressDialog (command_thread, selection.Count); progress_dialog.Start (); // Save these settings for next time Preferences.Set (SCALE_KEY, scale); Preferences.Set (SIZE_KEY, size); Preferences.Set (BROWSER_KEY, open); Preferences.Set (TAGS_KEY, tag_check.Active); Preferences.Set (PUBLIC_KEY, public_radio.Active); Preferences.Set (FAMILY_KEY, family_check.Active); Preferences.Set (FRIENDS_KEY, friend_check.Active); Preferences.Set (TAG_HIERARCHY_KEY, hierarchy_check.Active); Preferences.Set (IGNORE_TOP_LEVEL_KEY, ignore_top_level_check.Active); Preferences.Set (current_service.PreferencePath, fr.Token); }
public void CheckAuthorization() { AuthorizationEventArgs args = new AuthorizationEventArgs (); try { args.Auth = fr.CheckLogin (); } catch (FlickrException e) { args.Exception = e; } catch (Exception e) { HigMessageDialog md = new HigMessageDialog (Dialog, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Unable to log on"), e.Message); md.Run (); md.Destroy (); return; } ThreadAssist.ProxyToMain (() => { do_export_flickr.Sensitive = args.Auth != null; if (args.Auth != null) { token = args.Auth.Token; auth = args.Auth; CurrentState = State.Authorized; Preferences.Set (current_service.PreferencePath, token); } else { CurrentState = State.Disconnected; } }); }
private void Apply(Editor editor) { if (!SetupEditor (editor)) return; if (!editor.CanBeApplied) { string msg = Catalog.GetString ("No selection available"); string desc = Catalog.GetString ("This tool requires an active selection. Please select a region of the photo and try the operation again"); HigMessageDialog md = new HigMessageDialog (App.Instance.Organizer.Window, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run (); md.Destroy (); return; } // TODO: Might need to do some nicer things for multiple selections (progress?) try { editor.Apply (); } catch (Exception e) { Log.DebugException (e); string msg = Catalog.GetPluralString ("Error saving adjusted photo", "Error saving adjusted photos", editor.State.Items.Length); string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Note that you have to develop RAW files into JPEG before you can edit them."), e.Message); HigMessageDialog md = new HigMessageDialog (App.Instance.Organizer.Window, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run (); md.Destroy (); } ShowTools (); }
void CreateTagIconFromExternalPhoto() { try { using (var img = ImageFile.Create (new SafeUri(external_photo_chooser.Uri, true))) { using (Gdk.Pixbuf external_image = img.Load ()) { PreviewPixbuf = PixbufUtils.TagIconFromPixbuf (external_image); } } } catch (Exception) { string caption = Catalog.GetString ("Unable to load image"); string message = String.Format (Catalog.GetString ("Unable to load \"{0}\" as icon for the tag"), external_photo_chooser.Uri.ToString ()); HigMessageDialog md = new HigMessageDialog (this, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, caption, message); md.Run(); md.Destroy(); } }
public void OnRemove(object o, EventArgs args) { HigMessageDialog dialog = new HigMessageDialog (window, DialogFlags.Modal, MessageType.Question, ButtonsType.None, Catalog.GetString ("Would you like to delete the virtual machine files, or keep them?"), Catalog.GetString ("If you delete them, all data in the virtual machine will be lost.")); dialog.AddButton (Catalog.GetString ("Keep"), ResponseType.No, true); dialog.AddButton (Stock.Delete, ResponseType.Yes, false); int response = dialog.Run (); dialog.Destroy (); foreach (TreePath path in vmview.Selection.GetSelectedRows ()) { TreeIter iter; vmview.Model.GetIter (out iter, path); VirtualMachine machine = (VirtualMachine) vmview.Model.GetValue (iter, 0); if (response == (int) ResponseType.Yes) { machine.Delete (); } manager.RemoveMachine (machine); } }