Replace checkbox-treeview functions with a object PsppireCheckboxTreeview
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 2 Oct 2013 13:14:15 +0000 (15:14 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 6 Oct 2013 14:32:42 +0000 (16:32 +0200)
Prior to this change there existed a function which operated on
a GtkTreeView which populated it with a model and renderers such
that it would display a list of annotated checkboxes.

This change subclasses GtkTreeView and moves the function to a
method of that class.

I anticipate this will ease implementation of upcoming functionality.

15 files changed:
src/ui/gui/automake.mk
src/ui/gui/checkbox-treeview.c [deleted file]
src/ui/gui/checkbox-treeview.h [deleted file]
src/ui/gui/crosstabs.ui
src/ui/gui/descriptives.ui
src/ui/gui/frequencies.ui
src/ui/gui/psppire-checkbox-treeview.c [new file with mode: 0644]
src/ui/gui/psppire-checkbox-treeview.h [new file with mode: 0644]
src/ui/gui/psppire-dialog-action-crosstabs.c
src/ui/gui/psppire-dialog-action-crosstabs.h
src/ui/gui/psppire-dialog-action-descriptives.c
src/ui/gui/psppire-dialog-action-frequencies.c
src/ui/gui/psppire-dialog-action-regression.c
src/ui/gui/regression.ui
src/ui/gui/widgets.c

index 47a3215835e7bb47716eabd0fb4666ea2a7562ac..f5bd07bee32513a0f5c1b84b8ed260f6bed458de 100644 (file)
@@ -137,8 +137,6 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/aggregate-dialog.h \
        src/ui/gui/builder-wrapper.c \
        src/ui/gui/builder-wrapper.h \
-       src/ui/gui/checkbox-treeview.c \
-       src/ui/gui/checkbox-treeview.h \
        src/ui/gui/comments-dialog.c \
        src/ui/gui/comments-dialog.h \
        src/ui/gui/compute-dialog.c \
@@ -178,6 +176,8 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/psppire.h \
        src/ui/gui/psppire-acr.h \
        src/ui/gui/psppire-buttonbox.h \
+       src/ui/gui/psppire-checkbox-treeview.c \
+       src/ui/gui/psppire-checkbox-treeview.h \
        src/ui/gui/psppire-conf.c \
        src/ui/gui/psppire-conf.h \
        src/ui/gui/psppire-data-editor.c \
diff --git a/src/ui/gui/checkbox-treeview.c b/src/ui/gui/checkbox-treeview.c
deleted file mode 100644 (file)
index 324943a..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2007, 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 "checkbox-treeview.h"
-#include <gtk/gtk.h>
-
-#include "gettext.h"
-#define _(msgid) gettext (msgid)
-#define N_(msgid) msgid
-
-
-/* Callback for checkbox cells in the statistics tree view.
-   Toggles the checkbox. */
-static void
-toggle (GtkCellRendererToggle *cell_renderer, gchar *path_str, gpointer data)
-{
-  GtkTreeView *tv = GTK_TREE_VIEW (data);
-  GtkTreeModel *model = gtk_tree_view_get_model (tv);
-  GtkTreeIter iter;
-  GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
-  gboolean selected;
-
-  gtk_tree_model_get_iter (model, &iter, path);
-  gtk_tree_model_get (model, &iter, CHECKBOX_COLUMN_SELECTED, &selected, -1);
-  gtk_list_store_set (GTK_LIST_STORE (model), &iter, CHECKBOX_COLUMN_SELECTED,
-                      !selected, -1);
-  gtk_tree_path_free (path);
-}
-
-
-static void
-treeview_create_checkbox_model (GtkTreeView *treeview,
-                               guint default_items,
-                               gint n_items,
-                               const struct checkbox_entry_item *items
-                               )
-{
-  GtkListStore *list;
-  size_t i;
-
-  list = gtk_list_store_new (N_CHECKBOX_COLUMNS,
-                            G_TYPE_STRING, G_TYPE_BOOLEAN);
-
-  for (i = 0; i < n_items; i++)
-    {
-      GtkTreeIter iter;
-      gtk_list_store_append (list, &iter);
-      gtk_list_store_set (list, &iter,
-                          CHECKBOX_COLUMN_LABEL, gettext (items[i].label),
-                          CHECKBOX_COLUMN_SELECTED,
-                         (default_items & (1u << i)) != 0,
-                          -1);
-    }
-
-  gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (list));
-  g_object_unref (list);
-}
-
-static void
-treeview_checkbox_populate (GtkTreeView *treeview)
-{
-  GtkTreeViewColumn *col;
-  GtkCellRenderer *renderer;
-
-  /* Checkbox column. */
-  col = gtk_tree_view_column_new ();
-  renderer = gtk_cell_renderer_toggle_new ();
-
-  gtk_tree_view_column_pack_start (col, renderer, TRUE);
-
-  gtk_tree_view_append_column (treeview, col);
-
-  gtk_tree_view_column_add_attribute  (col, renderer, "active", CHECKBOX_COLUMN_SELECTED);
-
-  g_signal_connect (renderer, "toggled", G_CALLBACK (toggle), treeview);
-
-  /* Label column. */
-  col = gtk_tree_view_column_new ();
-  gtk_tree_view_column_set_title (col, _("Statistic"));
-  renderer = gtk_cell_renderer_text_new ();
-  gtk_tree_view_column_pack_start (col, renderer, TRUE);
-
-  gtk_tree_view_column_add_attribute  (col, renderer, "text", CHECKBOX_COLUMN_LABEL);
-
-  g_object_set (renderer, "ellipsize-set", TRUE, NULL);
-  g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
-  gtk_tree_view_column_set_min_width (col, 200);
-  gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
-  gtk_tree_view_column_set_resizable (col, TRUE);
-  gtk_tree_view_append_column (treeview, col);
-}
-
-
-void
-put_checkbox_items_in_treeview (GtkTreeView *treeview,
-                               guint default_items,
-                               gint n_items,
-                               const struct checkbox_entry_item *items
-                               )
-{
-  treeview_create_checkbox_model (treeview, default_items, n_items, items);
-  treeview_checkbox_populate (treeview);
-}
diff --git a/src/ui/gui/checkbox-treeview.h b/src/ui/gui/checkbox-treeview.h
deleted file mode 100644 (file)
index 1616b73..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2007  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 __CHECKBOX_TREEVIEW_H__
-#define __CHECKBOX_TREEVIEW_H__ 1
-
-
-#include <gtk/gtk.h>
-
-struct checkbox_entry_item
-  {
-    const char *name;
-    const char *label;
-  };
-
-enum
-  {
-    CHECKBOX_COLUMN_LABEL,
-    CHECKBOX_COLUMN_SELECTED,
-    N_CHECKBOX_COLUMNS
-  };
-
-
-void put_checkbox_items_in_treeview (GtkTreeView *treeview,
-                                    guint default_items,
-                                    gint n_items,
-                                    const struct checkbox_entry_item *items
-                                    );
-#endif
index 3e6ceb56340e31315b50224533a08172dedeb5ed..ac864041dba0a136f5366f40fc9ed557ba4a672c 100644 (file)
                 <property name="vscrollbar_policy">automatic</property>
                 <property name="shadow_type">in</property>
                 <child>
