X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-chisquare.c;h=305d74120419ae55db6b007ab530289ec19f22f3;hb=ff50bab74c735b9e48b851080edcd1d466a83371;hp=36c68c064e42d68f0c996eafb7f3ff07530a0c57;hpb=5b246c776e802ed91e8cac6ab19dcab7e4bd9921;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-chisquare.c b/src/ui/gui/psppire-dialog-action-chisquare.c index 36c68c064e..305d741204 100644 --- a/src/ui/gui/psppire-dialog-action-chisquare.c +++ b/src/ui/gui/psppire-dialog-action-chisquare.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2010, 2011, 2012, 2013 Free Software Foundation + Copyright (C) 2010, 2011, 2012, 2013, 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 @@ -19,6 +19,8 @@ #include "psppire-dialog-action-chisquare.h" +#include + #include "psppire-var-view.h" #include "psppire-dialog.h" @@ -35,7 +37,7 @@ G_DEFINE_TYPE (PsppireDialogActionChisquare, psppire_dialog_action_chisquare, PS static char * -generate_syntax (PsppireDialogAction *act) +generate_syntax (const PsppireDialogAction *act) { PsppireDialogActionChisquare *scd = PSPPIRE_DIALOG_ACTION_CHISQUARE (act); @@ -80,7 +82,7 @@ generate_syntax (PsppireDialogAction *act) gtk_tree_model_get (GTK_TREE_MODEL (ls), &iter, 0, &v, -1); - ds_put_c_format (&dss, " %g", v); + ds_put_c_format (&dss, " %.*g", DBL_DIG + 1, v); } } @@ -127,12 +129,18 @@ refresh (PsppireDialogAction *rd_) } static void -psppire_dialog_action_chisquare_activate (GtkAction *a) +psppire_dialog_action_chisquare_activate (PsppireDialogAction *a) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionChisquare *act = PSPPIRE_DIALOG_ACTION_CHISQUARE (a); - GtkBuilder *xml = builder_new ("chi-square.ui"); + GHashTable *thing = psppire_dialog_action_get_hash_table (pda); + GtkBuilder *xml = g_hash_table_lookup (thing, a); + if (!xml) + { + xml = builder_new ("chi-square.ui"); + g_hash_table_insert (thing, a, xml); + } GtkWidget *range_table = get_widget_assert (xml, "range-table"); GtkWidget *values_acr = get_widget_assert (xml, "psppire-acr1"); @@ -157,8 +165,6 @@ psppire_dialog_action_chisquare_activate (GtkAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); - g_object_unref (xml); - g_signal_connect (act->range_button, "toggled", G_CALLBACK (set_sensitivity_from_toggle), range_table); @@ -185,9 +191,7 @@ psppire_dialog_action_chisquare_activate (GtkAction *a) static void psppire_dialog_action_chisquare_class_init (PsppireDialogActionChisquareClass *class) { - GtkActionClass *action_class = GTK_ACTION_CLASS (class); - - action_class->activate = psppire_dialog_action_chisquare_activate; + psppire_dialog_action_set_activation (class, psppire_dialog_action_chisquare_activate); PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; }