projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change some instances of GtkAction to PsppireDialogAction
[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 296d1526e2258b05980ed9cdd12de20475372c0b..b7df2049d9ee8eb4199f385ef0fb9a0cb1ed6fd6 100644
(file)
--- a/
src/ui/gui/psppire-dialog-action-reliability.c
+++ b/
src/ui/gui/psppire-dialog-action-reliability.c
@@
-29,6
+29,12
@@
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 *
generate_syntax (PsppireDialogAction *act)
{
static char *
generate_syntax (PsppireDialogAction *act)
{
@@
-42,7
+48,7
@@
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)",
g_string_append (string, "ALPHA");
else
g_string_append_printf (string, "SPLIT (%d)",
@@
-73,21
+79,36
@@
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))));
}
static void
}
static void
-refresh (PsppireDialogAction
Reliability *pda
)
+refresh (PsppireDialogAction
*pda_
)
{
{
+ PsppireDialogActionReliability *pda =
+ PSPPIRE_DIALOG_ACTION_RELIABILITY (pda_);
GtkTreeModel *liststore =
gtk_tree_view_get_model (GTK_TREE_VIEW (pda->variables));
gtk_list_store_clear (GTK_LIST_STORE (liststore));
GtkTreeModel *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);
@@
-99,12
+120,20
@@
refresh (PsppireDialogActionReliability *pda)
}
static void
}
static void
-psppire_dialog_action_reliability_activate (
Gtk
Action *a)
+psppire_dialog_action_reliability_activate (
PsppireDialog
Action *a)
{
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 ;
+
+ GHashTable *thing = psppire_dialog_action_get_hash_table (pda);
+ GtkBuilder *xml = g_hash_table_lookup (thing, a);
+ if (!xml)
+ {
+ xml = builder_new ("reliability.ui");
+ g_hash_table_insert (thing, a, xml);
+ }
- 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");
@@
-117,10
+146,21
@@
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);
@@
-132,10
+172,8
@@
psppire_dialog_action_reliability_activate (GtkAction *a)
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_set_activation (class, psppire_dialog_action_reliability_activate);
pdac->generate_syntax = generate_syntax;
}
pdac->generate_syntax = generate_syntax;
}