summaryrefslogtreecommitdiffstats
path: root/gtk-gui.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-16 05:01:25 -0400
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-17 21:03:30 -0400
commit46d91acdffd9a7d9d54fce5d72a07bfc62100b02 (patch)
tree4e63da1602eaa87a2a512e1769587ab01ad12362 /gtk-gui.c
parent7148dea82795b81311c46dfb11d09c8fa2b13452 (diff)
downloadsubsurface-46d91acdffd9a7d9d54fce5d72a07bfc62100b02.tar.gz
Don't close existing data file in file_open if user cancels
This logic seems to make much more sense - if the user hits 'OK' then the old file is closed and the new one openened. Otherwise, leave things unchanged. Reported-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'gtk-gui.c')
-rw-r--r--gtk-gui.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gtk-gui.c b/gtk-gui.c
index 9b15cb4ee..27bf30cc4 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -286,11 +286,6 @@ static void file_open(GtkWidget *w, gpointer data)
GtkFileFilter *filter;
const char *current_default;
- /* first, close the existing file, if any, and forget its name */
- file_close(w, data);
- free((void *)existing_filename);
- existing_filename = NULL;
-
dialog = gtk_file_chooser_dialog_new("Open File",
GTK_WINDOW(main_window),
GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -308,6 +303,12 @@ static void file_open(GtkWidget *w, gpointer data)
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
GSList *filenames, *fn_glist;
char *filename;
+
+ /* first, close the existing file, if any, and forget its name */
+ file_close(w, data);
+ free((void *)existing_filename);
+ existing_filename = NULL;
+
filenames = fn_glist = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(dialog));
GError *error = NULL;