int CompressorInput::handle_event() { plugin->config.input = text_to_value(get_text()); ((CompressorWindow*)plugin->thread->window)->update(); plugin->send_configure_change(); return 1; }
/* Callback which occurs when the OK button is clicked */ static void missing_val_dialog_accept (GtkWidget *w, gpointer data) { struct missing_val_dialog *dialog = data; if ( gtk_toggle_button_get_active (dialog->button_discrete)) { gint nvals = 0; gint badvals = 0; gint i; mv_clear(&dialog->mvl); for(i = 0 ; i < 3 ; ++i ) { gchar *text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->mv[i]))); union value v; if ( !text || strlen (g_strstrip (text)) == 0 ) { g_free (text); continue; } if ( text_to_value (text, dialog->pv, &v)) { nvals++; mv_add_value (&dialog->mvl, &v); } else badvals++; g_free (text); value_destroy (&v, var_get_width (dialog->pv)); } if ( nvals == 0 || badvals > 0 ) { err_dialog (_("Incorrect value for variable type"), GTK_WINDOW (dialog->window)); return ; } } if (gtk_toggle_button_get_active (dialog->button_range)) { gchar *discrete_text ; union value low_val ; union value high_val; const gchar *low_text = gtk_entry_get_text (GTK_ENTRY (dialog->low)); const gchar *high_text = gtk_entry_get_text (GTK_ENTRY (dialog->high)); if ( text_to_value (low_text, dialog->pv, &low_val) && text_to_value (high_text, dialog->pv, &high_val)) { if ( low_val.f > high_val.f ) { err_dialog (_("Incorrect range specification"), GTK_WINDOW (dialog->window)); value_destroy (&low_val, var_get_width (dialog->pv)); value_destroy (&high_val, var_get_width (dialog->pv)); return ; } } else { err_dialog (_("Incorrect range specification"), GTK_WINDOW (dialog->window)); value_destroy (&low_val, var_get_width (dialog->pv)); value_destroy (&high_val, var_get_width (dialog->pv)); return; } discrete_text = g_strdup (gtk_entry_get_text (GTK_ENTRY (dialog->discrete))); mv_clear (&dialog->mvl); mv_add_range (&dialog->mvl, low_val.f, high_val.f); value_destroy (&low_val, var_get_width (dialog->pv)); value_destroy (&high_val, var_get_width (dialog->pv)); if ( discrete_text && strlen (g_strstrip (discrete_text)) > 0 ) { union value discrete_val; if ( !text_to_value (discrete_text, dialog->pv, &discrete_val)) { err_dialog (_("Incorrect value for variable type"), GTK_WINDOW (dialog->window) ); g_free (discrete_text); value_destroy (&discrete_val, var_get_width (dialog->pv)); return; } mv_add_value (&dialog->mvl, &discrete_val); value_destroy (&discrete_val, var_get_width (dialog->pv)); } g_free (discrete_text); } if (gtk_toggle_button_get_active (dialog->button_none)) mv_clear (&dialog->mvl); var_set_missing_values (dialog->pv, &dialog->mvl); gtk_widget_hide (dialog->window); }