src/ui/gui/psppire-window-base.c: Remove erroneous "return"
[pspp] / src / ui / gui / psppire-dialog-action-paired.c
index 558e86f52c70688cff95474142228f669f2eafd2..4d2fbb3aee06f2b9a3c13f02af2fcb297fa5a959 100644 (file)
@@ -46,7 +46,7 @@ dialog_state_valid (gpointer data)
   struct variable *v = NULL;
   GtkTreeIter dest_iter;
 
-  if ( n_rows == 0 )
+  if (n_rows == 0)
     return FALSE;
 
   /* Get the last row */
@@ -58,8 +58,8 @@ dialog_state_valid (gpointer data)
 
   if (v == NULL)
     return FALSE;
-    
-  /* if ( NULL == pd->valid) */
+
+  /* if (NULL == pd->valid) */
   /*   return TRUE; */
 
   return TRUE;
@@ -93,7 +93,7 @@ select_as_pair_member (GtkTreeIter source_iter,
 
   n_rows = gtk_tree_model_iter_n_children  (GTK_TREE_MODEL (tt_d->list_store), NULL);
 
-  if ( n_rows > 0 )
+  if (n_rows > 0)
     {
 
       gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (tt_d->list_store),
@@ -104,7 +104,7 @@ select_as_pair_member (GtkTreeIter source_iter,
   else
     v1 = NULL;
 
-  if ( n_rows == 0 || v1 != NULL)
+  if (n_rows == 0 || v1 != NULL)
     {
       gtk_list_store_append (tt_d->list_store, &dest_iter);
 
@@ -124,7 +124,7 @@ select_as_pair_member (GtkTreeIter source_iter,
 
 
 static gchar *
-generate_syntax (PsppireDialogAction *pda)
+generate_syntax (const PsppireDialogAction *pda)
 {
   PsppireDialogActionPaired *d = PSPPIRE_DIALOG_ACTION_PAIRED (pda);
   gchar *text = NULL;
@@ -149,22 +149,18 @@ generate_syntax (PsppireDialogAction *pda)
   return text;
 }
 
-static void
-psppire_dialog_action_paired_activate (GtkAction *a)
+static GtkBuilder *
+psppire_dialog_action_paired_activate (PsppireDialogAction *a, GVariant *param)
 {
   PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
   PsppireDialogActionPaired *act = PSPPIRE_DIALOG_ACTION_PAIRED (a);
 
-  GHashTable *thing = psppire_dialog_action_get_pointer (pda);
-  GtkBuilder *xml = g_hash_table_lookup (thing, a);
-  if (!xml)
-    {
-      xml = builder_new ("paired-samples.ui");
-      g_hash_table_insert (thing, a, xml);
-    }
+  GtkBuilder *xml = builder_new ("paired-samples.ui");
 
   GtkWidget *selector = get_widget_assert (xml, "psppire-selector3");
-  GtkWidget *button = get_widget_assert (xml, "option-button");
+  GtkWidget *bb = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
+  GtkWidget *button = gtk_button_new_with_mnemonic (_("O_ptions..."));
+  GtkWidget *box = get_widget_assert (xml, "dynamic-populate");
 
   pda->dialog = get_widget_assert   (xml, "t-test-paired-samples-dialog");
   pda->source = get_widget_assert   (xml, "paired-samples-t-test-treeview1");
@@ -178,7 +174,12 @@ psppire_dialog_action_paired_activate (GtkAction *a)
 
   g_signal_connect_swapped (button, "clicked", G_CALLBACK (tt_options_dialog_run), act->opt);
 
+
+  gtk_box_pack_start (GTK_BOX (bb), button, TRUE, TRUE, 5);
+  gtk_box_pack_start (GTK_BOX (box), bb, FALSE, FALSE, 5);
+  gtk_widget_show_all (box);
+
+
   psppire_dialog_action_set_valid_predicate (pda, dialog_state_valid);
   psppire_dialog_action_set_refresh (pda, refresh);
 
@@ -189,9 +190,7 @@ psppire_dialog_action_paired_activate (GtkAction *a)
   psppire_selector_set_select_func (PSPPIRE_SELECTOR (selector),
                                    select_as_pair_member,
                                    act);
-  
-  if (PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_paired_parent_class)->activate)
-    PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_paired_parent_class)->activate (pda);
+  return xml;
 }
 
 static void
@@ -205,7 +204,7 @@ static void
 psppire_dialog_action_paired_class_init (PsppireDialogActionPairedClass *class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (class);
-  psppire_dialog_action_set_activation (class, psppire_dialog_action_paired_activate);
+  PSPPIRE_DIALOG_ACTION_CLASS (class)->initial_activate = psppire_dialog_action_paired_activate;
   PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
 
   object_class->finalize = psppire_dialog_action_paired_finalize;