[f-spot/FSPOT_0_6_0_STABLE] Fix bug #326328 - "Copy files to Photos folder" should be preserved.



commit 086dff854b3abd369da91f74099f2e92df196b0c
Author: Markus Lindqvist <markus lindqvist iki fi>
Date:   Sun Jul 26 19:11:15 2009 +0300

    Fix bug #326328 - "Copy files to Photos folder" should be preserved.

 src/ImportCommand.cs |   34 +++++++++++++++++++++++++---------
 src/Preferences.cs   |    8 ++++++++
 2 files changed, 33 insertions(+), 9 deletions(-)
---
diff --git a/src/ImportCommand.cs b/src/ImportCommand.cs
index a47015e..8d106f0 100644
--- a/src/ImportCommand.cs
+++ b/src/ImportCommand.cs
@@ -7,6 +7,7 @@
  * 	Miguel de Icaza
  * 	Nat Friedman
  * 	Gabriel Burt
+ * 	Markus Lindqvist <markus lindqvist iki fi>
  *
  * This is free software. See COPYING for details.
  */
@@ -521,6 +522,14 @@ public class ImportCommand : GladeDialog
 			importer.Finish ();
 		
 		importer = null;
+		SavePreferences ();
+	}
+	
+	private void SavePreferences ()
+	{
+		Preferences.Set(Preferences.IMPORT_COPY_FILES, copy_check.Active);
+		Preferences.Set(Preferences.IMPORT_INCLUDE_SUBFOLDERS, recurse_check.Active);
+		Preferences.Set(Preferences.IMPORT_CHECK_DUPLICATES, duplicate_check.Active);
 	}
 	
 	public void HandleImportBrowse (object o, EventArgs args) 
@@ -577,25 +586,32 @@ public class ImportCommand : GladeDialog
 	       
 		idle_start.Start ();
 	}
+	
+	private void LoadPreferences ()
+	{
+		if (FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_WINDOW_WIDTH) > 0)
+			this.Dialog.Resize (FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_WINDOW_WIDTH), FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_WINDOW_HEIGHT));
+
+		if (FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_WINDOW_PANE_POSITION) > 0)
+			import_hpaned.Position = FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_WINDOW_PANE_POSITION);
+
+		copy_check.Active = Preferences.Get<bool> (Preferences.IMPORT_COPY_FILES);
+		recurse_check.Active = Preferences.Get<bool> (Preferences.IMPORT_INCLUDE_SUBFOLDERS);
+		duplicate_check.Active = Preferences.Get<bool> (Preferences.IMPORT_CHECK_DUPLICATES);
+	}
 
 	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;
+		this.Dialog.DefaultResponse = ResponseType.Ok;
 
- 		if (FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_WINDOW_WIDTH) > 0)
- 			this.Dialog.Resize (FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_WINDOW_WIDTH), FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_WINDOW_HEIGHT));
-
- 		if (FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_WINDOW_PANE_POSITION) > 0)
-			import_hpaned.Position = FSpot.Preferences.Get<int> (FSpot.Preferences.IMPORT_WINDOW_PANE_POSITION);
-
-	        AllowFinish = false;
+		AllowFinish = false;
 		
-		this.Dialog.DefaultResponse = ResponseType.Ok;
+		LoadPreferences ();
 		
 		//import_folder_entry.Activated += HandleEntryActivate;
 		duplicate_check.Toggled += HandleRecurseToggled;
diff --git a/src/Preferences.cs b/src/Preferences.cs
index 3f4fb9c..a4205eb 100644
--- a/src/Preferences.cs
+++ b/src/Preferences.cs
@@ -23,6 +23,10 @@ namespace FSpot
 		public const string IMPORT_WINDOW_WIDTH = APP_FSPOT + "ui/import_window_width";
 		public const string IMPORT_WINDOW_HEIGHT = APP_FSPOT + "ui/import_window_height";
 		public const string IMPORT_WINDOW_PANE_POSITION = APP_FSPOT + "ui/import_window_pane_position";
+
+		public const string IMPORT_COPY_FILES = "/apps/f-spot/import/copy_files";
+		public const string IMPORT_INCLUDE_SUBFOLDERS = "/apps/f-spot/import/include_subfolders";
+		public const string IMPORT_CHECK_DUPLICATES = "/apps/f-spot/import/check_duplicates";
 		
 		public const string VIEWER_WIDTH = APP_FSPOT + "ui/viewer_width";
 		public const string VIEWER_HEIGHT = APP_FSPOT + "ui/viewer_height";
@@ -166,6 +170,10 @@ namespace FSpot
 			case COLOR_MANAGEMENT_DISPLAY_PROFILE:
 			case COLOR_MANAGEMENT_OUTPUT_PROFILE:
 				return String.Empty;
+			case IMPORT_CHECK_DUPLICATES:
+			case IMPORT_COPY_FILES:
+			case IMPORT_INCLUDE_SUBFOLDERS:
+				return true;
 			default:
 				return null;
 			}



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