a11y: Move update_cache to GtkCellAccesible
This way, we can call it for container renderers, too.
This commit is contained in:
@ -27,13 +27,13 @@ G_DEFINE_TYPE (GtkBooleanCellAccessible, _gtk_boolean_cell_accessible, GTK_TYPE_
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_boolean_cell_accessible_update_cache (GtkRendererCellAccessible *cell)
|
gtk_boolean_cell_accessible_update_cache (GtkCellAccessible *cell)
|
||||||
{
|
{
|
||||||
GtkBooleanCellAccessible *boolean_cell = GTK_BOOLEAN_CELL_ACCESSIBLE (cell);
|
GtkBooleanCellAccessible *boolean_cell = GTK_BOOLEAN_CELL_ACCESSIBLE (cell);
|
||||||
gboolean active;
|
gboolean active;
|
||||||
gboolean sensitive;
|
gboolean sensitive;
|
||||||
|
|
||||||
g_object_get (G_OBJECT (cell->renderer),
|
g_object_get (G_OBJECT (GTK_RENDERER_CELL_ACCESSIBLE (cell)->renderer),
|
||||||
"active", &active,
|
"active", &active,
|
||||||
"sensitive", &sensitive,
|
"sensitive", &sensitive,
|
||||||
NULL);
|
NULL);
|
||||||
@ -62,9 +62,9 @@ gtk_boolean_cell_accessible_update_cache (GtkRendererCellAccessible *cell)
|
|||||||
static void
|
static void
|
||||||
_gtk_boolean_cell_accessible_class_init (GtkBooleanCellAccessibleClass *klass)
|
_gtk_boolean_cell_accessible_class_init (GtkBooleanCellAccessibleClass *klass)
|
||||||
{
|
{
|
||||||
GtkRendererCellAccessibleClass *renderer_cell_class = GTK_RENDERER_CELL_ACCESSIBLE_CLASS (klass);
|
GtkCellAccessibleClass *cell_class = GTK_CELL_ACCESSIBLE_CLASS (klass);
|
||||||
|
|
||||||
renderer_cell_class->update_cache = gtk_boolean_cell_accessible_update_cache;
|
cell_class->update_cache = gtk_boolean_cell_accessible_update_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
@ -439,3 +439,31 @@ _gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
|
|||||||
state_map[i].invert);
|
state_map[i].invert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _gtk_cell_accessible_update_cache:
|
||||||
|
* @cell: the cell that is changed
|
||||||
|
*
|
||||||
|
* Notifies the cell that the values in the data in the row that
|
||||||
|
* is used to feed the cell renderer with has changed. The
|
||||||
|
* cell_changed function of @cell is called to send update
|
||||||
|
* notifications for the properties it takes from its cell
|
||||||
|
* renderer.
|
||||||
|
*
|
||||||
|
* Note that there is no higher granularity available about which
|
||||||
|
* properties changed, so you will need to make do with this
|
||||||
|
* function.
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
_gtk_cell_accessible_update_cache (GtkCellAccessible *cell)
|
||||||
|
{
|
||||||
|
GtkCellAccessibleClass *klass;
|
||||||
|
|
||||||
|
g_return_if_fail (GTK_CELL_ACCESSIBLE (cell));
|
||||||
|
|
||||||
|
klass = GTK_CELL_ACCESSIBLE_GET_CLASS (cell);
|
||||||
|
|
||||||
|
if (klass->update_cache)
|
||||||
|
klass->update_cache (cell);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,6 +44,7 @@ struct _GtkCellAccessible
|
|||||||
struct _GtkCellAccessibleClass
|
struct _GtkCellAccessibleClass
|
||||||
{
|
{
|
||||||
AtkObjectClass parent_class;
|
AtkObjectClass parent_class;
|
||||||
|
void (*update_cache) (GtkCellAccessible *cell);
|
||||||
};
|
};
|
||||||
|
|
||||||
GType _gtk_cell_accessible_get_type (void);
|
GType _gtk_cell_accessible_get_type (void);
|
||||||
@ -54,6 +55,7 @@ void _gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
|
|||||||
GtkCellRendererState added,
|
GtkCellRendererState added,
|
||||||
GtkCellRendererState removed);
|
GtkCellRendererState removed);
|
||||||
void _gtk_cell_accessible_set_cell_data (GtkCellAccessible *cell);
|
void _gtk_cell_accessible_set_cell_data (GtkCellAccessible *cell);
|
||||||
|
void _gtk_cell_accessible_update_cache (GtkCellAccessible *cell);
|
||||||
|
|
||||||
void _gtk_cell_accessible_initialise (GtkCellAccessible *cell,
|
void _gtk_cell_accessible_initialise (GtkCellAccessible *cell,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
|
|||||||
@ -103,19 +103,6 @@ _gtk_renderer_cell_accessible_init (GtkRendererCellAccessible *renderer_cell)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_gtk_renderer_cell_accessible_update_cache (GtkRendererCellAccessible *cell)
|
|
||||||
{
|
|
||||||
GtkRendererCellAccessibleClass *klass;
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_RENDERER_CELL_ACCESSIBLE (cell));
|
|
||||||
|
|
||||||
klass = GTK_RENDERER_CELL_ACCESSIBLE_GET_CLASS (cell);
|
|
||||||
|
|
||||||
if (klass->update_cache)
|
|
||||||
klass->update_cache (cell);
|
|
||||||
}
|
|
||||||
|
|
||||||
AtkObject *
|
AtkObject *
|
||||||
_gtk_renderer_cell_accessible_new (GtkCellRenderer *renderer)
|
_gtk_renderer_cell_accessible_new (GtkCellRenderer *renderer)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -44,15 +44,12 @@ struct _GtkRendererCellAccessible
|
|||||||
struct _GtkRendererCellAccessibleClass
|
struct _GtkRendererCellAccessibleClass
|
||||||
{
|
{
|
||||||
GtkCellAccessibleClass parent_class;
|
GtkCellAccessibleClass parent_class;
|
||||||
void (*update_cache) (GtkRendererCellAccessible *cell);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GType _gtk_renderer_cell_accessible_get_type (void);
|
GType _gtk_renderer_cell_accessible_get_type (void);
|
||||||
|
|
||||||
AtkObject *_gtk_renderer_cell_accessible_new (GtkCellRenderer * renderer);
|
AtkObject *_gtk_renderer_cell_accessible_new (GtkCellRenderer * renderer);
|
||||||
|
|
||||||
void _gtk_renderer_cell_accessible_update_cache (GtkRendererCellAccessible *cell);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_RENDERER_CELL_ACCESSIBLE_H__ */
|
#endif /* __GTK_RENDERER_CELL_ACCESSIBLE_H__ */
|
||||||
|
|||||||
@ -80,7 +80,7 @@ static void add_attr (PangoAttrList *attr_li
|
|||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
|
|
||||||
static void gtk_text_cell_accessible_update_cache (GtkRendererCellAccessible *cell);
|
static void gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell);
|
||||||
|
|
||||||
static void atk_text_interface_init (AtkTextIface *iface);
|
static void atk_text_interface_init (AtkTextIface *iface);
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ gtk_text_cell_accessible_get_name (AtkObject *atk_obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_text_cell_accessible_update_cache (GtkRendererCellAccessible *cell)
|
gtk_text_cell_accessible_update_cache (GtkCellAccessible *cell)
|
||||||
{
|
{
|
||||||
GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (cell);
|
GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (cell);
|
||||||
AtkObject *obj = ATK_OBJECT (cell);
|
AtkObject *obj = ATK_OBJECT (cell);
|
||||||
@ -129,7 +129,9 @@ gtk_text_cell_accessible_update_cache (GtkRendererCellAccessible *cell)
|
|||||||
gint temp_length;
|
gint temp_length;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
|
|
||||||
g_object_get (G_OBJECT (cell->renderer), "text", &text, NULL);
|
g_object_get (G_OBJECT (GTK_RENDERER_CELL_ACCESSIBLE (cell)->renderer),
|
||||||
|
"text", &text,
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (text_cell->cell_text)
|
if (text_cell->cell_text)
|
||||||
{
|
{
|
||||||
@ -180,9 +182,9 @@ _gtk_text_cell_accessible_class_init (GtkTextCellAccessibleClass *klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
|
AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
|
||||||
GtkRendererCellAccessibleClass *renderer_cell_class = GTK_RENDERER_CELL_ACCESSIBLE_CLASS (klass);
|
GtkCellAccessibleClass *cell_class = GTK_CELL_ACCESSIBLE_CLASS (klass);
|
||||||
|
|
||||||
renderer_cell_class->update_cache = gtk_text_cell_accessible_update_cache;
|
cell_class->update_cache = gtk_text_cell_accessible_update_cache;
|
||||||
|
|
||||||
atk_object_class->get_name = gtk_text_cell_accessible_get_name;
|
atk_object_class->get_name = gtk_text_cell_accessible_get_name;
|
||||||
atk_object_class->ref_state_set = gtk_text_cell_accessible_ref_state_set;
|
atk_object_class->ref_state_set = gtk_text_cell_accessible_ref_state_set;
|
||||||
|
|||||||
@ -1651,7 +1651,7 @@ update_cell_value (GtkRendererCellAccessible *renderer_cell,
|
|||||||
is_expander, is_expanded);
|
is_expander, is_expanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
_gtk_renderer_cell_accessible_update_cache (renderer_cell);
|
_gtk_cell_accessible_update_cache (cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Misc Private */
|
/* Misc Private */
|
||||||
|
|||||||
Reference in New Issue
Block a user