From ac0eee20f20d7624717b11f22bdfd515bd3e4ce5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 12 Jul 2018 14:28:26 +0200 Subject: cell_explorer: Fix logic for unit cell save window --- src/cell_explorer.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/cell_explorer.c b/src/cell_explorer.c index f58423c7..a48ab9b5 100644 --- a/src/cell_explorer.c +++ b/src/cell_explorer.c @@ -1181,8 +1181,8 @@ static int write_cell_to_file(UnitCell *cell, const char *filename) static gint savecell_sig(GtkWidget *widget, CellWindow *w) { GtkWidget *d; - gchar *output_filename; UnitCell *cell; + gint r; cell = get_cell(w); if ( cell == NULL ) return FALSE; @@ -1195,19 +1195,19 @@ static gint savecell_sig(GtkWidget *widget, CellWindow *w) NULL); gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(d), TRUE); + r = gtk_dialog_run(GTK_DIALOG(d)); + if ( r == GTK_RESPONSE_ACCEPT ) { - if ( gtk_dialog_run(GTK_DIALOG(d)) == GTK_RESPONSE_CANCEL ) { - gtk_widget_destroy(d); - return FALSE; - } - output_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(d)); + gchar *output_filename; - if ( write_cell_to_file(cell, output_filename) ) { - error_box(w, "Failed to save unit cell"); - } + output_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(d)); + if ( write_cell_to_file(cell, output_filename) ) { + error_box(w, "Failed to save unit cell"); + } + g_free(output_filename); + } gtk_widget_destroy(d); - g_free(output_filename); return FALSE; } -- cgit v1.2.3