aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-05-14 15:29:21 +0200
committerThomas White <taw@physics.org>2020-07-29 18:42:57 +0200
commite55a533d816b4a888637562d108fc9f248ed77c8 (patch)
tree7f9fc64f686b30d37e252643b57e8581b86040a8
parentd7d505fea885f0d5bb93a4bfb9f4e424d6e9f229 (diff)
Expand event list
-rw-r--r--src/crystfel_gui.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index 026d8f1a..ded5a6ee 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -124,8 +124,29 @@ static void update_imageview(struct crystfelproject *proj)
}
+static void add_all_events(struct crystfelproject *proj,
+ const char *filename,
+ const DataTemplate *dtempl)
+{
+ struct event_list *events;
+ int i;
+
+ events = image_expand_frames(dtempl, filename);
+ if ( events == NULL ) {
+ ERROR("Couldn't expand event list\n");
+ return;
+ }
+
+ for ( i=0; i<events->num_events; i++ ) {
+ add_file_to_project(proj, filename,
+ get_event_string(events->events[i]));
+ }
+}
+
+
static void add_files(struct crystfelproject *proj, GFile *folder,
- enum match_type_id type)
+ enum match_type_id type,
+ const DataTemplate *dtempl)
{
GFileEnumerator *fenum;
GFileInfo *finfo;
@@ -153,16 +174,14 @@ static void add_files(struct crystfelproject *proj, GFile *folder,
if ( g_file_info_get_file_type(finfo) == G_FILE_TYPE_DIRECTORY ) {
- add_files(proj, file, type);
+ add_files(proj, file, type, dtempl);
} else {
char *bn = g_file_get_basename(file);
if ( match_filename(bn, type) ) {
- /* FIXME: Expand events if appropriate */
- add_file_to_project(proj,
- g_file_get_path(file),
- NULL);
+ add_all_events(proj, g_file_get_path(file),
+ dtempl);
}
}
@@ -206,7 +225,7 @@ static void finddata_response_sig(GtkWidget *dialog, gint resp,
clear_project_files(proj);
type_id = gtk_combo_box_get_active_id(GTK_COMBO_BOX(proj->type_combo));
- add_files(proj, top, decode_matchtype(type_id));
+ add_files(proj, top, decode_matchtype(type_id), dtempl);
proj->unsaved = 1;
proj->cur_frame = 0;