diff options
author | Thomas White <taw@physics.org> | 2020-10-30 16:07:13 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-10-30 16:07:13 +0100 |
commit | 5e61ee1322a30ee505782697ff4b762dcec9b947 (patch) | |
tree | 45277a6108f9cf9e98d195b7af94de1acaa4a27a /src/crystfelmergeopts.c | |
parent | fe1e61a9c28b25c759a609d5eb4d174c7d90a5c7 (diff) |
Bring common GTK routines into separate file
Diffstat (limited to 'src/crystfelmergeopts.c')
-rw-r--r-- | src/crystfelmergeopts.c | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/src/crystfelmergeopts.c b/src/crystfelmergeopts.c index aa357235..eb5f0665 100644 --- a/src/crystfelmergeopts.c +++ b/src/crystfelmergeopts.c @@ -44,6 +44,7 @@ #include "crystfelmergeopts.h" #include "crystfelsymmetryselector.h" +#include "gtk-util-routines.h" G_DEFINE_TYPE(CrystFELMergeOpts, @@ -431,40 +432,6 @@ void crystfel_merge_opts_set_push_res(CrystFELMergeOpts *mo, } -static float get_float(GtkWidget *entry) -{ - const gchar *text; - char *rval; - float val; - text = gtk_entry_get_text(GTK_ENTRY(entry)); - errno = 0; - val = strtof(text, &rval); - if ( *rval != '\0' ) return NAN; - return val; -} - - -static unsigned int get_uint(GtkWidget *entry) -{ - const gchar *text; - char *rval; - unsigned long int val; - text = gtk_entry_get_text(GTK_ENTRY(entry)); - errno = 0; - val = strtoul(text, &rval, 10); - if ( *rval != '\0' ) { - printf("Invalid integer '%s'\n", text); - return 0; - } - return val; -} - -static int get_bool(GtkWidget *widget) -{ - return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); -} - - const char *crystfel_merge_opts_get_model(CrystFELMergeOpts *opts) { return gtk_combo_box_get_active_id(GTK_COMBO_BOX(opts->model_combo)); |