[gtk+] pango: move an utility function from gtklabel
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] pango: move an utility function from gtklabel
- Date: Sun, 5 Jul 2015 22:32:43 +0000 (UTC)
commit b92c530a61420fc039048aff4feb3f019dc7cdfe
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Jul 5 22:48:16 2015 +0200
pango: move an utility function from gtklabel
This will be used both by gtklabel and gtkentry
gtk/gtklabel.c | 19 ++-----------------
gtk/gtkpango.c | 22 ++++++++++++++++++++++
gtk/gtkpango.h | 3 +++
3 files changed, 27 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index def986f..88fc284 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -2145,21 +2145,6 @@ gtk_label_set_use_underline_internal (GtkLabel *label,
}
}
-static gboolean
-my_pango_attr_list_merge_filter (PangoAttribute *attribute,
- gpointer list)
-{
- pango_attr_list_change (list, pango_attribute_copy (attribute));
- return FALSE;
-}
-
-static void
-my_pango_attr_list_merge (PangoAttrList *into,
- PangoAttrList *from)
-{
- pango_attr_list_filter (from, my_pango_attr_list_merge_filter, into);
-}
-
/* Calculates text, attrs and mnemonic_keyval from
* label, use_underline and use_markup
*/
@@ -3480,7 +3465,7 @@ gtk_label_update_layout_attributes (GtkLabel *label)
if (priv->markup_attrs)
{
if (attrs)
- my_pango_attr_list_merge (attrs, priv->markup_attrs);
+ _gtk_pango_attr_list_merge (attrs, priv->markup_attrs);
else
attrs = pango_attr_list_ref (priv->markup_attrs);
}
@@ -3488,7 +3473,7 @@ gtk_label_update_layout_attributes (GtkLabel *label)
if (priv->attrs)
{
if (attrs)
- my_pango_attr_list_merge (attrs, priv->attrs);
+ _gtk_pango_attr_list_merge (attrs, priv->attrs);
else
attrs = pango_attr_list_ref (priv->attrs);
}
diff --git a/gtk/gtkpango.c b/gtk/gtkpango.c
index 416bf6e..261fac7 100644
--- a/gtk/gtkpango.c
+++ b/gtk/gtkpango.c
@@ -1289,3 +1289,25 @@ _gtk_pango_get_text_at (PangoLayout *layout,
return g_utf8_substring (text, start, end);
}
+
+static gboolean
+attr_list_merge_filter (PangoAttribute *attribute,
+ gpointer list)
+{
+ pango_attr_list_change (list, pango_attribute_copy (attribute));
+ return FALSE;
+}
+
+/*
+ * _gtk_pango_attr_list_merge:
+ * @into: a #PangoAttrList where attributes are merged.
+ * @from: a #PangoAttrList with the attributes to merge
+ *
+ * Merges attributes from @from into @into.
+ */
+void
+_gtk_pango_attr_list_merge (PangoAttrList *into,
+ PangoAttrList *from)
+{
+ pango_attr_list_filter (from, attr_list_merge_filter, into);
+}
diff --git a/gtk/gtkpango.h b/gtk/gtkpango.h
index ad32354..f538337 100644
--- a/gtk/gtkpango.h
+++ b/gtk/gtkpango.h
@@ -79,6 +79,9 @@ gchar *_gtk_pango_get_text_after (PangoLayout *layout,
gint *start_offset,
gint *end_offset);
+void _gtk_pango_attr_list_merge (PangoAttrList *into,
+ PangoAttrList *from);
+
G_END_DECLS
#endif /* __GTK_PANGO_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]