[gtk/matthiasc/a11y: 26/28] atspiroot: Implement GetLocale
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/a11y: 26/28] atspiroot: Implement GetLocale
- Date: Fri, 9 Oct 2020 22:37:26 +0000 (UTC)
commit 06ee424ce6d7c5b33edf7a0bf36f225fbe9c838a
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 9 15:16:43 2020 -0400
atspiroot: Implement GetLocale
gtk/a11y/gtkatspiroot.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/gtk/a11y/gtkatspiroot.c b/gtk/a11y/gtkatspiroot.c
index e1a76b1e95..5c69c9be28 100644
--- a/gtk/a11y/gtkatspiroot.c
+++ b/gtk/a11y/gtkatspiroot.c
@@ -136,7 +136,6 @@ gtk_at_spi_root_get_property (GObject *gobject,
}
}
-
static void
handle_application_method (GDBusConnection *connection,
const gchar *sender,
@@ -147,6 +146,28 @@ handle_application_method (GDBusConnection *connection,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
+ if (g_strcmp0 (method_name, "GetLocale") == 0)
+ {
+ guint lctype;
+ const char *locale;
+
+ int types[] = {
+ LC_MESSAGES, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME
+ };
+
+ g_variant_get (parameters, "(u)", &lctype);
+ if (lctype >= G_N_ELEMENTS (types))
+ {
+ g_dbus_method_invocation_return_error (invocation,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ "Not a known locale facet: %u", lctype);
+ return;
+ }
+
+ locale = setlocale (types[lctype], NULL);
+ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", locale));
+ }
}
static GVariant *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]