[pango/attribute-list: 1/4] Add pango_attr_list_get_attributes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/attribute-list: 1/4] Add pango_attr_list_get_attributes
- Date: Fri, 19 Jul 2019 17:03:08 +0000 (UTC)
commit bf5876e0aba41d6843bc1ec0d1d78b4769e0a86c
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jul 19 08:12:08 2019 -0700
Add pango_attr_list_get_attributes
This was a gap in the attribute api - no way
to get attributes back out of a list.
docs/pango-sections.txt | 1 +
pango/pango-attributes.c | 21 +++++++++++++++++++++
pango/pango-attributes.h | 3 +++
3 files changed, 25 insertions(+)
---
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 9d08d0b2..3b70e980 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -426,6 +426,7 @@ pango_attr_list_change
pango_attr_list_splice
pango_attr_list_filter
PangoAttrFilterFunc
+pango_attr_list_get_attributes
pango_attr_list_get_iterator
PangoAttrIterator
pango_attr_iterator_copy
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
@@ -1681,6 +1681,27 @@ pango_attr_list_splice (PangoAttrList *list,
#undef CLAMP_ADD
}
+/**
+ * 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]