-                  <object class="GtkTreeView" id="cell-view">
+                  <object class="PsppireCheckboxTreeview" id="cell-view">
                     <property name="visible">True</property>
                     <property name="headers_visible">False</property>
                   </object>
                 <property name="vscrollbar_policy">automatic</property>
                 <property name="shadow_type">in</property>
                 <child>
-                  <object class="GtkTreeView" id="stats-view">
+                  <object class="PsppireCheckboxTreeview" id="stats-view">
                     <property name="width_request">128</property>
                     <property name="height_request">150</property>
                     <property name="visible">True</property>
index 70fef5df1ac317572e00a667597a78f200f3767f..a573cc1be357f982703ac6c8cbbc57aa4d4cbb6c 100644 (file)
                                     <property name="vscrollbar_policy">automatic</property>
                                     <property name="shadow_type">etched-in</property>
                                     <child>
-                                      <object class="GtkTreeView" id="statistics">
+                                      <object class="PsppireCheckboxTreeview" id="statistics">
                                         <property name="height_request">200</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
index e0bb6c6e7fa61cbe3f6a255fdb5a1a5bd9266518..a65e45f0b9bcab0b7a8f33079e5468fa847ff8bd 100644 (file)
                             <property name="vscrollbar_policy">automatic</property>
                             <property name="shadow_type">etched-in</property>
                             <child>
