Use a more reliable way of setting the initial state of PsppireDialogAction objects.
[pspp] / src / ui / gui / psppire-dialog-action-compute.c
index 048c05de384843bd23e003e0a69ea5d291a7f4c1..2a9b68906593cf69b6549062087d62cab86cd0aa 100644 (file)
@@ -35,7 +35,7 @@ G_DEFINE_TYPE (PsppireDialogActionCompute, psppire_dialog_action_compute, PSPPIR
 
 
 static char *
-generate_syntax (PsppireDialogAction *act)
+generate_syntax (const PsppireDialogAction *act)
 {
   PsppireDialogActionCompute *cd = PSPPIRE_DIALOG_ACTION_COMPUTE (act);
   gchar *text;
@@ -454,14 +454,14 @@ insert_function_into_syntax_area (GtkTreeIter iter,
 }
 
 
-
-static void
-psppire_dialog_action_compute_activate (GtkAction *a)
+static GtkBuilder *
+psppire_dialog_action_compute_activate (PsppireDialogAction *a, GVariant *param)
 {
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionCompute *act = PSPPIRE_DIALOG_ACTION_COMPUTE (a);
 
-  GtkBuilder *xml = builder_new ("compute.ui");
+  GtkBuilder *xml = builder_new ( "compute.ui");
+
   pda->dialog = get_widget_assert   (xml, "compute-variable-dialog");
   pda->source = get_widget_assert   (xml, "compute-treeview1");
 
@@ -490,7 +490,7 @@ psppire_dialog_action_compute_activate (GtkAction *a)
                    G_CALLBACK (on_expression_toggle), pda);
 
   g_signal_connect (act->str_btn, "toggled",
-                   G_CALLBACK (on_type_toggled), pda);
+                   G_CALLBACK (on_type_toggled), pda);
 
 
   g_object_set (pda->source,
@@ -520,18 +520,14 @@ psppire_dialog_action_compute_activate (GtkAction *a)
   psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
   psppire_dialog_action_set_refresh (pda, refresh);
 
-  g_object_unref (xml);
-
-  if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_compute_parent_class)->activate)
-    PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_compute_parent_class)->activate (pda);
+  return xml;
 }
 
 static void
 psppire_dialog_action_compute_class_init (PsppireDialogActionComputeClass *class)
 {
-  GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+  PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_compute_activate;
 
-  action_class->activate = psppire_dialog_action_compute_activate;
   PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
 }