aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/crystfel_gui.c26
-rw-r--r--src/gui_project.c26
-rw-r--r--src/gui_project.h2
3 files changed, 28 insertions, 26 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index 6838dcf8..9718e9f5 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -96,32 +96,6 @@ static void update_imageview(struct crystfelproject *proj)
}
-static int match_filename(const char *fn, enum match_type_id mt)
-{
- const char *ext = NULL;
- const char *ext2 = NULL;
-
- if ( mt == MATCH_EVERYTHING ) return 1;
-
- ext = filename_extension(fn, &ext2);
- if ( ext == NULL ) return 0;
-
- if ( mt == MATCH_CHEETAH_LCLS_H5 ) {
- return ((strcmp(ext, ".h5")==0)
- && (strncmp(fn, "LCLS", 4)==0));
- }
- if ( mt == MATCH_CHEETAH_CXI ) return strcmp(ext, ".cxi")==0;
- if ( mt == MATCH_CBF ) return strcmp(ext, ".cbf")==0;
- if ( mt == MATCH_CBFGZ ) {
- if ( ext2 != NULL ) {
- return strcmp(ext2, ".cbf.gz")==0;
- }
- }
-
- return 0;
-}
-
-
static void add_files(struct crystfelproject *proj, GFile *folder,
enum match_type_id type)
{
diff --git a/src/gui_project.c b/src/gui_project.c
index 4effc603..fcfce995 100644
--- a/src/gui_project.c
+++ b/src/gui_project.c
@@ -89,6 +89,32 @@ enum match_type_id decode_matchtype(const char *type_id)
}
+int match_filename(const char *fn, enum match_type_id mt)
+{
+ const char *ext = NULL;
+ const char *ext2 = NULL;
+
+ if ( mt == MATCH_EVERYTHING ) return 1;
+
+ ext = filename_extension(fn, &ext2);
+ if ( ext == NULL ) return 0;
+
+ if ( mt == MATCH_CHEETAH_LCLS_H5 ) {
+ return ((strcmp(ext, ".h5")==0)
+ && (strncmp(fn, "LCLS", 4)==0));
+ }
+ if ( mt == MATCH_CHEETAH_CXI ) return strcmp(ext, ".cxi")==0;
+ if ( mt == MATCH_CBF ) return strcmp(ext, ".cbf")==0;
+ if ( mt == MATCH_CBFGZ ) {
+ if ( ext2 != NULL ) {
+ return strcmp(ext2, ".cbf.gz")==0;
+ }
+ }
+
+ return 0;
+}
+
+
static void handle_var(const char *key, const char *val,
struct crystfelproject *proj)
{
diff --git a/src/gui_project.h b/src/gui_project.h
index 1c99d5ce..77936f2a 100644
--- a/src/gui_project.h
+++ b/src/gui_project.h
@@ -110,6 +110,8 @@ struct crystfelproject {
extern enum match_type_id decode_matchtype(const char *type_id);
+extern int match_filename(const char *fn, enum match_type_id mt);
+
extern int load_project(struct crystfelproject *proj);
extern void add_file_to_project(struct crystfelproject *proj,