Index: src/f-spot.glade
===================================================================
--- src/f-spot.glade	(revision 4353)
+++ src/f-spot.glade	(working copy)
@@ -633,7 +633,7 @@
                     <property name="expand">False</property>
                     <property name="fill">False</property>
                   </packing>
-                </child>
+                </child>                
                 <child>
                   <widget class="GtkOptionMenu" id="tag_option_menu">
                     <property name="visible">True</property>
@@ -650,6 +650,20 @@
                 <property name="position">2</property>
               </packing>
             </child>
+            <child>
+              <widget class="GtkCheckButton" id="duplicate_check">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label" translatable="yes">Include duplicates</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+                <property name="draw_indicator">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
           </widget>
           <packing>
             <property name="position">1</property>
Index: src/CameraFileSelectionDialog.cs
===================================================================
--- src/CameraFileSelectionDialog.cs	(revision 4353)
+++ src/CameraFileSelectionDialog.cs	(working copy)
@@ -15,6 +15,7 @@
 using Glade;
 using LibGPhoto2;
 using Mono.Unix;
+using FSpot.Utils;
 using FSpot.UI.Dialog;
 
 namespace FSpot {
@@ -31,6 +32,7 @@
 		[Widget] Gtk.TreeView file_tree;
 		[Widget] Gtk.OptionMenu tag_option_menu;
 		[Widget] Gtk.CheckButton attach_check;
+		[Widget] Gtk.CheckButton duplicate_check;
 
 		GPhotoCamera camera;
 		ListStore preview_list_store;
@@ -219,7 +221,12 @@
 									    (i + 1), index_list.Count);
 						
 						progress_dialog.ProgressText = msg;
-						saved.Add (SaveFile ((int)(index_list [i])));
+
+						SaveResult result = SaveFile ((int)(index_list [i]));
+
+						if (!result.IsDuplicate)
+						 	saved.Add (result.Path);
+
 						progress_dialog.Fraction = (i + 1)/(double)index_list.Count;
 					}
 					catch (System.Exception e) {
@@ -241,7 +248,7 @@
 			}
 		}
 		
-		private string SaveFile (int index) 
+		private SaveResult SaveFile (int index) 
 		{
 			GPhotoCameraFile camfile = (GPhotoCameraFile) camera.FileList [index];
 			string tempdir = FSpot.Global.PhotoDirectory;
@@ -266,12 +273,36 @@
 			progress_dialog.Message = msg;
 			
 			camera.SaveFile (index, path);
+
+			if (!duplicate_check.Active && db.Photos.CheckForDuplicate (FSpot.Utils.UriUtils.PathToFileUri (path)) != null) {
+			 	System.IO.File.Delete (path);
+
+				return new SaveResult (path, true);
+			} else {
+				string dest = FileImportBackend.ChooseLocation (path);
+				System.IO.File.Move (path, dest);
+
+				return new SaveResult (dest, false);
+			}
+		}
+
+		private class SaveResult {
+			private bool is_duplicate;
 			
-			string dest = FileImportBackend.ChooseLocation (path);
-			System.IO.File.Move (path, dest);
-			path = dest;
+			private string path;
 
-			return path;
+			public string Path {
+				get { return path; } 
+			}
+
+			public bool IsDuplicate {
+				get { return is_duplicate; } 
+			}
+			
+			public SaveResult (string path, bool is_duplicate) {
+				this.path = path;
+				this.is_duplicate = is_duplicate;
+			} 
 		}
 		
 		private int ImportFiles ()
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 4353)
+++ ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2008-09-15  Thomas Van Machelen <thomas.vanmachelen@gmail.com>
+
+	* src/f-spot.glade:
+	* src/ImportCommand.cs:
+	* src/CameraFileSelectionDialog.cs: Add support for duplicate
+	detection when importing from Camera.
+
 2008-09-15  Ruben Vermeersch  <ruben@savanne.be>
 
 	* src/InfoOverlay.cs: Use the FullScreen context while viewing full
