X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-binomial.c;h=648e6e551d4c1c85ac35faf3e590046839273522;hb=33cdbdf7e095370cf04240eed21344205a487191;hp=0f63e0652f8c3ba0db4b25c7f302ea34e31b39a8;hpb=fc6620099bbc53762095569d5356b67a81a85402;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-binomial.c b/src/ui/gui/psppire-dialog-action-binomial.c index 0f63e0652f..648e6e551d 100644 --- a/src/ui/gui/psppire-dialog-action-binomial.c +++ b/src/ui/gui/psppire-dialog-action-binomial.c @@ -53,7 +53,7 @@ get_proportion (PsppireDialogActionBinomial *act, double *prop) if (endptr == text) return FALSE; - return TRUE; + return TRUE; } static gboolean @@ -67,10 +67,10 @@ dialog_state_valid (gpointer data) GtkTreeIter notused; - if ( !gtk_tree_model_get_iter_first (vars, ¬used) ) + if (!gtk_tree_model_get_iter_first (vars, ¬used)) return FALSE; - if ( ! get_proportion (act, &prop)) + if (! get_proportion (act, &prop)) return FALSE; if (prop < 0 || prop > 1.0) @@ -96,19 +96,13 @@ refresh (PsppireDialogAction *da) } -static void -psppire_dialog_action_binomial_activate (GtkAction *a) +static GtkBuilder * +psppire_dialog_action_binomial_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionBinomial *act = PSPPIRE_DIALOG_ACTION_BINOMIAL (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_pointer (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("binomial.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ("binomial.ui"); pda->dialog = get_widget_assert (xml, "binomial-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -126,16 +120,14 @@ psppire_dialog_action_binomial_activate (GtkAction *a) psppire_dialog_action_set_refresh (pda, refresh); psppire_dialog_action_set_valid_predicate (pda, - dialog_state_valid); - - if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_binomial_parent_class)->activate) - PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_binomial_parent_class)->activate (pda); + dialog_state_valid); + return xml; } static char * -generate_syntax (PsppireDialogAction *a) +generate_syntax (const PsppireDialogAction *a) { PsppireDialogActionBinomial *scd = PSPPIRE_DIALOG_ACTION_BINOMIAL (a); gchar *text = NULL; @@ -145,14 +137,14 @@ generate_syntax (PsppireDialogAction *a) ds_init_cstr (&str, "NPAR TEST\n\t/BINOMIAL"); - if ( get_proportion (scd, &prop)) + if (get_proportion (scd, &prop)) ds_put_c_format (&str, "(%.*g)", DBL_DIG + 1, prop); ds_put_cstr (&str, " ="); psppire_var_view_append_names_str (PSPPIRE_VAR_VIEW (scd->var_view), 0, &str); - if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->cutpoint_button))) + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scd->cutpoint_button))) { const gchar *cutpoint = gtk_entry_get_text (GTK_ENTRY (scd->cutpoint_entry)); ds_put_c_format (&str, "(%s)", cutpoint); @@ -170,7 +162,7 @@ generate_syntax (PsppireDialogAction *a) static void psppire_dialog_action_binomial_class_init (PsppireDialogActionBinomialClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_binomial_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_binomial_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; }