Convert count dialog to PsppireDialogAction 20131011030504/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 11 Oct 2013 07:24:34 +0000 (09:24 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 11 Oct 2013 07:24:34 +0000 (09:24 +0200)
src/ui/gui/automake.mk
src/ui/gui/count-dialog.c [deleted file]
src/ui/gui/count-dialog.h [deleted file]
src/ui/gui/data-editor.ui
src/ui/gui/psppire-data-window.c
src/ui/gui/psppire-dialog-action-count.c [new file with mode: 0644]
src/ui/gui/psppire-dialog-action-count.h [new file with mode: 0644]
src/ui/gui/widgets.c

index addbbe2cad9a5491df23453dbc8f07a4a7defcd5..9722010256c2fe55503b820573b2131e10c6e557 100644 (file)
@@ -139,8 +139,6 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/builder-wrapper.h \
        src/ui/gui/comments-dialog.c \
        src/ui/gui/comments-dialog.h \
-       src/ui/gui/count-dialog.c \
-       src/ui/gui/count-dialog.h \
        src/ui/gui/dialog-common.c \
        src/ui/gui/dialog-common.h \
        src/ui/gui/dict-display.h \
@@ -191,6 +189,8 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/psppire-dialog-action-chisquare.h \
        src/ui/gui/psppire-dialog-action-compute.c \
        src/ui/gui/psppire-dialog-action-compute.h \
+       src/ui/gui/psppire-dialog-action-count.c \
+       src/ui/gui/psppire-dialog-action-count.h \
        src/ui/gui/psppire-dialog-action-correlation.c \
        src/ui/gui/psppire-dialog-action-correlation.h \
        src/ui/gui/psppire-dialog-action-crosstabs.c \
diff --git a/src/ui/gui/count-dialog.c b/src/ui/gui/count-dialog.c
deleted file mode 100644 (file)
index c730322..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2011, 2012  Free Software Foundation
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
-
-
-#include <config.h>
-
-#include "count-dialog.h"
-
-#include <gtk/gtk.h>
-#include "builder-wrapper.h"
-#include "psppire-dialog.h"
-#include "psppire-selector.h"
-#include "psppire-val-chooser.h"
-#include "psppire-var-view.h"
-#include "psppire-acr.h"
-#include "dialog-common.h"
-
-
-#include <ui/syntax-gen.h>
-#include "executor.h"
-#include "helper.h"
-
-struct cnt_dialog
-{
-  PsppireDict *dict;
-
-  GtkWidget *dialog;
-
-  GtkListStore *value_list;
-  GtkWidget *chooser;
-
-  GtkWidget *target;
-  GtkWidget *label;
-  GtkWidget *variable_treeview;
-};
-
-/* Callback which gets called when a new row is selected
-   in the acr's variable treeview.
-   We use if to set the togglebuttons and entries to correspond to the
-   selected row.
-*/
-static void
-on_acr_selection_change (GtkTreeSelection *selection, gpointer data)
-{
-  GtkTreeIter iter;
-  struct old_value *ov = NULL;
-  GtkTreeModel *model = NULL;
-  struct cnt_dialog *cnt = data;
-  GValue ov_value = {0};
-
-  if ( ! gtk_tree_selection_get_selected (selection, &model, &iter) )
-    return;
-
-  gtk_tree_model_get_value (GTK_TREE_MODEL (model), &iter,
-                           0, &ov_value);
-
-  ov = g_value_get_boxed (&ov_value);
-  psppire_val_chooser_set_status (PSPPIRE_VAL_CHOOSER (cnt->chooser), ov);
-}
-
-
-
-static char * generate_syntax (const struct cnt_dialog *cnt);
-
-static void values_dialog (struct cnt_dialog *cd);
-
-static void
-refresh (PsppireDialog *dialog, struct cnt_dialog *cnt)
-{
-  GtkTreeModel *vars =
-    gtk_tree_view_get_model (GTK_TREE_VIEW (cnt->variable_treeview));
-
-  gtk_list_store_clear (GTK_LIST_STORE (vars));
-
-  gtk_entry_set_text (GTK_ENTRY (cnt->target), "");
-  gtk_entry_set_text (GTK_ENTRY (cnt->label), "");
-  gtk_list_store_clear (GTK_LIST_STORE (cnt->value_list));
-}
-
-static gboolean
-dialog_state_valid (gpointer data)
-{
-  GtkTreeIter iter;
-  struct cnt_dialog *cnt = data;
-
-  if (! cnt->value_list)
-    return FALSE;
-
-  if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (cnt->value_list),        &iter) )
-    return FALSE;
-
-  if (!gtk_tree_model_get_iter_first (gtk_tree_view_get_model (GTK_TREE_VIEW (cnt->variable_treeview)), &iter))
-    return FALSE;
-
-  if (0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (cnt->target))))
-    return FALSE;
-
-  return TRUE;
-}
-
-void count_dialog (PsppireDataWindow *de)
-{
-  gint response;
-  struct cnt_dialog cnt;
-
-  GtkBuilder *builder = builder_new ("count.ui");
-
-  GtkWidget *selector = get_widget_assert (builder, "count-selector1");
-
-  GtkWidget *dict_view = get_widget_assert (builder, "dict-view");
-  GtkWidget *button = get_widget_assert (builder, "button1");
-
-  cnt.target = get_widget_assert (builder, "entry1");
-  cnt.label = get_widget_assert (builder, "entry2");
-  cnt.variable_treeview = get_widget_assert (builder, "treeview2");
-
-  g_signal_connect_swapped (button, "clicked", G_CALLBACK (values_dialog), &cnt);
-
-  cnt.value_list = gtk_list_store_new (1,old_value_get_type ());
-
-  cnt.dialog =  get_widget_assert (builder, "count-dialog");
-
-  g_signal_connect (cnt.dialog, "refresh", G_CALLBACK (refresh),  &cnt);
-
-
-  g_object_get (de->data_editor, "dictionary", &cnt.dict, NULL);
-
-  gtk_window_set_transient_for (GTK_WINDOW (cnt.dialog), GTK_WINDOW (de));
-
-  g_object_set (dict_view, "model", cnt.dict, NULL);
-
-  psppire_selector_set_allow (PSPPIRE_SELECTOR (selector),  numeric_only);
-
-  psppire_dialog_set_valid_predicate (PSPPIRE_DIALOG (cnt.dialog),
-                                     dialog_state_valid, &cnt);
-
-  response = psppire_dialog_run (PSPPIRE_DIALOG (cnt.dialog));
-
-  switch (response)
-    {
-    case GTK_RESPONSE_OK:
-      g_free (execute_syntax_string (de, generate_syntax (&cnt)));
-      break;
-    case PSPPIRE_RESPONSE_PASTE:
-      g_free (paste_syntax_to_window (generate_syntax (&cnt)));
-      break;
-    default:
-      break;
-    }
-
-
-  g_object_unref (cnt.value_list);
-  g_object_unref (builder);
-}
-
-/* A function to set a value in a column in the ACR */
-static gboolean
-set_value (gint col, GValue  *val, gpointer data)
-{
-  struct cnt_dialog *cnt = data;
-  PsppireValChooser *vc = PSPPIRE_VAL_CHOOSER (cnt->chooser);
-  struct old_value ov;
-       
-  g_assert (col == 0);
-
-  psppire_val_chooser_get_status (vc, &ov);
-
-  g_value_init (val, old_value_get_type ());
-  g_value_set_boxed (val, &ov);
-
-  return TRUE;
-}
-
-
-static void
-values_dialog (struct cnt_dialog *cd)
-{
-  gint response;
-  GtkListStore *local_store = clone_list_store (cd->value_list);
-  GtkBuilder *builder = builder_new ("count.ui");
-
-  GtkWidget *dialog = get_widget_assert (builder, "values-dialog");
-
-  GtkWidget *acr = get_widget_assert (builder, "acr");
-  cd->chooser = get_widget_assert (builder, "value-chooser");
-
-  psppire_acr_set_enabled (PSPPIRE_ACR (acr), TRUE);
-
-  psppire_acr_set_model (PSPPIRE_ACR (acr), local_store);
-  psppire_acr_set_get_value_func (PSPPIRE_ACR (acr), set_value, cd);
-
-  {
-    GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (PSPPIRE_ACR(acr)->tv));
-    g_signal_connect (sel, "changed",
-                   G_CALLBACK (on_acr_selection_change), cd);
-  }
-
-  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
-
-  if ( response == PSPPIRE_RESPONSE_CONTINUE )
-    {
-      g_object_unref (cd->value_list);
-      cd->value_list = local_store;
-    }
-  else
-    {
-      g_object_unref (local_store);
-    }
-
-  psppire_dialog_notify_change (PSPPIRE_DIALOG (cd->dialog));
-
-  g_object_unref (builder);
-}
-
-
-
-static char *
-generate_syntax (const struct cnt_dialog *cnt)
-{
-  gchar *text = NULL;
-  const gchar *s = NULL;
-  gboolean ok;
-  GtkTreeIter iter;
-  struct string dds;
-  
-  ds_init_empty (&dds);
-
-  ds_put_cstr (&dds, "\nCOUNT ");
-
-  ds_put_cstr (&dds, gtk_entry_get_text (GTK_ENTRY (cnt->target)));
-
-  ds_put_cstr (&dds, " =");
-
-  psppire_var_view_append_names_str (PSPPIRE_VAR_VIEW (cnt->variable_treeview), 0, &dds);
-
-  ds_put_cstr (&dds, "(");
-  for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (cnt->value_list),
-                                          &iter);
-       ok;
-       ok = gtk_tree_model_iter_next (GTK_TREE_MODEL (cnt->value_list), &iter))
-    {
-      GValue a_value = {0};
-      struct old_value *ov;
-
-      gtk_tree_model_get_value (GTK_TREE_MODEL (cnt->value_list), &iter,
-                               0, &a_value);
-
-      ov = g_value_get_boxed (&a_value);
-
-      ds_put_cstr (&dds, " ");
-      old_value_append_syntax (&dds, ov);
-    }
-  ds_put_cstr (&dds, ").");
-
-
-  s = gtk_entry_get_text (GTK_ENTRY (cnt->label));
-  if (0 != strcmp (s, ""))
-  {
-    ds_put_cstr (&dds, "\nVARIABLE LABELS ");
-
-    ds_put_cstr (&dds, gtk_entry_get_text (GTK_ENTRY (cnt->target)));
-
-    ds_put_cstr (&dds, " ");
-
-    syntax_gen_string (&dds, ss_cstr (s));
-
-    ds_put_cstr (&dds, ".");
-  }
-
-  ds_put_cstr (&dds, "\nEXECUTE.\n");
-
-  text = ds_steal_cstr (&dds);
-
-  ds_destroy (&dds);
-
-  return text;
-}
diff --git a/src/ui/gui/count-dialog.h b/src/ui/gui/count-dialog.h
deleted file mode 100644 (file)
index d97765d..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2011  Free Software Foundation
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef __COUNT_DIALOG_H
-#define __COUNT_DIALOG_H
-
-#include "psppire-data-window.h"
-
-void count_dialog (PsppireDataWindow * data);
-
-#endif
index 850f318a06ff81776e3acb4c42a2bfce69a3ce32..658116092c04ae1e3dc22c142b43ecdabeb37b58 100644 (file)
           </object>
         </child>
         <child>
