X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-factor.c;h=4c5d927e287cbb57eb2c210ceb47b47d7c6525b7;hb=8180c5dd1591446174c0753ee960921786113403;hp=2c6b3e63b3882dbebe273838e1e2cfc84ce94d41;hpb=6f3865480503c571963d8a2d1af858a4d72d4e88;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-factor.c b/src/ui/gui/psppire-dialog-action-factor.c index 2c6b3e63b3..4c5d927e28 100644 --- a/src/ui/gui/psppire-dialog-action-factor.c +++ b/src/ui/gui/psppire-dialog-action-factor.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation + Copyright (C) 2009, 2010, 2011, 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 @@ -19,6 +19,8 @@ #include "psppire-dialog-action-factor.h" +#include + #include "psppire-var-view.h" #include "dialog-common.h" #include "psppire-selector.h" @@ -36,7 +38,7 @@ static void psppire_dialog_action_factor_class_init (PsppireDialogActionFac G_DEFINE_TYPE (PsppireDialogActionFactor, psppire_dialog_action_factor, PSPPIRE_TYPE_DIALOG_ACTION); -static const char *rot_method_syntax[] = +static const char *rot_method_syntax[] = { "NOROTATE", "VARIMAX", @@ -54,7 +56,7 @@ on_extract_toggle (GtkToggleButton *button, PsppireDialogActionFactor *f) } static char * -generate_syntax (PsppireDialogAction *act) +generate_syntax (const PsppireDialogAction *act) { PsppireDialogActionFactor *rd = PSPPIRE_DIALOG_ACTION_FACTOR (act); @@ -71,7 +73,8 @@ generate_syntax (PsppireDialogAction *act) if ( rd->extraction.explicit_nfactors ) ds_put_c_format (&str, "FACTORS (%d)", rd->extraction.n_factors); else - ds_put_c_format (&str, "MINEIGEN (%g)", rd->extraction.mineigen); + ds_put_c_format (&str, "MINEIGEN (%.*g)", + DBL_DIG + 1, rd->extraction.mineigen); /* The CRITERIA = ITERATE subcommand is overloaded. @@ -102,7 +105,7 @@ generate_syntax (PsppireDialogAction *act) ds_put_cstr (&str, "\n\t/PRINT = "); ds_put_cstr (&str, "INITIAL "); - if ( rd->extraction.unrotated ) + if ( rd->extraction.unrotated ) ds_put_cstr (&str, "EXTRACTION "); if ( rd->rotation.rotated_solution ) @@ -130,7 +133,7 @@ load_rotation_parameters (PsppireDialogActionFactor *fd, const struct rotation_p { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fd->display_rotated_solution), p->rotated_solution); - + gtk_spin_button_set_value (GTK_SPIN_BUTTON (fd->rotate_iterations), p->iterations); @@ -181,7 +184,7 @@ load_extraction_parameters (PsppireDialogActionFactor *fd, const struct extracti gtk_combo_box_set_active (GTK_COMBO_BOX (fd->extraction_combo), 1); else gtk_combo_box_set_active (GTK_COMBO_BOX (fd->extraction_combo), 0); - + } static gboolean @@ -290,15 +293,15 @@ run_rotations_subdialog (PsppireDialogActionFactor *act) } } -static void -psppire_dialog_action_factor_activate (GtkAction *a) +static GtkBuilder * +psppire_dialog_action_factor_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); PsppireDialogActionFactor *act = PSPPIRE_DIALOG_ACTION_FACTOR (a); GtkWidget *extraction_button ; GtkWidget *rotation_button ; - GtkBuilder *xml = builder_new ("factor.ui"); + GtkBuilder *xml = builder_new ( "factor.ui"); pda->dialog = get_widget_assert (xml, "factor-dialog"); pda->source = get_widget_assert (xml, "dict-view"); @@ -356,19 +359,16 @@ psppire_dialog_action_factor_activate (GtkAction *a) G_CALLBACK (run_extractions_subdialog), act); g_signal_connect_swapped (rotation_button, "clicked", G_CALLBACK (run_rotations_subdialog), act); - psppire_dialog_action_set_valid_predicate (pda, (void *) dialog_state_valid); psppire_dialog_action_set_refresh (pda, dialog_refresh); - PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_factor_parent_class)->activate (pda); - - g_object_unref (xml); + return xml; } static void psppire_dialog_action_factor_class_init (PsppireDialogActionFactorClass *class) { - GTK_ACTION_CLASS (class)->activate = psppire_dialog_action_factor_activate; + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_factor_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; }