[gtk+/gtk-3-22] Revert "Use CSS for styling links in labels"
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-22] Revert "Use CSS for styling links in labels"
- Date: Fri, 6 Jan 2017 00:41:10 +0000 (UTC)
commit 41b14fd148a5eda9dacd2e9b847ab480f99cc2a7
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jan 5 19:40:12 2017 -0500
Revert "Use CSS for styling links in labels"
This reverts commit 34264667ed844dd9212e987852e06d2bbba54e66.
gtk/gtklabel.c | 33 +++++++++++++++------------------
1 files changed, 15 insertions(+), 18 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 97ee479..9e2b002 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3481,18 +3481,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
}
}
-static gboolean
-filter_func (PangoAttribute *attribute,
- gpointer data)
-{
- GtkLabelLink *link = data;
-
- attribute->start_index = link->start;
- attribute->end_index = link->end;
-
- return FALSE;
-}
-
static void
gtk_label_update_layout_attributes (GtkLabel *label)
{
@@ -3509,6 +3497,8 @@ gtk_label_update_layout_attributes (GtkLabel *label)
if (priv->select_info && priv->select_info->links)
{
+ GdkRGBA link_color;
+ PangoAttribute *attribute;
GList *list;
attrs = pango_attr_list_new ();
@@ -3517,14 +3507,21 @@ gtk_label_update_layout_attributes (GtkLabel *label)
{
GtkLabelLink *link = list->data;
+ attribute = pango_attr_underline_new (TRUE);
+ attribute->start_index = link->start;
+ attribute->end_index = link->end;
+ pango_attr_list_insert (attrs, attribute);
+
gtk_style_context_save_to_node (context, link->cssnode);
- style_attrs = _gtk_style_context_get_pango_attributes (context);
- if (style_attrs)
- {
- pango_attr_list_filter (style_attrs, filter_func, link);
- attrs = _gtk_pango_attr_list_merge (attrs, style_attrs);
- }
+ gtk_style_context_get_color (context, gtk_style_context_get_state (context), &link_color);
gtk_style_context_restore (context);
+
+ attribute = pango_attr_foreground_new (link_color.red * 65535,
+ link_color.green * 65535,
+ link_color.blue * 65535);
+ attribute->start_index = link->start;
+ attribute->end_index = link->end;
+ pango_attr_list_insert (attrs, attribute);
}
}
else if (priv->markup_attrs && priv->attrs)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]