-          <object class="GtkAction" id="transform_count">
+          <object class="PsppireDialogActionCount" id="transform_count">
             <property name="name">transform_count</property>
+            <property name="manager">uimanager1</property>
             <property name="label" translatable="yes">Cou_nt...</property>
            <property name="stock-id">transform-count</property>
           </object>
index f756586a25bc9fe0c4c5d15f3ce33b6fdd79e9c8..7979257b5d3339788199f5f4e9201c8e862f86e7 100644 (file)
@@ -28,7 +28,6 @@
 #include "ui/gui/autorecode-dialog.h"
 #include "ui/gui/builder-wrapper.h"
 #include "ui/gui/comments-dialog.h"
-#include "ui/gui/count-dialog.h"
 #include "ui/gui/entry-dialog.h"
 #include "ui/gui/executor.h"
 #include "ui/gui/help-menu.h"
@@ -961,7 +960,6 @@ psppire_data_window_finish_init (PsppireDataWindow *de,
   connect_action (de, "oneway-anova", G_CALLBACK (oneway_anova_dialog));
   connect_action (de, "paired-t-test", G_CALLBACK (t_test_paired_samples_dialog));
   connect_action (de, "utilities_comments", G_CALLBACK (comments_dialog));
-  connect_action (de, "transform_count", G_CALLBACK (count_dialog));
   connect_action (de, "transform_recode-same", G_CALLBACK (recode_same_dialog));
   connect_action (de, "transform_recode-different", G_CALLBACK (recode_different_dialog));
   connect_action (de, "two-related-samples", G_CALLBACK (two_related_dialog));
diff --git a/src/ui/gui/psppire-dialog-action-count.c b/src/ui/gui/psppire-dialog-action-count.c
new file mode 100644 (file)
index 0000000..a439e1a
--- /dev/null
@@ -0,0 +1,286 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2011, 2012, 2013  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+
+#include <config.h>
+
+#include "psppire-dialog-action-count.h"
+
+#include "psppire-var-view.h"
+
+#include "psppire-dialog.h"
+#include "psppire-selector.h"
+#include "builder-wrapper.h"
+#include "psppire-acr.h"
+#include "dialog-common.h"
+
+#include <ui/syntax-gen.h>
+
+#include "psppire-val-chooser.h"
+#include "helper.h"
+
+
+static void values_dialog (PsppireDialogActionCount *cd);
+
+
+static void psppire_dialog_action_count_init            (PsppireDialogActionCount      *act);
+static void psppire_dialog_action_count_class_init      (PsppireDialogActionCountClass *class);
+
+G_DEFINE_TYPE (PsppireDialogActionCount, psppire_dialog_action_count, PSPPIRE_TYPE_DIALOG_ACTION);
+
+
+static char *
+generate_syntax (PsppireDialogAction *act)
+{
+  PsppireDialogActionCount *cnt = PSPPIRE_DIALOG_ACTION_COUNT (act);
+  gchar *text = NULL;
+  const gchar *s = NULL;
+  gboolean ok;
+  GtkTreeIter iter;
+  struct string dds;
+  
+  ds_init_empty (&dds);
+
+  ds_put_cstr (&dds, "\nCOUNT ");
+
+  ds_put_cstr (&dds, gtk_entry_get_text (GTK_ENTRY (cnt->target)));
+
+  ds_put_cstr (&dds, " =");
+
+  psppire_var_view_append_names_str (PSPPIRE_VAR_VIEW (cnt->variable_treeview), 0, &dds);
+
+  ds_put_cstr (&dds, "(");
+  for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (cnt->value_list),
+                                          &iter);
+       ok;
+       ok = gtk_tree_model_iter_next (GTK_TREE_MODEL (cnt->value_list), &iter))
+    {
+      GValue a_value = {0};
+      struct old_value *ov;
+
+      gtk_tree_model_get_value (GTK_TREE_MODEL (cnt->value_list), &iter,
+                               0, &a_value);
+
+      ov = g_value_get_boxed (&a_value);
+
+      ds_put_cstr (&dds, " ");
+      old_value_append_syntax (&dds, ov);
+    }
+  ds_put_cstr (&dds, ").");
+
+
+  s = gtk_entry_get_text (GTK_ENTRY (cnt->label));
+  if (0 != strcmp (s, ""))
+  {
+    ds_put_cstr (&dds, "\nVARIABLE LABELS ");
+
+    ds_put_cstr (&dds, gtk_entry_get_text (GTK_ENTRY (cnt->target)));
+
+    ds_put_cstr (&dds, " ");
+
+    syntax_gen_string (&dds, ss_cstr (s));
+
+    ds_put_cstr (&dds, ".");
+  }
+
+  ds_put_cstr (&dds, "\nEXECUTE.\n");
+
+  text = ds_steal_cstr (&dds);
+
+  ds_destroy (&dds);
+
+  return text;
+}
+
+
+static gboolean
+dialog_state_valid (gpointer data)
+{
+  PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (data);
+  PsppireDialogActionCount *cnt = PSPPIRE_DIALOG_ACTION_COUNT (pda);
+
+  GtkTreeIter iter;
+
+  if (! cnt->value_list)
+    return FALSE;
+
+  if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (cnt->value_list),        &iter) )
+    return FALSE;
+
+  if (!gtk_tree_model_get_iter_first (gtk_tree_view_get_model (GTK_TREE_VIEW (cnt->variable_treeview)), &iter))
+    return FALSE;
+
+  if (0 == strcmp ("", gtk_entry_get_text (GTK_ENTRY (cnt->target))))
+    return FALSE;
+
+  return TRUE;
+}
+
+static void
+refresh (PsppireDialogAction *rd_)
+{
+  PsppireDialogActionCount *cnt = PSPPIRE_DIALOG_ACTION_COUNT (rd_);
+
+  GtkTreeModel *vars =
+    gtk_tree_view_get_model (GTK_TREE_VIEW (cnt->variable_treeview));
+
+  gtk_list_store_clear (GTK_LIST_STORE (vars));
+
+  gtk_entry_set_text (GTK_ENTRY (cnt->target), "");
+  gtk_entry_set_text (GTK_ENTRY (cnt->label), "");
+  gtk_list_store_clear (GTK_LIST_STORE (cnt->value_list));
+}
+
+static void
+psppire_dialog_action_count_activate (GtkAction *a)
+{
+  PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (a);
+  PsppireDialogActionCount *act = PSPPIRE_DIALOG_ACTION_COUNT (a);
+
+  GtkBuilder *xml = builder_new ("count.ui");
+  GtkWidget *selector = get_widget_assert (xml, "count-selector1");
+  GtkWidget *button = get_widget_assert (xml, "button1");
+
+  pda->dialog = get_widget_assert   (xml, "count-dialog");
+  pda->source = get_widget_assert   (xml, "dict-view");
+
+
+  act->target = get_widget_assert (xml, "entry1");
+  act->label = get_widget_assert (xml, "entry2");
+  act->variable_treeview = get_widget_assert (xml, "treeview2");
+
+  act->value_list = gtk_list_store_new (1, old_value_get_type ());
+
+  psppire_selector_set_allow (PSPPIRE_SELECTOR (selector),  numeric_only);
+
+  g_signal_connect_swapped (button, "clicked", G_CALLBACK (values_dialog), act);
+
+
+  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_count_parent_class)->activate)
+    PSPPIRE_DIALOG_ACTION_CLASS (psppire_dialog_action_count_parent_class)->activate (pda);
+}
+
+static void
+psppire_dialog_action_count_class_init (PsppireDialogActionCountClass *class)
+{
+  GtkActionClass *action_class = GTK_ACTION_CLASS (class);
+
+  action_class->activate = psppire_dialog_action_count_activate;
+  PSPPIRE_DIALOG_ACTION_CLASS (class)->generate_syntax = generate_syntax;
+}
+
+
+static void
+psppire_dialog_action_count_init (PsppireDialogActionCount *act)
+{
+}
+
+
+
+\f
+
+
+/* Callback which gets called when a new row is selected
+   in the acr's variable treeview.
+   We use if to set the togglebuttons and entries to correspond to the
+   selected row.
+*/
+static void
+on_acr_selection_change (GtkTreeSelection *selection, gpointer data)
+{
+  GtkTreeIter iter;
+  struct old_value *ov = NULL;
+  GtkTreeModel *model = NULL;
+  PsppireDialogActionCount *cnt = PSPPIRE_DIALOG_ACTION_COUNT (data);
+  GValue ov_value = {0};
+
+  if ( ! gtk_tree_selection_get_selected (selection, &model, &iter) )
+    return;
+
+  gtk_tree_model_get_value (GTK_TREE_MODEL (model), &iter,
+                           0, &ov_value);
+
+  ov = g_value_get_boxed (&ov_value);
+  psppire_val_chooser_set_status (PSPPIRE_VAL_CHOOSER (cnt->chooser), ov);
+}
+
+
+/* A function to set a value in a column in the ACR */
+static gboolean
+set_value (gint col, GValue  *val, gpointer data)
+{
+  PsppireDialogActionCount *cnt = PSPPIRE_DIALOG_ACTION_COUNT (data);
+  PsppireValChooser *vc = PSPPIRE_VAL_CHOOSER (cnt->chooser);
+  struct old_value ov;
+       
+  g_assert (col == 0);
+
+  psppire_val_chooser_get_status (vc, &ov);
+
+  g_value_init (val, old_value_get_type ());
+  g_value_set_boxed (val, &ov);
+
+  return TRUE;
+}
+
+
+static void
+values_dialog (PsppireDialogActionCount *cd)
+{
+  PsppireDialogAction *pda = PSPPIRE_DIALOG_ACTION (cd);
+  gint response;
+  GtkListStore *local_store = clone_list_store (cd->value_list);
+  GtkBuilder *builder = builder_new ("count.ui");
+
+  GtkWidget *dialog = get_widget_assert (builder, "values-dialog");
+
+  GtkWidget *acr = get_widget_assert (builder, "acr");
+  cd->chooser = get_widget_assert (builder, "value-chooser");
+
+  psppire_acr_set_enabled (PSPPIRE_ACR (acr), TRUE);
+
+  psppire_acr_set_model (PSPPIRE_ACR (acr), local_store);
+  psppire_acr_set_get_value_func (PSPPIRE_ACR (acr), set_value, cd);
+
+  {
+    GtkTreeSelection *sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (PSPPIRE_ACR(acr)->tv));
+    g_signal_connect (sel, "changed",
+                   G_CALLBACK (on_acr_selection_change), cd);
+  }
+
+  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+
+  if ( response == PSPPIRE_RESPONSE_CONTINUE )
+    {
+      g_object_unref (cd->value_list);
+      cd->value_list = local_store;
+    }
+  else
+    {
+      g_object_unref (local_store);
+    }
+
+  psppire_dialog_notify_change (PSPPIRE_DIALOG (pda->dialog));
+
+  g_object_unref (builder);
+}
+
+
diff --git a/src/ui/gui/psppire-dialog-action-count.h b/src/ui/gui/psppire-dialog-action-count.h
new file mode 100644 (file)
index 0000000..af4bdce
--- /dev/null
@@ -0,0 +1,82 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2013  Free Software Foundation
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
+
+
+#include <glib-object.h>
+#include <glib.h>
+
+#include "psppire-dialog-action.h"
+
+#ifndef __PSPPIRE_DIALOG_ACTION_COUNT_H__
+#define __PSPPIRE_DIALOG_ACTION_COUNT_H__
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_DIALOG_ACTION_COUNT (psppire_dialog_action_count_get_type ())
+
+#define PSPPIRE_DIALOG_ACTION_COUNT(obj)       \
+                     (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                                                 PSPPIRE_TYPE_DIALOG_ACTION_COUNT, PsppireDialogActionCount))
+
+#define PSPPIRE_DIALOG_ACTION_COUNT_CLASS(klass) \
+                     (G_TYPE_CHECK_CLASS_CAST ((klass), \
+                                PSPPIRE_TYPE_DIALOG_ACTION_COUNT, \
+                                 PsppireDialogActionCountClass))
+
+
+#define PSPPIRE_IS_DIALOG_ACTION_COUNT(obj) \
+                    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_COUNT))
+
+#define PSPPIRE_IS_DIALOG_ACTION_COUNT_CLASS(klass) \
+                     (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_COUNT))
+
+
+#define PSPPIRE_DIALOG_ACTION_COUNT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+                                  PSPPIRE_TYPE_DIALOG_ACTION_COUNT, \
+                                  PsppireDialogActionCountClass))
+
+typedef struct _PsppireDialogActionCount       PsppireDialogActionCount;
+typedef struct _PsppireDialogActionCountClass  PsppireDialogActionCountClass;
+
+
+struct _PsppireDialogActionCount
+{
+  PsppireDialogAction parent;
+
+  /*< private >*/
+  gboolean dispose_has_run ;
+
+  GtkWidget *target ;
+  GtkWidget *label ;
+  GtkWidget *variable_treeview ;
+  GtkWidget *chooser;
+
+  GtkListStore *value_list;
+};
+
+
+struct _PsppireDialogActionCountClass
+{
+  PsppireDialogActionClass parent_class;
+};
+
+
+GType psppire_dialog_action_count_get_type (void) ;
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_DIALOG_ACTION_COUNT_H__ */
index 220de39642a21c87bcaa7a52a22eb6564d58006c..93257e5b084e147724de8479aaa74d90d8ed891d 100644 (file)
@@ -20,6 +20,7 @@
 #include "psppire-dialog-action-chisquare.h"
 #include "psppire-dialog-action-compute.h"
 #include "psppire-dialog-action-correlation.h"
+#include "psppire-dialog-action-count.h"
 #include "psppire-dialog-action-crosstabs.h"
 #include "psppire-dialog-action-descriptives.h"
 #include "psppire-dialog-action-examine.h"
@@ -69,6 +70,7 @@ preregister_widgets (void)
   psppire_dialog_action_chisquare_get_type ();
   psppire_dialog_action_compute_get_type ();
   psppire_dialog_action_correlation_get_type ();
+  psppire_dialog_action_count_get_type ();
   psppire_dialog_action_crosstabs_get_type ();
   psppire_dialog_action_descriptives_get_type ();
   psppire_dialog_action_examine_get_type ();