[gtk+/refactor: 2/106] gtkactiongroup: Unseal private pointer



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

    gtkactiongroup: Unseal private pointer
    
    Also, use ->priv instead GET_PRIV() macro all the time

 gtk/gtkactiongroup.c |   49 ++++++++++++++++++++++++++-----------------------
 gtk/gtkactiongroup.h |    3 +--
 2 files changed, 27 insertions(+), 25 deletions(-)
---
diff --git a/gtk/gtkactiongroup.c b/gtk/gtkactiongroup.c
index 4ed7e38..d0749f4 100644
--- a/gtk/gtkactiongroup.c
+++ b/gtk/gtkactiongroup.c
@@ -104,7 +104,6 @@
 #include "gtkprivate.h"
 #include "gtkintl.h"
 
-#define GTK_ACTION_GROUP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ACTION_GROUP, GtkActionGroupPrivate))
 
 struct _GtkActionGroupPrivate 
 {
@@ -350,11 +349,14 @@ remove_action (GtkAction *action)
 }
 
 static void
-gtk_action_group_init (GtkActionGroup *self)
+gtk_action_group_init (GtkActionGroup *action_group)
 {
   GtkActionGroupPrivate *private;
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (self);
+  action_group->priv = G_TYPE_INSTANCE_GET_PRIVATE (action_group,
+                                                    GTK_TYPE_ACTION_GROUP,
+                                                    GtkActionGroupPrivate);
+  private = action_group->priv;
 
   private->name = NULL;
   private->sensitive = TRUE;
@@ -392,7 +394,7 @@ gtk_action_group_buildable_set_name (GtkBuildable *buildable,
 				     const gchar  *name)
 {
   GtkActionGroup *self = GTK_ACTION_GROUP (buildable);
-  GtkActionGroupPrivate *private = GTK_ACTION_GROUP_GET_PRIVATE (self);
+  GtkActionGroupPrivate *private = self->priv;
 
   private->name = g_strdup (name);
 }
@@ -401,7 +403,8 @@ static const gchar *
 gtk_action_group_buildable_get_name (GtkBuildable *buildable)
 {
   GtkActionGroup *self = GTK_ACTION_GROUP (buildable);
-  GtkActionGroupPrivate *private = GTK_ACTION_GROUP_GET_PRIVATE (self);
+  GtkActionGroupPrivate *private = self->priv;
+
   return private->name;
 }
 
@@ -495,7 +498,7 @@ gtk_action_group_buildable_custom_tag_end (GtkBuildable *buildable,
       
       data = (AcceleratorParserData*)user_data;
       action_group = GTK_ACTION_GROUP (buildable);
-      private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+      private = action_group->priv;
       action = GTK_ACTION (child);
 	
       accel_path = g_strconcat ("<Actions>/",
@@ -533,7 +536,7 @@ gtk_action_group_new (const gchar *name)
   GtkActionGroupPrivate *private;
 
   self = g_object_new (GTK_TYPE_ACTION_GROUP, NULL);
-  private = GTK_ACTION_GROUP_GET_PRIVATE (self);
+  private = self->priv;
   private->name = g_strdup (name);
 
   return self;
@@ -546,7 +549,7 @@ gtk_action_group_finalize (GObject *object)
   GtkActionGroupPrivate *private;
 
   self = GTK_ACTION_GROUP (object);
-  private = GTK_ACTION_GROUP_GET_PRIVATE (self);
+  private = self->priv;
 
   g_free (private->name);
   private->name = NULL;
@@ -571,7 +574,7 @@ gtk_action_group_set_property (GObject         *object,
   gchar *tmp;
   
   self = GTK_ACTION_GROUP (object);
-  private = GTK_ACTION_GROUP_GET_PRIVATE (self);
+  private = self->priv;
 
   switch (prop_id)
     {
@@ -602,7 +605,7 @@ gtk_action_group_get_property (GObject    *object,
   GtkActionGroupPrivate *private;
   
   self = GTK_ACTION_GROUP (object);
-  private = GTK_ACTION_GROUP_GET_PRIVATE (self);
+  private = self->priv;
 
   switch (prop_id)
     {
@@ -627,7 +630,7 @@ gtk_action_group_real_get_action (GtkActionGroup *self,
 {
   GtkActionGroupPrivate *private;
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (self);
+  private = self->priv;
 
   return g_hash_table_lookup (private->actions, action_name);
 }
@@ -649,7 +652,7 @@ gtk_action_group_get_name (GtkActionGroup *action_group)
 
   g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), NULL);
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+  private = action_group->priv;
 
   return private->name;
 }
@@ -674,7 +677,7 @@ gtk_action_group_get_sensitive (GtkActionGroup *action_group)
 
   g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), FALSE);
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+  private = action_group->priv;
 
   return private->sensitive;
 }
@@ -706,7 +709,7 @@ gtk_action_group_set_sensitive (GtkActionGroup *action_group,
 
   g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+  private = action_group->priv;
   sensitive = sensitive != FALSE;
 
   if (private->sensitive != sensitive)
@@ -739,7 +742,7 @@ gtk_action_group_get_visible (GtkActionGroup *action_group)
 
   g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), FALSE);
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+  private = action_group->priv;
 
   return private->visible;
 }
