GtkBooleanCellAccessible: 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 02:40:20 -04:00
parent 7264a996fe
commit 5226327e11
2 changed files with 22 additions and 10 deletions

View File

@ -20,6 +20,12 @@
#include <gtk/gtk.h>
#include "gtkbooleancellaccessible.h"
struct _GtkBooleanCellAccessiblePrivate
{
gboolean cell_value;
gboolean cell_sensitive;
};
static AtkActionIface *parent_action_iface;
static gint
@ -82,10 +88,10 @@ gtk_boolean_cell_accessible_ref_state_set (AtkObject *accessible)
state_set = ATK_OBJECT_CLASS (_gtk_boolean_cell_accessible_parent_class)->ref_state_set (accessible);
if (cell->cell_value)
if (cell->priv->cell_value)
atk_state_set_add_state (state_set, ATK_STATE_CHECKED);
if (cell->cell_sensitive)
if (cell->priv->cell_sensitive)
atk_state_set_add_state (state_set, ATK_STATE_SENSITIVE);
else
atk_state_set_remove_state (state_set, ATK_STATE_SENSITIVE);
@ -105,16 +111,16 @@ gtk_boolean_cell_accessible_update_cache (GtkCellAccessible *cell)
"sensitive", &sensitive,
NULL);
if (boolean_cell->cell_value != active)
if (boolean_cell->priv->cell_value != active)
{
boolean_cell->cell_value = !boolean_cell->cell_value;
boolean_cell->priv->cell_value = !boolean_cell->priv->cell_value;
atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_CHECKED, active);
}
if (boolean_cell->cell_sensitive != sensitive)
if (boolean_cell->priv->cell_sensitive != sensitive)
{
boolean_cell->cell_sensitive = !boolean_cell->cell_sensitive;
boolean_cell->priv->cell_sensitive = !boolean_cell->priv->cell_sensitive;
atk_object_notify_state_change (ATK_OBJECT (cell), ATK_STATE_CHECKED, sensitive);
}
@ -129,10 +135,15 @@ _gtk_boolean_cell_accessible_class_init (GtkBooleanCellAccessibleClass *klass)
atkobject_class->ref_state_set = gtk_boolean_cell_accessible_ref_state_set;
cell_class->update_cache = gtk_boolean_cell_accessible_update_cache;
g_type_class_add_private (klass, sizeof (GtkBooleanCellAccessiblePrivate));
}
static void
_gtk_boolean_cell_accessible_init (GtkBooleanCellAccessible *cell)
{
cell->priv = G_TYPE_INSTANCE_GET_PRIVATE (cell,
GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE,
GtkBooleanCellAccessiblePrivate);
}

View File

@ -30,14 +30,15 @@ G_BEGIN_DECLS
#define GTK_IS_BOOLEAN_CELL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE))
#define GTK_BOOLEAN_CELL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_BOOLEAN_CELL_ACCESSIBLE, GtkBooleanCellAccessibleClass))
typedef struct _GtkBooleanCellAccessible GtkBooleanCellAccessible;
typedef struct _GtkBooleanCellAccessibleClass GtkBooleanCellAccessibleClass;
typedef struct _GtkBooleanCellAccessible GtkBooleanCellAccessible;
typedef struct _GtkBooleanCellAccessibleClass GtkBooleanCellAccessibleClass;
typedef struct _GtkBooleanCellAccessiblePrivate GtkBooleanCellAccessiblePrivate;
struct _GtkBooleanCellAccessible
{
GtkRendererCellAccessible parent;
gboolean cell_value;
gboolean cell_sensitive;
GtkBooleanCellAccessiblePrivate *priv;
};
struct _GtkBooleanCellAccessibleClass