mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
7148dea827
commit
46d91acdff
1 changed files with 6 additions and 5 deletions
11
gtk-gui.c
11
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;
|
||||
|
|
Loading…
Add table
Reference in a new issue