inspector: Show if accessibles aren't realized
authorMatthias Clasen <mclasen@redhat.com>
Fri, 3 Feb 2023 10:40:52 +0000 (11:40 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Fri, 3 Feb 2023 10:49:17 +0000 (11:49 +0100)
This prevents confusion and makes it clear
what is going on.

gtk/inspector/a11y.c

index 5c506e24cc1436de61a82e9cbee7452963d8eb58..f1844892046f9a680dcc640e3d4fdb7d3d97ade5 100644 (file)
@@ -236,7 +236,14 @@ update_path (GtkInspectorA11y *sl)
 
   context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object));
   if (GTK_IS_AT_SPI_CONTEXT (context))
-    path = gtk_at_spi_context_get_context_path (GTK_AT_SPI_CONTEXT (context));
+    {
+      if (gtk_at_context_is_realized (context))
+        path = gtk_at_spi_context_get_context_path (GTK_AT_SPI_CONTEXT (context));
+      else
+        path = "not realized";
+    }
+  else
+    path = "not on bus";
 #endif
 
   gtk_label_set_label (GTK_LABEL (sl->path), path);
@@ -422,7 +429,7 @@ gtk_inspector_a11y_set_object (GtkInspectorA11y *sl,
   stack = gtk_widget_get_parent (GTK_WIDGET (sl));
   page = gtk_stack_get_page (GTK_STACK (stack), GTK_WIDGET (sl));
 
-  if (GTK_IS_ACCESSIBLE (object))
+  if (GTK_IS_ACCESSIBLE (sl->object))
     {
       context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object));
       if (context)