summaryrefslogtreecommitdiff
path: root/src/eom-print-preview.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eom-print-preview.c')
-rw-r--r--src/eom-print-preview.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/eom-print-preview.c b/src/eom-print-preview.c
index 0e85ae6..219db41 100644
--- a/src/eom-print-preview.c
+++ b/src/eom-print-preview.c
@@ -464,7 +464,11 @@ static gboolean button_release_event_cb (GtkWidget *widget, GdkEventButton *bev,
static gboolean motion_notify_event_cb (GtkWidget *widget, GdkEventMotion *mev, gpointer user_data);
static gboolean key_press_event_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
+#if GTK_CHECK_VERSION (3, 0, 0)
+static gboolean draw_cb (GtkDrawingArea *drawing_area, cairo_t *cr, gpointer user_data);
+#else
static void expose_event_cb (GtkDrawingArea *drawing_area, GdkEventExpose *eev, gpointer user_data);
+#endif
static void size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer user_data);
/**
@@ -524,8 +528,13 @@ eom_print_preview_new (void)
/* update_relative_sizes (preview); */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ g_signal_connect (G_OBJECT (area), "draw",
+ G_CALLBACK (draw_cb), preview);
+#else
g_signal_connect (G_OBJECT (area), "expose-event",
G_CALLBACK (expose_event_cb), preview);
+#endif
g_signal_connect (G_OBJECT (area), "motion-notify-event",
G_CALLBACK (motion_notify_event_cb), preview);
@@ -545,21 +554,31 @@ eom_print_preview_new (void)
return GTK_WIDGET (preview);
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+static gboolean
+draw_cb (GtkDrawingArea *drawing_area,
+ cairo_t *cr,
+#else
static void
expose_event_cb (GtkDrawingArea *drawing_area,
GdkEventExpose *eev,
+#endif
gpointer user_data)
{
GtkWidget *widget;
EomPrintPreviewPrivate *priv;
+#if !GTK_CHECK_VERSION (3, 0, 0)
cairo_t *cr;
+#endif
widget = GTK_WIDGET (drawing_area);
priv = EOM_PRINT_PREVIEW (user_data)->priv;
update_relative_sizes (EOM_PRINT_PREVIEW (user_data));
+#if !GTK_CHECK_VERSION (3, 0, 0)
cr = gdk_cairo_create (gtk_widget_get_window (widget));
+#endif
eom_print_preview_draw (EOM_PRINT_PREVIEW (user_data), cr);
@@ -568,9 +587,14 @@ expose_event_cb (GtkDrawingArea *drawing_area,
cairo_status_to_string (cairo_status (cr)));
}
+#if !GTK_CHECK_VERSION (3, 0, 0)
cairo_destroy (cr);
+#endif
gdk_window_get_pointer (gtk_widget_get_window (widget), NULL, NULL, NULL);
+#if !GTK_CHECK_VERSION (3, 0, 0)
+ return TRUE;
+#endif
}
/**