[gthumb/ext] [photo importer] added the overwrite option in the preferences



commit 6ff0fbae97e355880903313b60878d110cbcc76a
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Nov 16 17:56:27 2009 +0100

    [photo importer] added the overwrite option in the preferences
    
    and removed the check buttons from the file list

 .../data/gthumb_photo_importer.schemas.in          |   13 ++
 .../photo_importer/data/ui/photo-importer.ui       |  208 ++++++++++----------
 extensions/photo_importer/dlg-photo-importer.c     |  167 +++++++---------
 extensions/photo_importer/gth-import-task.c        |   43 +++--
 extensions/photo_importer/gth-import-task.h        |    1 +
 extensions/photo_importer/preferences.h            |    1 +
 6 files changed, 225 insertions(+), 208 deletions(-)
---
diff --git a/extensions/photo_importer/data/gthumb_photo_importer.schemas.in b/extensions/photo_importer/data/gthumb_photo_importer.schemas.in
index 40ff3bb..f0a3ddd 100644
--- a/extensions/photo_importer/data/gthumb_photo_importer.schemas.in
+++ b/extensions/photo_importer/data/gthumb_photo_importer.schemas.in
@@ -67,6 +67,19 @@
       </schema>
 
       <schema>
+	<key>/schemas/apps/gthumb/ext/photo_importer/overwrite_files</key>
+	<applyto>/apps/gthumb/ext/photo_importer/overwrite_files</applyto>
+	<owner>gthumb</owner>
+	<type>bool</type>
+	<default>FALSE</default>
+	<locale name="C">
+	  <short></short>
+	  <long>
+	  </long>
+	</locale>
+      </schema>
+
+      <schema>
 	<key>/schemas/apps/gthumb/ext/photo_importer/adjust_orientation</key>
 	<applyto>/apps/gthumb/ext/photo_importer/adjust_orientation</applyto>
 	<owner>gthumb</owner>
diff --git a/extensions/photo_importer/data/ui/photo-importer.ui b/extensions/photo_importer/data/ui/photo-importer.ui
index f2be6ad..e3ec855 100644
--- a/extensions/photo_importer/data/ui/photo-importer.ui
+++ b/extensions/photo_importer/data/ui/photo-importer.ui
@@ -127,44 +127,6 @@
                     <property name="position">0</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkHBox" id="list_command_box">
-                    <property name="visible">True</property>
-                    <property name="spacing">6</property>
-                    <child>
-                      <object class="GtkButton" id="select_all_button">
-                        <property name="label" translatable="yes">Select _All</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkButton" id="select_none_button">
-                        <property name="label" translatable="yes">Select _None</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">True</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="pack_type">end</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
               </object>
               <packing>
                 <property name="position">2</property>
@@ -177,26 +139,34 @@
                 <property name="column_spacing">6</property>
                 <property name="row_spacing">5</property>
                 <child>
-                  <object class="GtkLabel" id="tags_label">
+                  <object class="GtkHBox" id="tags_entry_box">
                     <property name="visible">True</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">_Tags:</property>
-                    <property name="use_underline">True</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </object>
                   <packing>
-                    <property name="x_options">GTK_FILL</property>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkHBox" id="tags_entry_box">
+                  <object class="GtkAlignment" id="alignment5">
                     <property name="visible">True</property>
+                    <property name="top_padding">3</property>
                     <child>
-                      <placeholder/>
+                      <object class="GtkLabel" id="tags_label">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="yalign">0</property>
+                        <property name="label" translatable="yes">_Tags:</property>
+                        <property name="use_underline">True</property>
+                      </object>
                     </child>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
                   </packing>
                 </child>
               </object>
@@ -205,6 +175,20 @@
                 <property name="position">3</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkCheckButton" id="delete_checkbutton">
+                <property name="label" translatable="yes">_Delete the imported files from the source</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="position">1</property>
@@ -313,43 +297,6 @@
             <property name="orientation">vertical</property>
             <property name="spacing">12</property>
             <child>
-              <object class="GtkVBox" id="vbox5">
-                <property name="visible">True</property>
-                <property name="orientation">vertical</property>
-                <property name="spacing">6</property>
-                <child>
-                  <object class="GtkCheckButton" id="delete_checkbutton">
-                    <property name="label" translatable="yes">_Delete imported files</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="draw_indicator">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkCheckButton" id="adjust_orientation_checkbutton">
-                    <property name="label" translatable="yes">_Rotate images physically</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="draw_indicator">True</property>
-                  </object>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkFrame" id="frame1">
                 <property name="visible">True</property>
                 <property name="label_xalign">0</property>
