Author: post
Date: 2010-12-28 22:03:49 +0100 (Tue, 28 Dec 2010)
New Revision: 3703

Modified:
   trunk/src/rs-save-dialog.c
Log:
Export As: Ask whether to overwrite existing files.

Modified: trunk/src/rs-save-dialog.c
===================================================================
--- trunk/src/rs-save-dialog.c  2010-12-28 20:46:01 UTC (rev 3702)
+++ trunk/src/rs-save-dialog.c  2010-12-28 21:03:49 UTC (rev 3703)
@@ -377,6 +377,19 @@
        gchar *filename = 
gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog->chooser));
        if (filename)
        {
+               if (g_file_test(filename, G_FILE_TEST_EXISTS))
+               {
+                       GtkWidget *q_dialog;
+                       q_dialog = gtk_message_dialog_new ( GTK_WINDOW(dialog), 
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, 
_("Overwrite File?"));
+                       gtk_message_dialog_format_secondary_text 
(GTK_MESSAGE_DIALOG(q_dialog), _("The file '%s' already exists.\n\nDo you want 
to overwrite the file?"), filename);
+                       gint response = gtk_dialog_run ( GTK_DIALOG ( q_dialog 
) );
+                       gtk_widget_destroy ( q_dialog );
+                       if (GTK_RESPONSE_YES != response)
+                       {
+                               g_free(filename);
+                               return;
+                       }
+               }
                gchar *dirname = g_path_get_dirname(filename);
                rs_conf_set_string(CONF_EXPORT_AS_FOLDER, dirname);
                g_free(filename);


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to