[gtk+] a11y: Move update_cache to GtkCellAccesible
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] a11y: Move update_cache to GtkCellAccesible
- Date: Fri, 16 Dec 2011 03:59:44 +0000 (UTC)
commit 118bc610f6486ddec4b9fd62ce7a285c4b236ffe
Author: Benjamin Otte <otte redhat com>
Date: Fri Dec 16 00:07:46 2011 +0100
a11y: Move update_cache to GtkCellAccesible
This way, we can call it for container renderers, too.
gtk/a11y/gtkbooleancellaccessible.c | 8 ++++----
gtk/a11y/gtkcellaccessible.c | 28 ++++++++++++++++++++++++++++
gtk/a11y/gtkcellaccessible.h | 2 ++
gtk/a11y/gtkrenderercellaccessible.c | 13 -------------
gtk/a11y/gtkrenderercellaccessible.h | 3 ---
gtk/a11y/gtktextcellaccessible.c | 12 +++++++-----
gtk/a11y/gtktreeviewaccessible.c | 2 +-
7 files changed, 42 insertions(+), 26 deletions(-)
---
diff --git a/gtk/a11y/gtkbooleancellaccessible.c b/gtk/a11y/gtkbooleancellaccessible.c
index da4dadc..aafd730 100644
--- a/gtk/a11y/gtkbooleancellaccessible.c
+++ b/gtk/a11y/gtkbooleancellaccessible.c
@@ -27,13 +27,13 @@ G_DEFINE_TYPE (GtkBooleanCellAccessible, _gtk_boolean_cell_accessible, GTK_TYPE_
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);
gboolean active;
gboolean sensitive;
- g_object_get (G_OBJECT (cell->renderer),
+ g_object_get (G_OBJECT (GTK_RENDERER_CELL_ACCESSIBLE (cell)->renderer),
"active", &active,
"sensitive", &sensitive,
NULL);
@@ -62,9 +62,9 @@ gtk_boolean_cell_accessible_update_cache (GtkRendererCellAccessible *cell)
static void
_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
diff --git a/gtk/a11y/gtkcellaccessible.c b/gtk/a11y/gtkcellaccessible.c
index bd3d608..3d39708 100644
--- a/gtk/a11y/gtkcellaccessible.c
+++ b/gtk/a11y/gtkcellaccessible.c
@@ -439,3 +439,31 @@ _gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
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);
+}
+
diff --git a/gtk/a11y/gtkcellaccessible.h b/gtk/a11y/gtkcellaccessible.h
index 7fdabf5..8cd9ca7 100644
--- a/gtk/a11y/gtkcellaccessible.h
+++ b/gtk/a11y/gtkcellaccessible.h
@@ -44,6 +44,7 @@ struct _GtkCellAccessible
struct _GtkCellAccessibleClass
{
AtkObjectClass parent_class;
+ void (*update_cache) (GtkCellAccessible *cell);
};
GType _gtk_cell_accessible_get_type (void);
@@ -54,6 +55,7 @@ void _gtk_cell_accessible_state_changed (GtkCellAccessible *cell,
GtkCellRendererState added,
GtkCellRendererState removed);
void _gtk_cell_accessible_set_cell_data (GtkCellAccessible *cell);
+void _gtk_cell_accessible_update_cache (GtkCellAccessible *cell);
void _gtk_cell_accessible_initialise (GtkCellAccessible *cell,
GtkWidget *widget,
diff --git a/gtk/a11y/gtkrenderercellaccessible.c b/gtk/a11y/gtkrenderercellaccessible.c
index 3b2c399..40ab02f 100644
--- a/gtk/a11y/gtkrenderercellaccessible.c
+++ b/gtk/a11y/gtkrenderercellaccessible.c
@@ -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 *
_gtk_renderer_cell_accessible_new (GtkCellRenderer *renderer)
{
diff --git a/gtk/a11y/gtkrenderercellaccessible.h b/gtk/a11y/gtkrenderercellaccessible.h
index 8c79b9a..f7e1102 100644
--- a/gtk/a11y/gtkrenderercellaccessible.h
+++ b/gtk/a11y/gtkrenderercellaccessible.h
@@ -44,15 +44,12 @@ struct _GtkRendererCellAccessible
struct _GtkRendererCellAccessibleClass
{
GtkCellAccessibleClass parent_class;
- void (*update_cache) (GtkRendererCellAccessible *cell);
};
GType _gtk_renderer_cell_accessible_get_type (void);
AtkObject *_gtk_renderer_cell_accessible_new (GtkCellRenderer * renderer);
-void _gtk_renderer_cell_accessible_update_cache (GtkRendererCellAccessible *cell);
-
G_END_DECLS
#endif /* __GTK_RENDERER_CELL_ACCESSIBLE_H__ */
diff --git a/gtk/a11y/gtktextcellaccessible.c b/gtk/a11y/gtktextcellaccessible.c
index b714cde..5ccc53f 100644
--- a/gtk/a11y/gtktextcellaccessible.c
+++ b/gtk/a11y/gtktextcellaccessible.c
@@ -80,7 +80,7 @@ static void add_attr (PangoAttrList *attr_li
/* 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);
@@ -121,7 +121,7 @@ gtk_text_cell_accessible_get_name (AtkObject *atk_obj)
}
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);
AtkObject *obj = ATK_OBJECT (cell);
@@ -129,7 +129,9 @@ gtk_text_cell_accessible_update_cache (GtkRendererCellAccessible *cell)
gint temp_length;
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)
{
@@ -180,9 +182,9 @@ _gtk_text_cell_accessible_class_init (GtkTextCellAccessibleClass *klass)
{
GObjectClass *gobject_class = G_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->ref_state_set = gtk_text_cell_accessible_ref_state_set;
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index b8717cc..3654d97 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -1651,7 +1651,7 @@ update_cell_value (GtkRendererCellAccessible *renderer_cell,
is_expander, is_expanded);
}
- _gtk_renderer_cell_accessible_update_cache (renderer_cell);
+ _gtk_cell_accessible_update_cache (cell);
}
/* Misc Private */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]