From 3e87dd3ef59b513393031f838f43bd93fa9a7e0d Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Mon, 30 Jul 2012 12:03:25 -0500 Subject: [PATCH] Implement GetLocalizedName for actions https://bugzilla.gnome.org/show_bug.cgi?id=680598 --- atk-adaptor/adaptors/action-adaptor.c | 35 +++++++++++++++++++++++++++++++++++ atk-adaptor/introspection.c | 7 ++++++- 2 files changed, 41 insertions(+), 1 deletion(-) 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 = " " " " "" +" " +" " +" " +" " +"" " " " " " " " " "" " " -" " +" " " " " " "" -- 2.7.4