@@ -770,7 +773,7 @@ gtk_action_group_set_visible (GtkActionGroup *action_group,
 
   g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+  private = action_group->priv;
   visible = visible != FALSE;
 
   if (private->visible != visible)
@@ -813,7 +816,7 @@ check_unique_action (GtkActionGroup *action_group,
     {
       GtkActionGroupPrivate *private;
 
-      private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+      private = action_group->priv;
 
       g_warning ("Refusing to add non-unique action '%s' to action group '%s'",
 	 	 action_name,
@@ -854,7 +857,7 @@ gtk_action_group_add_action (GtkActionGroup *action_group,
   if (!check_unique_action (action_group, name))
     return;
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+  private = action_group->priv;
 
   g_hash_table_insert (private->actions, 
 		       (gpointer) name,
@@ -895,7 +898,7 @@ gtk_action_group_add_action_with_accel (GtkActionGroup *action_group,
   if (!check_unique_action (action_group, name))
     return;
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+  private = action_group->priv;
   accel_path = g_strconcat ("<Actions>/",
 			    private->name, "/", name, NULL);
 
@@ -958,7 +961,7 @@ gtk_action_group_remove_action (GtkActionGroup *action_group,
   name = gtk_action_get_name (action);
   g_return_if_fail (name != NULL);
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+  private = action_group->priv;
 
   g_hash_table_remove (private->actions, name);
 }
@@ -991,7 +994,7 @@ gtk_action_group_list_actions (GtkActionGroup *action_group)
 
   g_return_val_if_fail (GTK_IS_ACTION_GROUP (action_group), NULL);
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+  private = action_group->priv;
   
   g_hash_table_foreach (private->actions, add_single_action, &actions);
 
@@ -1379,7 +1382,7 @@ gtk_action_group_set_translate_func (GtkActionGroup   *action_group,
 
   g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
   
-  private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+  private = action_group->priv;
 
   if (private->translate_notify)
     private->translate_notify (private->translate_data);
@@ -1452,7 +1455,7 @@ gtk_action_group_translate_string (GtkActionGroup *action_group,
   if (string == NULL)
     return NULL;
 
-  private = GTK_ACTION_GROUP_GET_PRIVATE (action_group);
+  private = action_group->priv;
 
   translate_func = private->translate_func;
   translate_data = private->translate_data;
diff --git a/gtk/gtkactiongroup.h b/gtk/gtkactiongroup.h
index 9ac3e38..c77987c 100644
--- a/gtk/gtkactiongroup.h
+++ b/gtk/gtkactiongroup.h
@@ -59,8 +59,7 @@ struct _GtkActionGroup
   GObject parent;
 
   /*< private >*/
-
-  GtkActionGroupPrivate *GSEAL (private_data);
+  GtkActionGroupPrivate *priv;
 };
 
 struct _GtkActionGroupClass



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