-                              <object class="GtkTreeView" id="stats-treeview">
+                              <object class="PsppireCheckboxTreeview" id="stats-treeview">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
                                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
diff --git a/src/ui/gui/psppire-checkbox-treeview.c b/src/ui/gui/psppire-checkbox-treeview.c
new file mode 100644 (file)
index 0000000..9cf5030
--- /dev/null
@@ -0,0 +1,155 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2007, 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/>. */
+
+
+/* 
+   This module provides a subclass of GtkTreeView, designed for dialogs
+   which need lists of annotated checkbox items.
+   The object contains the necessary model and renderers, which means that
+   the user does not have to create these herself.
+ */
+
+#include <config.h>
+#include <gtk/gtk.h>
+
+#include "psppire-checkbox-treeview.h"
+
+
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+static void psppire_checkbox_treeview_init          (PsppireCheckboxTreeview      *cbtv);
+
+GType
+psppire_checkbox_treeview_get_type (void)
+{
+  static GType psppire_checkbox_treeview_type = 0;
+
+  if (!psppire_checkbox_treeview_type)
+    {
+      static const GTypeInfo psppire_checkbox_treeview_info =
+      {
+       sizeof (PsppireCheckboxTreeviewClass),
+       (GBaseInitFunc) NULL,
+        (GBaseFinalizeFunc) NULL,
+       (GClassInitFunc) NULL,
+       (GClassFinalizeFunc) NULL,
+       NULL,
+        sizeof (PsppireCheckboxTreeview),
+       0,
+       (GInstanceInitFunc) psppire_checkbox_treeview_init,
+      };
+
+      psppire_checkbox_treeview_type =
+       g_type_register_static (GTK_TYPE_TREE_VIEW, "PsppireCheckboxTreeview",
+                               &psppire_checkbox_treeview_info, 0);
+    }
+
+  return psppire_checkbox_treeview_type;
+}
+
+
+
+/* Callback for checkbox cells in the statistics tree view.
+   Toggles the checkbox. */
+static void
+toggle (GtkCellRendererToggle *cell_renderer, const gchar *path_str, gpointer data)
+{
+  GtkTreeView *tv = GTK_TREE_VIEW (data);
+  GtkTreeModel *model = gtk_tree_view_get_model (tv);
+  GtkTreeIter iter;
+  GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
+  gboolean selected;
+
+  gtk_tree_model_get_iter (model, &iter, path);
+  gtk_tree_model_get (model, &iter, CHECKBOX_COLUMN_SELECTED, &selected, -1);
+  gtk_list_store_set (GTK_LIST_STORE (model), &iter, CHECKBOX_COLUMN_SELECTED,
+                      !selected, -1);
+  gtk_tree_path_free (path);
+}
+
+/* Create the necessary columns and renderers and add them to the widget */
+static void
+treeview_checkbox_populate (GtkTreeView *treeview)
+{
+  /* Checkbox column. */
+  GtkTreeViewColumn *col = gtk_tree_view_column_new ();
+  GtkCellRenderer *renderer = gtk_cell_renderer_toggle_new ();
+
+  gtk_tree_view_column_pack_start (col, renderer, TRUE);
+
+  gtk_tree_view_append_column (treeview, col);
+
+  gtk_tree_view_column_add_attribute  (col, renderer, "active", CHECKBOX_COLUMN_SELECTED);
+
+  g_signal_connect (renderer, "toggled", G_CALLBACK (toggle), treeview);
+
+  /* Label column. */
+  col = gtk_tree_view_column_new ();
+  gtk_tree_view_column_set_title (col, _("Statistic"));
+  renderer = gtk_cell_renderer_text_new ();
+  gtk_tree_view_column_pack_start (col, renderer, TRUE);
+
+  gtk_tree_view_column_add_attribute  (col, renderer, "text", CHECKBOX_COLUMN_LABEL);
+
+  g_object_set (renderer, "ellipsize-set", TRUE, NULL);
+  g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+  gtk_tree_view_column_set_min_width (col, 200);
+  gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+  gtk_tree_view_column_set_resizable (col, TRUE);
+  gtk_tree_view_append_column (treeview, col);
+}
+
+static void
+psppire_checkbox_treeview_init (PsppireCheckboxTreeview *cbtv)
+{
+  cbtv->list = GTK_TREE_MODEL (gtk_list_store_new (N_CHECKBOX_COLUMNS,
+                                                 G_TYPE_STRING, 
+                                                 G_TYPE_BOOLEAN));
+
+  gtk_tree_view_set_model (GTK_TREE_VIEW (cbtv), cbtv->list);
+  g_object_unref (cbtv->list);
+
+  treeview_checkbox_populate (GTK_TREE_VIEW (cbtv));
+}
+
+
+/*
+  Load the object's model from the array ITEMS.
+  N_ITEMS is the size of the array.
+  DEFAULT_ITEMS is a bitwise field indicating the initial state
+  of the items.
+*/
+void
+psppire_checkbox_treeview_populate (PsppireCheckboxTreeview *cbtv,
+                                   guint default_items,
+                                   gint n_items,
+                                   const struct checkbox_entry_item *items)
+{
+  size_t i;
+  for (i = 0; i < n_items; ++i)
+    {
+      GtkTreeIter iter;
+      gtk_list_store_append (GTK_LIST_STORE (cbtv->list), &iter);
+      gtk_list_store_set (GTK_LIST_STORE (cbtv->list), &iter,
+                          CHECKBOX_COLUMN_LABEL, gettext (items[i].label),
+                          CHECKBOX_COLUMN_SELECTED,
+                         (default_items & (1u << i)) != 0,
+                          -1);
+    }
+
+}
diff --git a/src/ui/gui/psppire-checkbox-treeview.h b/src/ui/gui/psppire-checkbox-treeview.h
new file mode 100644 (file)
index 0000000..b61cfdc
--- /dev/null
@@ -0,0 +1,88 @@
+/* PSPPIRE - a graphical user interface for PSPP.
+   Copyright (C) 2007, 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/>. */
+
+
+#ifndef __PSPPIRE_CHECKBOX_TREEVIEW_H__
+#define __PSPPIRE_CHECKBOX_TREEVIEW_H__
+
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+
+#define PSPPIRE_TYPE_CHECKBOX_TREEVIEW            (psppire_checkbox_treeview_get_type ())
+
+#define PSPPIRE_CHECKBOX_TREEVIEW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+    PSPPIRE_TYPE_CHECKBOX_TREEVIEW, PsppireCheckboxTreeview))
+
+#define PSPPIRE_CHECKBOX_TREEVIEW_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), \
+    PSPPIRE_TYPE_CHECKBOX_TREEVIEW, PsppireCheckboxTreeviewClass))
+
+#define PSPPIRE_IS_CHECKBOX_TREEVIEW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+    PSPPIRE_TYPE_CHECKBOX_TREEVIEW))
+
+#define PSPPIRE_IS_CHECKBOX_TREEVIEW_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
+    PSPPIRE_TYPE_CHECKBOX_TREEVIEW))
+
+
+typedef struct _PsppireCheckboxTreeview       PsppireCheckboxTreeview;
+typedef struct _PsppireCheckboxTreeviewClass  PsppireCheckboxTreeviewClass;
+
+
+struct _PsppireCheckboxTreeview
+{
+  GtkTreeView parent;
+
+  /* <private> */
+  GtkTreeModel *list;
+};
+
+
+struct _PsppireCheckboxTreeviewClass
+{
+  GtkTreeViewClass parent_class;
+};
+
+
+
+GType      psppire_checkbox_treeview_get_type        (void);
+GType      psppire_checkbox_treeview_model_get_type        (void);
+
+
+struct checkbox_entry_item
+  {
+    const char *name;
+    const char *label;
+  };
+
+enum
+  {
+    CHECKBOX_COLUMN_LABEL,
+    CHECKBOX_COLUMN_SELECTED,
+    N_CHECKBOX_COLUMNS
+  };
+
+void psppire_checkbox_treeview_populate (PsppireCheckboxTreeview *pctv,
+                                        guint default_items,
+                                        gint n_items,
+                                        const struct checkbox_entry_item *items);
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_CHECKBOX_TREEVIEW_H__ */
index 2bc07c6e4c75a4c9554a90e35e3374deb511dd75..b0b08b5ce6fd9356f58349e031098aa308fd891a 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "psppire-dialog.h"
 #include "builder-wrapper.h"
