projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
output-item: Add missing new-line printing tables in output_item_dump().
[pspp]
/
src
/
ui
/
gui
/
psppire-dialog-action-reliability.c
diff --git
a/src/ui/gui/psppire-dialog-action-reliability.c
b/src/ui/gui/psppire-dialog-action-reliability.c
index 67d8c186a5a377cf1e5cbb966e3a7a9fe25169eb..4bb78f9e1e1a089fb0dbf09682849d195e93fc25 100644
(file)
--- a/
src/ui/gui/psppire-dialog-action-reliability.c
+++ b/
src/ui/gui/psppire-dialog-action-reliability.c
@@
-29,8
+29,14
@@
static void psppire_dialog_action_reliability_class_init (PsppireDialogActi
G_DEFINE_TYPE (PsppireDialogActionReliability, psppire_dialog_action_reliability, PSPPIRE_TYPE_DIALOG_ACTION);
G_DEFINE_TYPE (PsppireDialogActionReliability, psppire_dialog_action_reliability, PSPPIRE_TYPE_DIALOG_ACTION);
+enum
+ {
+ ALPHA = 0,
+ SPLIT = 1
+ };
+
static char *
static char *
-generate_syntax (PsppireDialogAction *act)
+generate_syntax (
const
PsppireDialogAction *act)
{
PsppireDialogActionReliability *rd = PSPPIRE_DIALOG_ACTION_RELIABILITY (act);
gchar *text;
{
PsppireDialogActionReliability *rd = PSPPIRE_DIALOG_ACTION_RELIABILITY (act);
gchar *text;
@@
-42,14
+48,14
@@
generate_syntax (PsppireDialogAction *act)
g_string_append (string, "\n\t/MODEL=");
g_string_append (string, "\n\t/MODEL=");
- if (
0
== gtk_combo_box_get_active (GTK_COMBO_BOX (rd->model_combo)))
+ if (
ALPHA
== gtk_combo_box_get_active (GTK_COMBO_BOX (rd->model_combo)))
g_string_append (string, "ALPHA");
else
g_string_append_printf (string, "SPLIT (%d)",
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (rd->split_spinbutton))
g_string_append (string, "ALPHA");
else
g_string_append_printf (string, "SPLIT (%d)",
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (rd->split_spinbutton))
-
);
+ );
- if (
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->scale_if_item_deleted_checkbutton)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rd->scale_if_item_deleted_checkbutton)))
g_string_append (string, "\n\t/SUMMARY = TOTAL");
g_string_append (string, ".\n");
g_string_append (string, "\n\t/SUMMARY = TOTAL");
g_string_append (string, ".\n");
@@
-73,10
+79,23
@@
dialog_state_valid (gpointer user_data)
}
static void
}
static void
-
on_method_change
(PsppireDialogActionReliability *pda)
+
update_split_control
(PsppireDialogActionReliability *pda)
{
{
+ GtkTreeModel *liststore =
+ gtk_tree_view_get_model (GTK_TREE_VIEW (pda->variables));
+
+ gint n_vars = gtk_tree_model_iter_n_children (liststore, NULL);
+
+ gint sp = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pda->split_spinbutton));
+
+ if (sp >= n_vars)
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (pda->split_spinbutton), n_vars - 1);
+
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON (pda->split_spinbutton),
+ 0, n_vars - 1);
+
gtk_widget_set_sensitive (pda->split_point_hbox,
gtk_widget_set_sensitive (pda->split_point_hbox,
- (
1
== gtk_combo_box_get_active (GTK_COMBO_BOX (pda->model_combo))));
+ (
SPLIT
== gtk_combo_box_get_active (GTK_COMBO_BOX (pda->model_combo))));
}
}
@@
-89,7
+108,7
@@
refresh (PsppireDialogAction *pda_)
gtk_tree_view_get_model (GTK_TREE_VIEW (pda->variables));
gtk_list_store_clear (GTK_LIST_STORE (liststore));
gtk_tree_view_get_model (GTK_TREE_VIEW (pda->variables));
gtk_list_store_clear (GTK_LIST_STORE (liststore));
- gtk_combo_box_set_active (GTK_COMBO_BOX (pda->model_combo),
0
);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (pda->model_combo),
ALPHA
);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (pda->split_spinbutton), 0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (pda->split_spinbutton), 0);
@@
-100,13
+119,15
@@
refresh (PsppireDialogAction *pda_)
FALSE);
}
FALSE);
}
-static
void
-psppire_dialog_action_reliability_activate (
GtkAction *a
)
+static
GtkBuilder *
+psppire_dialog_action_reliability_activate (
PsppireDialogAction *a, GVariant *param
)
{
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionReliability *act = PSPPIRE_DIALOG_ACTION_RELIABILITY (a);
{
PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
PsppireDialogActionReliability *act = PSPPIRE_DIALOG_ACTION_RELIABILITY (a);
+ GtkTreeModel *liststore ;
GtkBuilder *xml = builder_new ("reliability.ui");
GtkBuilder *xml = builder_new ("reliability.ui");
+
pda->dialog = get_widget_assert (xml, "reliability-dialog");
pda->source = get_widget_assert (xml, "dict-view");
pda->dialog = get_widget_assert (xml, "reliability-dialog");
pda->source = get_widget_assert (xml, "dict-view");
@@
-119,25
+140,32
@@
psppire_dialog_action_reliability_activate (GtkAction *a)
act->model_combo = get_widget_assert (xml, "combobox1");
act->split_spinbutton = get_widget_assert (xml, "spinbutton1");
act->model_combo = get_widget_assert (xml, "combobox1");
act->split_spinbutton = get_widget_assert (xml, "spinbutton1");
+ liststore =
+ gtk_tree_view_get_model (GTK_TREE_VIEW (act->variables));
+
+
act->scale_if_item_deleted_checkbutton = get_widget_assert (xml, "totals-checkbutton");
g_signal_connect_swapped (act->model_combo, "changed",
act->scale_if_item_deleted_checkbutton = get_widget_assert (xml, "totals-checkbutton");
g_signal_connect_swapped (act->model_combo, "changed",
- G_CALLBACK (on_method_change), pda);
+ G_CALLBACK (update_split_control), pda);
+
+
+ g_signal_connect_swapped (liststore, "row-inserted",
+ G_CALLBACK (update_split_control), pda);
+ g_signal_connect_swapped (liststore, "row-deleted",
+ G_CALLBACK (update_split_control), pda);
+
psppire_dialog_action_set_refresh (pda, refresh);
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_reliability_parent_class)->activate)
- PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_reliability_parent_class)->activate (pda);
+ return xml;
}
static void
psppire_dialog_action_reliability_class_init (PsppireDialogActionReliabilityClass *class)
{
}
static void
psppire_dialog_action_reliability_class_init (PsppireDialogActionReliabilityClass *class)
{
- GtkActionClass *action_class = GTK_ACTION_CLASS (class);
PsppireDialogActionClass *pdac = PSPPIRE_DIALOG_ACTION_CLASS (class);
PsppireDialogActionClass *pdac = PSPPIRE_DIALOG_ACTION_CLASS (class);
-
- action_class->activate = psppire_dialog_action_reliability_activate;
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_reliability_activate;
pdac->generate_syntax = generate_syntax;
}
pdac->generate_syntax = generate_syntax;
}