[gtk/a11y/atspi: 23/30] atspiroot: Implement GetChildren




commit c78019852e81a8a8dcc836f87a58c0adf0e2baf8
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Oct 9 18:33:28 2020 -0400

    atspiroot: Implement GetChildren
    
    No surprises here.

 gtk/a11y/gtkatspiroot.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/gtk/a11y/gtkatspiroot.c b/gtk/a11y/gtkatspiroot.c
index e8f7ef8817..98ba152267 100644
--- a/gtk/a11y/gtkatspiroot.c
+++ b/gtk/a11y/gtkatspiroot.c
@@ -302,6 +302,29 @@ handle_accessible_method (GDBusConnection       *connection,
 
       g_dbus_method_invocation_return_value (invocation, g_variant_new ("((so))", name, path));
     }
+  else if (g_strcmp0 (method_name, "GetChildren") == 0)
+    {
+      GVariantBuilder builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE ("a(so)"));
+
+      guint n_toplevels = g_list_model_get_n_items (self->toplevels);
+      for (guint i = 0; i < n_toplevels; i++)
+        {
+          GtkWidget *window = g_list_model_get_item (self->toplevels, i);
+
+          g_object_unref (window);
+
+          if (!gtk_widget_get_visible (window))
+            continue;
+
+          GtkATContext *context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (window));
+          const char *name = g_dbus_connection_get_unique_name (self->connection);
+          const char *path = gtk_at_spi_context_get_context_path (GTK_AT_SPI_CONTEXT (context));
+
+          g_variant_builder_add (&builder, "(so)", name, path);
+        }
+
+      g_dbus_method_invocation_return_value (invocation, g_variant_new ("(a(so))", &builder));
+    }
 }
 
 static GVariant *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]