aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-07-02 09:20:50 +0200
committerThomas White <taw@physics.org>2020-07-29 18:53:44 +0200
commitcd6ff3ac79dfd5f421adf29afab3388b347a70fb (patch)
tree2d86bc0b720a0dbf40c46a15b182bc3d18dc1f58 /src
parent226c51876c243a566f491f1b887bd503127c78de (diff)
Fix order of operations when loading data
Retains the old configuration if the geometry file is bad Avoids trying to load old images with new DataTemplate
Diffstat (limited to 'src')
-rw-r--r--src/crystfel_gui.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index f1c441e6..c83cfbec 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -237,23 +237,30 @@ static void finddata_response_sig(GtkWidget *dialog, gint resp,
geom_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(ctx->geom_file));
if ( geom_filename == NULL ) return;
+
+ top = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(ctx->top_folder));
+ if ( top == NULL ) return;
+
dtempl = data_template_new_from_file(geom_filename);
if ( dtempl == NULL ) return;
+
+ type_id = gtk_combo_box_get_active_id(GTK_COMBO_BOX(ctx->type_combo));
+ proj->data_search_pattern = decode_matchtype(type_id);
+
+ /* Totally clean up the old list */
+ clear_project_files(proj);
+ crystfel_image_view_set_image(CRYSTFEL_IMAGE_VIEW(proj->imageview),
+ NULL, NULL);
+
free(proj->geom_filename);
proj->geom_filename = geom_filename;
- crystfel_image_view_set_datatemplate(CRYSTFEL_IMAGE_VIEW(proj->imageview),
- dtempl);
- top = gtk_file_chooser_get_file(GTK_FILE_CHOOSER(ctx->top_folder));
- if ( top == NULL ) return;
free(proj->data_top_folder);
proj->data_top_folder = g_file_get_path(top);
- /* Totally clean up the old list */
- clear_project_files(proj);
+ crystfel_image_view_set_datatemplate(CRYSTFEL_IMAGE_VIEW(proj->imageview),
+ dtempl);
- type_id = gtk_combo_box_get_active_id(GTK_COMBO_BOX(ctx->type_combo));
- proj->data_search_pattern = decode_matchtype(type_id);
add_files(proj, top, proj->data_search_pattern, dtempl);
g_object_unref(top);