diff options
author | infirit <[email protected]> | 2014-12-09 23:42:21 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-10 00:53:52 +0100 |
commit | 75c1d391dea7978f76ff401e8a8da3a79c117009 (patch) | |
tree | dc4876bf65d0064c380e085a761b99cceee44e6f | |
parent | 92eef21160dad5e3eaa7356fb6b9fe1cec86b1a9 (diff) | |
download | atril-75c1d391dea7978f76ff401e8a8da3a79c117009.tar.bz2 atril-75c1d391dea7978f76ff401e8a8da3a79c117009.tar.xz |
Gtk3: libview: Port EvAnnotationWindow to GtkStyleContext
Taken from evince commit: 0e3c1a6bbc18562c515bd10e2ca9d5bf32b9780f
From: Carlos Garcia Campos <[email protected]>
-rw-r--r-- | libview/ev-annotation-window.c | 30 |
1 files changed, 28 insertions, 2 deletions
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 |