X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-oneway.c;h=35e2d3996634eb06339ada98227764b048207f02;hb=c259b336de0870cfdb221761238c519efe094177;hp=66b80f6417e901b8b908102e573f33d0aaf557de;hpb=394b64d4075a9e3fc7037758d65ff31522a7c642;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-oneway.c b/src/ui/gui/psppire-dialog-action-oneway.c index 66b80f6417..35e2d39966 100644 --- a/src/ui/gui/psppire-dialog-action-oneway.c +++ b/src/ui/gui/psppire-dialog-action-oneway.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2012, 2013 Free Software Foundation + Copyright (C) 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-oneway.h" +#include + #include "psppire-var-view.h" #include "psppire-acr.h" @@ -89,7 +91,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); } } @@ -177,7 +179,7 @@ list_store_changed (PsppireDialogActionOneway *csd) total += v; } - text = g_strdup_printf ("%g", total); + text = g_strdup_printf ("%.*g", DBL_DIG + 1, total); gtk_entry_set_text (GTK_ENTRY (csd->ctotal), text); @@ -224,7 +226,14 @@ psppire_dialog_action_oneway_activate (GtkAction *a) PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionOneway *act = PSPPIRE_DIALOG_ACTION_ONEWAY (a); - GtkBuilder *xml = builder_new ("oneway.ui"); + GHashTable *thing = psppire_dialog_action_get_hash_table (pda); + GtkBuilder *xml = g_hash_table_lookup (thing, a); + if (!xml) + { + xml = builder_new ("oneway.ui"); + g_hash_table_insert (thing, a, xml); + } + GtkWidget *contrasts_button = get_widget_assert (xml, "contrasts-button"); GtkEntry *entry = GTK_ENTRY (get_widget_assert (xml, "entry1")); @@ -264,8 +273,6 @@ psppire_dialog_action_oneway_activate (GtkAction *a) psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); psppire_dialog_action_set_refresh (pda, refresh); - g_object_unref (xml); - if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_oneway_parent_class)->activate) PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_oneway_parent_class)->activate (pda); } @@ -273,9 +280,7 @@ psppire_dialog_action_oneway_activate (GtkAction *a) static void psppire_dialog_action_oneway_class_init (PsppireDialogActionOnewayClass *class) { - GtkActionClass *action_class = GTK_ACTION_CLASS (class); - - action_class->activate = psppire_dialog_action_oneway_activate; + psppire_dialog_action_set_activation (class, psppire_dialog_action_oneway_activate); PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; }