X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-frequencies.c;h=c987e5ee903b1b5c20162ec64f9de732841f5695;hb=0f447caa885d8f0fd8c30d4440556d9b6abb99ea;hp=7b69c8efa94588046227a0c920114a47f268fde3;hpb=ed208cf009043f0bf319a4e919c279d5b1401f36;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-frequencies.c b/src/ui/gui/psppire-dialog-action-frequencies.c index 7b69c8efa9..c987e5ee90 100644 --- a/src/ui/gui/psppire-dialog-action-frequencies.c +++ b/src/ui/gui/psppire-dialog-action-frequencies.c @@ -251,112 +251,98 @@ refresh (PsppireDialogAction * fdx) (B_FS_DEFAULT & (1u << i)) ? true : false, -1); } - - -static void -psppire_dialog_action_frequencies_activate (GtkAction * a) +static GtkBuilder * +psppire_dialog_action_frequencies_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionFrequencies *act = PSPPIRE_DIALOG_ACTION_FREQUENCIES (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_hash_table (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("frequencies.ui"); - g_hash_table_insert (thing, a, xml); - - GtkWidget *stats_treeview = get_widget_assert (xml, "stats-treeview"); + GtkBuilder *xml = builder_new ( "frequencies.ui"); - psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (stats_treeview), - B_FS_DEFAULT, N_FREQUENCY_STATS, stats); + GtkWidget *stats_treeview = get_widget_assert (xml, "stats-treeview"); - act->stats = gtk_tree_view_get_model (GTK_TREE_VIEW (stats_treeview)); + psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (stats_treeview), + B_FS_DEFAULT, N_FREQUENCY_STATS, stats); - GtkWidget *tables_button = get_widget_assert (xml, "tables-button"); - GtkWidget *charts_button = get_widget_assert (xml, "charts-button"); + act->stats = gtk_tree_view_get_model (GTK_TREE_VIEW (stats_treeview)); - pda->dialog = get_widget_assert (xml, "frequencies-dialog"); - pda->source = get_widget_assert (xml, "dict-treeview"); + GtkWidget *tables_button = get_widget_assert (xml, "tables-button"); + GtkWidget *charts_button = get_widget_assert (xml, "charts-button"); - act->stat_vars = get_widget_assert (xml, "var-treeview"); + pda->dialog = get_widget_assert (xml, "frequencies-dialog"); + pda->source = get_widget_assert (xml, "dict-treeview"); + act->stat_vars = get_widget_assert (xml, "var-treeview"); - act->include_missing = get_widget_assert (xml, "include_missing"); + act->include_missing = get_widget_assert (xml, "include_missing"); + act->tables_dialog = get_widget_assert (xml, "tables-dialog"); + act->charts_dialog = get_widget_assert (xml, "charts-dialog"); + act->always = get_widget_assert (xml, "always"); + act->never = get_widget_assert (xml, "never"); + act->limit = get_widget_assert (xml, "limit"); + act->limit_spinbutton = get_widget_assert (xml, "limit-spin"); + g_signal_connect (act->limit, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), + act->limit_spinbutton); - act->tables_dialog = get_widget_assert (xml, "tables-dialog"); - act->charts_dialog = get_widget_assert (xml, "charts-dialog"); - act->always = get_widget_assert (xml, "always"); - act->never = get_widget_assert (xml, "never"); - act->limit = get_widget_assert (xml, "limit"); - act->limit_spinbutton = get_widget_assert (xml, "limit-spin"); + act->avalue = get_widget_assert (xml, "avalue"); + act->dvalue = get_widget_assert (xml, "dvalue"); + act->afreq = get_widget_assert (xml, "afreq"); + act->dfreq = get_widget_assert (xml, "dfreq"); - g_signal_connect (act->limit, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), - act->limit_spinbutton); + act->charts_opts_use_min = false; + act->charts_opts_min = 0; + act->charts_opts_use_max = false; + act->charts_opts_max = 100; + act->charts_opts_draw_hist = false; + act->charts_opts_draw_normal = false; + act->charts_opts_scale = FRQ_FREQ; + act->charts_opts_draw_pie = false; + act->charts_opts_draw_bar = false; + act->charts_opts_pie_include_missing = false; - act->avalue = get_widget_assert (xml, "avalue"); - act->dvalue = get_widget_assert (xml, "dvalue"); - act->afreq = get_widget_assert (xml, "afreq"); - act->dfreq = get_widget_assert (xml, "dfreq"); + act->freqs = get_widget_assert (xml, "freqs"); + act->percents = get_widget_assert (xml, "percents"); - act->charts_opts_use_min = false; - act->charts_opts_min = 0; - act->charts_opts_use_max = false; - act->charts_opts_max = 100; - act->charts_opts_draw_hist = false; - act->charts_opts_draw_normal = false; - act->charts_opts_scale = FRQ_FREQ; - act->charts_opts_draw_pie = false; - act->charts_opts_draw_bar = false; - act->charts_opts_pie_include_missing = false; + act->min = get_widget_assert (xml, "min"); + act->min_spin = get_widget_assert (xml, "min-spin"); + g_signal_connect (act->min, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), act->min_spin); + act->max = get_widget_assert (xml, "max"); + act->max_spin = get_widget_assert (xml, "max-spin"); + g_signal_connect (act->max, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), act->max_spin); - act->freqs = get_widget_assert (xml, "freqs"); - act->percents = get_widget_assert (xml, "percents"); + act->hist = get_widget_assert (xml, "hist"); + act->normal = get_widget_assert (xml, "normal"); + g_signal_connect (act->hist, "toggled", + G_CALLBACK (set_sensitivity_from_toggle), act->normal); - act->min = get_widget_assert (xml, "min"); - act->min_spin = get_widget_assert (xml, "min-spin"); - g_signal_connect (act->min, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), act->min_spin); - act->max = get_widget_assert (xml, "max"); - act->max_spin = get_widget_assert (xml, "max-spin"); - g_signal_connect (act->max, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), act->max_spin); + act->pie = (get_widget_assert (xml, "pie")); + act->pie_include_missing = get_widget_assert (xml, "pie-include-missing"); - act->hist = get_widget_assert (xml, "hist"); - act->normal = get_widget_assert (xml, "normal"); - g_signal_connect (act->hist, "toggled", - G_CALLBACK (set_sensitivity_from_toggle), act->normal); + act->bar = (get_widget_assert (xml, "bar")); - act->pie = (get_widget_assert (xml, "pie")); - act->pie_include_missing = get_widget_assert (xml, "pie-include-missing"); + act->tables_opts_order = FRQ_AVALUE; + act->tables_opts_table = FRQ_TABLE; + act->tables_opts_limit = 50; - act->bar = (get_widget_assert (xml, "bar")); + g_signal_connect_swapped (tables_button, "clicked", + G_CALLBACK (on_tables_clicked), act); - act->tables_opts_order = FRQ_AVALUE; - act->tables_opts_table = FRQ_TABLE; - act->tables_opts_limit = 50; + g_signal_connect_swapped (charts_button, "clicked", + G_CALLBACK (on_charts_clicked), act); - g_signal_connect_swapped (tables_button, "clicked", - G_CALLBACK (on_tables_clicked), act); + psppire_dialog_action_set_refresh (pda, refresh); - g_signal_connect_swapped (charts_button, "clicked", - G_CALLBACK (on_charts_clicked), act); + psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid); - 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_frequencies_parent_class)->activate) - PSPPIRE_DIALOG_ACTION_CLASS - (psppire_dialog_action_frequencies_parent_class)->activate (pda); + return xml; } static char * -generate_syntax (PsppireDialogAction * a) +generate_syntax (const PsppireDialogAction * a) { PsppireDialogActionFrequencies *fd = PSPPIRE_DIALOG_ACTION_FREQUENCIES (a); gchar *text = NULL; @@ -468,6 +454,8 @@ generate_syntax (PsppireDialogAction * a) if (fd->charts_opts_pie_include_missing) ds_put_cstr (&str, " MISSING"); + else + ds_put_cstr (&str, " NOMISSING"); if (fd->charts_opts_use_min) ds_put_c_format (&str, " MIN(%.15g)", fd->charts_opts_min); @@ -502,12 +490,12 @@ generate_syntax (PsppireDialogAction * a) static void psppire_dialog_action_frequencies_class_init (PsppireDialogActionFrequenciesClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_frequencies_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_frequencies_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } static void -psppire_dialog_action_frequencies_init (PsppireDialogActionFrequencies * act) +psppire_dialog_action_frequencies_init (PsppireDialogActionFrequencies *act) { }