[gtk+] a11y: Redo cell update function
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] a11y: Redo cell update function
- Date: Fri, 16 Dec 2011 03:59:39 +0000 (UTC)
commit 2e7fcc24ac45462ce2b75fd021e3e6fc2ad0479a
Author: Benjamin Otte <otte redhat com>
Date: Thu Dec 15 23:51:57 2011 +0100
a11y: Redo cell update function
1) always emit signals
Previously, newly constructed cells would be told to not emit events.
However, we can ensure that nothing is connected to the signals, so
they will not actually emit anything.
2) don't return anything
The return value is unused anyway.
gtk/a11y/gtkbooleancellaccessible.c | 18 ++++++------------
gtk/a11y/gtkrenderercellaccessible.c | 15 ++++++++-------
gtk/a11y/gtkrenderercellaccessible.h | 6 ++----
gtk/a11y/gtktextcellaccessible.c | 29 ++++++++++-------------------
gtk/a11y/gtktreeviewaccessible.c | 10 +++++-----
5 files changed, 31 insertions(+), 47 deletions(-)
---
diff --git a/gtk/a11y/gtkbooleancellaccessible.c b/gtk/a11y/gtkbooleancellaccessible.c
index c9d73d9..da4dadc 100644
--- a/gtk/a11y/gtkbooleancellaccessible.c
+++ b/gtk/a11y/gtkbooleancellaccessible.c
@@ -26,12 +26,10 @@
G_DEFINE_TYPE (GtkBooleanCellAccessible, _gtk_boolean_cell_accessible, GTK_TYPE_RENDERER_CELL_ACCESSIBLE)
-static gboolean
-gtk_boolean_cell_accessible_update_cache (GtkRendererCellAccessible *cell,
- gboolean emit_change_signal)
+static void
+gtk_boolean_cell_accessible_update_cache (GtkRendererCellAccessible *cell)
{
GtkBooleanCellAccessible *boolean_cell = GTK_BOOLEAN_CELL_ACCESSIBLE (cell);
- gboolean rv = FALSE;
gboolean active;
gboolean sensitive;
@@ -42,27 +40,23 @@ gtk_boolean_cell_accessible_update_cache (GtkRendererCellAccessible *cell,
if (boolean_cell->cell_value != active)
{
- rv = TRUE;
boolean_cell->cell_value = !boolean_cell->cell_value;
if (active)
- _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_CHECKED, emit_change_signal);
+ _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_CHECKED, TRUE);
else
- _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_CHECKED, emit_change_signal);
+ _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_CHECKED, TRUE);
}
if (boolean_cell->cell_sensitive != sensitive)
{
- rv = TRUE;
boolean_cell->cell_sensitive = !boolean_cell->cell_sensitive;
if (sensitive)
- _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_SENSITIVE, emit_change_signal);
+ _gtk_cell_accessible_add_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_SENSITIVE, TRUE);
else
- _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_SENSITIVE, emit_change_signal);
+ _gtk_cell_accessible_remove_state (GTK_CELL_ACCESSIBLE (cell), ATK_STATE_SENSITIVE, TRUE);
}
-
- return rv;
}
static void
diff --git a/gtk/a11y/gtkrenderercellaccessible.c b/gtk/a11y/gtkrenderercellaccessible.c
index 165a746..3b2c399 100644
--- a/gtk/a11y/gtkrenderercellaccessible.c
+++ b/gtk/a11y/gtkrenderercellaccessible.c
@@ -103,16 +103,17 @@ _gtk_renderer_cell_accessible_init (GtkRendererCellAccessible *renderer_cell)
{
}
-gboolean
-_gtk_renderer_cell_accessible_update_cache (GtkRendererCellAccessible *cell,
- gboolean emit_change_signal)
+void
+_gtk_renderer_cell_accessible_update_cache (GtkRendererCellAccessible *cell)
{
- GtkRendererCellAccessibleClass *class = GTK_RENDERER_CELL_ACCESSIBLE_GET_CLASS (cell);
+ GtkRendererCellAccessibleClass *klass;
+
+ g_return_if_fail (GTK_IS_RENDERER_CELL_ACCESSIBLE (cell));
- if (class->update_cache)
- return (class->update_cache) (cell, emit_change_signal);
+ klass = GTK_RENDERER_CELL_ACCESSIBLE_GET_CLASS (cell);
- return FALSE;
+ if (klass->update_cache)
+ klass->update_cache (cell);
}
AtkObject *
diff --git a/gtk/a11y/gtkrenderercellaccessible.h b/gtk/a11y/gtkrenderercellaccessible.h
index d913d06..8c79b9a 100644
--- a/gtk/a11y/gtkrenderercellaccessible.h
+++ b/gtk/a11y/gtkrenderercellaccessible.h
@@ -44,16 +44,14 @@ struct _GtkRendererCellAccessible
struct _GtkRendererCellAccessibleClass
{
GtkCellAccessibleClass parent_class;
- gboolean (*update_cache) (GtkRendererCellAccessible *cell,
- gboolean emit_change_signal);
+ void (*update_cache) (GtkRendererCellAccessible *cell);
};
GType _gtk_renderer_cell_accessible_get_type (void);
AtkObject *_gtk_renderer_cell_accessible_new (GtkCellRenderer * renderer);
-gboolean _gtk_renderer_cell_accessible_update_cache (GtkRendererCellAccessible *cell,
- gboolean emit_change_signal);
+void _gtk_renderer_cell_accessible_update_cache (GtkRendererCellAccessible *cell);
G_END_DECLS
diff --git a/gtk/a11y/gtktextcellaccessible.c b/gtk/a11y/gtktextcellaccessible.c
index deb0b4a..b714cde 100644
--- a/gtk/a11y/gtktextcellaccessible.c
+++ b/gtk/a11y/gtktextcellaccessible.c
@@ -80,8 +80,7 @@ static void add_attr (PangoAttrList *attr_li
/* Misc */
-static gboolean gtk_text_cell_accessible_update_cache (GtkRendererCellAccessible *cell,
- gboolean emit_change_signal);
+static void gtk_text_cell_accessible_update_cache (GtkRendererCellAccessible *cell);
static void atk_text_interface_init (AtkTextIface *iface);
@@ -121,9 +120,8 @@ gtk_text_cell_accessible_get_name (AtkObject *atk_obj)
return text_cell->cell_text;
}
-static gboolean
-gtk_text_cell_accessible_update_cache (GtkRendererCellAccessible *cell,
- gboolean emit_change_signal)
+static void
+gtk_text_cell_accessible_update_cache (GtkRendererCellAccessible *cell)
{
GtkTextCellAccessible *text_cell = GTK_TEXT_CELL_ACCESSIBLE (cell);
AtkObject *obj = ATK_OBJECT (cell);
@@ -141,12 +139,9 @@ gtk_text_cell_accessible_update_cache (GtkRendererCellAccessible *cell,
temp_length = text_cell->cell_length;
text_cell->cell_text = NULL;
text_cell->cell_length = 0;
- if (emit_change_signal)
- {
- g_signal_emit_by_name (cell, "text-changed::delete", 0, temp_length);
- if (obj->name == NULL)
- g_object_notify (G_OBJECT (obj), "accessible-name");
- }
+ g_signal_emit_by_name (cell, "text-changed::delete", 0, temp_length);
+ if (obj->name == NULL)
+ g_object_notify (G_OBJECT (obj), "accessible-name");
if (text)
rv = TRUE;
}
@@ -172,16 +167,12 @@ gtk_text_cell_accessible_update_cache (GtkRendererCellAccessible *cell,
if (rv)
{
- if (emit_change_signal)
- {
- g_signal_emit_by_name (cell, "text-changed::insert",
- 0, text_cell->cell_length);
+ g_signal_emit_by_name (cell, "text-changed::insert",
+ 0, text_cell->cell_length);
- if (obj->name == NULL)
- g_object_notify (G_OBJECT (obj), "accessible-name");
- }
+ if (obj->name == NULL)
+ g_object_notify (G_OBJECT (obj), "accessible-name");
}
- return rv;
}
static void
diff --git a/gtk/a11y/gtktreeviewaccessible.c b/gtk/a11y/gtktreeviewaccessible.c
index 0b36497..b8717cc 100644
--- a/gtk/a11y/gtktreeviewaccessible.c
+++ b/gtk/a11y/gtktreeviewaccessible.c
@@ -56,7 +56,7 @@ static gboolean focus_out (GtkWidget *widget);
static int cell_info_get_index (GtkTreeView *tree_view,
GtkTreeViewAccessibleCellInfo *info);
-static gboolean update_cell_value (GtkRendererCellAccessible *renderer_cell,
+static void update_cell_value (GtkRendererCellAccessible *renderer_cell,
GtkTreeViewAccessible *accessible,
gboolean emit_change_signal);
static gboolean is_cell_showing (GtkTreeView *tree_view,
@@ -1605,7 +1605,7 @@ is_cell_showing (GtkTreeView *tree_view,
* set to FALSE and in model_row_changed() on receipt of "row-changed"
* signal when emit_change_signal is set to TRUE
*/
-static gboolean
+static void
update_cell_value (GtkRendererCellAccessible *renderer_cell,
GtkTreeViewAccessible *accessible,
gboolean emit_change_signal)
@@ -1621,7 +1621,7 @@ update_cell_value (GtkRendererCellAccessible *renderer_cell,
cell = GTK_CELL_ACCESSIBLE (renderer_cell);
cell_info = find_cell_info (accessible, cell);
if (!cell_info)
- return FALSE;
+ return;
if (emit_change_signal)
{
@@ -1629,7 +1629,7 @@ update_cell_value (GtkRendererCellAccessible *renderer_cell,
tree_model = gtk_tree_view_get_model (tree_view);
path = cell_info_get_path (cell_info);
if (path == NULL)
- return FALSE;
+ return;
gtk_tree_model_get_iter (tree_model, &iter, path);
is_expander = FALSE;
@@ -1651,7 +1651,7 @@ update_cell_value (GtkRendererCellAccessible *renderer_cell,
is_expander, is_expanded);
}
- return _gtk_renderer_cell_accessible_update_cache (renderer_cell, emit_change_signal);
+ _gtk_renderer_cell_accessible_update_cache (renderer_cell);
}
/* Misc Private */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]