-#include "checkbox-treeview.h"
+#include "psppire-checkbox-treeview.h"
 #include "psppire-dict.h"
 #include "libpspp/str.h"
 
@@ -235,19 +235,17 @@ psppire_dialog_action_crosstabs_activate (GtkAction *a)
   act->format_options_table = TRUE;
   act->format_options_pivot = TRUE;
 
-  put_checkbox_items_in_treeview (GTK_TREE_VIEW (act->cell_view),
-                                 B_CS_CELL_DEFAULT,
-                                 N_CROSSTABS_CELLS,
-                                 cells
-                                 );
+  psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->cell_view),
+                                 B_CS_CELL_DEFAULT,
+                                 N_CROSSTABS_CELLS,
+                                 cells);
 
   act->cell = gtk_tree_view_get_model (GTK_TREE_VIEW (act->cell_view));
 
-  put_checkbox_items_in_treeview (GTK_TREE_VIEW (act->stat_view),
-                                 B_CS_STATS_DEFAULT,
-                                 N_CROSSTABS_STATS,
-                                 stats
-                                 );
+  psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->stat_view),
+                                 B_CS_STATS_DEFAULT,
+                                 N_CROSSTABS_STATS,
+                                 stats);
 
   act->stat = gtk_tree_view_get_model (GTK_TREE_VIEW (act->stat_view));
 
