f-spot r4747 - in trunk: . src src/Core



Author: sdelcroix
Date: Wed Apr  1 13:52:58 2009
New Revision: 4747
URL: http://svn.gnome.org/viewvc/f-spot?rev=4747&view=rev

Log:
2009-04-01  Stephane delcroix  <sdelcroix novell com>

	* src/Preferences.cs:
	* src/Core/Photo.cs:
	* src/MainWindow.cs: Allow creation of .xcf version of file from the
	"Open With" menu. Require a pixbuf loader for xcf.

Modified:
   trunk/ChangeLog
   trunk/src/Core/Photo.cs
   trunk/src/MainWindow.cs
   trunk/src/Preferences.cs

Modified: trunk/src/Core/Photo.cs
==============================================================================
--- trunk/src/Core/Photo.cs	(original)
+++ trunk/src/Core/Photo.cs	Wed Apr  1 13:52:58 2009
@@ -506,7 +506,12 @@
 			}
 		}
 	
-		public uint CreateNamedVersion (string name, uint base_version_id, bool create_file)
+		public uint CreateNamedVersion (string name, uint baseVersionId, bool createFile)
+		{
+			return CreateNamedVersion (name, baseVersionId, createFile);
+		}
+
+		public uint CreateNamedVersion (string name, string extension, uint base_version_id, bool create_file)
 		{
 			int num = 1;
 			
@@ -517,7 +522,7 @@
 						num, name);
 	
 				if (! VersionNameExists (final_name))
-					return CreateVersion (final_name, base_version_id, create_file);
+					return CreateVersion (final_name, extension, base_version_id, create_file);
 	
 				num ++;
 			}

Modified: trunk/src/MainWindow.cs
==============================================================================
--- trunk/src/MainWindow.cs	(original)
+++ trunk/src/MainWindow.cs	Wed Apr  1 13:52:58 2009
@@ -3083,6 +3083,24 @@
 		//hmd.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
 		hmd.AddButton (Gtk.Stock.Yes, Gtk.ResponseType.Yes, true);
 
+		bool support_xcf = false;;
+		if (application.Id == "gimp.desktop") 
+			foreach (Gdk.PixbufFormat format in Gdk.Pixbuf.Formats)
+				if (format.Name == "xcf")
+					support_xcf = true;
+
+		//This allows creating a version with a .xcf extension.
+		//There's no need to convert the file to xcf file format, gimp will take care of this
+		if (support_xcf) {	
+			CheckButton cb = new CheckButton (Catalog.GetString ("XCF version"));
+			cb.Active = Preferences.Get<bool> (Preferences.EDIT_CREATE_XCF_VERSION);
+			hmd.VBox.Add (cb);
+			cb.Toggled += delegate (object s, EventArgs e) {
+				Preferences.Set (Preferences.EDIT_CREATE_XCF_VERSION, (s as CheckButton).Active);
+			};
+			cb.Show ();
+		}
+
 		Gtk.ResponseType response = Gtk.ResponseType.Cancel;
 
 		try {
@@ -3090,6 +3108,12 @@
 		} finally {
 			hmd.Destroy ();
 		}
+		
+		bool create_xcf = false;
+		if (support_xcf)
+			create_xcf = Preferences.Get<bool> (Preferences.EDIT_CREATE_XCF_VERSION);
+
+		Console.WriteLine ("XCF ? {0}", create_xcf);
 
 		if (response == Gtk.ResponseType.Cancel)
 			return;
@@ -3101,7 +3125,7 @@
 		foreach (Photo photo in selected) {
 			try {
 				if (create_new_versions) {
-					uint version = photo.CreateNamedVersion (application.Name, photo.DefaultVersionId, true);
+					uint version = photo.CreateNamedVersion (application.Name, create_xcf ? ".xcf" : null, photo.DefaultVersionId, true);
 					photo.DefaultVersionId = version;
 				}
 			} catch (Exception e) {

Modified: trunk/src/Preferences.cs
==============================================================================
--- trunk/src/Preferences.cs	(original)
+++ trunk/src/Preferences.cs	Wed Apr  1 13:52:58 2009
@@ -69,6 +69,7 @@
 		public const string METADATA_EMBED_IN_IMAGE = APP_FSPOT + "metadata/embed_in_image";
 
 		public const string EDIT_REDEYE_THRESHOLD = APP_FSPOT + "edit/redeye_threshold";
+		public const string EDIT_CREATE_XCF_VERSION = APP_FSPOT + "edit/create_xcf";
 
 		public const string GNOME_SCREENSAVER_THEME = "/apps/gnome-screensaver/themes";
 		public const string GNOME_SCREENSAVER_MODE = "/apps/gnome-screensaver/mode";



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