From 0991115ada766bfbaa1765a92b7478c83771095a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jard=C3=B3n?= Date: Fri, 4 Jun 2010 23:48:00 +0200 Subject: [PATCH] gtkfixed: Move public members to private structure --- gtk/gtkfixed.c | 53 +++++++++++++++++++++++++++++++++----------------- gtk/gtkfixed.h | 5 +++-- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c index 587636a424..22b77775a3 100644 --- a/gtk/gtkfixed.c +++ b/gtk/gtkfixed.c @@ -30,6 +30,11 @@ #include "gtkintl.h" +struct _GtkFixedPriv +{ + GList *children; +}; + enum { CHILD_PROP_0, CHILD_PROP_X, @@ -104,6 +109,8 @@ gtk_fixed_class_init (GtkFixedClass *class) G_MAXINT, 0, GTK_PARAM_READWRITE)); + + g_type_class_add_private (class, sizeof (GtkFixedPriv)); } static GType @@ -115,9 +122,16 @@ gtk_fixed_child_type (GtkContainer *container) static void gtk_fixed_init (GtkFixed *fixed) { + GtkFixedPriv *priv; + + fixed->priv = G_TYPE_INSTANCE_GET_PRIVATE (fixed, + GTK_TYPE_FIXED, + GtkFixedPriv); + priv = fixed->priv; + gtk_widget_set_has_window (GTK_WIDGET (fixed), FALSE); - fixed->children = NULL; + priv->children = NULL; } GtkWidget* @@ -130,9 +144,10 @@ static GtkFixedChild* get_child (GtkFixed *fixed, GtkWidget *widget) { + GtkFixedPriv *priv = fixed->priv; GList *children; - - children = fixed->children; + + children = priv->children; while (children) { GtkFixedChild *child; @@ -153,6 +168,7 @@ gtk_fixed_put (GtkFixed *fixed, gint x, gint y) { + GtkFixedPriv *priv = fixed->priv; GtkFixedChild *child_info; g_return_if_fail (GTK_IS_FIXED (fixed)); @@ -165,7 +181,7 @@ gtk_fixed_put (GtkFixed *fixed, gtk_widget_set_parent (widget, GTK_WIDGET (fixed)); - fixed->children = g_list_append (fixed->children, child_info); + priv->children = g_list_append (priv->children, child_info); } static void @@ -306,17 +322,20 @@ static void gtk_fixed_size_request (GtkWidget *widget, GtkRequisition *requisition) { - GtkFixed *fixed; + GtkFixedPriv *priv; + GtkFixed *fixed; GtkFixedChild *child; GList *children; GtkRequisition child_requisition; guint border_width; fixed = GTK_FIXED (widget); + priv = fixed->priv; + requisition->width = 0; requisition->height = 0; - children = fixed->children; + children = priv->children; while (children) { child = children->data; @@ -344,15 +363,14 @@ static void gtk_fixed_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { - GtkFixed *fixed; + GtkFixed *fixed = GTK_FIXED (widget); + GtkFixedPriv *priv = fixed->priv; GtkFixedChild *child; GtkAllocation child_allocation; GtkRequisition child_requisition; GList *children; guint border_width; - fixed = GTK_FIXED (widget); - widget->allocation = *allocation; if (gtk_widget_get_has_window (widget)) @@ -367,7 +385,7 @@ gtk_fixed_size_allocate (GtkWidget *widget, border_width = gtk_container_get_border_width (GTK_CONTAINER (fixed)); - children = fixed->children; + children = priv->children; while (children) { child = children->data; @@ -403,15 +421,13 @@ static void gtk_fixed_remove (GtkContainer *container, GtkWidget *widget) { - GtkFixed *fixed; + GtkFixed *fixed = GTK_FIXED (container); + GtkFixedPriv *priv = fixed->priv; GtkFixedChild *child; - GtkWidget *widget_container; + GtkWidget *widget_container = GTK_WIDGET (container); GList *children; - fixed = GTK_FIXED (container); - widget_container = GTK_WIDGET (container); - - children = fixed->children; + children = priv->children; while (children) { child = children->data; @@ -422,7 +438,7 @@ gtk_fixed_remove (GtkContainer *container, gtk_widget_unparent (widget); - fixed->children = g_list_remove_link (fixed->children, children); + priv->children = g_list_remove_link (priv->children, children); g_list_free (children); g_free (child); @@ -443,10 +459,11 @@ gtk_fixed_forall (GtkContainer *container, gpointer callback_data) { GtkFixed *fixed = GTK_FIXED (container); + GtkFixedPriv *priv = fixed->priv; GtkFixedChild *child; GList *children; - children = fixed->children; + children = priv->children; while (children) { child = children->data; diff --git a/gtk/gtkfixed.h b/gtk/gtkfixed.h index 7f2fa96003..fc65f6cae5 100644 --- a/gtk/gtkfixed.h +++ b/gtk/gtkfixed.h @@ -44,8 +44,8 @@ G_BEGIN_DECLS #define GTK_IS_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FIXED)) #define GTK_FIXED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FIXED, GtkFixedClass)) - typedef struct _GtkFixed GtkFixed; +typedef struct _GtkFixedPriv GtkFixedPriv; typedef struct _GtkFixedClass GtkFixedClass; typedef struct _GtkFixedChild GtkFixedChild; @@ -53,7 +53,8 @@ struct _GtkFixed { GtkContainer container; - GList *GSEAL (children); + /* */ + GtkFixedPriv *priv; }; struct _GtkFixedClass