X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-dialog-action-crosstabs.c;h=6fc41de0d41bee20f0fa8388413ebc2cb2610128;hb=174fe8e41ef09534218803189529cbd797750934;hp=f6883a88041924f2835bc78bb7c60ee277557311;hpb=fc6620099bbc53762095569d5356b67a81a85402;p=pspp diff --git a/src/ui/gui/psppire-dialog-action-crosstabs.c b/src/ui/gui/psppire-dialog-action-crosstabs.c index f6883a8804..6fc41de0d4 100644 --- a/src/ui/gui/psppire-dialog-action-crosstabs.c +++ b/src/ui/gui/psppire-dialog-action-crosstabs.c @@ -51,7 +51,7 @@ dialog_state_valid (gpointer data) GtkTreeIter notused; - return (gtk_tree_model_get_iter_first (row_vars, ¬used) + return (gtk_tree_model_get_iter_first (row_vars, ¬used) && gtk_tree_model_get_iter_first (col_vars, ¬used)); } @@ -62,7 +62,7 @@ refresh (PsppireDialogAction *rd_) GtkTreeModel *liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (cd->dest_rows)); gtk_list_store_clear (GTK_LIST_STORE (liststore)); - + liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (cd->dest_cols)); gtk_list_store_clear (GTK_LIST_STORE (liststore)); } @@ -151,7 +151,7 @@ on_format_clicked (PsppireDialogActionCrosstabs *cd) ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->format_dialog)); - if ( ret == PSPPIRE_RESPONSE_CONTINUE ) + if (ret == PSPPIRE_RESPONSE_CONTINUE) { cd->format_options_avalue = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->avalue_button)); @@ -159,7 +159,7 @@ on_format_clicked (PsppireDialogActionCrosstabs *cd) cd->format_options_table = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->table_button)); - cd->format_options_pivot = + cd->format_options_pivot = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cd->pivot_button)); } } @@ -171,7 +171,7 @@ on_cell_clicked (PsppireDialogActionCrosstabs *cd) gint ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->cell_dialog)); - if ( ret == PSPPIRE_RESPONSE_CONTINUE ) + if (ret == PSPPIRE_RESPONSE_CONTINUE) { g_object_unref (liststore); } @@ -190,7 +190,7 @@ on_statistics_clicked (PsppireDialogActionCrosstabs *cd) gint ret = psppire_dialog_run (PSPPIRE_DIALOG (cd->stat_dialog)); - if ( ret == PSPPIRE_RESPONSE_CONTINUE ) + if (ret == PSPPIRE_RESPONSE_CONTINUE) { g_object_unref (liststore); } @@ -202,19 +202,13 @@ on_statistics_clicked (PsppireDialogActionCrosstabs *cd) } -static void -psppire_dialog_action_crosstabs_activate (GtkAction *a) +static GtkBuilder * +psppire_dialog_action_crosstabs_activate (PsppireDialogAction *a, GVariant *param) { PsppireDialogActionCrosstabs *act = PSPPIRE_DIALOG_ACTION_CROSSTABS (a); PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a); - GHashTable *thing = psppire_dialog_action_get_pointer (pda); - GtkBuilder *xml = g_hash_table_lookup (thing, a); - if (!xml) - { - xml = builder_new ("crosstabs.ui"); - g_hash_table_insert (thing, a, xml); - } + GtkBuilder *xml = builder_new ("crosstabs.ui"); pda->dialog = get_widget_assert (xml, "crosstabs-dialog"); pda->source = get_widget_assert (xml, "dict-treeview"); @@ -239,23 +233,23 @@ psppire_dialog_action_crosstabs_activate (GtkAction *a) act->format_options_pivot = TRUE; psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->cell_view), - B_CS_CELL_DEFAULT, - N_CROSSTABS_CELLS, - cells); + B_CS_CELL_DEFAULT, + N_CROSSTABS_CELLS, + cells); act->cell = gtk_tree_view_get_model (GTK_TREE_VIEW (act->cell_view)); psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->stat_view), - B_CS_STATS_DEFAULT, - N_CROSSTABS_STATS, - stats); + B_CS_STATS_DEFAULT, + N_CROSSTABS_STATS, + stats); act->stat = gtk_tree_view_get_model (GTK_TREE_VIEW (act->stat_view)); psppire_dialog_action_set_refresh (pda, refresh); psppire_dialog_action_set_valid_predicate (pda, - dialog_state_valid); + dialog_state_valid); g_signal_connect_swapped (act->cell_button, "clicked", G_CALLBACK (on_cell_clicked), act); @@ -266,15 +260,13 @@ psppire_dialog_action_crosstabs_activate (GtkAction *a) g_signal_connect_swapped (act->format_button, "clicked", G_CALLBACK (on_format_clicked), act); - - if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_crosstabs_parent_class)->activate) - PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_crosstabs_parent_class)->activate (pda); + return xml; } static char * -generate_syntax (PsppireDialogAction *a) +generate_syntax (const PsppireDialogAction *a) { PsppireDialogActionCrosstabs *cd = PSPPIRE_DIALOG_ACTION_CROSSTABS (a); gchar *text = NULL; @@ -294,7 +286,7 @@ generate_syntax (PsppireDialogAction *a) if (cd->format_options_avalue) g_string_append (string, "AVALUE"); - else + else g_string_append (string, "DVALUE"); g_string_append (string, " "); @@ -306,20 +298,20 @@ generate_syntax (PsppireDialogAction *a) if (cd->format_options_pivot) g_string_append (string, "PIVOT"); - else + else g_string_append (string, "NOPIVOT"); selected = 0; - for (i = 0, ok = gtk_tree_model_get_iter_first (cd->stat, &iter); ok; + for (i = 0, ok = gtk_tree_model_get_iter_first (cd->stat, &iter); ok; i++, ok = gtk_tree_model_iter_next (cd->stat, &iter)) { gboolean toggled; gtk_tree_model_get (cd->stat, &iter, - CHECKBOX_COLUMN_SELECTED, &toggled, -1); - if (toggled) - selected |= 1u << i; - else + CHECKBOX_COLUMN_SELECTED, &toggled, -1); + if (toggled) + selected |= 1u << i; + else selected &= ~(1u << i); } @@ -340,15 +332,15 @@ generate_syntax (PsppireDialogAction *a) } selected = 0; - for (i = 0, ok = gtk_tree_model_get_iter_first (cd->cell, &iter); ok; + for (i = 0, ok = gtk_tree_model_get_iter_first (cd->cell, &iter); ok; i++, ok = gtk_tree_model_iter_next (cd->cell, &iter)) { gboolean toggled; gtk_tree_model_get (cd->cell, &iter, - CHECKBOX_COLUMN_SELECTED, &toggled, -1); - if (toggled) - selected |= 1u << i; - else + CHECKBOX_COLUMN_SELECTED, &toggled, -1); + if (toggled) + selected |= 1u << i; + else selected &= ~(1u << i); } @@ -381,7 +373,7 @@ generate_syntax (PsppireDialogAction *a) static void psppire_dialog_action_crosstabs_class_init (PsppireDialogActionCrosstabsClass *class) { - psppire_dialog_action_set_activation (class, psppire_dialog_action_crosstabs_activate); + PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_crosstabs_activate; PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax; } @@ -390,4 +382,3 @@ static void psppire_dialog_action_crosstabs_init (PsppireDialogActionCrosstabs *act) { } -