#include "gtklistitemprivate.h"
#include "gtkcolumnviewcell.h"
+#include "gtkaccessible.h"
/**
* GtkListItem:
enum
{
PROP_0,
+ PROP_ACCESSIBLE_DESCRIPTION,
+ PROP_ACCESSIBLE_LABEL,
PROP_ACTIVATABLE,
PROP_CHILD,
PROP_FOCUSABLE,
g_assert (self->owner == NULL); /* would hold a reference */
g_clear_object (&self->child);
+ g_clear_pointer (&self->accessible_description, g_free);
+ g_clear_pointer (&self->accessible_label, g_free);
+
G_OBJECT_CLASS (gtk_list_item_parent_class)->dispose (object);
}
switch (property_id)
{
+ case PROP_ACCESSIBLE_DESCRIPTION:
+ g_value_set_string (value, self->accessible_description);
+ break;
+
+ case PROP_ACCESSIBLE_LABEL:
+ g_value_set_string (value, self->accessible_label);
+ break;
+
case PROP_ACTIVATABLE:
g_value_set_boolean (value, self->activatable);
break;
switch (property_id)
{
+ case PROP_ACCESSIBLE_DESCRIPTION:
+ gtk_list_item_set_accessible_description (self, g_value_get_string (value));
+ break;
+
+ case PROP_ACCESSIBLE_LABEL:
+ gtk_list_item_set_accessible_label (self, g_value_get_string (value));
+ break;
+
case PROP_ACTIVATABLE:
gtk_list_item_set_activatable (self, g_value_get_boolean (value));
break;
gobject_class->get_property = gtk_list_item_get_property;
gobject_class->set_property = gtk_list_item_set_property;
+ /**
+ * GtkListItem:accessible-description: (attributes org.gtk.Property.get=gtk_list_item_get_accessible_description org.gtk.Property.set=gtk_list_item_set_accessible_description)
+ *
+ * The accessible description to set on the list item.
+ *
+ * Since: 4.12
+ */
+ properties[PROP_ACCESSIBLE_DESCRIPTION] =
+ g_param_spec_string ("accessible-description", NULL, NULL,
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
+
+ /**
+ * GtkListItem:accessible-label: (attributes org.gtk.Property.get=gtk_list_item_get_accessible_label org.gtk.Property.set=gtk_list_item_set_accessible_label)
+ *
+ * The accessible label to set on the list item.
+ *
+ * Since: 4.12
+ */
+ properties[PROP_ACCESSIBLE_LABEL] =
+ g_param_spec_string ("accessible-label", NULL, NULL,
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
+
/**
* GtkListItem:activatable: (attributes org.gtk.Property.get=gtk_list_item_get_activatable org.gtk.Property.set=gtk_list_item_set_activatable)
*
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FOCUSABLE]);
}
+
+/**
+ * gtk_list_item_set_accessible_description:
+ * @self: a `GtkListItem`
+ * @description: the description
+ *
+ * Sets the accessible description for the list item,
+ * which may be used by e.g. screen readers.
+ *
+ * Since: 4.12
+ */
+void
+gtk_list_item_set_accessible_description (GtkListItem *self,
+ const char *description)
+{
+ g_return_if_fail (GTK_IS_LIST_ITEM (self));
+
+ if (!g_set_str (&self->accessible_description, description))
+ return;
+
+ if (self->owner)
+ gtk_accessible_update_property (GTK_ACCESSIBLE (self->owner),
+ GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, self->accessible_description,
+ -1);
+
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ACCESSIBLE_DESCRIPTION]);
+}
+
+/**
+ * gtk_list_item_get_accessible_description:
+ * @self: a `GtkListItem`
+ *
+ * Gets the accessible description of @self.
+ *
+ * Returns: the accessible description
+ *
+ * Since: 4.12
+ */
+const char *
+gtk_list_item_get_accessible_description (GtkListItem *self)
+{
+ g_return_val_if_fail (GTK_IS_LIST_ITEM (self), NULL);
+
+ return self->accessible_description;
+}
+
+/**
+ * gtk_list_item_set_accessible_label:
+ * @self: a `GtkListItem`
+ * @label: the label
+ *
+ * Sets the accessible label for the list item,
+ * which may be used by e.g. screen readers.
+ *
+ * Since: 4.12
+ */
+void
+gtk_list_item_set_accessible_label (GtkListItem *self,
+ const char *label)
+{
+ g_return_if_fail (GTK_IS_LIST_ITEM (self));
+
+ if (!g_set_str (&self->accessible_label, label))
+ return;
+
+ if (self->owner)
+ gtk_accessible_update_property (GTK_ACCESSIBLE (self->owner),
+ GTK_ACCESSIBLE_PROPERTY_LABEL, self->accessible_label,
+ -1);
+
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ACCESSIBLE_LABEL]);
+}
+
+/**
+ * gtk_list_item_get_accessible_label:
+ * @self: a `GtkListItem`
+ *
+ * Gets the accessible label of @self.
+ *
+ * Returns: the accessible label
+ *
+ * Since: 4.12
+ */
+const char *
+gtk_list_item_get_accessible_label (GtkListItem *self)
+{
+ g_return_val_if_fail (GTK_IS_LIST_ITEM (self), NULL);
+
+ return self->accessible_label;
+}