diff options
author | Thomas White <taw@physics.org> | 2020-10-22 18:28:25 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-10-22 18:28:25 +0200 |
commit | 65f7ff44d6a5461f2392b644a0c4e03b550d4975 (patch) | |
tree | 5c9088a10d1cd04d6ac6ee83c60ed67e790a8656 /src/gui_backend_local.c | |
parent | 5d09bcdda5ee7bcec251051eb24ec41e3f06b650 (diff) |
Skeleton for merging via GUI
Diffstat (limited to 'src/gui_backend_local.c')
-rw-r--r-- | src/gui_backend_local.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/gui_backend_local.c b/src/gui_backend_local.c index 7a5f440e..28b6e0ec 100644 --- a/src/gui_backend_local.c +++ b/src/gui_backend_local.c @@ -45,6 +45,12 @@ struct local_indexing_opts }; +struct local_merge_opts +{ + int n_threads; +}; + + struct local_job { double frac_complete; @@ -368,6 +374,55 @@ static void read_indexing_opt(void *opts_priv, } +static void n_threads_activate_sig(GtkEntry *entry, gpointer data) +{ + struct local_merge_opts *opts = data; + convert_int(gtk_entry_get_text(entry), &opts->n_threads); +} + + +static gboolean n_threads_focus_sig(GtkEntry *entry, GdkEvent *event, + gpointer data) +{ + n_threads_activate_sig(entry, data); + return FALSE; +} + + +static GtkWidget *make_merge_parameters_widget(void *opts_priv) +{ + struct local_merge_opts *opts = opts_priv; + GtkWidget *vbox; + GtkWidget *hbox; + GtkWidget *entry; + GtkWidget *label; + char tmp[64]; + + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8); + + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8); + gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), + FALSE, FALSE, 0); + label = gtk_label_new("Number of threads:"); + gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), + FALSE, FALSE, 0); + entry = gtk_entry_new(); + snprintf(tmp, 63, "%i", opts->n_threads); + gtk_entry_set_text(GTK_ENTRY(entry), tmp); + gtk_entry_set_width_chars(GTK_ENTRY(entry), 5); + gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entry), + FALSE, FALSE, 0); + + g_signal_connect(G_OBJECT(entry), "activate", + G_CALLBACK(n_threads_activate_sig), + opts); + g_signal_connect(G_OBJECT(entry), "focus-out-event", + G_CALLBACK(n_threads_focus_sig), + opts); + return vbox; +} + + int make_local_backend(struct crystfel_backend *be) { be->name = "local"; @@ -382,5 +437,7 @@ int make_local_backend(struct crystfel_backend *be) be->write_indexing_opts = write_indexing_opts; be->read_indexing_opt = read_indexing_opt; + be->make_merge_parameters_widget = make_merge_parameters_widget; + return 0; }; |