[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: branch: master updated (1.1.2.20070818-140-g47240f8)
The branch, master has been updated
via 47240f890c2282d19a1822c280de4fac18a50e66 (commit)
from a146b68dfbffe227f3ab89af2beefb7627e26daa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
gschem/src/x_fileselect.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
=================
Commit Messages
=================
commit 47240f890c2282d19a1822c280de4fac18a50e66
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Wed Dec 12 19:19:13 2007 +0000
gschem: Warn before overwriting files. [1846593]
Also fixes a memory leak in the file save function.
:100644 100644 c23c39d... bdf8188... M gschem/src/x_fileselect.c
=========
Changes
=========
commit 47240f890c2282d19a1822c280de4fac18a50e66
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Wed Dec 12 19:19:13 2007 +0000
gschem: Warn before overwriting files. [1846593]
Also fixes a memory leak in the file save function.
diff --git a/gschem/src/x_fileselect.c b/gschem/src/x_fileselect.c
index c23c39d..bdf8188 100644
--- a/gschem/src/x_fileselect.c
+++ b/gschem/src/x_fileselect.c
@@ -274,12 +274,34 @@ x_fileselect_save (GSCHEM_TOPLEVEL *w_current)
gchar *filename =
gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+ /* If the file already exists, display a dialog box to check if
+ the user really wants to overwrite it. */
+ if ((filename != NULL) && g_file_test (filename, G_FILE_TEST_EXISTS)) {
+ GtkWidget *checkdialog =
+ gtk_message_dialog_new (GTK_WINDOW(dialog),
+ (GTK_DIALOG_MODAL |
+ GTK_DIALOG_DESTROY_WITH_PARENT),
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ _("The selected file `%s' already exists.\n\n"
+ "Would you like to overwrite it?"),
+ filename);
+ gtk_window_set_title (GTK_WINDOW (checkdialog), _("Overwrite file?"));
+ if (gtk_dialog_run (GTK_DIALOG (checkdialog)) != GTK_RESPONSE_YES) {
+ s_log_message (_("Save cancelled on user request\n"));
+ g_free (filename);
+ filename = NULL;
+ }
+ gtk_widget_destroy (checkdialog);
+ }
/* try saving current page of toplevel to file filename */
if (filename != NULL) {
x_window_save_page (w_current,
w_current->toplevel->page_current,
filename);
}
+
+ g_free (filename);
}
gtk_widget_destroy (dialog);
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs