diff options
-rw-r--r-- | src/gui_peaksearch.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/gui_peaksearch.c b/src/gui_peaksearch.c index 97df46b4..93afbbe1 100644 --- a/src/gui_peaksearch.c +++ b/src/gui_peaksearch.c @@ -158,6 +158,14 @@ static void int_param_callback(GtkWidget *entry, } +static void int_param_focus_callback(GtkWidget *entry, + GdkEvent *event, + struct param_callback_vals *cbvals) +{ + int_param_callback(entry, cbvals); +} + + static void float_param_callback(GtkWidget *entry, struct param_callback_vals *cbvals) { @@ -176,6 +184,14 @@ static void float_param_callback(GtkWidget *entry, } +static void float_param_focus_callback(GtkWidget *entry, + GdkEvent *event, + struct param_callback_vals *cbvals) +{ + float_param_callback(entry, cbvals); +} + + static void free_callback_params(gpointer cbvals, GClosure *closure) { @@ -209,9 +225,14 @@ static void add_int_param(GtkWidget *params_box, const char *labeltext, if ( cbvals != NULL ) { cbvals->proj = proj; cbvals->pival = pval; - g_signal_connect_data(G_OBJECT(entry), "activate", + g_signal_connect_data(G_OBJECT(entry), + "activate", G_CALLBACK(int_param_callback), cbvals, free_callback_params, 0); + g_signal_connect(G_OBJECT(entry), + "focus-out-event", + G_CALLBACK(int_param_focus_callback), + cbvals); } else { ERROR("Failed to connect parameter callback\n"); } @@ -244,9 +265,15 @@ static void add_float_param(GtkWidget *params_box, const char *labeltext, if ( cbvals != NULL ) { cbvals->proj = proj; cbvals->pfval = pval; - g_signal_connect_data(G_OBJECT(entry), "activate", + g_signal_connect_data(G_OBJECT(entry), + "activate", G_CALLBACK(float_param_callback), cbvals, free_callback_params, 0); + g_signal_connect(G_OBJECT(entry), + "focus-out-event", + G_CALLBACK(float_param_focus_callback), + cbvals); + } else { ERROR("Failed to connect parameter callback\n"); } @@ -386,14 +413,13 @@ static void peaksearch_algo_changed(GtkWidget *combo, static void peaksearch_response_sig(GtkWidget *dialog, gint resp, struct crystfelproject *proj) { - if ( (resp == GTK_RESPONSE_DELETE_EVENT) || (resp == GTK_RESPONSE_CANCEL) ) { proj->peak_search_params = proj->original_params; - update_peaks(proj); } + update_peaks(proj); gtk_widget_destroy(dialog); proj->peak_vbox = NULL; proj->peak_params = NULL; |