summaryrefslogtreecommitdiff
path: root/libview/ev-loading-window.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-09 23:26:16 +0100
committerinfirit <[email protected]>2014-12-10 00:53:40 +0100
commit26a531547b02c4631859397f7f52ae2e5349f896 (patch)
tree018fe8a07f20d86567ac2f3fd9494ddf18b0f929 /libview/ev-loading-window.c
parentb9389aada734dfc328c6db2a7bfd4f7e2c0c90a5 (diff)
downloadatril-26a531547b02c4631859397f7f52ae2e5349f896.tar.bz2
atril-26a531547b02c4631859397f7f52ae2e5349f896.tar.xz
Gtk3: libview: Port EvLoadingWindow to GtkStyleContext
Taken from evince commit: 082ba0dbfeed04fb5cb5bb2e5d81c77c831e8c7a From: Matthias Clasen <[email protected]>
Diffstat (limited to 'libview/ev-loading-window.c')
-rw-r--r--libview/ev-loading-window.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libview/ev-loading-window.c b/libview/ev-loading-window.c
index 2b79d4ed..c6ce8b85 100644
--- a/libview/ev-loading-window.c
+++ b/libview/ev-loading-window.c
@@ -71,8 +71,13 @@ ev_loading_window_init (EvLoadingWindow *window)
GtkWidget *widget = GTK_WIDGET (window);
GtkWidget *hbox;
GtkWidget *label;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkStyleContext *context;
+ GdkRGBA fg, bg;
+#else
GtkStyle *style;
GdkColor fg, bg;
+#endif
const gchar *loading_text = _("Loading…");
const gchar *fg_color_name = "info_fg_color";
const gchar *bg_color_name = "info_bg_color";
@@ -99,6 +104,25 @@ ev_loading_window_init (EvLoadingWindow *window)
gtk_window_set_decorated (gtk_window, FALSE);
gtk_window_set_resizable (gtk_window, FALSE);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ context = gtk_widget_get_style_context (widget);
+ if (!gtk_style_context_lookup_color (context, fg_color_name, &fg) ||
+ !gtk_style_context_lookup_color (context, bg_color_name, &bg)) {
+ fg.red = 0.7;
+ fg.green = 0.67;
+ fg.blue = 0.63;
+ fg.alpha = 1.0;
+
+ bg.red = 0.99;
+ bg.green = 0.99;
+ bg.blue = 0.71;
+ bg.alpha = 1.0;
+ }
+
+ gtk_widget_override_background_color (widget, GTK_STATE_NORMAL, &bg);
+ gtk_widget_override_color (widget, GTK_STATE_NORMAL, &fg);
+}
+#else
style = gtk_widget_get_style (widget);
if (!gtk_style_lookup_color (style, fg_color_name, &fg) ||
!gtk_style_lookup_color (style, bg_color_name, &bg)) {
@@ -118,6 +142,7 @@ ev_loading_window_init (EvLoadingWindow *window)
if (!gdk_color_equal (&fg, &style->fg[GTK_STATE_NORMAL]))
gtk_widget_modify_fg (widget, GTK_STATE_NORMAL, &fg);
}
+#endif
static GObject *
ev_loading_window_constructor (GType type,