diff options
author | Mike Gorse <mgorse@suse.com> | 2012-07-30 12:03:25 -0500 |
---|---|---|
committer | Mike Gorse <mgorse@suse.com> | 2012-07-30 12:03:25 -0500 |
commit | 3e87dd3ef59b513393031f838f43bd93fa9a7e0d (patch) | |
tree | 9803fc548c32ada6b03a16f03b94b6787d08085f | |
parent | 99f4af834e37cbabfd32e4e2cb9de0d294cd2137 (diff) | |
download | at-spi2-atk-3e87dd3ef59b513393031f838f43bd93fa9a7e0d.tar.gz |
Implement GetLocalizedName for actions
https://bugzilla.gnome.org/show_bug.cgi?id=680598
-rw-r--r-- | atk-adaptor/adaptors/action-adaptor.c | 35 | ||||
-rw-r--r-- | atk-adaptor/introspection.c | 7 |
2 files changed, 41 insertions, 1 deletions
diff --git a/atk-adaptor/adaptors/action-adaptor.c b/atk-adaptor/adaptors/action-adaptor.c index fd04faa..7d9beab 100644 --- a/atk-adaptor/adaptors/action-adaptor.c +++ b/atk-adaptor/adaptors/action-adaptor.c @@ -98,6 +98,35 @@ impl_get_name (DBusConnection * bus, DBusMessage * message, void *user_data) } static DBusMessage * +impl_get_localized_name (DBusConnection * bus, DBusMessage * message, void *user_data) +{ + DBusMessage *reply; + DBusError error; + dbus_int32_t index; + const char *name; + AtkAction *action = (AtkAction *) user_data; + + dbus_error_init (&error); + g_return_val_if_fail (ATK_IS_ACTION (user_data), + droute_not_yet_handled_error (message)); + if (!dbus_message_get_args + (message, &error, DBUS_TYPE_INT32, &index, DBUS_TYPE_INVALID)) + { + return droute_invalid_arguments_error (message); + } + name = atk_action_get_localized_name (action, index); + if (!name) + name = ""; + reply = dbus_message_new_method_return (message); + if (reply) + { + dbus_message_append_args (reply, DBUS_TYPE_STRING, &name, + DBUS_TYPE_INVALID); + } + return reply; +} + +static DBusMessage * impl_get_keybinding (DBusConnection * bus, DBusMessage * message, void *user_data) { @@ -149,10 +178,13 @@ impl_GetActions (DBusConnection * bus, DBusMessage * message, void *user_data) for (i = 0; i < count; i++) { const char *name = atk_action_get_name (action, i); + const char *lname = atk_action_get_localized_name (action, i); const char *desc = atk_action_get_description (action, i); const char *kb = atk_action_get_keybinding (action, i); if (!name) name = ""; + if (!lname) + lname = ""; if (!desc) desc = ""; if (!kb) @@ -161,6 +193,7 @@ impl_GetActions (DBusConnection * bus, DBusMessage * message, void *user_data) (&iter_array, DBUS_TYPE_STRUCT, NULL, &iter_struct)) goto oom; dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &name); + dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &lname); dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &desc); dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_STRING, &kb); if (!dbus_message_iter_close_container (&iter_array, &iter_struct)) @@ -208,6 +241,8 @@ DRouteMethod methods[] = { , {impl_get_name, "GetName"} , + {impl_get_localized_name, "GetLocalizedName"} + , {impl_get_keybinding, "GetKeyBinding"} , {impl_GetActions, "GetActions"} diff --git a/atk-adaptor/introspection.c b/atk-adaptor/introspection.c index 22c3115..838d933 100644 --- a/atk-adaptor/introspection.c +++ b/atk-adaptor/introspection.c @@ -88,13 +88,18 @@ const char *spi_org_a11y_atspi_Action = " <arg direction=\"out\" type=\"s\" />" " </method>" "" +" <method name=\"GetLocalizedName\">" +" <arg direction=\"in\" name=\"index\" type=\"i\" />" +" <arg direction=\"out\" type=\"s\" />" +" </method>" +"" " <method name=\"GetKeyBinding\">" " <arg direction=\"in\" name=\"index\" type=\"i\" />" " <arg direction=\"out\" type=\"s\" />" " </method>" "" " <method name=\"GetActions\">" -" <arg direction=\"out\" name=\"index\" type=\"a(sss)\" />" +" <arg direction=\"out\" name=\"index\" type=\"a(ssss)\" />" " " " </method>" "" |