From 9b6649abf3047657e9a95223e98acfb1455ef9e7 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Tue, 1 Sep 2015 23:18:42 +0200 Subject: Gtk3: remove an unused variable + simplify the code inspiriert from: https://git.gnome.org/browse/eog/commit/?h=gnome-3-4&id=9ef7d86 --- src/eom-print-preview.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/eom-print-preview.c b/src/eom-print-preview.c index 0f5f484..5410ebb 100644 --- a/src/eom-print-preview.c +++ b/src/eom-print-preview.c @@ -559,26 +559,32 @@ eom_print_preview_new (void) #if GTK_CHECK_VERSION (3, 0, 0) static gboolean draw_cb (GtkDrawingArea *drawing_area, - cairo_t *cr, + cairo_t *cr, + gpointer user_data) +{ + update_relative_sizes (EOM_PRINT_PREVIEW (user_data)); + + eom_print_preview_draw (EOM_PRINT_PREVIEW (user_data), cr); + + if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) { + fprintf (stderr, "Cairo is unhappy: %s\n", + cairo_status_to_string (cairo_status (cr))); + } + return TRUE; +} #else static void expose_event_cb (GtkDrawingArea *drawing_area, GdkEventExpose *eev, -#endif gpointer user_data) { GtkWidget *widget; -#if !GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr; -#endif widget = GTK_WIDGET (drawing_area); 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); @@ -586,17 +592,10 @@ expose_event_cb (GtkDrawingArea *drawing_area, fprintf (stderr, "Cairo is unhappy: %s\n", cairo_status_to_string (cairo_status (cr))); } - -#if !GTK_CHECK_VERSION (3, 0, 0) cairo_destroy (cr); - gdk_window_get_pointer (gtk_widget_get_window (widget), NULL, NULL, NULL); -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) - return TRUE; -#endif } +#endif /** * get_current_image_coordinates: -- cgit v1.2.1