GString *string = g_string_new ("SPLIT FILE OFF.");
- if ( ! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->off)))
+ if (! gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->off)))
{
GString * varlist = g_string_sized_new (80);
gint n_vars = psppire_var_view_append_names (PSPPIRE_VAR_VIEW (act->tv), 0, varlist);
- if ( n_vars > 0 )
+ if (n_vars > 0)
{
g_string_assign (string, "");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(act->sort)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(act->sort)))
{
g_string_append (string, "SORT CASES BY");
g_string_append (string, varlist->str);
g_string_append (string, "SPLIT FILE ");
- if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->layered)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (act->layered)))
g_string_append (string, "LAYERED ");
else
g_string_append (string, "SEPARATE ");
GtkTreeModel *liststore = gtk_tree_view_get_model (GTK_TREE_VIEW (act->tv));
- gint n_vars = dict_get_split_cnt (pda->dict->dict);
+ gint n_vars = dict_get_n_splits (pda->dict->dict);
gtk_list_store_clear (GTK_LIST_STORE (liststore));
- if ( n_vars == 0 )
+ if (n_vars == 0)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (act->off), TRUE);
else
{
gint i;
const struct variable *const *vars = dict_get_split_vars (pda->dict->dict);
- for (i = 0 ; i < n_vars; ++i )
+ for (i = 0 ; i < n_vars; ++i)
{
gtk_list_store_append (GTK_LIST_STORE (liststore), &iter);
gtk_widget_set_sensitive (act->source, state);
}
-static void
-psppire_dialog_action_split_activate (PsppireDialogAction *pda)
+static GtkBuilder *
+psppire_dialog_action_split_activate (PsppireDialogAction *pda, GVariant *param)
{
PsppireDialogActionSplit *act = PSPPIRE_DIALOG_ACTION_SPLIT (pda);
- GHashTable *thing = psppire_dialog_action_get_hash_table (pda);
- GtkBuilder *xml = g_hash_table_lookup (thing, pda);
- if (!xml)
- {
- xml = builder_new ("split-file.ui");
- g_hash_table_insert (thing, pda, xml);
+ GtkBuilder *xml = builder_new ("split-file.ui");
- pda->dialog = get_widget_assert (xml, "split-file-dialog");
- pda->source = get_widget_assert (xml, "split-file-dict-treeview");
- act->selector = get_widget_assert (xml, "split-file-selector");
+ pda->dialog = get_widget_assert (xml, "split-file-dialog");
+ pda->source = get_widget_assert (xml, "split-file-dict-treeview");
+ act->selector = get_widget_assert (xml, "split-file-selector");
- act->dest = get_widget_assert (xml, "split-file-grouping-vars");
- act->source = get_widget_assert (xml, "split-file-dict-treeview");
- act->sort = get_widget_assert (xml, "split-sort");
+ act->dest = get_widget_assert (xml, "split-file-grouping-vars");
+ act->source = get_widget_assert (xml, "split-file-dict-treeview");
+ act->sort = get_widget_assert (xml, "split-sort");
- act->off = get_widget_assert (xml, "split-off");
- act->layered = get_widget_assert (xml, "split-layered");
+ act->off = get_widget_assert (xml, "split-off");
+ act->layered = get_widget_assert (xml, "split-layered");
- act->tv = get_widget_assert (xml, "split-file-grouping-vars");
+ act->tv = get_widget_assert (xml, "split-file-grouping-vars");
+
+ g_signal_connect (act->off, "toggled", G_CALLBACK (on_off_toggled), pda);
+ g_signal_connect_swapped (pda->dialog, "show", G_CALLBACK (refresh), pda);
- g_signal_connect (act->off, "toggled", G_CALLBACK (on_off_toggled), pda);
- g_signal_connect_swapped (pda->dialog, "show", G_CALLBACK (refresh), pda);
- }
-
psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
psppire_dialog_action_set_refresh (pda, refresh);
-
- if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_split_parent_class)->activate)
- PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_split_parent_class)->activate (pda);
+ return xml;
}
static void
psppire_dialog_action_split_class_init (PsppireDialogActionSplitClass *class)
{
- psppire_dialog_action_set_activation (class, psppire_dialog_action_split_activate);
+ PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_split_activate;
PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
}
-
static void
psppire_dialog_action_split_init (PsppireDialogActionSplit *act)
{