a11y: Add utility function for null refs

ATSPI was written for CORBA, which allows passing around "nil"
as valid object references.
This commit is contained in:
Emmanuele Bassi 2020-10-10 12:51:03 +01:00
parent 9d0952bd7f
commit 35163bd7cc
3 changed files with 10 additions and 1 deletions

View File

@ -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)
{

View File

@ -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");
}

View File

@ -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