index ee8169aece3bc5b10c3fc11c3611f725cb6595d0..a286e0f828b88a89cf2ad68cb54f615f53ca5430 100644 (file)
 
 #include "psppire-dialog-action.h"
 
+/* 
+   This module provides a subclass of GtkTreeView, designed for dialogs
+   which need lists of annotated checkbox items.
+   The object contains the necessary model and renderers, which means that
+   the user does not have to create these herself.
+ */
+
+
 #ifndef __PSPPIRE_DIALOG_ACTION_CROSSTABS_H__
 #define __PSPPIRE_DIALOG_ACTION_CROSSTABS_H__
 
index b83cea8067f7cc6bbda9369ac4483985f4dfd049..451091726692705a30759bd6d6eae815c347f599 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "psppire-dialog-action-descriptives.h"
 
-#include "checkbox-treeview.h"
+#include "psppire-checkbox-treeview.h"
 
 #include "psppire-var-view.h"
 #include "psppire-dict.h"
@@ -209,9 +209,9 @@ psppire_dialog_action_descriptives_activate (GtkAction *a)
   g_object_set (pda->source, "model", pda->dict,
        "predicate", var_is_numeric, NULL);
 
-  put_checkbox_items_in_treeview (GTK_TREE_VIEW (stats_treeview),
-                                 B_DS_DEFAULT,
-                                 N_DESCRIPTIVE_STATS, stats);
+  psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (stats_treeview),
+                                     B_DS_DEFAULT,
+                                     N_DESCRIPTIVE_STATS, stats);
 
   act->stat_vars = GTK_TREE_VIEW (act->variables);
   act->stats = gtk_tree_view_get_model (GTK_TREE_VIEW (stats_treeview));
