diff options
-rw-r--r-- | atk/atkobject.c | 123 | ||||
-rw-r--r-- | atk/atkprivate.c | 10 | ||||
-rw-r--r-- | atk/meson.build | 1 | ||||
-rw-r--r-- | atspi/atspi-accessible.c | 5 | ||||
-rw-r--r-- | atspi/atspi-misc.c | 170 | ||||
-rw-r--r-- | atspi/atspi-misc.h | 2 | ||||
-rw-r--r-- | meson.build | 2 | ||||
-rw-r--r-- | xml/Accessible.xml | 8 |
8 files changed, 189 insertions, 132 deletions
diff --git a/atk/atkobject.c b/atk/atkobject.c index 8d75d53d..89f85b4e 100644 --- a/atk/atkobject.c +++ b/atk/atkobject.c @@ -95,129 +95,6 @@ enum LAST_SIGNAL }; -/* These are listed here for extraction by intltool */ -#if 0 - N_("invalid") - N_("accelerator label") - N_("alert") - N_("animation") - N_("arrow") - N_("calendar") - N_("canvas") - N_("check box") - N_("check menu item") - N_("color chooser") - N_("column header") - N_("combo box") - N_("dateeditor") - N_("desktop icon") - N_("desktop frame") - N_("dial") - N_("dialog") - N_("directory pane") - N_("drawing area") - N_("file chooser") - N_("filler") - /* I know it looks wrong but that is what Java returns */ - N_("fontchooser") - N_("frame") - N_("glass pane") - N_("html container") - N_("icon") - N_("image") - N_("internal frame") - N_("label") - N_("layered pane") - N_("list") - N_("list item") - N_("menu") - N_("menu bar") - N_("menu button") - N_("menu item") - N_("option pane") - N_("page tab") - N_("page tab list") - N_("panel") - N_("password text") - N_("popup menu") - N_("progress bar") - N_("push button") - N_("radio button") - N_("radio menu item") - N_("root pane") - N_("row header") - N_("scroll bar") - N_("scroll pane") - N_("separator") - N_("slider") - N_("split pane") - N_("spin button") - N_("statusbar") - N_("table") - N_("table cell") - N_("table column header") - N_("table row header") - N_("tear off menu item") - N_("terminal") - N_("text") - N_("toggle button") - N_("tool bar") - N_("tool tip") - N_("tree") - N_("tree table") - N_("unknown") - N_("viewport") - N_("window") - N_("header") - N_("footer") - N_("paragraph") - N_("ruler") - N_("application") - N_("autocomplete") - N_("edit bar") - N_("embedded component") - N_("entry") - N_("chart") - N_("caption") - N_("document frame") - N_("heading") - N_("page") - N_("section") - N_("redundant object") - N_("form") - N_("link") - N_("input method window") - N_("table row") - N_("tree item") - N_("document spreadsheet") - N_("document presentation") - N_("document text") - N_("document web") - N_("document email") - N_("comment") - N_("list box") - N_("grouping") - N_("image map") - N_("notification") - N_("info bar") - N_("level bar") - N_("title bar") - N_("block quote") - N_("audio") - N_("video") - N_("definition") - N_("article") - N_("landmark") - N_("log") - N_("marquee") - N_("math") - N_("rating") - N_("timer") - N_("description list") - N_("description term") - N_("description value") -#endif /* 0 */ - typedef struct { gchar *accessible_id; diff --git a/atk/atkprivate.c b/atk/atkprivate.c index 9242e14d..be41c470 100644 --- a/atk/atkprivate.c +++ b/atk/atkprivate.c @@ -63,10 +63,10 @@ get_atk_locale_dir (void) const gchar *p; gchar *root, *temp; - /* ATK_LOCALEDIR might end in either /lib/locale or + /* ATSPI_LOCALEDIR might end in either /lib/locale or * /share/locale. Scan for that slash. */ - p = ATK_LOCALEDIR + strlen (ATK_LOCALEDIR); + p = ATSPI_LOCALEDIR + strlen (ATSPI_LOCALEDIR); while (*--p != '/') ; while (*--p != '/') @@ -85,9 +85,9 @@ get_atk_locale_dir (void) return atk_localedir; } -#undef ATK_LOCALEDIR +#undef ATSPI_LOCALEDIR -#define ATK_LOCALEDIR get_atk_locale_dir () +#define ATSPI_LOCALEDIR get_atk_locale_dir () #endif @@ -103,7 +103,7 @@ _gettext_initialization (void) gettext_initialized = TRUE; if (dir == NULL) - dir = ATK_LOCALEDIR; + dir = ATSPI_LOCALEDIR; bindtextdomain (GETTEXT_PACKAGE, dir); #ifdef HAVE_BIND_TEXTDOMAIN_CODESET diff --git a/atk/meson.build b/atk/meson.build index d216b680..a2a543bf 100644 --- a/atk/meson.build +++ b/atk/meson.build @@ -111,7 +111,6 @@ atk_cflags = [ '-DGLIB_DISABLE_DEPRECATION_WARNINGS', '-DATK_DISABLE_DEPRECATION_WARNINGS', '-DATK_COMPILATION', - '-DATK_LOCALEDIR="@0@"'.format(join_paths(atspi_datadir, 'locale')), ] if host_system == 'windows' diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index 65c1f354..54f67c8f 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -669,9 +669,14 @@ gchar * atspi_accessible_get_localized_role_name (AtspiAccessible *obj, GError **error) { char *retval = NULL; + AtspiRole role; g_return_val_if_fail (obj != NULL, NULL); + role = atspi_accessible_get_role (obj, error); + if (role >= 0 && role < ATSPI_ROLE_COUNT && role != ATSPI_ROLE_EXTENDED) + return g_strdup (atspi_role_get_localized_name (role)); + _atspi_dbus_call (obj, atspi_interface_accessible, "GetLocalizedRoleName", error, "=>s", &retval); if (!retval) diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c index 9e68049d..a8491084 100644 --- a/atspi/atspi-misc.c +++ b/atspi/atspi-misc.c @@ -34,6 +34,7 @@ #endif #include "atspi-gmain.h" #include <ctype.h> +#include <locale.h> #include <stdio.h> #include <string.h> @@ -43,6 +44,143 @@ * Miscellaneous methods for using AT-SPI services. */ +/* These are listed here for extraction by intltool */ +#if 0 + N_("invalid") + N_("accelerator label") + N_("alert") + N_("animation") + N_("arrow") + N_("calendar") + N_("canvas") + N_("check box") + N_("check menu item") + N_("color chooser") + N_("column header") + N_("combo box") + N_("dateeditor") + N_("desktop icon") + N_("desktop frame") + N_("dial") + N_("dialog") + N_("directory pane") + N_("drawing area") + N_("file chooser") + N_("filler") + /* I know it looks wrong but that is what Java returns */ + N_("fontchooser") + N_("frame") + N_("glass pane") + N_("html container") + N_("icon") + N_("image") + N_("internal frame") + N_("label") + N_("layered pane") + N_("list") + N_("list item") + N_("menu") + N_("menu bar") + N_("menu button") + N_("menu item") + N_("option pane") + N_("page tab") + N_("page tab list") + N_("panel") + N_("password text") + N_("popup menu") + N_("progress bar") + N_("push button") + N_("radio button") + N_("radio menu item") + N_("root pane") + N_("row header") + N_("scroll bar") + N_("scroll pane") + N_("separator") + N_("slider") + N_("split pane") + N_("spin button") + N_("statusbar") + N_("table") + N_("table cell") + N_("table column header") + N_("table row header") + N_("tear off menu item") + N_("terminal") + N_("text") + N_("toggle button") + N_("tool bar") + N_("tool tip") + N_("tree") + N_("tree table") + N_("unknown") + N_("viewport") + N_("window") + N_("header") + N_("footer") + N_("paragraph") + N_("ruler") + N_("application") + N_("autocomplete") + N_("edit bar") + N_("embedded component") + N_("entry") + N_("chart") + N_("caption") + N_("document frame") + N_("heading") + N_("page") + N_("section") + N_("redundant object") + N_("form") + N_("link") + N_("input method window") + N_("table row") + N_("tree item") + N_("document spreadsheet") + N_("document presentation") + N_("document text") + N_("document web") + N_("document email") + N_("comment") + N_("list box") + N_("grouping") + N_("image map") + N_("notification") + N_("info bar") + N_("level bar") + N_("title bar") + N_("block quote") + N_("audio") + N_("video") + N_("definition") + N_("article") + N_("landmark") + N_("log") + N_("marquee") + N_("math") + N_("rating") + N_("timer") + N_("description list") + N_("description term") + N_("description value") +#endif /* 0 */ + +static void +_gettext_initialization (void) +{ + static gboolean gettext_initialized = FALSE; + + if (!gettext_initialized) + { + gettext_initialized = TRUE; + setlocale (LC_ALL, ""); + bindtextdomain (GETTEXT_PACKAGE, ATSPI_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + } +} + static void handle_get_items (DBusPendingCall *pending, void *user_data); static DBusConnection *bus = NULL; @@ -459,7 +597,14 @@ add_accessible_from_iter (DBusMessageIter *iter) parent = _atspi_dbus_consume_accessible (&iter_struct); if (accessible->accessible_parent) g_object_unref (accessible->accessible_parent); - accessible->accessible_parent = parent; + if (parent == accessible) + { + guint pid = atspi_accessible_get_process_id (accessible, NULL); + g_warning ("Process %d sent an accessible with itself as its parent. This shouldn't happen.", pid); + accessible->accessible_parent = NULL; + } + else + accessible->accessible_parent = parent; if (dbus_message_iter_get_arg_type (&iter_struct) == 'i') { @@ -1864,6 +2009,29 @@ atspi_role_get_name (AtspiRole role) return NULL; } +/** + * atspi_role_get_localized_name: + * @role: an #AtspiRole object to query. + * + * Gets the localized description string describing the #AtspiRole @role. + * + * Returns: the localized string describing the AtspiRole + **/ +const gchar * +atspi_role_get_localized_name (AtspiRole role) +{ + gchar *raw_name = NULL; + const gchar *ret; + + _gettext_initialization (); + + raw_name = atspi_role_get_name (role); + ret = dgettext (GETTEXT_PACKAGE, raw_name); + if (ret != raw_name) + g_free (raw_name); + return ret; +} + GHashTable * _atspi_dbus_update_cache_from_dict (AtspiAccessible *accessible, DBusMessageIter *iter) { diff --git a/atspi/atspi-misc.h b/atspi/atspi-misc.h index d820d94e..d262aff4 100644 --- a/atspi/atspi-misc.h +++ b/atspi/atspi-misc.h @@ -47,6 +47,8 @@ void atspi_set_main_context (GMainContext *cnx); gchar *atspi_role_get_name (AtspiRole role); + +const gchar *atspi_role_get_localized_name (AtspiRole role); G_END_DECLS #endif /* _ATSPI_MISC_H_ */ diff --git a/meson.build b/meson.build index 84d872d7..bd5b8878 100644 --- a/meson.build +++ b/meson.build @@ -119,6 +119,8 @@ else systemd_user_dir = join_paths(get_option('prefix'), 'lib/systemd/user') endif +at_spi_conf.set_quoted('ATSPI_LOCALEDIR', join_paths(atspi_datadir, 'locale')) + # Dependencies libdbus_req_version = '>= 1.5' glib_req_version = '>= 2.67.4' diff --git a/xml/Accessible.xml b/xml/Accessible.xml index 2ada7005..25e16994 100644 --- a/xml/Accessible.xml +++ b/xml/Accessible.xml @@ -729,7 +729,9 @@ Gets a UTF-8 string corresponding to the name of the role played by an object. This method will return useful values for roles that fall outside the - enumeration used in the GetRole method. + enumeration used in the GetRole method. Implementing this method is + optional, and it may be removed in a future version of the API. + Libatspi will only call id in the event of an unknown role. --> <method name="GetRoleName"> <arg direction="out" type="s"/> @@ -741,7 +743,9 @@ Gets a UTF-8 string corresponding to the name of the role played by an object, translated to the current locale. This method will return useful values for roles that fall outside the - enumeration used in the GetRole method. + enumeration used in the GetRole method. Implementing this method is + optional, and it may be removed in a future version of the API. + Libatspi will only call id in the event of an unknown role. --> <method name="GetLocalizedRoleName"> <arg direction="out" type="s"/> |