forked from AuroraMiddleware/gtk
pango: make merge_attrs return the merged list
This simplifies all the callers
This commit is contained in:
parent
180a378a07
commit
803430a779
@ -6253,7 +6253,6 @@ gtk_entry_create_layout (GtkEntry *entry,
|
||||
GtkWidget *widget = GTK_WIDGET (entry);
|
||||
GtkStyleContext *context;
|
||||
PangoLayout *layout;
|
||||
PangoAttrList *style_attrs;
|
||||
PangoAttrList *tmp_attrs;
|
||||
gboolean placeholder_layout;
|
||||
|
||||
@ -6269,13 +6268,10 @@ gtk_entry_create_layout (GtkEntry *entry,
|
||||
layout = gtk_widget_create_pango_layout (widget, NULL);
|
||||
pango_layout_set_single_paragraph_mode (layout, TRUE);
|
||||
|
||||
style_attrs = _gtk_style_context_get_pango_attributes (context);
|
||||
tmp_attrs = style_attrs ? style_attrs : pango_attr_list_new ();
|
||||
|
||||
if (priv->attrs)
|
||||
{
|
||||
_gtk_pango_attr_list_merge (tmp_attrs, priv->attrs);
|
||||
}
|
||||
tmp_attrs = _gtk_style_context_get_pango_attributes (context);
|
||||
tmp_attrs = _gtk_pango_attr_list_merge (tmp_attrs, priv->attrs);
|
||||
if (!tmp_attrs)
|
||||
tmp_attrs = pango_attr_list_new ();
|
||||
|
||||
placeholder_layout = show_placeholder_text (entry);
|
||||
if (placeholder_layout)
|
||||
|
@ -3465,36 +3465,17 @@ gtk_label_update_layout_attributes (GtkLabel *label)
|
||||
attrs = NULL;
|
||||
|
||||
style_attrs = _gtk_style_context_get_pango_attributes (context);
|
||||
if (style_attrs)
|
||||
{
|
||||
if (attrs)
|
||||
_gtk_pango_attr_list_merge (attrs, style_attrs);
|
||||
else
|
||||
attrs = pango_attr_list_ref (style_attrs);
|
||||
|
||||
pango_attr_list_unref (style_attrs);
|
||||
}
|
||||
|
||||
if (priv->markup_attrs)
|
||||
{
|
||||
if (attrs)
|
||||
_gtk_pango_attr_list_merge (attrs, priv->markup_attrs);
|
||||
else
|
||||
attrs = pango_attr_list_ref (priv->markup_attrs);
|
||||
}
|
||||
|
||||
if (priv->attrs)
|
||||
{
|
||||
if (attrs)
|
||||
_gtk_pango_attr_list_merge (attrs, priv->attrs);
|
||||
else
|
||||
attrs = pango_attr_list_ref (priv->attrs);
|
||||
}
|
||||
attrs = _gtk_pango_attr_list_merge (attrs, style_attrs);
|
||||
attrs = _gtk_pango_attr_list_merge (attrs, priv->markup_attrs);
|
||||
attrs = _gtk_pango_attr_list_merge (attrs, priv->attrs);
|
||||
|
||||
pango_layout_set_attributes (priv->layout, attrs);
|
||||
|
||||
if (attrs)
|
||||
pango_attr_list_unref (attrs);
|
||||
if (style_attrs)
|
||||
pango_attr_list_unref (style_attrs);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1300,14 +1300,24 @@ attr_list_merge_filter (PangoAttribute *attribute,
|
||||
|
||||
/*
|
||||
* _gtk_pango_attr_list_merge:
|
||||
* @into: a #PangoAttrList where attributes are merged.
|
||||
* @from: a #PangoAttrList with the attributes to merge
|
||||
* @into: a #PangoAttrList where attributes are merged or %NULL
|
||||
* @from: a #PangoAttrList with the attributes to merge or %NULL
|
||||
*
|
||||
* Merges attributes from @from into @into.
|
||||
*
|
||||
* Returns: the merged list.
|
||||
*/
|
||||
void
|
||||
PangoAttrList *
|
||||
_gtk_pango_attr_list_merge (PangoAttrList *into,
|
||||
PangoAttrList *from)
|
||||
{
|
||||
pango_attr_list_filter (from, attr_list_merge_filter, into);
|
||||
if (from)
|
||||
{
|
||||
if (into)
|
||||
pango_attr_list_filter (from, attr_list_merge_filter, into);
|
||||
else
|
||||
return pango_attr_list_ref (from);
|
||||
}
|
||||
|
||||
return into;
|
||||
}
|
||||
|
@ -79,8 +79,8 @@ gchar *_gtk_pango_get_text_after (PangoLayout *layout,
|
||||
gint *start_offset,
|
||||
gint *end_offset);
|
||||
|
||||
void _gtk_pango_attr_list_merge (PangoAttrList *into,
|
||||
PangoAttrList *from);
|
||||
PangoAttrList *_gtk_pango_attr_list_merge (PangoAttrList *into,
|
||||
PangoAttrList *from);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user