From: Jason Francis Date: Tue, 9 May 2023 01:30:10 +0000 (-0400) Subject: inspector: hide a11y object path when not using AT-SPI backend X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~1^2~290^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=1181ecbf0e3cece7ffed31db176e7b3c0dd7a307;p=gtk4.git inspector: hide a11y object path when not using AT-SPI backend --- diff --git a/gtk/inspector/a11y.c b/gtk/inspector/a11y.c index 7fbaec0c92..8d4c20a5cf 100644 --- a/gtk/inspector/a11y.c +++ b/gtk/inspector/a11y.c @@ -201,6 +201,7 @@ struct _GtkInspectorA11y GtkWidget *box; GtkWidget *role; + GtkWidget *path_label; GtkWidget *path; GtkWidget *attributes; }; @@ -230,8 +231,8 @@ update_role (GtkInspectorA11y *sl) static void update_path (GtkInspectorA11y *sl) { - const char *path = "—"; #ifdef G_OS_UNIX + const char *path = NULL; GtkATContext *context; context = gtk_accessible_get_at_context (GTK_ACCESSIBLE (sl->object)); @@ -242,13 +243,15 @@ update_path (GtkInspectorA11y *sl) else path = "not realized"; } - else - path = "not on bus"; + + if (path != NULL) + gtk_label_set_label (GTK_LABEL (sl->path), path); + + gtk_widget_set_visible (sl->path, path != NULL); + gtk_widget_set_visible (sl->path_label, path != NULL); g_clear_object (&context); #endif - - gtk_label_set_label (GTK_LABEL (sl->path), path); } extern GType gtk_string_pair_get_type (void); @@ -460,6 +463,11 @@ static void gtk_inspector_a11y_init (GtkInspectorA11y *sl) { gtk_widget_init_template (GTK_WIDGET (sl)); + +#ifndef G_OS_UNIX + gtk_widget_set_visible (sl->path, FALSE); + gtk_widget_set_visible (sl->path_label, FALSE); +#endif } static void @@ -497,6 +505,7 @@ gtk_inspector_a11y_class_init (GtkInspectorA11yClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/a11y.ui"); gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, box); gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, role); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, path_label); gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, path); gtk_widget_class_bind_template_child (widget_class, GtkInspectorA11y, attributes); diff --git a/gtk/inspector/a11y.ui b/gtk/inspector/a11y.ui index 8e001f6c95..785a337df6 100644 --- a/gtk/inspector/a11y.ui +++ b/gtk/inspector/a11y.ui @@ -40,7 +40,7 @@ 40 - Object path + Object Path start baseline 0.0