index 6f8049009eb5524361e167854042d3797fed555c..a5c5010a09c0e69f93952a1dfeaa906e60ff092a 100644 (file)
@@ -27,7 +27,7 @@ This program is free software: you can redistribute it and/or modify
 
 #include "psppire-dialog.h"
 #include "builder-wrapper.h"
-#include "checkbox-treeview.h"
+#include "psppire-checkbox-treeview.h"
 #include "psppire-dict.h"
 #include "libpspp/str.h"
 
@@ -263,7 +263,7 @@ psppire_dialog_action_frequencies_activate (GtkAction * a)
 
   act->stat_vars = get_widget_assert (xml, "var-treeview");
 
-  put_checkbox_items_in_treeview (GTK_TREE_VIEW (stats_treeview),
+  psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (stats_treeview),
                                   B_FS_DEFAULT, N_FREQUENCY_STATS, stats);
 
   act->stats = gtk_tree_view_get_model (GTK_TREE_VIEW (stats_treeview));
index 29df2a4392ac0c7bc6c8ce20e12c443258205ca9..fe3d4418cf0980c458de2ee1ac189ff629ea3935 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "psppire-dialog.h"
 #include "builder-wrapper.h"
-#include "checkbox-treeview.h"
+#include "psppire-checkbox-treeview.h"
 #include "psppire-dict.h"
 #include "libpspp/str.h"
 
@@ -162,10 +162,10 @@ psppire_dialog_action_regression_activate (GtkAction *a)
 
   g_object_unref (xml);
 
-  put_checkbox_items_in_treeview (GTK_TREE_VIEW (act->stat_view),
-                                 B_RG_STATS_DEFAULT,
-                                 N_REGRESSION_STATS,
-                                 stats);
+  psppire_checkbox_treeview_populate (PSPPIRE_CHECKBOX_TREEVIEW (act->stat_view),
+                                 B_RG_STATS_DEFAULT,
+                                 N_REGRESSION_STATS,
+                                 stats);
 
   psppire_dialog_action_set_refresh (pda, refresh);
 
index e56c095c1de562b6ed8976ebe292011af9fac25d..d7a0675f4db0d85ee297f23c7de795e18cddeee6 100644 (file)
                     <property name="vscrollbar_policy">automatic</property>
                     <property name="shadow_type">etched-in</property>
                     <child>
-                      <object class="GtkTreeView" id="stat-view">
+                      <object class="PsppireCheckboxTreeview" id="stat-view">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
index 488656e9e6365173805a373c0fa64e03e6fe8ad6..7046df8c93cf59c127181b775b5ac358b7d1b89b 100644 (file)
@@ -14,6 +14,7 @@
 #include "psppire-dictview.h"
 #include "psppire-var-view.h"
 #include "psppire-val-chooser.h"
+#include "psppire-checkbox-treeview.h"
 
 #include "psppire-dialog-action-binomial.h"
 #include "psppire-dialog-action-correlation.h"
@@ -53,6 +54,7 @@ preregister_widgets (void)
   psppire_dict_view_get_type ();
   psppire_var_view_get_type ();
   psppire_value_entry_get_type ();
+  psppire_checkbox_treeview_get_type ();
 
   psppire_dialog_action_binomial_get_type ();
   psppire_dialog_action_correlation_get_type ();