@@ -384,12 +331,6 @@
                             <property name="position">0</property>
                           </packing>
                         </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
                       </object>
                     </child>
                   </object>
@@ -407,7 +348,7 @@
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="position">1</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
@@ -468,23 +409,90 @@
                     <property name="position">1</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkAlignment" id="alignment3">
+                    <property name="visible">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">14</property>
+                    <child>
+                      <object class="GtkLabel" id="example_label">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">example: file:///home/paolo/images/2009/08/12</property>
+                        <attributes>
+                          <attribute name="size" value="8500"/>
+                        </attributes>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
               </object>
               <packing>
-                <property name="position">2</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="example_label">
+              <object class="GtkFrame" id="frame2">
                 <property name="visible">True</property>
-                <property name="xalign">0</property>
-                <property name="label" translatable="yes">example: file:///home/paolo/images/2009/08/12</property>
-                <attributes>
-                  <attribute name="size" value="8500"/>
-                </attributes>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment4">
+                    <property name="visible">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkVBox" id="vbox5">
+                        <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkCheckButton" id="overwrite_checkbutton">
+                            <property name="label" translatable="yes">_Overwrite existing files</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="adjust_orientation_checkbutton">
+                            <property name="label" translatable="yes">_Rotate images physically</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Files</property>
+                    <property name="use_markup">True</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
               </object>
               <packing>
-                <property name="expand">False</property>
-                <property name="position">3</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </object>
diff --git a/extensions/photo_importer/dlg-photo-importer.c b/extensions/photo_importer/dlg-photo-importer.c
index 55250cf..c0cee76 100644
--- a/extensions/photo_importer/dlg-photo-importer.c
+++ b/extensions/photo_importer/dlg-photo-importer.c
@@ -83,6 +83,7 @@ destroy_dialog (gpointer user_data)
 	GthSubfolderType    subfolder_type;
 	GthSubfolderFormat  subfolder_format;
 	gboolean            delete_imported;
+	gboolean            overwrite_files;
 	gboolean            adjust_orientation;
 
 	g_signal_handler_disconnect (gth_main_get_default_monitor (), data->monitor_event);
@@ -109,32 +110,47 @@ destroy_dialog (gpointer user_data)
 	delete_imported = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("delete_checkbutton")));
 	eel_gconf_set_boolean (PREF_PHOTO_IMPORT_DELETE, delete_imported);
 
+	overwrite_files = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("overwrite_checkbutton")));
+	eel_gconf_set_boolean (PREF_PHOTO_IMPORT_OVERWRITE, overwrite_files);
+
 	adjust_orientation = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("adjust_orientation_checkbutton")));
 	eel_gconf_set_boolean (PREF_PHOTO_IMPORT_ADJUST_ORIENTATION, adjust_orientation);
 
 	if (data->import) {
-		GthFileStore  *file_store;
-		GList         *files;
-		char         **tags;
-		GthTask       *task;
-
-		file_store = (GthFileStore *) gth_file_view_get_model (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (data->file_list))));
-		files = gth_file_store_get_checked (file_store);
-		tags = gth_tags_entry_get_tags (GTH_TAGS_ENTRY (data->tags_entry), TRUE);
-		task = gth_import_task_new (data->browser,
-					    files,
-					    destination,
-					    subfolder_type,
-					    subfolder_format,
-					    single_subfolder,
-					    tags,
-					    delete_imported,
-					    adjust_orientation);
-		gth_browser_exec_task (data->browser, task, FALSE);
-
-		g_strfreev (tags);
-		g_object_unref (task);
-		_g_object_list_unref (files);
+		GtkWidget *file_view;
+		GList     *items;
+		GList     *file_list;
+
+		file_view = gth_file_list_get_view (GTH_FILE_LIST (data->file_list));
+		items = gth_file_selection_get_selected (GTH_FILE_SELECTION (file_view));
+		if (items != NULL)
+			file_list = gth_file_list_get_files (GTH_FILE_LIST (data->file_list), items);
+		else
+			file_list = gth_file_store_get_visibles (GTH_FILE_STORE (gth_file_view_get_model (GTH_FILE_VIEW (file_view))));
+
+		if (file_list != NULL) {
+			char    **tags;
+			GthTask  *task;
+
+			tags = gth_tags_entry_get_tags (GTH_TAGS_ENTRY (data->tags_entry), TRUE);
+			task = gth_import_task_new (data->browser,
+						    file_list,
+						    destination,
+						    subfolder_type,
+						    subfolder_format,
+						    single_subfolder,
+						    tags,
+						    delete_imported,
+						    overwrite_files,
+						    adjust_orientation);
+			gth_browser_exec_task (data->browser, task, FALSE);
+
+			g_strfreev (tags);
+			g_object_unref (task);
+		}
+
+		_g_object_list_unref (file_list);
+		_gtk_tree_path_list_free (items);
 	}
 
 	_g_object_unref (destination);
