diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2013-06-27 20:02:52 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2013-07-09 09:30:02 +0100 |
commit | 0899ef7cc9cf73824901923143f38bb9b6d224a3 (patch) | |
tree | 16207a8837da8a89a6f4a1d1a1c23074fd29aa1d /gtk/gtkcontainer.c | |
parent | 365919d5f6da0a8648815ca5cf5805fb88c9be16 (diff) | |
download | gtk+-0899ef7cc9cf73824901923143f38bb9b6d224a3.tar.gz |
gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
Diffstat (limited to 'gtk/gtkcontainer.c')
-rw-r--r-- | gtk/gtkcontainer.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 2d6d2df9e4..989a36f307 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -356,6 +356,7 @@ static guint vadjustment_key_id = 0; static const gchar hadjustment_key[] = "gtk-hadjustment"; static guint hadjustment_key_id = 0; static guint container_signals[LAST_SIGNAL] = { 0 }; +static gint GtkContainer_private_offset; static GtkWidgetClass *parent_class = NULL; extern GParamSpecPool *_gtk_widget_child_property_pool; extern GObjectNotifyContext *_gtk_widget_child_property_notify_context; @@ -363,6 +364,12 @@ static GtkBuildableIface *parent_buildable_iface; /* --- functions --- */ +static inline gpointer +gtk_container_get_instance_private (GtkContainer *self) +{ + return G_STRUCT_MEMBER_P (self, GtkContainer_private_offset); +} + GType gtk_container_get_type (void) { @@ -395,6 +402,9 @@ gtk_container_get_type (void) g_type_register_static (GTK_TYPE_WIDGET, I_("GtkContainer"), &container_info, G_TYPE_FLAG_ABSTRACT); + GtkContainer_private_offset = + g_type_add_instance_private (container_type, sizeof (GtkContainerPrivate)); + g_type_add_interface_static (container_type, GTK_TYPE_BUILDABLE, &buildable_info); @@ -526,7 +536,8 @@ gtk_container_class_init (GtkContainerClass *class) G_TYPE_NONE, 1, GTK_TYPE_WIDGET); - g_type_class_add_private (class, sizeof (GtkContainerPrivate)); + if (GtkContainer_private_offset != 0) + g_type_class_adjust_private_offset (class, &GtkContainer_private_offset); gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_CONTAINER_ACCESSIBLE); } @@ -1348,9 +1359,7 @@ gtk_container_init (GtkContainer *container) { GtkContainerPrivate *priv; - container->priv = G_TYPE_INSTANCE_GET_PRIVATE (container, - GTK_TYPE_CONTAINER, - GtkContainerPrivate); + container->priv = gtk_container_get_instance_private (container); priv = container->priv; priv->focus_child = NULL; |