aboutsummaryrefslogtreecommitdiff
path: root/src/cell_explorer.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-07-12 14:28:26 +0200
committerThomas White <taw@physics.org>2018-07-12 14:28:26 +0200
commitac0eee20f20d7624717b11f22bdfd515bd3e4ce5 (patch)
treefacb8256e40de604eedcba8773607c5e07e07984 /src/cell_explorer.c
parent10ca0fd3a600884cddebce4e639b4d12c3ce211d (diff)
cell_explorer: Fix logic for unit cell save window
Diffstat (limited to 'src/cell_explorer.c')
-rw-r--r--src/cell_explorer.c20
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;
}