summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-01-05 19:48:51 -0500
committerMatthias Clasen <mclasen@redhat.com>2017-01-05 20:57:42 -0500
commit5fa1b14a9639e22114e207a8390cd1ef2772646d (patch)
treec4e1fa9204d47acbe034a157f091b5d65dc46965
parent4170f79eea4569fce12a57bd7248211c7fa09e1f (diff)
downloadgtk+-5fa1b14a9639e22114e207a8390cd1ef2772646d.tar.gz
Revert "Use CSS for styling links in labels"
This reverts commit 60a8769e7f0c952fdc8090b1ecd96cca00123ad9. This needs more work to work properly.
-rw-r--r--gtk/gtklabel.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 54fd67778a..7a24f71f48 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3447,18 +3447,6 @@ gtk_label_update_layout_width (GtkLabel *label)
}
}
-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)
{
@@ -3475,6 +3463,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 ();
@@ -3483,14 +3473,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, &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)