@@ -218,7 +234,6 @@ update_sensitivity (DialogData *data)
 
 	can_import = data->source != NULL;
 	gtk_widget_set_sensitive (GET_WIDGET ("ok_button"), can_import);
-	gtk_widget_set_sensitive (GET_WIDGET ("list_command_box"), can_import);
 	gtk_widget_set_sensitive (GET_WIDGET ("source_selector_box"), can_import);
 	gtk_widget_set_sensitive (GET_WIDGET ("tags_box"), can_import);
 }
@@ -227,31 +242,40 @@ update_sensitivity (DialogData *data)
 static void
 update_status (DialogData *data)
 {
-	GthFileStore *file_store;
-	int           n_checked;
-	goffset       size;
-	GList        *checked;
-	GList        *scan;
-	char         *ssize;
-	char         *status;
-
-	file_store = (GthFileStore *) gth_file_view_get_model (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (data->file_list))));
+	GtkWidget *file_view;
+	int        n_selected;
+	goffset    size;
+	GList     *selected;
+	GList     *file_list;
+	GList     *scan;
+	char      *ssize;
+	char      *status;
+
+	file_view = gth_file_list_get_view (GTH_FILE_LIST (data->file_list));
+	selected = gth_file_selection_get_selected (GTH_FILE_SELECTION (file_view));
+	if (selected != NULL)
+		file_list = gth_file_list_get_files (GTH_FILE_LIST (data->file_list), selected);
+	else
+		file_list = gth_file_store_get_visibles (GTH_FILE_STORE (gth_file_view_get_model (GTH_FILE_VIEW (file_view))));
 
-	n_checked = 0;
+	n_selected = 0;
 	size = 0;
-	checked = gth_file_store_get_checked (file_store);
-	for (scan = checked; scan; scan = scan->next) {
+	for (scan = file_list; scan; scan = scan->next) {
 		GthFileData *file_data = scan->data;
 
 		size += g_file_info_get_size (file_data->info);
-		n_checked += 1;
+		n_selected += 1;
 	}
 	ssize = g_format_size_for_display (size);
-	status = g_strdup_printf (_("Files: %d (%s)"), n_checked, ssize);
+	/* translators: %d is the number of files, %s the total size */
+	status = g_strdup_printf (_("Files to import: %d (%s)"), n_selected, ssize);
 	gtk_label_set_text (GTK_LABEL (GET_WIDGET ("status_label")), status);
 
 	g_free (status);
 	g_free (ssize);
+
+	_g_object_list_unref (file_list);
+	_gtk_tree_path_list_free (selected);
 }
 
 
