[gtk+] GtkTreeViewAccessible: add a private struct



commit 19fc0903549f9808e89eea87b4932bbcdfddfb0e
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Oct 15 05:56:41 2012 -0400

    GtkTreeViewAccessible: add a private struct
    
    Move instance fields to a private struct, in preparation
    for installing a11y headers.

 gtk/a11y/gtktreeviewaccessible.c |   28 +++++++++++++++++++---------
 gtk/a11y/gtktreeviewaccessible.h |    7 ++++---
 2 files changed, 23 insertions(+), 12 deletions(-)
---
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index 36fbf31..4a21dc0 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -33,6 +33,11 @@
 #include "gtktextcellaccessible.h"
 #include "gtkcellaccessibleparent.h"
 
+struct _GtkTreeViewAccessiblePrivate
+{
+  GHashTable *cell_infos;
+};
+
 typedef struct _GtkTreeViewAccessibleCellInfo  GtkTreeViewAccessibleCellInfo;
 struct _GtkTreeViewAccessibleCellInfo
 {
@@ -142,7 +147,7 @@ gtk_tree_view_accessible_initialize (AtkObject *obj,
 
   accessible = GTK_TREE_VIEW_ACCESSIBLE (obj);
 
-  accessible->cell_infos = g_hash_table_new_full (cell_info_hash,
+  accessible->priv->cell_infos = g_hash_table_new_full (cell_info_hash,
       cell_info_equal, NULL, (GDestroyNotify) cell_info_free);
 
   widget = GTK_WIDGET (data);
@@ -163,8 +168,8 @@ gtk_tree_view_accessible_finalize (GObject *object)
 {
   GtkTreeViewAccessible *accessible = GTK_TREE_VIEW_ACCESSIBLE (object);
 
-  if (accessible->cell_infos)
-    g_hash_table_destroy (accessible->cell_infos);
+  if (accessible->priv->cell_infos)
+    g_hash_table_destroy (accessible->priv->cell_infos);
 
   G_OBJECT_CLASS (_gtk_tree_view_accessible_parent_class)->finalize (object);
 }
@@ -187,7 +192,7 @@ gtk_tree_view_accessible_notify_gtk (GObject    *obj,
       AtkRole role;
 
       tree_model = gtk_tree_view_get_model (tree_view);
-      g_hash_table_remove_all (accessible->cell_infos);
+      g_hash_table_remove_all (accessible->priv->cell_infos);
 
       if (tree_model)
         {
@@ -215,7 +220,7 @@ gtk_tree_view_accessible_widget_unset (GtkAccessible *gtkaccessible)
 {
   GtkTreeViewAccessible *accessible = GTK_TREE_VIEW_ACCESSIBLE (gtkaccessible);
 
-  g_hash_table_remove_all (accessible->cell_infos);
+  g_hash_table_remove_all (accessible->priv->cell_infos);
 
   GTK_ACCESSIBLE_CLASS (_gtk_tree_view_accessible_parent_class)->widget_unset (gtkaccessible);
 }
@@ -343,7 +348,7 @@ peek_cell (GtkTreeViewAccessible *accessible,
   lookup.node = node;
   lookup.cell_col_ref = column;
 
-  cell_info = g_hash_table_lookup (accessible->cell_infos, &lookup);
+  cell_info = g_hash_table_lookup (accessible->priv->cell_infos, &lookup);
   if (cell_info == NULL)
     return NULL;
 
@@ -521,11 +526,16 @@ _gtk_tree_view_accessible_class_init (GtkTreeViewAccessibleClass *klass)
   container_class->remove_gtk = NULL;
 
   gobject_class->finalize = gtk_tree_view_accessible_finalize;
+
+  g_type_class_add_private (klass, sizeof (GtkTreeViewAccessiblePrivate));
 }
 
 static void
 _gtk_tree_view_accessible_init (GtkTreeViewAccessible *view)
 {
+  view->priv = G_TYPE_INSTANCE_GET_PRIVATE (view,
+                                            GTK_TYPE_TREE_VIEW_ACCESSIBLE,
+                                            GtkTreeViewAccessiblePrivate);
 }
 
 /* atkcomponent.h */
@@ -1429,7 +1439,7 @@ cell_info_new (GtkTreeViewAccessible *accessible,
                       gtk_tree_view_accessible_get_data_quark (),
                       cell_info);
 
-  g_hash_table_replace (accessible->cell_infos, cell_info, cell_info);
+  g_hash_table_replace (accessible->priv->cell_infos, cell_info, cell_info);
 }
 
 /* Returns the column number of the specified GtkTreeViewColumn
@@ -1610,7 +1620,7 @@ _gtk_tree_view_accessible_remove (GtkTreeView *treeview,
           g_signal_emit_by_name (accessible, "children-changed::remove", i, NULL, NULL);
         }
 
-      g_hash_table_iter_init (&iter, accessible->cell_infos);
+      g_hash_table_iter_init (&iter, accessible->priv->cell_infos);
       while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&cell_info))
         {
           if (node == cell_info->node ||
@@ -1724,7 +1734,7 @@ gtk_tree_view_accessible_do_remove_column (GtkTreeViewAccessible *accessible,
   guint row, n_rows, n_cols;
 
   /* Clean column from cache */
-  g_hash_table_iter_init (&iter, accessible->cell_infos);
+  g_hash_table_iter_init (&iter, accessible->priv->cell_infos);
   while (g_hash_table_iter_next (&iter, NULL, &value))
     {
       cell_info = value;
diff --git a/gtk/a11y/gtktreeviewaccessible.h b/gtk/a11y/gtktreeviewaccessible.h
index f751d24..badc2d7 100644
--- a/gtk/a11y/gtktreeviewaccessible.h
+++ b/gtk/a11y/gtktreeviewaccessible.h
@@ -30,14 +30,15 @@ G_BEGIN_DECLS
 #define GTK_IS_TREE_VIEW_ACCESSIBLE_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TREE_VIEW_ACCESSIBLE))
 #define GTK_TREE_VIEW_ACCESSIBLE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_TREE_VIEW_ACCESSIBLE, GtkTreeViewAccessibleClass))
 
-typedef struct _GtkTreeViewAccessible      GtkTreeViewAccessible;
-typedef struct _GtkTreeViewAccessibleClass GtkTreeViewAccessibleClass;
+typedef struct _GtkTreeViewAccessible        GtkTreeViewAccessible;
+typedef struct _GtkTreeViewAccessibleClass   GtkTreeViewAccessibleClass;
+typedef struct _GtkTreeViewAccessiblePrivate GtkTreeViewAccessiblePrivate;
 
 struct _GtkTreeViewAccessible
 {
   GtkContainerAccessible parent;
 
-  GHashTable    *cell_infos;
+  GtkTreeViewAccessiblePrivate *priv;
 };
 
 struct _GtkTreeViewAccessibleClass



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]