diff options
-rw-r--r-- | src/cell_explorer.c | 20 |
1 files changed, 10 insertions, 10 deletions
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; } |