@@ -264,6 +288,14 @@ file_store_changed_cb (GthFileStore *file_store,
 
 
 static void
+file_view_selection_changed_cb (GtkIconView *iconview,
+				DialogData  *data)
+{
+	update_status (data);
+}
+
+
+static void
 list_ready_cb (GList    *files,
 	       GError   *error,
 	       gpointer  user_data)
@@ -455,50 +487,6 @@ filter_combobox_changed_cb (GtkComboBox *widget,
 }
 
 
-static void
-select_all_button_clicked_cb (GtkButton  *button,
-			      DialogData *data)
-{
-	GthFileStore *file_store;
-	GtkTreeIter   iter;
-
-	file_store = (GthFileStore *) gth_file_view_get_model (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (data->file_list))));
-	if (gth_file_store_get_first (file_store, &iter)) {
-		do {
-			gth_file_store_queue_set (file_store,
-						  &iter,
-						  GTH_FILE_STORE_CHECKED_COLUMN, TRUE,
-						  -1);
-		}
-		while (gth_file_store_get_next (file_store, &iter));
-
-		gth_file_store_exec_set (file_store);
-	}
-}
-
-
-static void
-select_none_button_clicked_cb (GtkButton  *button,
-			       DialogData *data)
-{
-	GthFileStore *file_store;
-	GtkTreeIter   iter;
-
-	file_store = (GthFileStore *) gth_file_view_get_model (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (data->file_list))));
-	if (gth_file_store_get_first (file_store, &iter)) {
-		do {
-			gth_file_store_queue_set (file_store,
-						  &iter,
-						  GTH_FILE_STORE_CHECKED_COLUMN, FALSE,
-						  -1);
-		}
-		while (gth_file_store_get_next (file_store, &iter));
-
-		gth_file_store_exec_set (file_store);
-	}
-}
-
-
 static GthFileData *
 create_example_file_data (void)
 {
@@ -676,7 +664,7 @@ dlg_photo_importer (GthBrowser *browser,
 
 	/*gtk_label_set_mnemonic_widget (GTK_LABEL (GET_WIDGET ("subfolder_label")), data->subfolder_type_list);*/
 
-	data->file_list = gth_file_list_new (GTH_FILE_LIST_TYPE_SELECTOR);
+	data->file_list = gth_file_list_new (GTH_FILE_LIST_TYPE_NORMAL);
 	sort_type = gth_main_get_sort_type ("file::mtime");
 	gth_file_list_set_sort_func (GTH_FILE_LIST (data->file_list), sort_type->cmp_func, FALSE);
 	gth_file_list_enable_thumbs (GTH_FILE_LIST (data->file_list), TRUE);
@@ -762,6 +750,7 @@ dlg_photo_importer (GthBrowser *browser,
 	gtk_label_set_mnemonic_widget (GTK_LABEL (GET_WIDGET ("tags_label")), data->tags_entry);
 
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("delete_checkbutton")), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_DELETE, FALSE));
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("overwrite_checkbutton")), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_OVERWRITE, FALSE));
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("adjust_orientation_checkbutton")), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_ADJUST_ORIENTATION, TRUE));
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_subfolder_checkbutton")), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_SUBFOLDER_SINGLE, TRUE));
 	subfolder_type = eel_gconf_get_enum (PREF_PHOTO_IMPORT_SUBFOLDER_TYPE, GTH_TYPE_SUBFOLDER_TYPE, GTH_SUBFOLDER_TYPE_FILE_DATE);
@@ -793,21 +782,13 @@ dlg_photo_importer (GthBrowser *browser,
 			  "changed",
 			  G_CALLBACK (filter_combobox_changed_cb),
 			  data);
-	g_signal_connect (GET_WIDGET ("select_all_button"),
-			  "clicked",
-			  G_CALLBACK (select_all_button_clicked_cb),
-			  data);
-	g_signal_connect (GET_WIDGET ("select_none_button"),
-			  "clicked",
-			  G_CALLBACK (select_none_button_clicked_cb),
-			  data);
 	g_signal_connect (gth_file_view_get_model (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (data->file_list)))),
 			  "visibility_changed",
 			  G_CALLBACK (file_store_changed_cb),
 			  data);
