Use a more reliable way of setting the initial state of PsppireDialogAction objects.
[pspp] / src / ui / gui / psppire-dialog-action-recode-different.c
index 2d28146c792f348f1baf42f2c0b5bcf1cef609b8..251e5999e03b0079dfef7fdfaa082d06abcfca75 100644 (file)
@@ -41,7 +41,7 @@ difx_variable_treeview_is_populated (PsppireDialogActionRecode *rd)
 {
   PsppireDialogActionRecodeDifferent *rdd = PSPPIRE_DIALOG_ACTION_RECODE_DIFFERENT (rd);
   GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (rd->variable_treeview));
-  
+
   if (g_hash_table_size (rdd->varmap) != gtk_tree_model_iter_n_children (model, NULL) )
     return FALSE;
 
@@ -57,7 +57,7 @@ dialog_state_valid (gpointer data)
 {
   PsppireDialogActionRecode *rd = data;
   GtkTreeIter not_used;
-      
+
   if ( ! rd->value_map )
     return FALSE;
 
@@ -155,7 +155,7 @@ render_new_var_name (GtkTreeViewColumn *tree_column,
 
   struct variable *var = NULL;
 
-  gtk_tree_model_get (tree_model, iter, 
+  gtk_tree_model_get (tree_model, iter,
                      0, &var,
                      -1);
 
@@ -243,7 +243,7 @@ on_selection_change (GtkTreeSelection *selection, gpointer data)
       g_return_if_fail (ok);
 
       gtk_tree_model_get (model, &iter,
-                         0, &var, 
+                         0, &var,
                          -1);
 
       nlp = g_hash_table_lookup (rdd->varmap, var);
@@ -312,13 +312,14 @@ populate_treeview (PsppireDialogActionRecode *act)
 }
 
 
-static void
-psppire_dialog_action_recode_different_activate (PsppireDialogAction *a)
+static GtkBuilder *
+psppire_dialog_action_recode_different_activate (PsppireDialogAction *a, GVariant *param)
 {
   PsppireDialogActionRecode *act = PSPPIRE_DIALOG_ACTION_RECODE (a);
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
 
-  psppire_dialog_action_recode_pre_activate (act, populate_treeview);
+  GtkBuilder *xml = psppire_dialog_action_recode_pre_activate (act,
+                                                              populate_treeview);
 
   gtk_window_set_title (GTK_WINDOW (pda->dialog),
                        _("Recode into Different Variables"));
@@ -327,7 +328,7 @@ psppire_dialog_action_recode_different_activate (PsppireDialogAction *a)
                        _("Recode into Different Variables: Old and New Values "));
 
   gtk_widget_show (act->output_variable_box);
-  
+
   g_signal_connect_swapped (act->old_and_new_dialog, "show",
                            G_CALLBACK (on_old_new_show), act);
 
@@ -335,9 +336,7 @@ psppire_dialog_action_recode_different_activate (PsppireDialogAction *a)
 
   psppire_dialog_action_set_valid_predicate (pda,
                                             dialog_state_valid);
-
-  if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_recode_different_parent_class)->activate)
-    PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_recode_different_parent_class)->activate (pda);
+  return xml;
 }
 
 static void
@@ -349,7 +348,7 @@ append_into_clause (const PsppireDialogActionRecode *rd, struct string *dds)
   GtkTreeIter iter;
   ds_put_cstr (dds, "\n\tINTO ");
   gboolean ok;
-      
+
   for (ok = psppire_var_view_get_iter_first (PSPPIRE_VAR_VIEW (rd->variable_treeview), &iter);
        ok;
        ok = psppire_var_view_get_iter_next (PSPPIRE_VAR_VIEW (rd->variable_treeview), &iter))
@@ -358,7 +357,7 @@ append_into_clause (const PsppireDialogActionRecode *rd, struct string *dds)
       const struct variable *var = psppire_var_view_get_variable (PSPPIRE_VAR_VIEW (rd->variable_treeview), 0, &iter);
 
       nlp = g_hash_table_lookup (rdd->varmap, var);
-           
+
       ds_put_cstr (dds, nlp->name);
       ds_put_cstr (dds, " ");
     }
@@ -434,7 +433,7 @@ target_is_string (const PsppireDialogActionRecode *rd)
 static void
 psppire_dialog_action_recode_different_class_init (PsppireDialogActionRecodeDifferentClass *class)
 {
-  psppire_dialog_action_set_activation (class, psppire_dialog_action_recode_different_activate);
+  PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_recode_different_activate;
 
   PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = diff_generate_syntax;
   PSPPIRE_DIALOG_ACTION_RECODE_CLASS (class)->target_is_string = target_is_string;