From 0bbfcc249191026a1ee822545398ec6e5e36f7f4 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 14 Oct 2012 19:38:08 -0400 Subject: [PATCH] GtkImageAccessible: add a private struct Move instance fields to a private struct, in preparation for installing a11y headers. --- gtk/a11y/gtkimageaccessible.c | 26 +++++++++++++++++--------- gtk/a11y/gtkimageaccessible.h | 8 ++++---- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/gtk/a11y/gtkimageaccessible.c b/gtk/a11y/gtkimageaccessible.c index 84c960702d..14dffa35f0 100644 --- a/gtk/a11y/gtkimageaccessible.c +++ b/gtk/a11y/gtkimageaccessible.c @@ -21,6 +21,11 @@ #include #include "gtkimageaccessible.h" +struct _GtkImageAccessiblePrivate +{ + gchar *image_description; + gchar *stock_name; +}; static void atk_image_interface_init (AtkImageIface *iface); @@ -41,8 +46,8 @@ gtk_image_accessible_finalize (GObject *object) { GtkImageAccessible *aimage = GTK_IMAGE_ACCESSIBLE (object); - g_free (aimage->image_description); - g_free (aimage->stock_name); + g_free (aimage->priv->image_description); + g_free (aimage->priv->stock_name); G_OBJECT_CLASS (_gtk_image_accessible_parent_class)->finalize (object); } @@ -68,8 +73,8 @@ gtk_image_accessible_get_name (AtkObject *accessible) image = GTK_IMAGE (widget); image_accessible = GTK_IMAGE_ACCESSIBLE (accessible); - g_free (image_accessible->stock_name); - image_accessible->stock_name = NULL; + g_free (image_accessible->priv->stock_name); + image_accessible->priv->stock_name = NULL; if (gtk_image_get_storage_type (image) != GTK_IMAGE_STOCK) return NULL; @@ -81,8 +86,8 @@ gtk_image_accessible_get_name (AtkObject *accessible) if (!gtk_stock_lookup (stock_id, &stock_item)) return NULL; - image_accessible->stock_name = _gtk_toolbar_elide_underscores (stock_item.label); - return image_accessible->stock_name; + image_accessible->priv->stock_name = _gtk_toolbar_elide_underscores (stock_item.label); + return image_accessible->priv->stock_name; } static void @@ -99,6 +104,9 @@ _gtk_image_accessible_class_init (GtkImageAccessibleClass *klass) static void _gtk_image_accessible_init (GtkImageAccessible *image) { + image->priv = G_TYPE_INSTANCE_GET_PRIVATE (image, + GTK_TYPE_IMAGE_ACCESSIBLE, + GtkImageAccessiblePrivate); } static const gchar * @@ -106,7 +114,7 @@ gtk_image_accessible_get_image_description (AtkImage *image) { GtkImageAccessible *accessible = GTK_IMAGE_ACCESSIBLE (image); - return accessible->image_description; + return accessible->priv->image_description; } static void @@ -187,8 +195,8 @@ gtk_image_accessible_set_image_description (AtkImage *image, { GtkImageAccessible* accessible = GTK_IMAGE_ACCESSIBLE (image); - g_free (accessible->image_description); - accessible->image_description = g_strdup (description); + g_free (accessible->priv->image_description); + accessible->priv->image_description = g_strdup (description); return TRUE; } diff --git a/gtk/a11y/gtkimageaccessible.h b/gtk/a11y/gtkimageaccessible.h index 1fad1205cf..7e481d7227 100644 --- a/gtk/a11y/gtkimageaccessible.h +++ b/gtk/a11y/gtkimageaccessible.h @@ -29,15 +29,15 @@ G_BEGIN_DECLS #define GTK_IS_IMAGE_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE_ACCESSIBLE)) #define GTK_IMAGE_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IMAGE_ACCESSIBLE, GtkImageAccessibleClass)) -typedef struct _GtkImageAccessible GtkImageAccessible; -typedef struct _GtkImageAccessibleClass GtkImageAccessibleClass; +typedef struct _GtkImageAccessible GtkImageAccessible; +typedef struct _GtkImageAccessibleClass GtkImageAccessibleClass; +typedef struct _GtkImageAccessiblePrivate GtkImageAccessiblePrivate; struct _GtkImageAccessible { GtkWidgetAccessible parent; - gchar* image_description; - gchar* stock_name; + GtkImageAccessiblePrivate *priv; }; struct _GtkImageAccessibleClass