summaryrefslogtreecommitdiff
path: root/src/eom-print-preview.c
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2015-07-23 23:23:17 +0200
committerinfirit <[email protected]>2015-08-31 22:35:17 +0200
commit971e627c6f066393b282f5d0182daaa0084e6e9a (patch)
tree787495f052f3833ee475edd2a8d1fd9723bff570 /src/eom-print-preview.c
parent56a21c86bb4cbe389a2448cafde621b8b9e5878c (diff)
downloadeom-971e627c6f066393b282f5d0182daaa0084e6e9a.tar.bz2
eom-971e627c6f066393b282f5d0182daaa0084e6e9a.tar.xz
GTK3: Fix deprecated GTK API usage
taken from: https://git.gnome.org/browse/eog/commit/?id=9bd1a07
Diffstat (limited to 'src/eom-print-preview.c')
-rw-r--r--src/eom-print-preview.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/eom-print-preview.c b/src/eom-print-preview.c
index ba45f8a..a8049b3 100644
--- a/src/eom-print-preview.c
+++ b/src/eom-print-preview.c
@@ -1017,7 +1017,11 @@ eom_print_preview_draw (EomPrintPreview *preview, cairo_t *cr)
GtkWidget *area;
GtkAllocation allocation;
gint x0, y0;
+#if GTK_CHECK_VERSION (3, 4, 0)
+ GdkRGBA color;
+#else
GtkStyle *style;
+#endif
gboolean has_focus;
priv = preview->priv;
@@ -1025,17 +1029,29 @@ eom_print_preview_draw (EomPrintPreview *preview, cairo_t *cr)
has_focus = gtk_widget_has_focus (area);
+#if !GTK_CHECK_VERSION (3, 4, 0)
style = gtk_widget_get_style (area);
+#endif
gtk_widget_get_allocation (area, &allocation);
/* draw the page */
+#if GTK_CHECK_VERSION (3, 4, 0)
+ gdk_rgba_parse (&color, "white");
+ gdk_cairo_set_source_rgba (cr, &color);
+#else
gdk_cairo_set_source_color (cr, &style->white);
+#endif
cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
cairo_fill (cr);
/* draw the page margins */
+#if GTK_CHECK_VERSION (3, 4, 0)
+ gdk_rgba_parse (&color, "black");
+ gdk_cairo_set_source_rgba (cr, &color);
+#else
gdk_cairo_set_source_color (cr, &style->black);
+#endif
cairo_set_line_width (cr, 0.1);
cairo_rectangle (cr,
priv->l_rmargin, priv->t_rmargin,
@@ -1077,15 +1093,17 @@ eom_print_preview_draw (EomPrintPreview *preview, cairo_t *cr)
}
if (has_focus) {
- #if GTK_CHECK_VERSION(3, 0, 0)
- gtk_paint_focus (style, cr,
- GTK_STATE_NORMAL, NULL, NULL,
- 0, 0, allocation.width, allocation.height);
- #else
+#if GTK_CHECK_VERSION(3, 0, 0)
+ GtkStyleContext *ctx;
+
+ ctx = gtk_widget_get_style_context (area);
+ gtk_render_focus (ctx, cr, 0, 0,
+ allocation.width, allocation.height);
+#else
gtk_paint_focus (style, gtk_widget_get_window (area),
GTK_STATE_NORMAL, NULL, NULL, NULL,
0, 0, allocation.width, allocation.height);
- #endif
+#endif
}
}