GtkImageAccessible: add a private struct

Move instance fields to a private struct, in preparation
for installing a11y headers.
This commit is contained in:
Matthias Clasen 2012-10-14 19:38:08 -04:00
parent 538c241951
commit 0bbfcc2491
2 changed files with 21 additions and 13 deletions

View File

@ -21,6 +21,11 @@
#include <gtk/gtk.h>
#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;
}

View File

@ -31,13 +31,13 @@ G_BEGIN_DECLS
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