/* 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
#include "psppire-dialog-action-oneway.h"
+#include <float.h>
+
#include "psppire-var-view.h"
#include "psppire-acr.h"
static char *
-generate_syntax (PsppireDialogAction *act)
+generate_syntax (const PsppireDialogAction *act)
{
PsppireDialogActionOneway *ow = PSPPIRE_DIALOG_ACTION_ONEWAY (act);
gchar *text;
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);
}
}
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);
}
-
-
-static void
-psppire_dialog_action_oneway_activate (GtkAction *a)
+static GtkBuilder *
+psppire_dialog_action_oneway_activate (PsppireDialogAction *a, GVariant *param)
{
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionOneway *act = PSPPIRE_DIALOG_ACTION_ONEWAY (a);
- GtkBuilder *xml = builder_new ("oneway.ui");
+ GtkBuilder *xml = builder_new ( "oneway.ui");
+
GtkWidget *contrasts_button =
get_widget_assert (xml, "contrasts-button");
GtkEntry *entry = GTK_ENTRY (get_widget_assert (xml, "entry1"));
act->homogeneity = get_widget_assert (xml, "checkbutton2");
act->contrasts_dialog = get_widget_assert (xml, "contrasts-dialog");
-
+
act->next = get_widget_assert (xml, "next-button");
act->prev = get_widget_assert (xml, "prev-button");
act->ctotal = get_widget_assert (xml, "entry2");
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);
+ return xml;
}
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_CLASS (class)->initial_activate = psppire_dialog_action_oneway_activate;
PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
}