From 35163bd7cce35c998f15a3751cd0a81ab0792f56 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Sat, 10 Oct 2020 12:51:03 +0100 Subject: [PATCH] a11y: Add utility function for null refs ATSPI was written for CORBA, which allows passing around "nil" as valid object references. --- gtk/a11y/gtkatspicontext.c | 2 +- gtk/a11y/gtkatspiutils.c | 6 ++++++ gtk/a11y/gtkatspiutilsprivate.h | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c index b93373db5c..c1448b6e22 100644 --- a/gtk/a11y/gtkatspicontext.c +++ b/gtk/a11y/gtkatspicontext.c @@ -426,7 +426,7 @@ handle_accessible_get_property (GDBusConnection *connection, } if (res == NULL) - res = g_variant_new ("(so)", "", "/org/a11y/atspi/null"); + res = gtk_at_spi_null_ref (); } else if (g_strcmp0 (property_name, "ChildCount") == 0) { diff --git a/gtk/a11y/gtkatspiutils.c b/gtk/a11y/gtkatspiutils.c index 4233904bb5..7a572ee41f 100644 --- a/gtk/a11y/gtkatspiutils.c +++ b/gtk/a11y/gtkatspiutils.c @@ -275,3 +275,9 @@ gtk_accessible_role_to_atspi_role (GtkAccessibleRole role) return GTK_ACCESSIBLE_ROLE_WIDGET; } + +GVariant * +gtk_at_spi_null_ref (void) +{ + return g_variant_new ("(so)", "", "/org/a11y/atspi/null"); +} diff --git a/gtk/a11y/gtkatspiutilsprivate.h b/gtk/a11y/gtkatspiutilsprivate.h index b882585a01..6d4f661026 100644 --- a/gtk/a11y/gtkatspiutilsprivate.h +++ b/gtk/a11y/gtkatspiutilsprivate.h @@ -26,4 +26,7 @@ G_BEGIN_DECLS AtspiRole gtk_accessible_role_to_atspi_role (GtkAccessibleRole role); +GVariant * +gtk_at_spi_null_ref (void); + G_END_DECLS