summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-07-19 08:12:08 -0700
committerMatthias Clasen <mclasen@redhat.com>2019-07-19 08:37:26 -0700
commitbf5876e0aba41d6843bc1ec0d1d78b4769e0a86c (patch)
tree5483702e038e093f2eb3d95d4ee3a8210b4add81 /pango
parent5f11d2e1f76931199fd4322659ca1df40a23e629 (diff)
downloadpango-bf5876e0aba41d6843bc1ec0d1d78b4769e0a86c.tar.gz
Add pango_attr_list_get_attributes
This was a gap in the attribute api - no way to get attributes back out of a list.
Diffstat (limited to 'pango')
-rw-r--r--pango/pango-attributes.c21
-rw-r--r--pango/pango-attributes.h3
2 files changed, 24 insertions, 0 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 54b13795..ac27251d 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1682,6 +1682,27 @@ pango_attr_list_splice (PangoAttrList *list,
}
/**
+ * pango_attr_list_get_attributes:
+ * @list: a #PangoAttrList
+ *
+ * Gets a list of all attributes in @list.
+ *
+ * Return value: (element-type Pango.Attribute) (transfer full):
+ * a list of all attributes in @list. To free this value, call
+ * pango_attribute_destroy() on each value and g_slist_free()
+ * on the list.
+ *
+ * Since: 1.44
+ */
+GSList *
+pango_attr_list_get_attributes (PangoAttrList *list)
+{
+ g_return_val_if_fail (list != NULL, NULL);
+
+ return g_slist_copy_deep (list->attributes, (GCopyFunc)pango_attribute_copy, NULL);
+}
+
+/**
* pango_attr_list_get_iterator:
* @list: a #PangoAttrList
*
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index cff495b2..1f43c27f 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -553,6 +553,9 @@ PangoAttrList *pango_attr_list_filter (PangoAttrList *list,
PangoAttrFilterFunc func,
gpointer data);
+PANGO_AVAILABLE_IN_1_44
+GSList *pango_attr_list_get_attributes (PangoAttrList *list);
+
PANGO_AVAILABLE_IN_ALL
PangoAttrIterator *pango_attr_list_get_iterator (PangoAttrList *list);