[gtk+/refactor: 6/106] gtkaccessible: Move public members to private structure



commit 472753330d176532c8fcce41598c78d9277b3956
Author: Javier Jardón <jjardon gnome org>
Date:   Sun May 23 01:06:45 2010 +0200

    gtkaccessible: Move public members to private structure

 gtk/gtkaccessible.c |   28 ++++++++++++++++++++++------
 gtk/gtkaccessible.h |    8 +++-----
 2 files changed, 25 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkaccessible.c b/gtk/gtkaccessible.c
index 3a42ccd..228f88f 100644
--- a/gtk/gtkaccessible.c
+++ b/gtk/gtkaccessible.c
@@ -30,20 +30,34 @@
  * @Title: GtkAccessible
  */
 
+/*
+ * GtkAccessiblePriv:
+ * @widget: The GtkWidget whose properties and features are exported via this
+ *   accessible instance
+ */
+struct _GtkAccessiblePriv
+{
+  GtkWidget *widget;
+};
 
 static void gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible);
 
 G_DEFINE_TYPE (GtkAccessible, gtk_accessible, ATK_TYPE_OBJECT)
 
 static void
-gtk_accessible_init (GtkAccessible *object)
+gtk_accessible_init (GtkAccessible *accesible)
 {
+  accesible->priv = G_TYPE_INSTANCE_GET_PRIVATE (accesible,
+                                                 GTK_TYPE_ACCESSIBLE,
+                                                 GtkAccessiblePriv);
 }
 
 static void
 gtk_accessible_class_init (GtkAccessibleClass *klass)
 {
   klass->connect_widget_destroyed = gtk_accessible_real_connect_widget_destroyed;
+
+  g_type_class_add_private (klass, sizeof (GtkAccessiblePriv));
 }
 
 /**
@@ -61,7 +75,7 @@ gtk_accessible_set_widget (GtkAccessible *accessible,
 {
   g_return_if_fail (GTK_IS_ACCESSIBLE (accessible));
 
-  accessible->widget = widget;
+  accessible->priv->widget = widget;
 }
 
 /**
@@ -81,7 +95,7 @@ gtk_accessible_get_widget (GtkAccessible *accessible)
 {
   g_return_val_if_fail (GTK_IS_ACCESSIBLE (accessible), NULL);
 
-  return accessible->widget;
+  return accessible->priv->widget;
 }
 
 /**
@@ -107,11 +121,13 @@ gtk_accessible_connect_widget_destroyed (GtkAccessible *accessible)
 static void
 gtk_accessible_real_connect_widget_destroyed (GtkAccessible *accessible)
 {
-  if (accessible->widget)
+  GtkAccessiblePriv *priv = accessible->priv;
+
+  if (priv->widget)
   {
-    g_signal_connect (accessible->widget,
+    g_signal_connect (priv->widget,
                       "destroy",
                       G_CALLBACK (gtk_widget_destroyed),
-                      &accessible->widget);
+                      &priv->widget);
   }
 }
diff --git a/gtk/gtkaccessible.h b/gtk/gtkaccessible.h
index 1a79f15..584bcc5 100644
--- a/gtk/gtkaccessible.h
+++ b/gtk/gtkaccessible.h
@@ -37,6 +37,7 @@ G_BEGIN_DECLS
 #define GTK_ACCESSIBLE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ACCESSIBLE, GtkAccessibleClass))
 
 typedef struct _GtkAccessible                GtkAccessible;
+typedef struct _GtkAccessiblePriv            GtkAccessiblePriv;
 typedef struct _GtkAccessibleClass           GtkAccessibleClass;
 
   /*
@@ -46,11 +47,8 @@ struct _GtkAccessible
 {
   AtkObject parent;
 
-  /*
-   * The GtkWidget whose properties and features are exported via this 
-   * accessible instance.
-   */
-  GtkWidget *GSEAL (widget);
+  /*< private >*/
+  GtkAccessiblePriv *priv;
 };
 
 struct _GtkAccessibleClass



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