summaryrefslogtreecommitdiff
path: root/gtk/gtktextutil.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2020-01-28 00:27:36 +0100
committerBenjamin Otte <otte@redhat.com>2020-01-28 02:58:02 +0100
commit632fab0ca702b600fde492319ab0aa2d9d3bbd08 (patch)
treecf0972443ecdf15fb833cf5be7cbbed754124153 /gtk/gtktextutil.c
parent43339f1c1c9d4330679a92affac71df71ef5fc40 (diff)
downloadgtk+-632fab0ca702b600fde492319ab0aa2d9d3bbd08.tar.gz
stylecontext: Get rid of gtk_style_context_get()
... and replace all the calls to it with gtk_style_context_peek_property(). All the calls are hacks that need to go away btw.
Diffstat (limited to 'gtk/gtktextutil.c')
-rw-r--r--gtk/gtktextutil.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index e12ddac84e..bc5be49127 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -27,6 +27,8 @@
#include "gtktextview.h"
#include "gtktextutil.h"
+#include "gtkcsscolorvalueprivate.h"
+#include "gtkstylecontextprivate.h"
#include "gtktextbuffer.h"
#include "gtktextlayoutprivate.h"
#include "gtkintl.h"
@@ -139,39 +141,26 @@ gtk_text_util_create_drag_icon (GtkWidget *widget,
return paintable;
}
-static GtkCssValue *
-query_func (guint id, gpointer values)
-{
- return gtk_css_style_get_value (values, id);
-}
-
static void
set_attributes_from_style (GtkWidget *widget,
GtkTextAttributes *values)
{
- GtkCssStyle *style;
+ GtkStyleContext *context;
const GdkRGBA black = { 0, };
- const GdkRGBA *color;
- GValue value = G_VALUE_INIT;
if (!values->appearance.bg_rgba)
values->appearance.bg_rgba = gdk_rgba_copy (&black);
if (!values->appearance.fg_rgba)
values->appearance.fg_rgba = gdk_rgba_copy (&black);
- style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
- color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
- *values->appearance.bg_rgba = *color;
- color = gtk_css_color_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
- *values->appearance.fg_rgba = *color;
+ context = gtk_widget_get_style_context (widget);
+ *values->appearance.bg_rgba = *gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
+ *values->appearance.fg_rgba = *gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
if (values->font)
pango_font_description_free (values->font);
- _gtk_style_property_query (_gtk_style_property_lookup ("font"), &value, query_func, style);
-
- values->font = g_value_get_boxed (&value);
- g_value_unset (&value);
+ values->font = gtk_css_style_get_pango_font (gtk_style_context_lookup_style (context));
}
static gint