From 75c1d391dea7978f76ff401e8a8da3a79c117009 Mon Sep 17 00:00:00 2001 From: infirit Date: Tue, 9 Dec 2014 23:42:21 +0100 Subject: Gtk3: libview: Port EvAnnotationWindow to GtkStyleContext Taken from evince commit: 0e3c1a6bbc18562c515bd10e2ca9d5bf32b9780f From: Carlos Garcia Campos --- libview/ev-annotation-window.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'libview/ev-annotation-window.c') diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c index f22934e4..be91cdc6 100644 --- a/libview/ev-annotation-window.c +++ b/libview/ev-annotation-window.c @@ -134,16 +134,41 @@ static void ev_annotation_window_set_color (EvAnnotationWindow *window, GdkColor *color) { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkStyleProperties *properties; + GtkStyleProvider *provider; + GdkRGBA rgba; + + rgba.red = color->red / 65535.; + rgba.green = color->green / 65535.; + rgba.blue = color->blue / 65535.; + rgba.alpha = 1; + + properties = gtk_style_properties_new (); + gtk_style_properties_set (properties, 0, + "color", &rgba, + "background-color", &rgba, + NULL); + + provider = GTK_STYLE_PROVIDER (properties); + gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (window)), + provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + gtk_style_context_add_provider (gtk_widget_get_style_context (window->close_button), + provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + gtk_style_context_add_provider (gtk_widget_get_style_context (window->resize_se), + provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + gtk_style_context_add_provider (gtk_widget_get_style_context (window->resize_sw), + provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + g_object_unref (properties); +#else GtkRcStyle *rc_style; GdkColor gcolor; gcolor = *color; -#if !GTK_CHECK_VERSION (3, 0, 0) /* Allocate these colors */ gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (window)), &gcolor, FALSE, TRUE); -#endif /* Apply colors to style */ rc_style = gtk_widget_get_modifier_style (GTK_WIDGET (window)); @@ -162,6 +187,7 @@ ev_annotation_window_set_color (EvAnnotationWindow *window, gtk_widget_modify_style (window->resize_se, rc_style); gtk_widget_modify_style (window->resize_sw, rc_style); g_object_unref (rc_style); +#endif } static void -- cgit v1.2.1