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=339f1956cc72;hp=019332eabad85ab651288a9443bdf26f04303bda;hpb=6f3865480503c571963d8a2d1af858a4d72d4e88;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-binomial.c b/src/ui/gui/psppire-dialog-action-binomial.c index 019332eaba..648e6e551d 100644 --- a/src/ui/gui/psppire-dialog-action-binomial.c +++ b/src/ui/gui/psppire-dialog-action-binomial.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2012 Free Software Foundation + Copyright (C) 2012, 2014 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,8 @@ #include "psppire-dialog-action-binomial.h" #include "psppire-value-entry.h" +#include + #include "dialog-common.h" #include "helper.h" #include @@ -27,7 +29,6 @@ #include "psppire-dialog.h" #include "builder-wrapper.h" -#include "checkbox-treeview.h" #include "psppire-dict.h" #include "libpspp/str.h" @@ -52,7 +53,7 @@ get_proportion (PsppireDialogActionBinomial *act, double *prop) if (endptr == text) return FALSE; - return TRUE; + return TRUE; } static gboolean @@ -66,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) @@ -95,8 +96,8 @@ 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); @@ -113,25 +114,20 @@ psppire_dialog_action_binomial_activate (GtkAction *a) act->cutpoint_entry = get_widget_assert (xml, "cutpoint-entry"); act->cutpoint_button = get_widget_assert (xml, "radiobutton4"); - g_object_unref (xml); - - g_signal_connect (act->cutpoint_button, "toggled", G_CALLBACK (set_sensitivity_from_toggle), act->cutpoint_entry); 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; @@ -141,14 +137,14 @@ generate_syntax (PsppireDialogAction *a) ds_init_cstr (&str, "NPAR TEST\n\t/BINOMIAL"); - if ( get_proportion (scd, &prop)) - ds_put_c_format (&str, "(%g)", 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); @@ -166,9 +162,7 @@ generate_syntax (PsppireDialogAction *a) static void psppire_dialog_action_binomial_class_init (PsppireDialogActionBinomialClass *class) { - GtkActionClass *action_class = GTK_ACTION_CLASS (class); - - action_class->activate = 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; }