summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-24 18:50:28 +0200
committerinfirit <[email protected]>2014-07-24 20:17:47 +0200
commit31434612ce873fba3410bc38d9fbbb0a411b8a5e (patch)
tree5f2d204f652ad0eb04a9879d9f122287c2cf7077 /src
parentee3eee61cf8db8609dcdb16164e2370cbd34c9ed (diff)
downloadeom-31434612ce873fba3410bc38d9fbbb0a411b8a5e.tar.bz2
eom-31434612ce873fba3410bc38d9fbbb0a411b8a5e.tar.xz
Gtk+3: Make print preview use the "draw"-signal
Based on eog commit 608ef5240e87c4d0e182e7748698e2c298ec00c8 From Felix Riemann <[email protected]>
Diffstat (limited to 'src')
-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
}
/**