a11y: Make GtkATContext.create() public

Implementations of the GtkAccessible interface should have a way to
instantiate the appropriate GtkATContext.
This commit is contained in:
Emmanuele Bassi 2020-07-27 11:46:52 +01:00
parent 9a4458ba33
commit 4060febd7f
4 changed files with 10 additions and 26 deletions

View File

@ -329,8 +329,8 @@ gtk_at_context_get_accessible_role (GtkATContext *self)
return self->accessible_role;
}
/*< private >
* gtk_at_context_create:
/**
* gtk_at_context_create: (constructor)
* @accessible_role: the accessible role used by the #GtkATContext
* @accessible: the #GtkAccessible implementation using the #GtkATContext
*
@ -340,7 +340,7 @@ gtk_at_context_get_accessible_role (GtkATContext *self)
* The #GtkATContext implementation being instantiated will depend on the
* platform.
*
* Returns: (nullable): the #GtkATContext
* Returns: (nullable) (transfer full): the #GtkATContext
*/
GtkATContext *
gtk_at_context_create (GtkAccessibleRole accessible_role,

View File

@ -36,8 +36,12 @@ GDK_AVAILABLE_IN_ALL
GDK_DECLARE_INTERNAL_TYPE (GtkATContext, gtk_at_context, GTK, AT_CONTEXT, GObject)
GDK_AVAILABLE_IN_ALL
GtkAccessible * gtk_at_context_get_accessible (GtkATContext *self);
GtkAccessible * gtk_at_context_get_accessible (GtkATContext *self);
GDK_AVAILABLE_IN_ALL
GtkAccessibleRole gtk_at_context_get_accessible_role (GtkATContext *self);
GtkAccessibleRole gtk_at_context_get_accessible_role (GtkATContext *self);
GDK_AVAILABLE_IN_ALL
GtkATContext * gtk_at_context_create (GtkAccessibleRole accessible_role,
GtkAccessible *accessible);
G_END_DECLS

View File

@ -105,9 +105,6 @@ struct _GtkATContextClass
GtkAccessibleAttributeSet *relations);
};
GtkATContext * gtk_at_context_create (GtkAccessibleRole accessible_role,
GtkAccessible *accessible);
void gtk_at_context_update (GtkATContext *self);
void gtk_at_context_set_accessible_state (GtkATContext *self,

View File

@ -29,10 +29,7 @@ test_object_accessible_get_at_context (GtkAccessible *accessible)
TestObject *self = (TestObject*)accessible;
if (self->at_context == NULL)
self->at_context = g_object_new (g_type_from_name ("GtkTestATContext"),
"accessible-role", self->role,
"accessible", accessible,
NULL);
self->at_context = gtk_at_context_create (self->role, accessible);
return self->at_context;
}
@ -622,25 +619,11 @@ test_reflist_relation (gconstpointer data)
g_object_unref (third);
}
static void
ensure_test_at_context_type (void)
{
GtkWidget *button;
button = gtk_button_new ();
g_object_ref_sink (button);
g_object_unref (button);
}
int
main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
ensure_test_at_context_type ();
g_test_add_data_func ("/a11y/state/busy", GUINT_TO_POINTER (GTK_ACCESSIBLE_STATE_BUSY), test_boolean_state);
g_test_add_data_func ("/a11y/state/checked", GUINT_TO_POINTER (GTK_ACCESSIBLE_STATE_CHECKED), test_tristate_state);
g_test_add_data_func ("/a11y/state/disabled", GUINT_TO_POINTER (GTK_ACCESSIBLE_STATE_DISABLED), test_boolean_state);