[gtk+] Check if the accessible is actually an AtkAction
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Check if the accessible is actually an AtkAction
- Date: Thu, 17 Feb 2011 18:30:37 +0000 (UTC)
commit bdacdfb78b6ba84e6e9fd063acba8b060e697358
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Feb 17 13:29:59 2011 -0500
Check if the accessible is actually an AtkAction
gtk/gtkwidget.c | 53 +++++++++++++++++++++++++++++------------------------
1 files changed, 29 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index b2e3572..84903a3 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -12882,32 +12882,37 @@ gtk_widget_buildable_custom_finished (GtkBuildable *buildable,
accessible = gtk_widget_get_accessible (GTK_WIDGET (buildable));
- action = ATK_ACTION (accessible);
- n_actions = atk_action_get_n_actions (action);
-
- for (l = a11y_data->actions; l; l = l->next)
- {
- AtkActionData *action_data = (AtkActionData*)l->data;
-
- for (i = 0; i < n_actions; i++)
- if (strcmp (atk_action_get_name (action, i),
- action_data->action_name) == 0)
- break;
-
- if (i < n_actions)
- {
- gchar *description;
-
- if (action_data->translatable && action_data->description->len)
- description = _gtk_builder_parser_translate (gtk_builder_get_translation_domain (builder),
- action_data->context,
- action_data->description->str);
- else
- description = action_data->description->str;
-
- atk_action_set_description (action, i, description);
+ if (ATK_IS_ACTION (accessible))
+ {
+ action = ATK_ACTION (accessible);
+ n_actions = atk_action_get_n_actions (action);
+
+ for (l = a11y_data->actions; l; l = l->next)
+ {
+ AtkActionData *action_data = (AtkActionData*)l->data;
+
+ for (i = 0; i < n_actions; i++)
+ if (strcmp (atk_action_get_name (action, i),
+ action_data->action_name) == 0)
+ break;
+
+ if (i < n_actions)
+ {
+ gchar *description;
+
+ if (action_data->translatable && action_data->description->len)
+ description = _gtk_builder_parser_translate (gtk_builder_get_translation_domain (builder),
+ action_data->context,
+ action_data->description->str);
+ else
+ description = action_data->description->str;
+
+ atk_action_set_description (action, i, description);
+ }
}
}
+ else
+ g_warning ("accessibility action on a widget that does not implement AtkAction");
g_slist_foreach (a11y_data->actions, (GFunc)free_action, NULL);
g_slist_free (a11y_data->actions);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]