-	g_signal_connect (gth_file_view_get_model (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (data->file_list)))),
-			  "check_changed",
-			  G_CALLBACK (file_store_changed_cb),
+	g_signal_connect (G_OBJECT (gth_file_list_get_view (GTH_FILE_LIST (data->file_list))),
+			  "selection_changed",
+			  G_CALLBACK (file_view_selection_changed_cb),
 			  data);
 	g_signal_connect (data->subfolder_type_list,
 			  "changed",
diff --git a/extensions/photo_importer/gth-import-task.c b/extensions/photo_importer/gth-import-task.c
index cfbe015..a0b85af 100644
--- a/extensions/photo_importer/gth-import-task.c
+++ b/extensions/photo_importer/gth-import-task.c
@@ -34,6 +34,7 @@ struct _GthImportTaskPrivate {
 	gboolean            single_subfolder;
 	char              **tags;
 	gboolean            delete_imported;
+	gboolean            overwrite_files;
 	gboolean            adjust_orientation;
 
 	gsize               tot_size;
@@ -237,22 +238,32 @@ file_info_ready_cb (GList    *files,
 		}
 	}
 
-	_g_object_unref (self->priv->destination_file);
-
 	destination_file = _g_file_get_destination (file_data->file, NULL, destination);
-	self->priv->destination_file = gth_file_data_new (destination_file, file_data->info);
-	_g_copy_file_async (file_data,
-			    destination_file,
-			    self->priv->delete_imported,
-			    G_FILE_COPY_ALL_METADATA | G_FILE_COPY_TARGET_DEFAULT_PERMS,
-			    G_PRIORITY_DEFAULT,
-			    gth_task_get_cancellable (GTH_TASK (self)),
-			    copy_progress_cb,
-			    self,
-			    copy_dialog_cb,
-			    self,
-			    copy_ready_cb,
-			    self);
+	if (self->priv->overwrite_files || ! g_file_query_exists (destination_file, NULL)) {
+		GFileCopyFlags copy_flags;
+
+		_g_object_unref (self->priv->destination_file);
+		self->priv->destination_file = gth_file_data_new (destination_file, file_data->info);
+
+		copy_flags = G_FILE_COPY_ALL_METADATA | G_FILE_COPY_TARGET_DEFAULT_PERMS;
+		if (self->priv->overwrite_files)
+			copy_flags |= G_FILE_COPY_OVERWRITE;
+
+		_g_copy_file_async (file_data,
+				    destination_file,
+				    self->priv->delete_imported,
+				    copy_flags,
+				    G_PRIORITY_DEFAULT,
+				    gth_task_get_cancellable (GTH_TASK (self)),
+				    copy_progress_cb,
+				    self,
+				    copy_dialog_cb,
+				    self,
+				    copy_ready_cb,
+				    self);
+	}
+	else
+		call_when_idle ((DataFunc) import_next_file, self);
 
 	g_object_unref (destination_file);
 	g_object_unref (destination);
@@ -361,6 +372,7 @@ gth_import_task_new (GthBrowser         *browser,
 		     gboolean            single_subfolder,
 		     char              **tags,
 		     gboolean            delete_imported,
+		     gboolean            overwrite_files,
 		     gboolean            adjust_orientation)
 {
 	GthImportTask *self;
@@ -374,6 +386,7 @@ gth_import_task_new (GthBrowser         *browser,
 	self->priv->single_subfolder = single_subfolder;
 	self->priv->tags = g_strdupv (tags);
 	self->priv->delete_imported = delete_imported;
+	self->priv->overwrite_files = overwrite_files;
 	self->priv->adjust_orientation = adjust_orientation;
 
 	return (GthTask *) self;
diff --git a/extensions/photo_importer/gth-import-task.h b/extensions/photo_importer/gth-import-task.h
index 6f5ce5e..1f89f74 100644
--- a/extensions/photo_importer/gth-import-task.h
+++ b/extensions/photo_importer/gth-import-task.h
@@ -58,6 +58,7 @@ GthTask *   gth_import_task_new                    (GthBrowser         *browser,
 						    gboolean            single_subfolder,
 						    char              **tags,
 						    gboolean            delete_imported,
+						    gboolean            overwrite_files,
 						    gboolean            adjust_orientation);
 GFile *     gth_import_task_get_file_destination   (GthFileData        *file_data,
 					            GFile              *destination,
diff --git a/extensions/photo_importer/preferences.h b/extensions/photo_importer/preferences.h
index ec44c76..9e9b3d2 100644
--- a/extensions/photo_importer/preferences.h
+++ b/extensions/photo_importer/preferences.h
@@ -46,6 +46,7 @@ typedef enum {
 #define PREF_PHOTO_IMPORT_SUBFOLDER_FORMAT   "/apps/gthumb/ext/photo_importer/subfolder_format"
 #define PREF_PHOTO_IMPORT_SUBFOLDER_SINGLE   "/apps/gthumb/ext/photo_importer/subfolder_single"
 #define PREF_PHOTO_IMPORT_DELETE             "/apps/gthumb/ext/photo_importer/delete_from_camera"
+#define PREF_PHOTO_IMPORT_OVERWRITE          "/apps/gthumb/ext/photo_importer/overwrite_files"
 #define PREF_PHOTO_IMPORT_ADJUST_ORIENTATION "/apps/gthumb/ext/photo_importer/adjust_orientation"
 
 



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