f-spot r3821 - in trunk: . src



Author: sdelcroix
Date: Fri Apr 11 16:46:53 2008
New Revision: 3821
URL: http://svn.gnome.org/viewvc/f-spot?rev=3821&view=rev

Log:
2008-04-11  Lorenzo Milesi <maxxer yetopen it>

	* src/TagCommand.cs: prevent from crashing if load icon from external
	file fails. Fix bgo #525513.


Modified:
   trunk/ChangeLog
   trunk/src/TagCommands.cs

Modified: trunk/src/TagCommands.cs
==============================================================================
--- trunk/src/TagCommands.cs	(original)
+++ trunk/src/TagCommands.cs	Fri Apr 11 16:46:53 2008
@@ -17,6 +17,7 @@
 using Mono.Unix;
 using FSpot;
 using FSpot.Utils;
+using FSpot.UI.Dialog;
 
 public class TagCommands {
 
@@ -377,10 +378,24 @@
 
 		private void CreateTagIconFromExternalPhoto ()
 		{
-			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);
+			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);
+					}
 				}
+			} catch (Exception e) {
+				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();
 			}
 		}
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]