From ae5f4711a21508a70d7123dbc0efb610af1289a2 Mon Sep 17 00:00:00 2001 From: monsta Date: Wed, 23 Nov 2016 18:15:54 +0300 Subject: move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option and require caja >= 1.17.1 --- Makefile.am | 3 +- NEWS | 3 + atril-document.pc.in | 2 +- configure.ac | 69 ++-- .../gimpcellrenderertoggle.c | 146 +------- cut-n-paste/smclient/eggsmclient-xsmp.c | 19 - cut-n-paste/toolbar-editor/egg-editable-toolbar.c | 72 +--- cut-n-paste/toolbar-editor/egg-editable-toolbar.h | 2 - cut-n-paste/toolbar-editor/egg-toolbar-editor.c | 101 +---- cut-n-paste/zoom-control/ephy-zoom-control.c | 4 - help/reference/shell/atril-sections.txt | 2 - libdocument/Makefile.am | 4 +- libdocument/ev-attachment.c | 18 +- libdocument/ev-document-misc.c | 14 - libdocument/ev-document-misc.h | 2 - libmisc/ev-page-action-widget.c | 6 +- libview/Makefile.am | 4 +- libview/ev-annotation-window.c | 44 +-- libview/ev-jobs.c | 60 --- libview/ev-loading-window.c | 48 +-- libview/ev-pixbuf-cache.c | 37 -- libview/ev-print-operation.c | 34 -- libview/ev-timeline.c | 10 - libview/ev-view-presentation.c | 134 +------ libview/ev-view-private.h | 10 - libview/ev-view.c | 406 +-------------------- libview/ev-web-view.c | 171 +-------- previewer/ev-previewer-window.c | 6 +- properties/ev-properties-view.c | 98 +---- shell/eggfindbar.c | 88 +---- shell/eggfindbar.h | 4 - shell/ev-annotation-properties-dialog.c | 106 ------ shell/ev-application.c | 5 - shell/ev-message-area.c | 11 +- shell/ev-navigation-action-widget.c | 4 - shell/ev-password-view.c | 53 +-- shell/ev-progress-message-area.c | 6 +- shell/ev-sidebar-annotations.c | 20 +- shell/ev-sidebar-attachments.c | 4 - shell/ev-sidebar-bookmarks.c | 8 - shell/ev-sidebar-thumbnails.c | 14 +- shell/ev-sidebar.c | 16 +- shell/ev-utils.c | 8 - shell/ev-window.c | 136 +------ 44 files changed, 95 insertions(+), 1917 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9ba3eba8..776982f4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,8 +82,7 @@ DISTCHECK_CONFIGURE_FLAGS = \ --enable-gtk-doc \ --disable-caja \ --disable-tests \ - --disable-silent-rules \ - --with-gtk=$(GTK_API_VERSION) + --disable-silent-rules distuninstallcheck_listfiles = find . -type f -print | grep -v /share/mate/help/ | grep -v \.omf diff --git a/NEWS b/NEWS index e634bde9..a29c4a3d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +1.17.0 +------ + 1.16.1 ------ diff --git a/atril-document.pc.in b/atril-document.pc.in index 8a528687..95cd52b6 100644 --- a/atril-document.pc.in +++ b/atril-document.pc.in @@ -7,6 +7,6 @@ backenddir=@libdir@/atril/@EV_BINARY_VERSION@/backends Name: Atril Document Description: MATE document viewer backend library Version: @VERSION@ -Requires: gio-2.0 >= @GLIB_REQUIRED@ gtk+-@GTK_API_VERSION@ >= @GTK_REQUIRED@ +Requires: gio-2.0 >= @GLIB_REQUIRED@ gtk+-3.0 >= @GTK_REQUIRED@ Libs: -L${libdir} -latrildocument Cflags: -I${includedir} diff --git a/configure.ac b/configure.ac index 47d082a8..07fdebca 100644 --- a/configure.ac +++ b/configure.ac @@ -3,8 +3,8 @@ # ***************************************************************************** m4_define([ev_major_version], [1]) -m4_define([ev_minor_version], [16]) -m4_define([ev_micro_version], [1]) +m4_define([ev_minor_version], [17]) +m4_define([ev_micro_version], [0]) m4_define([ev_extra_version], []) m4_define([ev_version], [ev_major_version.ev_minor_version.ev_micro_version()ev_extra_version]) @@ -96,28 +96,13 @@ AC_MSG_RESULT([$with_gtk]) dnl Specify required versions of dependencies CAIRO_REQUIRED=1.9.10 GLIB_REQUIRED=2.36.0 +GTK_REQUIRED=3.14.0 +WEBKIT_REQUIRED=2.4.3 LIBSECRET_REQUIRED=0.5 - -case "$with_gtk" in - 2.0) GTK_API_VERSION=2.0 - WEBKIT_API_VERSION=1.0 - GAIL_API_VERSION= - GTK_REQUIRED=2.24.0 - WEBKIT_REQUIRED=2.4.3 - ;; - 3.0) GTK_API_VERSION=3.0 - WEBKIT_API_VERSION=4.0 - GAIL_API_VERSION=-3.0 - GTK_REQUIRED=3.0.0 - WEBKIT_REQUIRED=2.4.3 - ;; -esac +LIBXML_REQUIRED=2.5.0 AC_SUBST([GLIB_REQUIRED]) AC_SUBST([GTK_REQUIRED]) -AC_SUBST([GTK_API_VERSION]) - -LIBXML_REQUIRED=2.5.0 dnl Check dependencies @@ -130,13 +115,13 @@ dnl Check dependencies AC_SEARCH_LIBS([hypot],[m]) -PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED) -PKG_CHECK_MODULES(LIBVIEW, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gail$GAIL_API_VERSION >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED) -PKG_CHECK_MODULES(BACKEND, cairo >= $CAIRO_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED) -PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED) +PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED) +PKG_CHECK_MODULES(LIBVIEW, gtk+-3.0 >= $GTK_REQUIRED gail-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED) +PKG_CHECK_MODULES(BACKEND, cairo >= $CAIRO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED) +PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED) PKG_CHECK_MODULES(GMODULE, gmodule-2.0 >= $GLIB_REQUIRED) -PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gthread-2.0 x11]) +PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED gtk+-3.0 >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gthread-2.0 x11]) dnl dnl zlib support @@ -156,7 +141,7 @@ dnl dnl SM client dnl -PKG_CHECK_MODULES([SMCLIENT],[gtk+-$GTK_API_VERSION gthread-2.0 sm >= 1.0.0]) +PKG_CHECK_MODULES([SMCLIENT],[gtk+-3.0 gthread-2.0 sm >= 1.0.0]) AC_SUBST([SMCLIENT_CFLAGS]) AC_SUBST([SMCLIENT_LIBS]) @@ -178,7 +163,7 @@ AC_ARG_WITH([gtk-unix-print], AC_MSG_RESULT([$with_gtk_unix_print]) if test "$with_gtk_unix_print" = "yes"; then - PKG_CHECK_MODULES(GTKUNIXPRINT, [gtk+-unix-print-$GTK_API_VERSION >= $GTK_REQUIRED]) + PKG_CHECK_MODULES(GTKUNIXPRINT, [gtk+-unix-print-3.0 >= $GTK_REQUIRED]) AC_DEFINE([GTKUNIXPRINT_ENABLED], [1], [Define if gtk+-unix-print is enabled.]) fi @@ -272,7 +257,7 @@ AC_ARG_ENABLE([caja], [enable_caja=yes]) if test "$enable_caja" = "yes" ; then - PKG_CHECK_MODULES([CAJA],[gtk+-x11-$GTK_API_VERSION $MM gthread-2.0 libcaja-extension], + PKG_CHECK_MODULES([CAJA],[gtk+-x11-3.0 $MM gthread-2.0 libcaja-extension >= 1.17.1], [],[AC_MSG_ERROR([libcaja-extension not found; use --disable-caja to disable the caja extensions])]) CAJA_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libcaja-extension` AC_SUBST([cajaextensiondir],[$CAJA_EXTENSION_DIR]) @@ -305,7 +290,7 @@ AC_ARG_ENABLE([previewer], [enable_previewer=yes]) if test x$enable_previewer = "xyes" ; then - PKG_CHECK_MODULES([PREVIEWER],[gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED]) + PKG_CHECK_MODULES([PREVIEWER],[gtk+-3.0 >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED]) fi AM_CONDITIONAL([ENABLE_PREVIEWER],[test "$enable_previewer" = "yes"]) @@ -578,22 +563,13 @@ AC_ARG_ENABLE(epub, have_webkit="no" if test "x$enable_epub" = "xyes"; then - case "$with_gtk" in - 2.0) - PKG_CHECK_MODULES(EPUB, webkit-$WEBKIT_API_VERSION >= $WEBKIT_REQUIRED \ - libxml-2.0 >= $LIBXML_REQUIRED zlib,have_webkit=yes,have_webkit=no) - ;; - 3.0) - PKG_CHECK_MODULES(EPUB, webkit2gtk-$WEBKIT_API_VERSION >= $WEBKIT_REQUIRED \ - libxml-2.0 >= $LIBXML_REQUIRED zlib,have_webkit=yes,have_webkit=no) - if test "x$have_webkit" = "xno"; then - AC_MSG_NOTICE([Webkit2 4.0 not found, trying 3.0]) - WEBKIT_API_VERSION=3.0 - PKG_CHECK_MODULES(EPUB, webkit2gtk-$WEBKIT_API_VERSION >= $WEBKIT_REQUIRED \ - libxml-2.0 >= $LIBXML_REQUIRED zlib,have_webkit=yes,have_webkit=no) - fi - ;; - esac + PKG_CHECK_MODULES(EPUB, webkit2gtk-4.0 >= $WEBKIT_REQUIRED \ + libxml-2.0 >= $LIBXML_REQUIRED zlib,have_webkit=yes,have_webkit=no) + if test "x$have_webkit" = "xno"; then + AC_MSG_NOTICE([Webkit2 4.0 not found, trying 3.0]) + PKG_CHECK_MODULES(EPUB, webkit2gtk-3.0 >= $WEBKIT_REQUIRED \ + libxml-2.0 >= $LIBXML_REQUIRED zlib,have_webkit=yes,have_webkit=no) + fi if test "x$have_webkit" = "xyes"; then AC_DEFINE([ENABLE_EPUB], [1], [Enable support for ePub documents.]) @@ -653,7 +629,7 @@ YELP_HELP_INIT GTK_DOC_CHECK([1.13], [--flavour no-tmpl]) AC_SUBST([GLIB_PREFIX], [$($PKG_CONFIG --variable=prefix glib-2.0)]) -AC_SUBST([GTK_PREFIX], [$($PKG_CONFIG --variable=prefix gtk+-$GTK_API_VERSION)]) +AC_SUBST([GTK_PREFIX], [$($PKG_CONFIG --variable=prefix gtk+-3.0)]) # ****************** # Backends directory @@ -757,7 +733,6 @@ AC_OUTPUT echo " Configure summary: - GTK+ version........: $with_gtk GTK+ Unix Print.....: $with_gtk_unix_print Keyring Support.....: $with_keyring DBUS Support........: $enable_dbus diff --git a/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c b/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c index e880b637..0addfa72 100644 --- a/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c +++ b/cut-n-paste/gimpcellrenderertoggle/gimpcellrenderertoggle.c @@ -25,17 +25,8 @@ #include "gimpwidgetsmarshal.h" #include "gimpcellrenderertoggle.h" - #define DEFAULT_ICON_SIZE GTK_ICON_SIZE_BUTTON -#if GTK_CHECK_VERSION (3, 0, 0) -#define GTK_STATE_INSENSITIVE GTK_STATE_FLAG_INSENSITIVE -#define GTK_STATE_SELECTED GTK_STATE_FLAG_SELECTED -#define GTK_STATE_ACTIVE GTK_STATE_FLAG_ACTIVE -#define GTK_STATE_NORMAL 0 -#define gtk_widget_render_icon(A,B,C,D) gtk_widget_render_icon_pixbuf(A,B,C) -#endif - enum { CLICKED, @@ -61,42 +52,23 @@ static void gimp_cell_renderer_toggle_set_property (GObject *object, GParamSpec *pspec); static void gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, GtkWidget *widget, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *rectangle, -#else - GdkRectangle *rectangle, -#endif gint *x_offset, gint *y_offset, gint *width, gint *height); static void gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, -#if GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr, -#else - GdkWindow *window, -#endif GtkWidget *widget, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *background_area, const GdkRectangle *cell_area, -#else - GdkRectangle *background_area, - GdkRectangle *cell_area, - GdkRectangle *expose_area, -#endif GtkCellRendererState flags); static gboolean gimp_cell_renderer_toggle_activate (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *background_area, const GdkRectangle *cell_area, -#else - GdkRectangle *background_area, - GdkRectangle *cell_area, -#endif GtkCellRendererState flags); static void gimp_cell_renderer_toggle_create_pixbuf (GimpCellRendererToggle *toggle, GtkWidget *widget); @@ -234,23 +206,15 @@ gimp_cell_renderer_toggle_set_property (GObject *object, static void gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, GtkWidget *widget, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *cell_area, -#else - GdkRectangle *cell_area, -#endif gint *x_offset, gint *y_offset, gint *width, gint *height) { GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell); -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context = gtk_widget_get_style_context (widget); GtkBorder border; -#else - GtkStyle *style = gtk_widget_get_style (widget); -#endif gint calc_width; gint calc_height; gint pixbuf_width; @@ -273,9 +237,7 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, gtk_cell_renderer_get_alignment (cell, &xalign, &yalign); gtk_cell_renderer_get_padding (cell, &xpad, &ypad); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_get_border (context, 0, &border); -#endif if (! toggle->pixbuf) gimp_cell_renderer_toggle_create_pixbuf (toggle, widget); @@ -283,15 +245,8 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, pixbuf_width = gdk_pixbuf_get_width (toggle->pixbuf); pixbuf_height = gdk_pixbuf_get_height (toggle->pixbuf); -#if GTK_CHECK_VERSION (3, 0, 0) calc_width = (pixbuf_width + (gint) xpad * 2 + (border.left + border.right)); calc_height = (pixbuf_height + (gint) ypad * 2 + (border.top + border.bottom)); -#else - calc_width = (pixbuf_width + - (gint) xpad * 2 + style->xthickness * 2); - calc_height = (pixbuf_height + - (gint) ypad * 2 + style->ythickness * 2); -#endif if (width) *width = calc_width; @@ -317,39 +272,20 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell, } } -#if GTK_CHECK_VERSION (3, 0, 0) -#define gimp_cell_renderer_toggle_get_size gtk_cell_renderer_get_size -#endif - static void gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, -#if GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr, -#else - GdkWindow *window, -#endif GtkWidget *widget, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *background_area, const GdkRectangle *cell_area, -#else - GdkRectangle *background_area, - GdkRectangle *cell_area, - GdkRectangle *expose_area, -#endif GtkCellRendererState flags) { GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell); GdkRectangle toggle_rect; GdkRectangle draw_rect; -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context = gtk_widget_get_style_context (widget); GdkRectangle clip_rect; GtkStateFlags state; -#else - GtkStyle *style = gtk_widget_get_style (widget); - GtkStateType state; -#endif gboolean active; gint xpad; gint ypad; @@ -357,26 +293,19 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, if (! toggle->stock_id) { GTK_CELL_RENDERER_CLASS (parent_class)->render (cell, -#if GTK_CHECK_VERSION (3, 0, 0) cr, -#else - window, -#endif widget, background_area, cell_area, -#if !GTK_CHECK_VERSION (3, 0, 0) - expose_area, -#endif flags); return; } - gimp_cell_renderer_toggle_get_size (cell, widget, cell_area, - &toggle_rect.x, - &toggle_rect.y, - &toggle_rect.width, - &toggle_rect.height); + gtk_cell_renderer_get_size (cell, widget, cell_area, + &toggle_rect.x, + &toggle_rect.y, + &toggle_rect.width, + &toggle_rect.height); gtk_cell_renderer_get_padding (cell, &xpad, &ypad); toggle_rect.x += cell_area->x + xpad; @@ -392,24 +321,23 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, if (!gtk_cell_renderer_get_sensitive (cell)) { - state = GTK_STATE_INSENSITIVE; + state = GTK_STATE_FLAG_INSENSITIVE; } else if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED) { if (gtk_widget_has_focus (widget)) - state = GTK_STATE_SELECTED; + state = GTK_STATE_FLAG_SELECTED; else - state = GTK_STATE_ACTIVE; + state = GTK_STATE_FLAG_ACTIVE; } else { if (gtk_cell_renderer_toggle_get_activatable (GTK_CELL_RENDERER_TOGGLE (cell))) - state = GTK_STATE_NORMAL; + state = GTK_STATE_FLAG_NORMAL; else - state = GTK_STATE_INSENSITIVE; + state = GTK_STATE_FLAG_INSENSITIVE; } -#if GTK_CHECK_VERSION (3, 0, 0) if ((flags & GTK_CELL_RENDERER_PRELIT) && gdk_cairo_get_clip_rectangle(cr, &clip_rect) && gdk_rectangle_intersect (&clip_rect, cell_area, &draw_rect)) @@ -424,25 +352,12 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, gtk_style_context_restore (context); cairo_restore (cr); } -#else - if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect) && - (flags & GTK_CELL_RENDERER_PRELIT)) - gtk_paint_shadow (style, - window, - state, - active ? GTK_SHADOW_IN : GTK_SHADOW_OUT, - &draw_rect, - widget, NULL, - toggle_rect.x, toggle_rect.y, - toggle_rect.width, toggle_rect.height); -#endif if (active) { GdkPixbuf *insensitive = NULL; GdkPixbuf *pixbuf = toggle->pixbuf; -#if GTK_CHECK_VERSION (3, 0, 0) GtkBorder border = { 1, 1, 1, 1 }; #if 0 @@ -459,14 +374,6 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, toggle_rect.height -= (border.top + border.bottom); if (state & GTK_STATE_FLAG_INSENSITIVE) -#else - toggle_rect.x += style->xthickness; - toggle_rect.y += style->ythickness; - toggle_rect.width -= style->xthickness * 2; - toggle_rect.height -= style->ythickness * 2; - - if (state == GTK_STATE_INSENSITIVE) -#endif { GtkIconSource *source; @@ -479,21 +386,10 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_icon_source_set_size_wildcarded (source, FALSE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_save (context); gtk_style_context_set_state (context, GTK_STATE_FLAG_INSENSITIVE); insensitive = gtk_render_icon_pixbuf (context, source, (GtkIconSize)-1); gtk_style_context_restore (context); -#else - insensitive = gtk_style_render_icon (gtk_widget_get_style (widget), - source, - gtk_widget_get_direction (widget), - GTK_STATE_INSENSITIVE, - /* arbitrary */ - (GtkIconSize)-1, - widget, - "gimpcellrenderertoggle"); -#endif gtk_icon_source_free (source); @@ -502,19 +398,9 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell, if (gdk_rectangle_intersect (&draw_rect, &toggle_rect, &draw_rect)) { -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_t *cr; - - cr = gdk_cairo_create (window); -#endif - gdk_cairo_set_source_pixbuf (cr, pixbuf, toggle_rect.x, toggle_rect.y); gdk_cairo_rectangle (cr, &draw_rect); cairo_fill (cr); - -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif } if (insensitive) @@ -527,13 +413,8 @@ gimp_cell_renderer_toggle_activate (GtkCellRenderer *cell, GdkEvent *event, GtkWidget *widget, const gchar *path, -#if GTK_CHECK_VERSION (3, 0, 0) const GdkRectangle *background_area, const GdkRectangle *cell_area, -#else - GdkRectangle *background_area, - GdkRectangle *cell_area, -#endif GtkCellRendererState flags) { GtkCellRendererToggle *toggle = GTK_CELL_RENDERER_TOGGLE (cell); @@ -565,12 +446,11 @@ gimp_cell_renderer_toggle_create_pixbuf (GimpCellRendererToggle *toggle, if (toggle->pixbuf) g_object_unref (toggle->pixbuf); - toggle->pixbuf = gtk_widget_render_icon (widget, - toggle->stock_id, - toggle->stock_size, NULL); + toggle->pixbuf = gtk_widget_render_icon_pixbuf (widget, + toggle->stock_id, + toggle->stock_size); } - /** * gimp_cell_renderer_toggle_new: * @stock_id: the stock_id of the icon to use for the active state diff --git a/cut-n-paste/smclient/eggsmclient-xsmp.c b/cut-n-paste/smclient/eggsmclient-xsmp.c index cf30f932..49f7296f 100644 --- a/cut-n-paste/smclient/eggsmclient-xsmp.c +++ b/cut-n-paste/smclient/eggsmclient-xsmp.c @@ -368,13 +368,7 @@ sm_client_xsmp_startup (EggSMClient *client, xsmp->client_id = g_strdup (ret_client_id); free (ret_client_id); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_enter (); -#endif gdk_x11_set_sm_client_id (xsmp->client_id); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave (); -#endif g_debug ("Got client ID \"%s\"", xsmp->client_id); } @@ -542,10 +536,6 @@ idle_do_pending_events (gpointer data) EggSMClientXSMP *xsmp = data; EggSMClient *client = data; -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_enter (); -#endif - xsmp->idle = 0; if (xsmp->waiting_to_emit_quit) @@ -569,9 +559,6 @@ idle_do_pending_events (gpointer data) } out: -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave (); -#endif return FALSE; } @@ -1293,13 +1280,7 @@ process_ice_messages (IceConn ice_conn) { IceProcessMessagesStatus status; -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_enter (); -#endif status = IceProcessMessages (ice_conn, NULL, NULL); -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave (); -#endif switch (status) { diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c index f92fd117..4885fc37 100644 --- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.c +++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.c @@ -35,12 +35,6 @@ static GdkPixbuf * new_separator_pixbuf (void); #define EGG_ITEM_NAME "egg-item-name" #define STOCK_DRAG_MODE "stock_drag-mode" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gdk_cursor_unref g_object_unref -#define gtk_widget_render_icon(A,B,C,D) gtk_widget_render_icon_pixbuf(A,B,C) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - static const GtkTargetEntry dest_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, }; @@ -86,10 +80,8 @@ struct _EggEditableToolbarPrivate GtkToolbar *dnd_toolbar; GtkToolItem *dnd_toolitem; -#if GTK_CHECK_VERSION (3, 0, 0) gboolean set_primary_class; gchar *primary_name; -#endif }; G_DEFINE_TYPE (EggEditableToolbar, egg_editable_toolbar, GTK_TYPE_BOX); @@ -296,7 +288,6 @@ move_item_cb (GtkAction *action, GtkTargetList *list = gtk_target_list_new (dest_drag_types, G_N_ELEMENTS (dest_drag_types)); GdkEvent *realevent = gtk_get_current_event(); -#if GTK_CHECK_VERSION (3, 0, 0) GdkEvent *event = gdk_event_new (GDK_MOTION_NOTIFY); event->motion.window = g_object_ref (realevent->any.window); event->motion.send_event = FALSE; @@ -309,19 +300,6 @@ move_item_cb (GtkAction *action, gtk_drag_begin (toolitem, list, GDK_ACTION_MOVE, 1, event); gdk_event_free (event); -#else - GdkEventMotion event; - event.type = GDK_MOTION_NOTIFY; - event.window = realevent->any.window; - event.send_event = FALSE; - event.axes = NULL; - event.time = gdk_event_get_time (realevent); - gdk_event_get_state (realevent, &event.state); - gdk_event_get_coords (realevent, &event.x, &event.y); - gdk_event_get_root_coords (realevent, &event.x_root, &event.y_root); - - gtk_drag_begin (toolitem, list, GDK_ACTION_MOVE, 1, (GdkEvent *)&event); -#endif gtk_target_list_unref (list); } @@ -390,7 +368,6 @@ popup_context_menu_cb (GtkWidget *toolbar, } } -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean edit_mode_button_press_event_cb (GtkWidget *widget, GdkEventButton *event, @@ -402,7 +379,6 @@ edit_mode_button_press_event_cb (GtkWidget *widget, } return FALSE; } -#endif static gboolean button_press_event_cb (GtkWidget *widget, @@ -450,7 +426,6 @@ configure_item_sensitivity (GtkToolItem *item, EggEditableToolbar *etoolbar) } -#if GTK_CHECK_VERSION (3, 0, 0) static void configure_item_window_drag (GtkToolItem *item, EggEditableToolbar *etoolbar) @@ -467,7 +442,6 @@ configure_item_window_drag (GtkToolItem *item, NULL); } } -#endif static void configure_item_cursor (GtkToolItem *item, @@ -490,7 +464,7 @@ configure_item_cursor (GtkToolItem *item, cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen), GDK_HAND2); gdk_window_set_cursor (window, cursor); - gdk_cursor_unref (cursor); + g_object_unref (cursor); gtk_drag_source_set (widget, GDK_BUTTON1_MASK, dest_drag_types, G_N_ELEMENTS (dest_drag_types), GDK_ACTION_MOVE); @@ -538,8 +512,8 @@ configure_item_cursor (GtkToolItem *item, } else if (stock_id) { - pixbuf = gtk_widget_render_icon (widget, stock_id, - GTK_ICON_SIZE_LARGE_TOOLBAR, NULL); + pixbuf = gtk_widget_render_icon_pixbuf (widget, stock_id, + GTK_ICON_SIZE_LARGE_TOOLBAR); } g_free (icon_name); g_free (stock_id); @@ -555,11 +529,7 @@ configure_item_cursor (GtkToolItem *item, } else { -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_cursor (window, NULL); -#else - gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET(item)), NULL); -#endif } } } @@ -620,16 +590,11 @@ action_sensitive_cb (GtkAction *action, { EggEditableToolbar *etoolbar; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *ancestor = gtk_widget_get_ancestor (GTK_WIDGET (item), EGG_TYPE_EDITABLE_TOOLBAR); if (!ancestor) return; etoolbar = EGG_EDITABLE_TOOLBAR (ancestor); -#else - etoolbar = EGG_EDITABLE_TOOLBAR - (gtk_widget_get_ancestor (GTK_WIDGET (item), EGG_TYPE_EDITABLE_TOOLBAR)); -#endif if (etoolbar->priv->edit_mode > 0) { @@ -648,9 +613,7 @@ create_item_from_action (EggEditableToolbar *etoolbar, if (strcmp (name, "_separator") == 0) { item = gtk_separator_tool_item_new (); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_show (GTK_WIDGET (item)); -#endif } else { @@ -669,10 +632,6 @@ create_item_from_action (EggEditableToolbar *etoolbar, G_CALLBACK (action_sensitive_cb), item, 0); } -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_show (GTK_WIDGET (item)); -#endif - g_object_set_data_full (G_OBJECT (item), EGG_ITEM_NAME, g_strdup (name), g_free); @@ -927,12 +886,10 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar) char action_name[40]; char *action_label; char *tmp; -#if GTK_CHECK_VERSION (3, 0, 0) gboolean primary_class_set; GtkStyleContext *context; const gchar *toolbar_name; gboolean visible; -#endif if (priv == NULL || priv->model == NULL || priv->manager == NULL || priv->visibility_paths == NULL || priv->actions == NULL) @@ -954,15 +911,11 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar) showing = gtk_widget_get_visible (GTK_WIDGET (etoolbar)); -#if GTK_CHECK_VERSION (3, 0, 0) primary_class_set = !priv->set_primary_class; -#endif n_toolbars = egg_toolbars_model_n_toolbars (priv->model); for (i = 0; i < n_toolbars; i++) { -#if GTK_CHECK_VERSION (3, 0, 0) toolbar_name = egg_toolbars_model_toolbar_nth (priv->model, i); -#endif string = g_string_sized_new (0); n_items = egg_toolbars_model_n_items (priv->model, i); for (k = 0, j = 0; j < n_items; j++) @@ -1041,7 +994,6 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar) & EGG_TB_MODEL_NOT_REMOVABLE) == 0); gtk_action_set_sensitive (GTK_ACTION (action), showing); -#if GTK_CHECK_VERSION (3, 0, 0) visible = gtk_widget_get_visible (get_dock_nth (etoolbar, i)); gtk_toggle_action_set_active (action, visible); @@ -1063,10 +1015,6 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar) } gtk_widget_reset_style (get_toolbar_nth (etoolbar, i)); -#else - gtk_toggle_action_set_active (action, gtk_widget_get_visible - (get_dock_nth (etoolbar, i))); -#endif for (list = priv->visibility_paths; list != NULL; list = g_list_next (list)) { @@ -1094,7 +1042,7 @@ create_dock (EggEditableToolbar *etoolbar) { GtkWidget *toolbar, *hbox; - hbox = gtk_hbox_new (0, FALSE); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); toolbar = gtk_toolbar_new (); gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE); @@ -1278,9 +1226,7 @@ item_added_cb (EggToolbarsModel *model, connect_widget_signals (GTK_WIDGET (item), etoolbar); configure_item_tooltip (item); configure_item_cursor (item, etoolbar); -#if GTK_CHECK_VERSION (3, 0, 0) configure_item_window_drag (item, etoolbar); -#endif configure_item_sensitivity (item, etoolbar); dock = get_dock_nth (etoolbar, tpos); @@ -1483,10 +1429,8 @@ egg_editable_toolbar_dispose (GObject *object) g_free (priv->popup_path); priv->popup_path = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) g_free (priv->primary_name); priv->primary_name = NULL; -#endif if (priv->manager != NULL) { @@ -1614,9 +1558,7 @@ set_edit_mode (EggEditableToolbar *etoolbar, item = gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), l); configure_item_cursor (item, etoolbar); -#if GTK_CHECK_VERSION (3, 0, 0) configure_item_window_drag (item, etoolbar); -#endif configure_item_sensitivity (item, etoolbar); } } @@ -1900,11 +1842,7 @@ new_separator_pixbuf (void) GtkWidget *separator; GdkPixbuf *pixbuf; -#if GTK_CHECK_VERSION(3, 0, 0) separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL); -#else - separator = gtk_vseparator_new (); -#endif pixbuf = new_pixbuf_from_widget (separator); return pixbuf; } @@ -1950,7 +1888,6 @@ egg_editable_toolbar_get_model (EggEditableToolbar *etoolbar) return etoolbar->priv->model; } -#if GTK_CHECK_VERSION(3, 0, 0) /** * egg_editable_toolbar_get_manager: * @@ -1974,4 +1911,3 @@ egg_editable_toolbar_set_primary_class (EggEditableToolbar *etoolbar, toolbar_visibility_refresh (etoolbar); } -#endif diff --git a/cut-n-paste/toolbar-editor/egg-editable-toolbar.h b/cut-n-paste/toolbar-editor/egg-editable-toolbar.h index a6d06f34..cd589661 100644 --- a/cut-n-paste/toolbar-editor/egg-editable-toolbar.h +++ b/cut-n-paste/toolbar-editor/egg-editable-toolbar.h @@ -81,11 +81,9 @@ void egg_editable_toolbar_set_selected (EggEditableToolbar * void egg_editable_toolbar_add_visibility (EggEditableToolbar *etoolbar, const char *path); -#if GTK_CHECK_VERSION(3, 0, 0) void egg_editable_toolbar_set_primary_class (EggEditableToolbar *etoolbar, gboolean set, const gchar *path); -#endif /* Private Functions */ diff --git a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c index 328b0327..fa79318b 100644 --- a/cut-n-paste/toolbar-editor/egg-toolbar-editor.c +++ b/cut-n-paste/toolbar-editor/egg-toolbar-editor.c @@ -28,12 +28,6 @@ #include #include -#if GTK_CHECK_VERSION (3, 0, 0) -#define gdk_cursor_unref g_object_unref -#define gtk_widget_render_icon(A,B,C,D) gtk_widget_render_icon_pixbuf(A,B,C) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - static const GtkTargetEntry dest_drag_types[] = { {EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0}, }; @@ -68,11 +62,7 @@ struct EggToolbarEditorPrivate GtkUIManager *manager; EggToolbarsModel *model; -#if GTK_CHECK_VERSION(3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *scrolled_window; GList *actions_list; GList *factory_list; @@ -379,7 +369,7 @@ set_drag_cursor (GtkWidget *widget) cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen), GDK_HAND2); gdk_window_set_cursor (gtk_widget_get_window (widget), cursor); - gdk_cursor_unref (cursor); + g_object_unref (cursor); } static void @@ -396,8 +386,8 @@ event_box_realize_cb (GtkWidget *widget, GtkImage *icon) GdkPixbuf *pixbuf; gtk_image_get_stock (icon, &stock_id, NULL); - pixbuf = gtk_widget_render_icon (widget, stock_id, - GTK_ICON_SIZE_LARGE_TOOLBAR, NULL); + pixbuf = gtk_widget_render_icon_pixbuf (widget, stock_id, + GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_drag_source_set_icon_pixbuf (widget, pixbuf); g_object_unref (pixbuf); } @@ -468,7 +458,7 @@ editor_create_item (EggToolbarEditor *editor, G_CALLBACK (drag_end_cb), NULL); } - vbox = gtk_vbox_new (0, FALSE); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show (vbox); gtk_container_add (GTK_CONTAINER (event_box), vbox); @@ -545,7 +535,6 @@ editor_create_item_from_name (EggToolbarEditor *editor, return item; } -#if GTK_CHECK_VERSION(3, 0, 0) static gint append_grid (GtkGrid *grid, GList *items, gint y, gint width) { @@ -590,52 +579,6 @@ append_grid (GtkGrid *grid, GList *items, gint y, gint width) } return y; } -#else -static gint -append_table (GtkTable *table, GList *items, gint y, gint width) -{ - if (items != NULL) - { - gint x = 0, height; - GtkWidget *alignment; - GtkWidget *item; - - height = g_list_length (items) / width + 1; - gtk_table_resize (table, height, width); - - if (y > 0) - { - item = gtk_hseparator_new (); - alignment = gtk_alignment_new (0.5, 0.5, 1.0, 0.0); - gtk_container_add (GTK_CONTAINER (alignment), item); - gtk_widget_show (alignment); - gtk_widget_show (item); - - gtk_table_attach_defaults (table, alignment, 0, width, y-1, y+1); - } - - for (; items != NULL; items = items->next) - { - item = items->data; - alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); - gtk_container_add (GTK_CONTAINER (alignment), item); - gtk_widget_show (alignment); - gtk_widget_show (item); - - if (x >= width) - { - x = 0; - y++; - } - gtk_table_attach_defaults (table, alignment, x, x+1, y, y+1); - x++; - } - - y++; - } - return y; -} -#endif static void update_editor_sheet (EggToolbarEditor *editor) @@ -643,7 +586,6 @@ update_editor_sheet (EggToolbarEditor *editor) gint y; GPtrArray *items; GList *to_move = NULL, *to_copy = NULL; -#if GTK_CHECK_VERSION(3, 0, 0) GtkWidget *grid; GtkWidget *viewport; @@ -656,20 +598,6 @@ update_editor_sheet (EggToolbarEditor *editor) gtk_grid_set_row_spacing (GTK_GRID (grid), 24); gtk_widget_show (grid); gtk_drag_dest_set (grid, GTK_DEST_DEFAULT_ALL, -#else - GtkWidget *table; - GtkWidget *viewport; - - g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor)); - - /* Create new table. */ - table = gtk_table_new (0, 0, TRUE); - editor->priv->table = table; - gtk_container_set_border_width (GTK_CONTAINER (table), 12); - gtk_table_set_row_spacings (GTK_TABLE (table), 24); - gtk_widget_show (table); - gtk_drag_dest_set (table, GTK_DEST_DEFAULT_ALL, -#endif dest_drag_types, G_N_ELEMENTS (dest_drag_types), GDK_ACTION_MOVE | GDK_ACTION_COPY); @@ -701,7 +629,6 @@ update_editor_sheet (EggToolbarEditor *editor) /* Add them to the sheet. */ y = 0; -#if GTK_CHECK_VERSION(3, 0, 0) y = append_grid (GTK_GRID (grid), to_move, y, 4); y = append_grid (GTK_GRID (grid), to_copy, y, 4); @@ -720,26 +647,6 @@ update_editor_sheet (EggToolbarEditor *editor) /* Add grid to window. */ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (editor->priv->scrolled_window), grid); -#else - y = append_table (GTK_TABLE (table), to_move, y, 4); - y = append_table (GTK_TABLE (table), to_copy, y, 4); - - g_list_free (to_move); - g_list_free (to_copy); - g_ptr_array_free (items, TRUE); - - /* Delete old table. */ - viewport = gtk_bin_get_child (GTK_BIN (editor->priv->scrolled_window)); - if (viewport) - { - gtk_container_remove (GTK_CONTAINER (viewport), - gtk_bin_get_child (GTK_BIN (viewport))); - } - - /* Add table to window. */ - gtk_scrolled_window_add_with_viewport - (GTK_SCROLLED_WINDOW (editor->priv->scrolled_window), table); -#endif } static void diff --git a/cut-n-paste/zoom-control/ephy-zoom-control.c b/cut-n-paste/zoom-control/ephy-zoom-control.c index ed5dc52e..a581e878 100644 --- a/cut-n-paste/zoom-control/ephy-zoom-control.c +++ b/cut-n-paste/zoom-control/ephy-zoom-control.c @@ -200,12 +200,8 @@ ephy_zoom_control_init (EphyZoomControl *control) i = ephy_zoom_get_zoom_level_index (p->zoom); gtk_combo_box_set_active (p->combo, i); -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_set_homogeneous (GTK_BOX (vbox), TRUE); -#else - vbox = gtk_vbox_new (TRUE, 0); -#endif gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (p->combo), TRUE, FALSE, 0); gtk_widget_show (vbox); diff --git a/help/reference/shell/atril-sections.txt b/help/reference/shell/atril-sections.txt index a775f7e2..3bda389e 100644 --- a/help/reference/shell/atril-sections.txt +++ b/help/reference/shell/atril-sections.txt @@ -336,8 +336,6 @@ egg_find_bar_set_search_string egg_find_bar_get_search_string egg_find_bar_set_case_sensitive egg_find_bar_get_case_sensitive -egg_find_bar_get_all_matches_color -egg_find_bar_get_current_match_color egg_find_bar_set_status_text EGG_FIND_BAR diff --git a/libdocument/Makefile.am b/libdocument/Makefile.am index bb6fc597..e4f22cc8 100644 --- a/libdocument/Makefile.am +++ b/libdocument/Makefile.am @@ -159,9 +159,9 @@ AtrilDocument-$(EV_API_VERSION).gir: libatrildocument.la Makefile $(INST_H_FILES --nsversion=$(EV_API_VERSION) \ --include=GLib-2.0 \ --include=Gio-2.0 \ - --include=Gdk-$(GTK_API_VERSION) \ + --include=Gdk-3.0 \ --include=GdkPixbuf-2.0 \ - --include=Gtk-$(GTK_API_VERSION) \ + --include=Gtk-3.0 \ --library=atrildocument \ --libtool="$(LIBTOOL)" \ --output $@ \ diff --git a/libdocument/ev-attachment.c b/libdocument/ev-attachment.c index 59af21ab..ec8bd35a 100644 --- a/libdocument/ev-attachment.c +++ b/libdocument/ev-attachment.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include "ev-file-helpers.h" #include "ev-attachment.h" @@ -347,12 +347,8 @@ ev_attachment_launch_app (EvAttachment *attachment, { gboolean result; GList *files = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) GdkAppLaunchContext *context; GdkDisplay *display; -#else - GAppLaunchContext *context = NULL; -#endif GError *ioerror = NULL; g_assert (G_IS_FILE (attachment->priv->tmp_file)); @@ -360,7 +356,6 @@ ev_attachment_launch_app (EvAttachment *attachment, files = g_list_prepend (files, attachment->priv->tmp_file); -#if GTK_CHECK_VERSION (3, 0, 0) display = screen ? gdk_screen_get_display (screen) : gdk_display_get_default (); context = gdk_display_get_app_launch_context (display); gdk_app_launch_context_set_screen (context, screen); @@ -370,17 +365,6 @@ ev_attachment_launch_app (EvAttachment *attachment, G_APP_LAUNCH_CONTEXT (context), &ioerror); g_object_unref (context); -#else - context = G_APP_LAUNCH_CONTEXT (gdk_app_launch_context_new ()); - gdk_app_launch_context_set_screen (GDK_APP_LAUNCH_CONTEXT (context), screen); - gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context), timestamp); - - result = g_app_info_launch (attachment->priv->app, files, - context, &ioerror); - - if (context) - g_object_unref (context); -#endif if (!result) { g_set_error (error, diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c index 6f760270..1afa1d77 100644 --- a/libdocument/ev-document-misc.c +++ b/libdocument/ev-document-misc.c @@ -140,7 +140,6 @@ ev_document_misc_paint_one_page (cairo_t *cr, gboolean highlight, gboolean inverted_colors) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context = gtk_widget_get_style_context (widget); GtkStateFlags state = gtk_widget_get_state_flags (widget); GdkRGBA fg, bg, shade_bg; @@ -157,12 +156,6 @@ ev_document_misc_paint_one_page (cairo_t *cr, gtk_symbolic_color_unref (c2); gdk_cairo_set_source_rgba (cr, highlight ? &fg : &shade_bg); -#else - GtkStyle *style = gtk_widget_get_style (widget); - GtkStateType state = gtk_widget_get_state (widget); - - gdk_cairo_set_source_color (cr, highlight ? &style->text[state] : &style->dark[state]); -#endif gdk_cairo_rectangle (cr, area); cairo_fill (cr); @@ -177,11 +170,7 @@ ev_document_misc_paint_one_page (cairo_t *cr, area->height - (border->top + border->bottom)); cairo_fill (cr); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_cairo_set_source_rgba (cr, &bg); -#else - gdk_cairo_set_source_color (cr, &style->mid[state]); -#endif cairo_rectangle (cr, area->x, area->y + area->height - (border->bottom - border->top), @@ -426,7 +415,6 @@ ev_document_misc_format_date (GTime utime) return g_locale_to_utf8 (s, -1, NULL, NULL, NULL); } -#if GTK_CHECK_VERSION(3, 0, 0) void ev_document_misc_get_pointer_position (GtkWidget *widget, gint *x, @@ -468,5 +456,3 @@ ev_document_misc_get_pointer_position (GtkWidget *widget, if (y) *y -= allocation.y; } -#endif - diff --git a/libdocument/ev-document-misc.h b/libdocument/ev-document-misc.h index e6ddf02a..98c791ca 100644 --- a/libdocument/ev-document-misc.h +++ b/libdocument/ev-document-misc.h @@ -62,11 +62,9 @@ gdouble ev_document_misc_get_screen_dpi (GdkScreen *screen); gchar *ev_document_misc_format_date (GTime utime); -#if GTK_CHECK_VERSION(3, 0, 0) void ev_document_misc_get_pointer_position (GtkWidget *widget, gint *x, gint *y); -#endif G_END_DECLS diff --git a/libmisc/ev-page-action-widget.c b/libmisc/ev-page-action-widget.c index 34e3371e..05322ef7 100644 --- a/libmisc/ev-page-action-widget.c +++ b/libmisc/ev-page-action-widget.c @@ -28,10 +28,6 @@ #include "ev-page-action.h" #include "ev-page-action-widget.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - /* Widget we pass back */ static void ev_page_action_widget_init (EvPageActionWidget *action_widget); static void ev_page_action_widget_class_init (EvPageActionWidgetClass *action_widget); @@ -162,7 +158,7 @@ ev_page_action_widget_init (EvPageActionWidget *action_widget) GtkWidget *hbox; AtkObject *obj; - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_set_spacing (GTK_BOX (hbox), 6); action_widget->entry = gtk_entry_new (); diff --git a/libview/Makefile.am b/libview/Makefile.am index 6377d7ab..252f9f0e 100644 --- a/libview/Makefile.am +++ b/libview/Makefile.am @@ -131,9 +131,9 @@ AtrilView-$(EV_API_VERSION).gir: libatrilview.la Makefile $(INST_H_FILES) $(filt --include=GLib-2.0 \ --include=GObject-2.0 \ --include=Gio-2.0 \ - --include=Gdk-$(GTK_API_VERSION) \ + --include=Gdk-3.0 \ --include=GdkPixbuf-2.0 \ - --include=Gtk-$(GTK_API_VERSION) \ + --include=Gtk-3.0 \ --include=AtrilDocument-$(EV_API_VERSION) \ --library=atrilview \ --libtool="$(LIBTOOL)" \ diff --git a/libview/ev-annotation-window.c b/libview/ev-annotation-window.c index 69278b3e..de5c8876 100644 --- a/libview/ev-annotation-window.c +++ b/libview/ev-annotation-window.c @@ -28,13 +28,6 @@ #include "ev-view-marshal.h" #include "ev-document-misc.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gdk_cursor_unref g_object_unref -#define gtk_widget_render_icon(A,B,C,D) gtk_widget_render_icon_pixbuf(A,B,C) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - enum { PROP_0, PROP_ANNOTATION, @@ -141,7 +134,6 @@ static void ev_annotation_window_set_color (EvAnnotationWindow *window, GdkColor *color) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleProperties *properties; GtkStyleProvider *provider; GdkRGBA rgba; @@ -167,34 +159,6 @@ ev_annotation_window_set_color (EvAnnotationWindow *window, gtk_style_context_add_provider (gtk_widget_get_style_context (window->resize_sw), provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (properties); -#else - GtkRcStyle *rc_style; - GdkColor gcolor; - - gcolor = *color; - - /* Allocate these colors */ - gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (window)), - &gcolor, FALSE, TRUE); - - /* Apply colors to style */ - rc_style = gtk_widget_get_modifier_style (GTK_WIDGET (window)); - rc_style->base[GTK_STATE_NORMAL] = gcolor; - rc_style->bg[GTK_STATE_PRELIGHT] = gcolor; - rc_style->bg[GTK_STATE_NORMAL] = gcolor; - rc_style->bg[GTK_STATE_ACTIVE] = gcolor; - rc_style->color_flags[GTK_STATE_PRELIGHT] = GTK_RC_BG; - rc_style->color_flags[GTK_STATE_NORMAL] = GTK_RC_BG | GTK_RC_BASE; - rc_style->color_flags[GTK_STATE_ACTIVE] = GTK_RC_BG; - - /* Apply the style to the widgets */ - g_object_ref (rc_style); - gtk_widget_modify_style (GTK_WIDGET (window), rc_style); - gtk_widget_modify_style (window->close_button, rc_style); - gtk_widget_modify_style (window->resize_se, rc_style); - gtk_widget_modify_style (window->resize_sw, rc_style); - g_object_unref (rc_style); -#endif } static void @@ -289,7 +253,7 @@ ev_annotation_window_set_resize_cursor (GtkWidget *widget, GDK_BOTTOM_LEFT_CORNER : GDK_BOTTOM_RIGHT_CORNER); gdk_window_set_cursor (gdk_window, cursor); - gdk_cursor_unref (cursor); + g_object_unref (cursor); } else { gdk_window_set_cursor (gdk_window, NULL); } @@ -321,10 +285,10 @@ ev_annotation_window_init (EvAnnotationWindow *window) gtk_widget_set_can_focus (GTK_WIDGET (window), TRUE); - vbox = gtk_vbox_new (FALSE, 0); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); /* Title bar */ - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); icon = gtk_image_new (); /* FIXME: use the annot icon */ gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0); @@ -367,7 +331,7 @@ ev_annotation_window_init (EvAnnotationWindow *window) gtk_widget_show (swindow); /* Resize bar */ - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); window->resize_sw = gtk_event_box_new (); gtk_widget_add_events (window->resize_sw, GDK_BUTTON_PRESS_MASK); diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c index f03aef2a..a7ef8f13 100644 --- a/libview/ev-jobs.c +++ b/libview/ev-jobs.c @@ -42,11 +42,7 @@ #include #if ENABLE_EPUB -#if GTK_CHECK_VERSION(3, 0, 0) #include -#else -#include -#endif #endif #include #include @@ -831,51 +827,6 @@ ev_job_thumbnail_dispose (GObject *object) } #if ENABLE_EPUB -#if !GTK_CHECK_VERSION(3, 0, 0) -static void -web_thumbnail_get_screenshot_cb(GObject *object, - GParamSpec *pspec, - EvJobThumbnail *job_thumb) -{ - WebKitWebView *webview = WEBKIT_WEB_VIEW(object); - WebKitLoadStatus status = webkit_web_view_get_load_status (webview); - if (status != WEBKIT_LOAD_FINISHED) { - return; - } - - ev_document_doc_mutex_lock (); - - EvPage *page = ev_document_get_page (EV_JOB(job_thumb)->document, job_thumb->page); - job_thumb->surface = webkit_web_view_get_snapshot (webview); - EvRenderContext *rc = ev_render_context_new (page, job_thumb->rotation, job_thumb->scale); - EvPage *screenshotpage; - screenshotpage = ev_page_new(job_thumb->page); - screenshotpage->backend_page = (EvBackendPage)job_thumb->surface; - screenshotpage->backend_destroy_func = (EvBackendPageDestroyFunc)cairo_surface_destroy ; - ev_render_context_set_page(rc,screenshotpage); - - job_thumb->thumbnail = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (EV_JOB(job_thumb)->document), - rc, TRUE); - g_object_unref(screenshotpage); - g_object_unref(rc); - - ev_document_doc_mutex_unlock (); - ev_job_succeeded (EV_JOB(job_thumb)); - return; -} - -static gboolean -webview_load_error_cb (WebKitWebView *webview, - WebKitWebFrame *web_frame, - gchar *uri, - GError *web_error, - EvJobThumbnail *job_thumb) -{ - g_warning ("Error loading data from %s: %s", uri, web_error->message); - ev_job_failed_from_error (EV_JOB(job_thumb), web_error); - return TRUE; -} -#else static void snapshot_callback(WebKitWebView *webview, GAsyncResult *results, @@ -939,7 +890,6 @@ webview_load_failed_cb (WebKitWebView *webview, ev_job_failed_from_error (EV_JOB(job_thumb), e); return TRUE; } -#endif /* GTK_CHECK_VERSION */ #endif /* ENABLE_EPUB */ static gboolean @@ -973,22 +923,12 @@ ev_job_thumbnail_run (EvJob *job) if (job->document->iswebdocument == TRUE) { if (!webview) { webview = webkit_web_view_new(); -#if !GTK_CHECK_VERSION (3, 0, 0) - g_object_connect(WEBKIT_WEB_VIEW(webview),"signal::notify::load-status", - G_CALLBACK(web_thumbnail_get_screenshot_cb), - g_object_ref (job_thumb), - NULL); - g_signal_connect(WEBKIT_WEB_VIEW(webview),"load-error", - G_CALLBACK(webview_load_error_cb), - g_object_ref (job_thumb)); -#else g_signal_connect(WEBKIT_WEB_VIEW(webview),"load-changed", G_CALLBACK(web_thumbnail_get_screenshot_cb), g_object_ref (job_thumb)); g_signal_connect(WEBKIT_WEB_VIEW(webview),"load-failed", G_CALLBACK(webview_load_failed_cb), g_object_ref (job_thumb)); -#endif /* GTK_CHECK_VERSION */ } if (!offscreenwindow) { diff --git a/libview/ev-loading-window.c b/libview/ev-loading-window.c index ff675ff1..52de665c 100644 --- a/libview/ev-loading-window.c +++ b/libview/ev-loading-window.c @@ -24,10 +24,6 @@ #include #include "ev-loading-window.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - enum { PROP_0, PROP_PARENT @@ -75,18 +71,14 @@ 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"; - hbox = gtk_hbox_new (FALSE, 12); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); window->spinner = gtk_spinner_new (); gtk_box_pack_start (GTK_BOX (hbox), window->spinner, FALSE, FALSE, 0); @@ -108,7 +100,6 @@ 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)) { @@ -126,27 +117,6 @@ ev_loading_window_init (EvLoadingWindow *window) 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)) { - fg.pixel = 0; - fg.red = 0xb800; - fg.green = 0xad00; - fg.blue = 0x9d00; - - bg.pixel = 0; - bg.red = 0xff00; - bg.green = 0xff00; - bg.blue = 0xbf00; - } - - if (!gdk_color_equal (&bg, &style->bg[GTK_STATE_NORMAL])) - gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, &bg); - 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, @@ -205,12 +175,8 @@ ev_loading_window_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { EvLoadingWindow *window = EV_LOADING_WINDOW (widget); -#if GTK_CHECK_VERSION (3, 0, 0) cairo_surface_t *surface; cairo_region_t *shape; -#else - GdkPixmap *mask; -#endif cairo_t *cr; double r; @@ -222,13 +188,8 @@ ev_loading_window_size_allocate (GtkWidget *widget, window->width = allocation->width; window->height = allocation->height; -#if GTK_CHECK_VERSION (3, 0, 0) surface = cairo_image_surface_create (CAIRO_FORMAT_A8, window->width, window->height); cr = cairo_create (surface); -#else - mask = gdk_pixmap_new (NULL, window->width, window->height, 1); - cr = gdk_cairo_create (GDK_DRAWABLE (mask)); -#endif cairo_save (cr); cairo_rectangle (cr, 0, 0, window->width, window->height); @@ -243,16 +204,11 @@ ev_loading_window_size_allocate (GtkWidget *widget, cairo_destroy (cr); -#if GTK_CHECK_VERSION (3, 0, 0) shape = gdk_cairo_region_create_from_surface (surface); cairo_surface_destroy (surface); gtk_widget_shape_combine_region (widget, shape); cairo_region_destroy (shape); -#else - gtk_widget_shape_combine_mask (widget, mask, 0, 0); - g_object_unref (mask); -#endif } static void diff --git a/libview/ev-pixbuf-cache.c b/libview/ev-pixbuf-cache.c index 645904ee..3c4fd31b 100644 --- a/libview/ev-pixbuf-cache.c +++ b/libview/ev-pixbuf-cache.c @@ -602,7 +602,6 @@ ev_pixbuf_cache_clear_job_sizes (EvPixbufCache *pixbuf_cache, } static void -#if GTK_CHECK_VERSION (3, 0, 0) get_selection_colors (GtkWidget *widget, GdkColor *text, GdkColor *base) { GtkStyleContext *context = gtk_widget_get_style_context (widget); @@ -623,20 +622,6 @@ get_selection_colors (GtkWidget *widget, GdkColor *text, GdkColor *base) base->green = CLAMP ((guint) (bg.green * 65535), 0, 65535); base->blue = CLAMP ((guint) (bg.blue * 65535), 0, 65535); } -#else -get_selection_colors (GtkWidget *widget, GdkColor **text, GdkColor **base) -{ - GtkStyle *style = gtk_widget_get_style (widget); - - if (gtk_widget_has_focus (widget)) { - *text = &style->text [GTK_STATE_SELECTED]; - *base = &style->base [GTK_STATE_SELECTED]; - } else { - *text = &style->text [GTK_STATE_ACTIVE]; - *base = &style->base [GTK_STATE_ACTIVE]; - } -} -#endif static void add_job (EvPixbufCache *pixbuf_cache, @@ -660,22 +645,12 @@ add_job (EvPixbufCache *pixbuf_cache, width, height); if (new_selection_surface_needed (pixbuf_cache, job_info, page, scale)) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkColor text, base; -#else - GdkColor *text, *base; - - gtk_widget_ensure_style (pixbuf_cache->view); -#endif get_selection_colors (pixbuf_cache->view, &text, &base); ev_job_render_set_selection_info (EV_JOB_RENDER (job_info->job), &(job_info->target_points), job_info->selection_style, -#if GTK_CHECK_VERSION (3, 0, 0) &text, &base); -#else - text, base); -#endif } g_signal_connect (job_info->job, "finished", @@ -983,11 +958,7 @@ ev_pixbuf_cache_get_selection_surface (EvPixbufCache *pixbuf_cache, */ if (ev_rect_cmp (&(job_info->target_points), &(job_info->selection_points))) { EvRectangle *old_points; -#if GTK_CHECK_VERSION (3, 0, 0) GdkColor text, base; -#else - GdkColor *text, *base; -#endif EvRenderContext *rc; EvPage *ev_page; @@ -1012,10 +983,6 @@ ev_pixbuf_cache_get_selection_surface (EvPixbufCache *pixbuf_cache, rc, job_info->selection_style, &(job_info->target_points)); -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_ensure_style (pixbuf_cache->view); -#endif - get_selection_colors (pixbuf_cache->view, &text, &base); ev_selection_render_selection (EV_SELECTION (pixbuf_cache->document), @@ -1023,11 +990,7 @@ ev_pixbuf_cache_get_selection_surface (EvPixbufCache *pixbuf_cache, &(job_info->target_points), old_points, job_info->selection_style, -#if GTK_CHECK_VERSION (3, 0, 0) &text, &base); -#else - text, base); -#endif job_info->selection_points = job_info->target_points; g_object_unref (rc); ev_document_doc_mutex_unlock (); diff --git a/libview/ev-print-operation.c b/libview/ev-print-operation.c index 822d1a84..7ca2b41e 100644 --- a/libview/ev-print-operation.c +++ b/libview/ev-print-operation.c @@ -872,12 +872,7 @@ export_print_done (EvPrintOperationExport *export) app = g_app_info_create_from_commandline (cmd, NULL, 0, &error); if (app != NULL) { -#if GTK_CHECK_VERSION (3, 0, 0) ctx = gdk_display_get_app_launch_context (gtk_widget_get_display (GTK_WIDGET (export->parent_window))); -#else - ctx = gdk_app_launch_context_new (); - gdk_app_launch_context_set_display (ctx, gtk_widget_get_display (GTK_WIDGET (export->parent_window))); -#endif gdk_app_launch_context_set_screen (ctx, gtk_window_get_screen (export->parent_window)); g_app_info_launch (app, NULL, G_APP_LAUNCH_CONTEXT (ctx), &error); @@ -1873,11 +1868,7 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print, { GtkPrintSettings *settings; GtkWidget *label; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif EvPrintScale page_scale; gboolean autorotate; gboolean use_source_size; @@ -1889,7 +1880,6 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print, TRUE; use_source_size = gtk_print_settings_get_bool (settings, EV_PRINT_SETTING_PAGE_SIZE); -#if GTK_CHECK_VERSION (3, 0, 0) grid = gtk_grid_new (); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_grid_set_column_spacing (GTK_GRID (grid), 12); @@ -1897,15 +1887,6 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print, label = gtk_label_new (_("Page Scaling:")); gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1); -#else - table = gtk_table_new (3, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 12); - gtk_container_set_border_width (GTK_CONTAINER (table), 12); - - label = gtk_label_new (_("Page Scaling:")); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); -#endif gtk_widget_show (label); print->scale_combo = gtk_combo_box_text_new (); @@ -1924,11 +1905,7 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print, "\n" "• \"Fit to Printable Area\": Document pages are enlarged or reduced as" " required to fit the printable area of the printer page.\n")); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), print->scale_combo, 1, 0, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), print->scale_combo, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); -#endif gtk_widget_show (print->scale_combo); print->autorotate_button = gtk_check_button_new_with_label (_("Auto Rotate and Center")); @@ -1936,28 +1913,17 @@ ev_print_operation_print_create_custom_widget (EvPrintOperationPrint *print, gtk_widget_set_tooltip_text (print->autorotate_button, _("Rotate printer page orientation of each page to match orientation of each document page. " "Document pages will be centered within the printer page.")); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), print->autorotate_button, 0, 1, 2, 1); -#else - gtk_table_attach (GTK_TABLE (table), print->autorotate_button, 0, 2, 1, 2, GTK_FILL, 0, 0, 0); -#endif gtk_widget_show (print->autorotate_button); print->source_button = gtk_check_button_new_with_label (_("Select page size using document page size")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (print->source_button), use_source_size); gtk_widget_set_tooltip_text (print->source_button, _("When enabled, each page will be printed on " "the same size paper as the document page.")); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), print->source_button, 0, 2, 2, 1); gtk_widget_show (print->source_button); return G_OBJECT (grid); -#else - gtk_table_attach (GTK_TABLE (table), print->source_button, 0, 2, 2, 3, GTK_FILL, 0, 0, 0); - gtk_widget_show (print->source_button); - - return G_OBJECT (table); -#endif } static void diff --git a/libview/ev-timeline.c b/libview/ev-timeline.c index 70644c22..62c97286 100644 --- a/libview/ev-timeline.c +++ b/libview/ev-timeline.c @@ -21,8 +21,6 @@ #include #include -#include -#include #include "ev-timeline.h" #define EV_TIMELINE_GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EV_TYPE_TIMELINE, EvTimelinePriv)) @@ -151,10 +149,6 @@ ev_timeline_run_frame (EvTimeline *timeline) gdouble progress; guint elapsed_time; -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_enter(); -#endif - priv = EV_TIMELINE_GET_PRIV (timeline); elapsed_time = (guint) (g_timer_elapsed (priv->timer, NULL) * 1000); @@ -177,10 +171,6 @@ ev_timeline_run_frame (EvTimeline *timeline) } } -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_threads_leave(); -#endif - return TRUE; } diff --git a/libview/ev-view-presentation.c b/libview/ev-view-presentation.c index dadd0c6b..74ce60ee 100644 --- a/libview/ev-view-presentation.c +++ b/libview/ev-view-presentation.c @@ -32,11 +32,6 @@ #include "ev-view-cursor.h" #include "ev-page-cache.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gdk_cursor_unref g_object_unref -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - enum { PROP_0, PROP_DOCUMENT, @@ -120,29 +115,19 @@ static void ev_view_presentation_set_cursor_for_location (EvViewPresentation *pv G_DEFINE_TYPE (EvViewPresentation, ev_view_presentation, GTK_TYPE_WIDGET) -#if GTK_CHECK_VERSION (3, 0, 0) static GdkRGBA black = { 0., 0., 0., 1. }; static GdkRGBA white = { 1., 1., 1., 1. }; -#endif static void ev_view_presentation_set_normal (EvViewPresentation *pview) { GtkWidget *widget = GTK_WIDGET (pview); -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkStyle *style; -#endif if (pview->state == EV_PRESENTATION_NORMAL) return; pview->state = EV_PRESENTATION_NORMAL; -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_background_rgba (gtk_widget_get_window (widget), &black); -#else - style = gtk_widget_get_style (widget); - gdk_window_set_background (gtk_widget_get_window (widget), &style->black); -#endif gtk_widget_queue_draw (widget); } @@ -150,20 +135,12 @@ static void ev_view_presentation_set_black (EvViewPresentation *pview) { GtkWidget *widget = GTK_WIDGET (pview); -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkStyle *style; -#endif if (pview->state == EV_PRESENTATION_BLACK) return; pview->state = EV_PRESENTATION_BLACK; -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_background_rgba (gtk_widget_get_window (widget), &black); -#else - style = gtk_widget_get_style (widget); - gdk_window_set_background (gtk_widget_get_window (widget), &style->black); -#endif gtk_widget_queue_draw (widget); } @@ -171,20 +148,12 @@ static void ev_view_presentation_set_white (EvViewPresentation *pview) { GtkWidget *widget = GTK_WIDGET (pview); -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkStyle *style; -#endif if (pview->state == EV_PRESENTATION_WHITE) return; pview->state = EV_PRESENTATION_WHITE; -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_set_background_rgba (gtk_widget_get_window (widget), &white); -#else - style = gtk_widget_get_style (widget); - gdk_window_set_background (gtk_widget_get_window (widget), &style->white); -#endif gtk_widget_queue_draw (widget); } @@ -528,11 +497,7 @@ ev_view_presentation_update_current_page (EvViewPresentation *pview, if (pview->cursor != EV_VIEW_CURSOR_HIDDEN) { gint x, y; -#if GTK_CHECK_VERSION(3, 0, 0) ev_document_misc_get_pointer_position (GTK_WIDGET (pview), &x, &y); -#else - gtk_widget_get_pointer (GTK_WIDGET (pview), &x, &y); -#endif ev_view_presentation_set_cursor_for_location (pview, x, y); } @@ -719,7 +684,7 @@ ev_view_presentation_goto_window_create (EvViewPresentation *pview) gtk_container_add (GTK_CONTAINER (pview->goto_window), frame); gtk_widget_show (frame); - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox), 3); gtk_container_add (GTK_CONTAINER (frame), hbox); gtk_widget_show (hbox); @@ -917,7 +882,7 @@ ev_view_presentation_set_cursor (EvViewPresentation *pview, gdk_window_set_cursor (gtk_widget_get_window (widget), cursor); gdk_flush (); if (cursor) - gdk_cursor_unref (cursor); + g_object_unref (cursor); } static void @@ -1005,7 +970,6 @@ ev_view_presentation_dispose (GObject *object) G_OBJECT_CLASS (ev_view_presentation_parent_class)->dispose (object); } -#if GTK_CHECK_VERSION (3, 0, 0) static void ev_view_presentation_get_preferred_width (GtkWidget *widget, gint *minimum, @@ -1021,15 +985,6 @@ ev_view_presentation_get_preferred_height (GtkWidget *widget, { *minimum = *natural = 0; } -#else -static void -ev_view_presentation_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - requisition->width = 0; - requisition->height = 0; -} -#endif static void ev_view_presentation_draw_end_page (EvViewPresentation *pview, cairo_t *cr) @@ -1038,10 +993,7 @@ ev_view_presentation_draw_end_page (EvViewPresentation *pview, cairo_t *cr) PangoLayout *layout; PangoFontDescription *font_desc; gchar *markup; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkAllocation allocation; - GdkRectangle area = {0}; -#endif + const gchar *text = _("End of presentation. Click to exit."); if (pview->state != EV_PRESENTATION_END) @@ -1056,57 +1008,27 @@ ev_view_presentation_draw_end_page (EvViewPresentation *pview, cairo_t *cr) pango_font_description_set_size (font_desc, 16 * PANGO_SCALE); pango_layout_set_font_description (layout, font_desc); -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_widget_get_allocation (widget, &allocation); - area.width = allocation.width; - area.height = allocation.height; -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) gtk_render_layout (gtk_widget_get_style_context (widget), cr, 15, 15, layout); -#else - gtk_paint_layout (gtk_widget_get_style (widget), - gtk_widget_get_window (widget), - gtk_widget_get_state (widget), - FALSE, - &area, - widget, - NULL, - 15, - 15, - layout); -#endif pango_font_description_free (font_desc); g_object_unref (layout); } static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) ev_view_presentation_draw (GtkWidget *widget, cairo_t *cr) -#else -ev_view_presentation_expose_event (GtkWidget *widget, - GdkEventExpose *event) -#endif { EvViewPresentation *pview = EV_VIEW_PRESENTATION (widget); GdkRectangle page_area; GdkRectangle overlap; cairo_surface_t *surface; -#if GTK_CHECK_VERSION (3, 0, 0) cairo_rectangle_int_t clip_rect; GdkRectangle *area = &clip_rect; -#else - cairo_t *cr; - GdkRectangle *area = &event->area; -#endif -#if GTK_CHECK_VERSION (3, 0, 0) if (!gdk_cairo_get_clip_rectangle (cr, &clip_rect)) return FALSE; -#endif + switch (pview->state) { case EV_PRESENTATION_END: ev_view_presentation_draw_end_page (pview, cr); @@ -1122,10 +1044,6 @@ ev_view_presentation_expose_event (GtkWidget *widget, if (ev_transition_animation_ready (pview->animation)) { ev_view_presentation_get_page_area (pview, &page_area); -#if !GTK_CHECK_VERSION (3, 0, 0) - cr = gdk_cairo_create (gtk_widget_get_window (widget)); -#endif - /* normalize to x=0, y=0 */ cairo_translate (cr, page_area.x, page_area.y); page_area.x = page_area.y = 0; @@ -1134,9 +1052,6 @@ ev_view_presentation_expose_event (GtkWidget *widget, page_area.width--; ev_transition_animation_paint (pview->animation, cr, page_area); -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif } return TRUE; @@ -1153,10 +1068,6 @@ ev_view_presentation_expose_event (GtkWidget *widget, ev_view_presentation_get_page_area (pview, &page_area); if (gdk_rectangle_intersect (&page_area, area, &overlap)) { -#if !GTK_CHECK_VERSION (3, 0, 0) - cr = gdk_cairo_create (gtk_widget_get_window (widget)); -#endif - /* Try to fix rounding errors. See bug #438760 */ if (overlap.width == page_area.width) overlap.width--; @@ -1164,9 +1075,6 @@ ev_view_presentation_expose_event (GtkWidget *widget, cairo_rectangle (cr, overlap.x, overlap.y, overlap.width, overlap.height); cairo_set_source_surface (cr, surface, page_area.x, page_area.y); cairo_fill (cr); -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); -#endif } return FALSE; @@ -1227,11 +1135,7 @@ ev_view_presentation_key_press_event (GtkWidget *widget, ev_view_presentation_goto_window_create (pview); ev_view_presentation_goto_window_send_key_event (pview, (GdkEvent *)event); -#if GTK_CHECK_VERSION(3, 0, 0) ev_document_misc_get_pointer_position (GTK_WIDGET (pview), &x, &y); -#else - gtk_widget_get_pointer (GTK_WIDGET (pview), &x, &y); -#endif gtk_window_move (GTK_WINDOW (pview->goto_window), x, y); gtk_widget_show (pview->goto_window); ev_view_presentation_goto_entry_grab_focus (pview); @@ -1324,9 +1228,6 @@ static void ev_view_presentation_realize (GtkWidget *widget) { GdkWindow *window; -#if !GTK_CHECK_VERSION (3, 0, 0) - GtkStyle *style; -#endif GdkWindowAttr attributes; GtkAllocation allocation; @@ -1335,9 +1236,6 @@ ev_view_presentation_realize (GtkWidget *widget) attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); -#if !GTK_CHECK_VERSION (3, 0, 0) - attributes.colormap = gtk_widget_get_colormap (widget); -#endif gtk_widget_get_allocation (widget, &allocation); attributes.x = allocation.x; @@ -1357,22 +1255,13 @@ ev_view_presentation_realize (GtkWidget *widget) window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, GDK_WA_X | GDK_WA_Y | -#if !GTK_CHECK_VERSION (3, 0, 0) - GDK_WA_COLORMAP | -#endif GDK_WA_VISUAL); gdk_window_set_user_data (window, widget); gtk_widget_set_window (widget, window); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_set_background (gtk_widget_get_style_context (widget), window); -#else - gtk_widget_style_attach (widget); - style = gtk_widget_get_style (widget); - gdk_window_set_background (window, &style->black); -#endif g_idle_add ((GSourceFunc)init_presentation, widget); } @@ -1413,10 +1302,8 @@ ev_view_presentation_scroll_event (GtkWidget *widget, case GDK_SCROLL_LEFT: ev_view_presentation_change_page (pview, GTK_SCROLL_PAGE_BACKWARD); break; -#if GTK_CHECK_VERSION (3, 0, 0) case GDK_SCROLL_SMOOTH: return FALSE; -#endif } return TRUE; @@ -1514,18 +1401,10 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass) klass->change_page = ev_view_presentation_change_page; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->get_preferred_width = ev_view_presentation_get_preferred_width; widget_class->get_preferred_height = ev_view_presentation_get_preferred_height; -#else - widget_class->size_request = ev_view_presentation_size_request; -#endif widget_class->realize = ev_view_presentation_realize; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->draw = ev_view_presentation_draw; -#else - widget_class->expose_event = ev_view_presentation_expose_event; -#endif widget_class->key_press_event = ev_view_presentation_key_press_event; widget_class->button_release_event = ev_view_presentation_button_release_event; widget_class->focus_out_event = ev_view_presentation_focus_out; @@ -1633,7 +1512,6 @@ ev_view_presentation_class_init (EvViewPresentationClass *klass) static void ev_view_presentation_init (EvViewPresentation *pview) { -#if GTK_CHECK_VERSION (3, 0, 0) static gsize initialization_value = 0; gtk_widget_set_can_focus (GTK_WIDGET (pview), TRUE); @@ -1653,10 +1531,6 @@ ev_view_presentation_init (EvViewPresentation *pview) g_object_unref (provider); g_once_init_leave (&initialization_value, 1); } -#else - gtk_widget_set_can_focus (GTK_WIDGET (pview), TRUE); - pview->is_constructing = TRUE; -#endif } GtkWidget * diff --git a/libview/ev-view-private.h b/libview/ev-view-private.h index b6c0ea5f..b18dcc00 100644 --- a/libview/ev-view-private.h +++ b/libview/ev-view-private.h @@ -109,14 +109,10 @@ typedef struct _EvHeightToPageCache { } EvHeightToPageCache; struct _EvView { -#if GTK_CHECK_VERSION (3, 0, 0) GtkContainer layout; /* Container */ GList *children; -#else - GtkLayout layout; -#endif EvDocument *document; @@ -140,12 +136,10 @@ struct _EvView { /* Scrolling */ GtkAdjustment *hadjustment; GtkAdjustment *vadjustment; -#if GTK_CHECK_VERSION (3, 0, 0) /* GtkScrollablePolicy needs to be checked when * driving the scrollable adjustment values */ guint hscroll_policy : 1; guint vscroll_policy : 1; -#endif gint scroll_x; gint scroll_y; @@ -211,11 +205,7 @@ struct _EvView { }; struct _EvViewClass { -#if GTK_CHECK_VERSION (3, 0, 0) GtkContainerClass parent_class; -#else - GtkLayoutClass parent_class; -#endif void (*binding_activated) (EvView *view, GtkScrollType scroll, diff --git a/libview/ev-view.c b/libview/ev-view.c index 4b503d4a..af0c3433 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -45,10 +45,6 @@ #include "ev-view-private.h" #include "ev-view-type-builtins.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gdk_cursor_unref g_object_unref -#endif - #define EV_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_VIEW, EvViewClass)) #define EV_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_VIEW)) #define EV_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_VIEW, EvViewClass)) @@ -71,7 +67,6 @@ enum { TARGET_DND_IMAGE }; -#if GTK_CHECK_VERSION (3, 0, 0) enum { PROP_0, PROP_HADJUSTMENT, @@ -79,7 +74,6 @@ enum { PROP_HSCROLL_POLICY, PROP_VSCROLL_POLICY }; -#endif static guint signals[N_SIGNALS] = { 0 }; @@ -88,7 +82,6 @@ typedef enum { EV_VIEW_FIND_PREV } EvViewFindDirection; -#if GTK_CHECK_VERSION (3, 0, 0) typedef struct { GtkWidget *widget; @@ -100,7 +93,6 @@ typedef struct { guint page; EvRectangle doc_rect; } EvViewChild; -#endif #define ZOOM_IN_FACTOR 1.2 #define ZOOM_OUT_FACTOR (1.0/ZOOM_IN_FACTOR) @@ -108,17 +100,7 @@ typedef struct { #define SCROLL_TIME 150 /*** Scrolling ***/ -#if !GTK_CHECK_VERSION (3, 0, 0) -static void ev_view_set_scroll_adjustments (GtkLayout *layout, - GtkAdjustment *hadjustment, - GtkAdjustment *vadjustment); -#endif static void view_update_range_and_current_page (EvView *view); -#if !GTK_CHECK_VERSION (3, 0, 0) -static void set_scroll_adjustment (EvView *view, - GtkOrientation orientation, - GtkAdjustment *adjustment); -#endif static void add_scroll_binding_keypad (GtkBindingSet *binding_set, guint keyval, GdkModifierType modifiers, @@ -185,18 +167,10 @@ static void ev_view_size_request (GtkWidget GtkRequisition *requisition); static void ev_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -#if !GTK_CHECK_VERSION (3, 0, 0) -static void ev_view_realize (GtkWidget *widget); -#endif static gboolean ev_view_scroll_event (GtkWidget *widget, GdkEventScroll *event); -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean ev_view_draw (GtkWidget *widget, cairo_t *cr); -#else -static gboolean ev_view_expose_event (GtkWidget *widget, - GdkEventExpose *event); -#endif static gboolean ev_view_popup_menu (GtkWidget *widget); static gboolean ev_view_button_press_event (GtkWidget *widget, GdkEventButton *event); @@ -208,12 +182,7 @@ static gboolean ev_view_enter_notify_event (GtkWidget GdkEventCrossing *event); static gboolean ev_view_leave_notify_event (GtkWidget *widget, GdkEventCrossing *event); -#if GTK_CHECK_VERSION (3, 0, 0) static void ev_view_style_updated (GtkWidget *widget); -#else -static void ev_view_style_set (GtkWidget *widget, - GtkStyle *old_style); -#endif static void ev_view_remove_all (EvView *view); static AtkObject *ev_view_get_accessible (GtkWidget *widget); @@ -324,12 +293,8 @@ static void ev_view_primary_clear_cb (GtkClipboard gpointer data); static void ev_view_update_primary_selection (EvView *ev_view); -#if GTK_CHECK_VERSION (3, 0, 0) G_DEFINE_TYPE_WITH_CODE (EvView, ev_view, GTK_TYPE_CONTAINER, G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL)) -#else -G_DEFINE_TYPE (EvView, ev_view, GTK_TYPE_LAYOUT) -#endif /* HeightToPage cache */ #define EV_HEIGHT_TO_PAGE_CACHE_KEY "ev-height-to-page-cache" @@ -518,11 +483,7 @@ ev_view_get_scrollbar_size (EvView *view, } gtk_widget_style_get (swindow, "scrollbar_spacing", &spacing, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (sb, &req, NULL); -#else - gtk_widget_size_request (sb, &req); -#endif return (orientation == GTK_ORIENTATION_VERTICAL ? req.width : req.height) + spacing; } @@ -789,22 +750,15 @@ set_scroll_adjustment (EvView *view, GtkAdjustment *adjustment) { GtkAdjustment **to_set; -#if GTK_CHECK_VERSION (3, 0, 0) const gchar *prop_name; -#endif if (orientation == GTK_ORIENTATION_HORIZONTAL) { to_set = &view->hadjustment; -#if GTK_CHECK_VERSION (3, 0, 0) prop_name = "hadjustment"; -#endif } else { to_set = &view->vadjustment; -#if GTK_CHECK_VERSION (3, 0, 0) prop_name = "vadjustment"; -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) if (adjustment && adjustment == *to_set) return; @@ -824,42 +778,8 @@ set_scroll_adjustment (EvView *view, view_set_adjustment_values (view, orientation); g_object_notify (G_OBJECT (view), prop_name); -#else - if (*to_set != adjustment) { - if (*to_set) { - g_signal_handlers_disconnect_by_func (*to_set, - (gpointer) on_adjustment_value_changed, - view); - g_object_unref (*to_set); - } - - *to_set = adjustment; - view_set_adjustment_values (view, orientation); - - if (*to_set) { - g_object_ref (*to_set); - g_signal_connect (*to_set, "value_changed", - G_CALLBACK (on_adjustment_value_changed), view); - } - } -#endif } -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -ev_view_set_scroll_adjustments (GtkLayout *layout, - GtkAdjustment *hadjustment, - GtkAdjustment *vadjustment) -{ - EvView *view = EV_VIEW (layout); - - set_scroll_adjustment (view, GTK_ORIENTATION_HORIZONTAL, hadjustment); - set_scroll_adjustment (view, GTK_ORIENTATION_VERTICAL, vadjustment); - - on_adjustment_value_changed (NULL, view); -} -#endif - static void add_scroll_binding_keypad (GtkBindingSet *binding_set, guint keyval, @@ -1552,7 +1472,6 @@ ev_view_get_area_from_mapping (EvView *view, area->y -= view->scroll_y; } -#if GTK_CHECK_VERSION (3, 0, 0) static void ev_view_put (EvView *view, GtkWidget *child_widget, @@ -1588,7 +1507,6 @@ ev_view_put_to_doc_rect (EvView *view, area.y -= view->scroll_y; ev_view_put (view, child_widget, area.x, area.y, page, doc_rect); } -#endif /*** Hyperref ***/ static EvLink * @@ -2510,11 +2428,7 @@ ev_view_handle_form_field (EvView *view, { GtkWidget *field_widget = NULL; EvMappingList *form_field_mapping; -#if GTK_CHECK_VERSION (3, 0, 0) EvMapping *mapping; -#else - GdkRectangle view_area; -#endif if (field->is_read_only) return; @@ -2539,16 +2453,8 @@ ev_view_handle_form_field (EvView *view, form_field_mapping = ev_page_cache_get_form_field_mapping (view->page_cache, field->page->index); -#if GTK_CHECK_VERSION (3, 0, 0) mapping = ev_mapping_list_find (form_field_mapping, field); ev_view_put_to_doc_rect (view, field_widget, field->page->index, &mapping->area); -#else - ev_view_get_area_from_mapping (view, field->page->index, - form_field_mapping, - field, &view_area); - - gtk_layout_put (GTK_LAYOUT (view), field_widget, view_area.x, view_area.y); -#endif gtk_widget_show (field_widget); gtk_widget_grab_focus (field_widget); } @@ -3079,11 +2985,7 @@ ev_view_cancel_add_annotation (EvView *view) return; view->adding_annot = FALSE; -#if GTK_CHECK_VERSION(3, 0, 0) ev_document_misc_get_pointer_position (GTK_WIDGET (view), &x, &y); -#else - gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y); -#endif ev_view_handle_cursor_over_xy (view, x, y); } @@ -3271,7 +3173,6 @@ ev_view_size_request (GtkWidget *widget, *requisition = view->requisition; } -#if GTK_CHECK_VERSION (3, 0, 0) static void ev_view_get_preferred_width (GtkWidget *widget, gint *minimum, @@ -3295,14 +3196,12 @@ ev_view_get_preferred_height (GtkWidget *widget, *minimum = *natural = requisition.height; } -#endif static void ev_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { EvView *view = EV_VIEW (widget); -#if GTK_CHECK_VERSION (3, 0, 0) GList *l; gint root_x, root_y; @@ -3314,12 +3213,6 @@ ev_view_size_allocate (GtkWidget *widget, allocation->y, allocation->width, allocation->height); -#else - GList *children, *l; - gint root_x, root_y; - - GTK_WIDGET_CLASS (ev_view_parent_class)->size_allocate (widget, allocation); -#endif if (!view->document) return; @@ -3347,7 +3240,6 @@ ev_view_size_allocate (GtkWidget *widget, view->pending_point.x = 0; view->pending_point.y = 0; -#if GTK_CHECK_VERSION (3, 0, 0) for (l = view->children; l && l->data; l = g_list_next (l)) { GdkRectangle view_area; EvViewChild *child = (EvViewChild *)l->data; @@ -3362,43 +3254,6 @@ ev_view_size_allocate (GtkWidget *widget, gtk_widget_set_size_request (child->widget, view_area.width, view_area.height); gtk_widget_size_allocate (child->widget, &view_area); } -#else - children = gtk_container_get_children (GTK_CONTAINER (widget)); - for (l = children; l && l->data; l = g_list_next (l)) { - EvFormField *field; - GdkRectangle view_area; - EvMappingList *form_field_mapping; - GtkAllocation child_allocation; - GtkRequisition child_requisition; - GtkWidget *child = (GtkWidget *)l->data; - - field = g_object_get_data (G_OBJECT (child), "form-field"); - if (!field) - continue; - - form_field_mapping = ev_page_cache_get_form_field_mapping (view->page_cache, - field->page->index); - ev_view_get_area_from_mapping (view, field->page->index, - form_field_mapping, - field, &view_area); - - gtk_widget_size_request (child, &child_requisition); - if (child_requisition.width != view_area.width || - child_requisition.height != view_area.height) - gtk_widget_set_size_request (child, view_area.width, view_area.height); - - gtk_container_child_get (GTK_CONTAINER (widget), - child, - "x", &child_allocation.x, - "y", &child_allocation.y, - NULL); - if (child_allocation.x != view_area.x || - child_allocation.y != view_area.y) { - gtk_layout_move (GTK_LAYOUT (widget), child, view_area.x, view_area.y); - } - } - g_list_free (children); -#endif if (view->window_children) gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (view)), @@ -3428,47 +3283,14 @@ ev_view_size_allocate (GtkWidget *widget, } } -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -ev_view_realize (GtkWidget *widget) -{ - EvView *view = EV_VIEW (widget); - GdkWindow *bin_window; - GtkStyle *style; - - if (GTK_WIDGET_CLASS (ev_view_parent_class)->realize) - (* GTK_WIDGET_CLASS (ev_view_parent_class)->realize) (widget); - - bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view)); - gdk_window_set_events (bin_window, - (gdk_window_get_events (bin_window) | - GDK_EXPOSURE_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_SCROLL_MASK | - GDK_KEY_PRESS_MASK | - GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_ENTER_NOTIFY_MASK | - GDK_LEAVE_NOTIFY_MASK)); - - style = gtk_widget_get_style (widget); - gdk_window_set_background (bin_window, &style->mid[GTK_STATE_NORMAL]); - - on_adjustment_value_changed (NULL, view); -} -#endif - static gboolean ev_view_scroll_event (GtkWidget *widget, GdkEventScroll *event) { EvView *view = EV_VIEW (widget); guint state; -#if GTK_CHECK_VERSION (3, 0, 0) if (event->direction == GDK_SCROLL_SMOOTH) return FALSE; -#endif state = event->state & gtk_accelerator_get_default_mod_mask (); @@ -3515,10 +3337,8 @@ ev_view_scroll_event (GtkWidget *widget, GdkEventScroll *event) case GDK_SCROLL_LEFT: ev_view_previous_page (view); break; -#if GTK_CHECK_VERSION (3, 0, 0) case GDK_SCROLL_SMOOTH: g_assert_not_reached (); -#endif } return TRUE; @@ -3545,7 +3365,6 @@ find_selection_for_page (EvView *view, return NULL; } -#if GTK_CHECK_VERSION (3, 0, 0) static void ev_view_realize (GtkWidget *widget) { @@ -3577,26 +3396,14 @@ ev_view_realize (GtkWidget *widget) gtk_style_context_set_background (gtk_widget_get_style_context (widget), window); } -#endif static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) ev_view_draw (GtkWidget *widget, cairo_t *cr) -#else -ev_view_expose_event (GtkWidget *widget, - GdkEventExpose *event) -#endif { EvView *view = EV_VIEW (widget); -#if GTK_CHECK_VERSION (3, 0, 0) cairo_rectangle_int_t clip_rect; GdkRectangle *area = &clip_rect; -#else - GdkWindow *bin_window; - cairo_t *cr; - GdkRectangle *area = &event->area; -#endif gint i; if (view->loading) { @@ -3606,23 +3413,17 @@ ev_view_expose_event (GtkWidget *widget, ev_view_loading_window_move (view); } -#if GTK_CHECK_VERSION (3, 0, 0) gtk_render_background (gtk_widget_get_style_context (widget), cr, 0, 0, gtk_widget_get_allocated_width (widget), gtk_widget_get_allocated_height (widget)); -#endif + if (view->document == NULL) return FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) if (!gdk_cairo_get_clip_rectangle (cr, &clip_rect)) return FALSE; -#else - bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view)); - cr = gdk_cairo_create (bin_window); -#endif for (i = view->start_page; i >= 0 && i <= view->end_page; i++) { GdkRectangle page_area; @@ -3647,15 +3448,8 @@ ev_view_expose_event (GtkWidget *widget, highlight_forward_search_results (view, cr, i); } -#if !GTK_CHECK_VERSION (3, 0, 0) - cairo_destroy (cr); - - if (GTK_WIDGET_CLASS (ev_view_parent_class)->expose_event) - (* GTK_WIDGET_CLASS (ev_view_parent_class)->expose_event) (widget, event); -#else if (GTK_WIDGET_CLASS (ev_view_parent_class)->draw) (* GTK_WIDGET_CLASS (ev_view_parent_class)->draw) (widget, cr); -#endif return FALSE; } @@ -3694,11 +3488,7 @@ ev_view_popup_menu (GtkWidget *widget) { gint x, y; -#if GTK_CHECK_VERSION(3, 0, 0) ev_document_misc_get_pointer_position (widget, &x, &y); -#else - gtk_widget_get_pointer (widget, &x, &y); -#endif return ev_view_do_popup_menu (EV_VIEW (widget), x, y); } @@ -3925,9 +3715,7 @@ ev_view_button_press_event (GtkWidget *widget, static void ev_view_remove_all (EvView *view) { -#if GTK_CHECK_VERSION (3, 0, 0) gtk_container_foreach (GTK_CONTAINER (view), (GtkCallback) gtk_widget_destroy, NULL); -#endif GList *children, *child; children = gtk_container_get_children (GTK_CONTAINER (view)); @@ -4029,11 +3817,7 @@ selection_scroll_timeout_cb (EvView *view) GtkAllocation allocation; gtk_widget_get_allocation (widget, &allocation); -#if GTK_CHECK_VERSION(3, 0, 0) ev_document_misc_get_pointer_position (widget, &x, &y); -#else - gtk_widget_get_pointer (widget, &x, &y); -#endif if (y > allocation.height) { shift = (y - allocation.height) / 2; @@ -4148,18 +3932,10 @@ ev_view_motion_notify_event (GtkWidget *widget, if (!view->document) return FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) bin_window = gtk_widget_get_window (widget); -#else - bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view)); -#endif if (event->is_hint || event->window != bin_window) { -#if GTK_CHECK_VERSION(3, 0, 0) ev_document_misc_get_pointer_position (widget, &x, &y); -#else - gtk_widget_get_pointer (widget, &x, &y); -#endif } else { x = event->x; y = event->y; @@ -4474,21 +4250,12 @@ ev_view_enter_notify_event (GtkWidget *widget, GdkEventCrossing *event) } static void -#if GTK_CHECK_VERSION (3, 0, 0) ev_view_style_updated (GtkWidget *widget) -#else -ev_view_style_set (GtkWidget *widget, - GtkStyle *old_style) -#endif { if (EV_VIEW (widget)->pixbuf_cache) ev_pixbuf_cache_style_changed (EV_VIEW (widget)->pixbuf_cache); -#if GTK_CHECK_VERSION (3, 0, 0) GTK_WIDGET_CLASS (ev_view_parent_class)->style_updated (widget); -#else - GTK_WIDGET_CLASS (ev_view_parent_class)->style_set (widget, old_style); -#endif } /*** Drawing ***/ @@ -4499,31 +4266,15 @@ draw_rubberband (EvView *view, const GdkRectangle *rect, gdouble alpha) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; GdkRGBA color; context = gtk_widget_get_style_context (GTK_WIDGET (view)); gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &color); -#else - GtkStyle *style; - GdkColor *fill_color_gdk; - gdouble r, g, b; - - style = gtk_widget_get_style (GTK_WIDGET (view)); - fill_color_gdk = gdk_color_copy (&style->base[GTK_STATE_SELECTED]); - r = fill_color_gdk->red / 65535.; - g = fill_color_gdk->green / 65535.; - b = fill_color_gdk->blue / 65535.; -#endif cairo_save (cr); -#if GTK_CHECK_VERSION (3, 0, 0) cairo_set_source_rgba (cr, color.red, color.green, color.blue, alpha); -#else - cairo_set_source_rgba (cr, r, g, b, alpha); -#endif cairo_rectangle (cr, rect->x - view->scroll_x, rect->y - view->scroll_y, @@ -4531,18 +4282,10 @@ draw_rubberband (EvView *view, cairo_fill_preserve (cr); cairo_set_line_width (cr, 0.5); -#if GTK_CHECK_VERSION (3, 0, 0) cairo_set_source_rgb (cr, color.red, color.green, color.blue); -#else - cairo_set_source_rgb (cr, r, g, b); -#endif cairo_stroke (cr); cairo_restore (cr); - -#if !GTK_CHECK_VERSION (3, 0, 0) - gdk_color_free (fill_color_gdk); -#endif } @@ -4606,21 +4349,11 @@ focus_annotation (EvView *view, return; doc_rect_to_view_rect (view, page, &mapping->area, &rect); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_render_focus (gtk_widget_get_style_context (widget), cr, rect.x - view->scroll_x, rect.y - view->scroll_y, rect.width + 1, rect.height + 1); -#else - gtk_paint_focus (gtk_widget_get_style (widget), - gtk_layout_get_bin_window (GTK_LAYOUT (view)), - gtk_widget_get_state (widget), - NULL, widget, NULL, - rect.x - view->scroll_x, - rect.y - view->scroll_y, - rect.width + 1, rect.height + 1); -#endif } static void @@ -4895,13 +4628,9 @@ ev_view_dispose (GObject *object) view->loading_timeout = 0; } -#if !GTK_CHECK_VERSION (3, 0, 0) - ev_view_set_scroll_adjustments (GTK_LAYOUT (view), NULL, NULL); -#endif G_OBJECT_CLASS (ev_view_parent_class)->dispose (object); } -#if GTK_CHECK_VERSION (3, 0, 0) static void ev_view_get_property (GObject *object, guint prop_id, @@ -4959,7 +4688,6 @@ ev_view_set_property (GObject *object, break; } } -#endif /* Accessibility */ static void @@ -5008,7 +4736,6 @@ ev_view_is_a11y_enabled (EvView *view) return view->a11y_enabled; } -#if GTK_CHECK_VERSION (3, 0, 0) /* GtkContainer */ static void ev_view_remove (GtkContainer *container, @@ -5052,32 +4779,21 @@ ev_view_forall (GtkContainer *container, (* callback) (child->widget, callback_data); } } -#endif static void ev_view_class_init (EvViewClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); -#if GTK_CHECK_VERSION (3, 0, 0) GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class); -#else - GtkLayoutClass *layout_class = GTK_LAYOUT_CLASS (class); -#endif GtkBindingSet *binding_set; -#if GTK_CHECK_VERSION (3, 0, 0) object_class->get_property = ev_view_get_property; object_class->set_property = ev_view_set_property; -#endif object_class->finalize = ev_view_finalize; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->realize = ev_view_realize; widget_class->draw = ev_view_draw; -#else - widget_class->expose_event = ev_view_expose_event; -#endif widget_class->button_press_event = ev_view_button_press_event; widget_class->motion_notify_event = ev_view_motion_notify_event; widget_class->button_release_event = ev_view_button_release_event; @@ -5085,24 +4801,13 @@ ev_view_class_init (EvViewClass *class) widget_class->focus_in_event = ev_view_focus_in; widget_class->focus_out_event = ev_view_focus_out; widget_class->get_accessible = ev_view_get_accessible; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->get_preferred_width = ev_view_get_preferred_width; widget_class->get_preferred_height = ev_view_get_preferred_height; -#else - widget_class->size_request = ev_view_size_request; -#endif widget_class->size_allocate = ev_view_size_allocate; -#if !GTK_CHECK_VERSION (3, 0, 0) - widget_class->realize = ev_view_realize; -#endif widget_class->scroll_event = ev_view_scroll_event; widget_class->enter_notify_event = ev_view_enter_notify_event; widget_class->leave_notify_event = ev_view_leave_notify_event; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->style_updated = ev_view_style_updated; -#else - widget_class->style_set = ev_view_style_set; -#endif widget_class->drag_data_get = ev_view_drag_data_get; widget_class->drag_motion = ev_view_drag_motion; widget_class->popup_menu = ev_view_popup_menu; @@ -5114,22 +4819,16 @@ ev_view_class_init (EvViewClass *class) gtk_widget_class_set_css_name (widget_class, "evview"); #endif -#if GTK_CHECK_VERSION (3, 0, 0) container_class->remove = ev_view_remove; container_class->forall = ev_view_forall; -#else - layout_class->set_scroll_adjustments = ev_view_set_scroll_adjustments; -#endif class->binding_activated = ev_view_scroll; -#if GTK_CHECK_VERSION (3, 0, 0) /* Scrollable interface */ g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment"); g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment"); g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy"); g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy"); -#endif signals[SIGNAL_BINDING_ACTIVATED] = g_signal_new ("binding_activated", G_TYPE_FROM_CLASS (object_class), @@ -5220,12 +4919,9 @@ ev_view_class_init (EvViewClass *class) static void ev_view_init (EvView *view) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *context; -#endif gtk_widget_set_can_focus (GTK_WIDGET (view), TRUE); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_has_window (GTK_WIDGET (view), TRUE); gtk_widget_set_redraw_on_allocate (GTK_WIDGET (view), FALSE); gtk_container_set_resize_mode (GTK_CONTAINER (view), GTK_RESIZE_QUEUE); @@ -5244,7 +4940,6 @@ ev_view_init (EvView *view) GDK_POINTER_MOTION_HINT_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); -#endif view->start_page = -1; view->end_page = -1; @@ -5267,11 +4962,6 @@ ev_view_init (EvView *view) view->pending_scroll = SCROLL_TO_KEEP_POSITION; view->jump_to_find_result = TRUE; view->highlight_find_results = FALSE; - -#if !GTK_CHECK_VERSION (3, 0, 0) - gtk_layout_set_hadjustment (GTK_LAYOUT (view), NULL); - gtk_layout_set_vadjustment (GTK_LAYOUT (view), NULL); -#endif } /*** Callbacks ***/ @@ -5287,11 +4977,7 @@ ev_view_change_page (EvView *view, hide_loading_window (view); -#if GTK_CHECK_VERSION(3, 0, 0) ev_document_misc_get_pointer_position (GTK_WIDGET (view), &x, &y); -#else - gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y); -#endif ev_view_handle_cursor_over_xy (view, x, y); gtk_widget_queue_resize (GTK_WIDGET (view)); @@ -5303,23 +4989,7 @@ job_finished_cb (EvPixbufCache *pixbuf_cache, EvView *view) { if (region) { -#if GTK_CHECK_VERSION(3, 0, 0) gdk_window_invalidate_region (gtk_widget_get_window (GTK_WIDGET (view)), region, TRUE); -#else - GdkWindow *bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view)); - GdkRegion *gdk_region = gdk_region_new (); - guint n_recs = cairo_region_num_rectangles (region); - guint i; - - for (i = 0; i < n_recs; i++) { - cairo_rectangle_int_t rect; - - cairo_region_get_rectangle (region, i, &rect); - gdk_region_union_with_rect (gdk_region, (GdkRectangle *)&rect); - } - gdk_window_invalidate_region (bin_window, gdk_region, TRUE); - gdk_region_destroy (gdk_region); -#endif } else { gtk_widget_queue_draw (GTK_WIDGET (view)); } @@ -5347,7 +5017,6 @@ static void on_adjustment_value_changed (GtkAdjustment *adjustment, EvView *view) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *widget = GTK_WIDGET (view); int dx = 0, dy = 0; gint x, y; @@ -5355,14 +5024,6 @@ on_adjustment_value_changed (GtkAdjustment *adjustment, GList *l; if (!gtk_widget_get_realized (widget)) -#else - int dx = 0, dy = 0; - gint x, y; - gint value; - GList *children, *l; - - if (!gtk_widget_get_realized (GTK_WIDGET (view))) -#endif return; if (view->hadjustment) { @@ -5381,7 +5042,6 @@ on_adjustment_value_changed (GtkAdjustment *adjustment, view->scroll_y = 0; } -#if GTK_CHECK_VERSION (3, 0, 0) for (l = view->children; l && l->data; l = g_list_next (l)) { EvViewChild *child = (EvViewChild *)l->data; @@ -5390,21 +5050,6 @@ on_adjustment_value_changed (GtkAdjustment *adjustment, if (gtk_widget_get_visible (child->widget) && gtk_widget_get_visible (widget)) gtk_widget_queue_resize (widget); } -#else - children = gtk_container_get_children (GTK_CONTAINER (view)); - for (l = children; l && l->data; l = g_list_next (l)) { - gint child_x, child_y; - GtkWidget *child = (GtkWidget *)l->data; - - gtk_container_child_get (GTK_CONTAINER (view), - child, - "x", &child_x, - "y", &child_y, - NULL); - gtk_layout_move (GTK_LAYOUT (view), child, child_x + dx, child_y + dy); - } - g_list_free (children); -#endif for (l = view->window_children; l && l->data; l = g_list_next (l)) { EvViewWindowChild *child; @@ -5415,24 +5060,12 @@ on_adjustment_value_changed (GtkAdjustment *adjustment, } if (view->pending_resize) { -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_queue_draw (widget); } else { gdk_window_scroll (gtk_widget_get_window (widget), dx, dy); } ev_document_misc_get_pointer_position (widget, &x, &y); -#else - gtk_widget_queue_draw (GTK_WIDGET (view)); - } else { - GdkWindow *bin_window; - - bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view)); - gdk_window_scroll (bin_window, dx, dy); - } - - gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y); -#endif ev_view_handle_cursor_over_xy (view, x, y); if (view->document) @@ -5566,11 +5199,7 @@ ev_view_autoscroll_start (EvView *view) g_timeout_add (20, (GSourceFunc)ev_view_autoscroll_cb, view); -#if GTK_CHECK_VERSION(3, 0, 0) ev_document_misc_get_pointer_position (GTK_WIDGET (view), &x, &y); -#else - gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y); -#endif ev_view_handle_cursor_over_xy (view, x, y); } @@ -5590,11 +5219,7 @@ ev_view_autoscroll_stop (EvView *view) view->scroll_info.timeout_id = 0; } -#if GTK_CHECK_VERSION(3, 0, 0) ev_document_misc_get_pointer_position (GTK_WIDGET (view), &x, &y); -#else - gtk_widget_get_pointer (GTK_WIDGET (view), &x, &y); -#endif ev_view_handle_cursor_over_xy (view, x, y); } @@ -6516,37 +6141,14 @@ merge_selection_region (EvView *view, /* Redraw the damaged region! */ if (region) { -#if !GTK_CHECK_VERSION (3, 0, 0) - GdkWindow *bin_window; -#endif GdkRectangle page_area; GtkBorder border; -#if !GTK_CHECK_VERSION (3, 0, 0) - bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view)); -#endif ev_view_get_page_extents (view, cur_page, &page_area, &border); cairo_region_translate (region, page_area.x + border.left - view->scroll_x, page_area.y + border.top - view->scroll_y); -#if GTK_CHECK_VERSION(3, 0, 0) gdk_window_invalidate_region (gtk_widget_get_window (GTK_WIDGET (view)), region, TRUE); -#else - { - GdkRegion *gdk_region = gdk_region_new (); - guint n_recs = cairo_region_num_rectangles (region); - guint i; - - for (i = 0; i < n_recs; i++) { - cairo_rectangle_int_t rect; - - cairo_region_get_rectangle (region, i, &rect); - gdk_region_union_with_rect (gdk_region, (GdkRectangle *)&rect); - } - gdk_window_invalidate_region (bin_window, gdk_region, TRUE); - gdk_region_destroy (gdk_region); - } -#endif cairo_region_destroy (region); } } @@ -6792,17 +6394,13 @@ ev_view_set_cursor (EvView *view, EvViewCursor new_cursor) view->cursor = new_cursor; -#if GTK_CHECK_VERSION (3, 0, 0) bin_window = gtk_widget_get_window (GTK_WIDGET (view)); -#else - bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (view)); -#endif widget = gtk_widget_get_toplevel (GTK_WIDGET (view)); cursor = ev_view_cursor_new (gtk_widget_get_display (widget), new_cursor); gdk_window_set_cursor (bin_window, cursor); gdk_flush (); if (cursor) - gdk_cursor_unref (cursor); + g_object_unref (cursor); } void diff --git a/libview/ev-web-view.c b/libview/ev-web-view.c index c995c4f4..6e302660 100644 --- a/libview/ev-web-view.c +++ b/libview/ev-web-view.c @@ -25,11 +25,7 @@ #include #include -#if GTK_CHECK_VERSION (3, 0, 0) #include -#else -#include -#endif #include "ev-web-view.h" #include "ev-document-model.h" @@ -62,11 +58,9 @@ struct _EvWebView gboolean inverted_stylesheet ; gboolean fullscreen; SearchParams *search; -#if GTK_CHECK_VERSION (3, 0, 0) WebKitFindController *findcontroller; WebKitFindOptions findoptions; gdouble zoom_level; -#endif gchar *hlink; }; @@ -180,11 +174,7 @@ ev_web_view_change_page (EvWebView *webview, webview->current_page = new_page; ev_document_model_set_page(webview->model,new_page); -#if GTK_CHECK_VERSION (3, 0, 0) webkit_find_controller_search_finish(webview->findcontroller); -#else - webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW(webview)); -#endif if (webview->hlink) { webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview),(gchar*)webview->hlink); g_free(webview->hlink); @@ -219,14 +209,12 @@ ev_web_view_new (void) webview = g_object_new (EV_TYPE_WEB_VIEW, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) EV_WEB_VIEW(webview)->findcontroller = webkit_web_view_get_find_controller (WEBKIT_WEB_VIEW(webview)); EV_WEB_VIEW(webview)->findoptions = webkit_find_controller_get_options (EV_WEB_VIEW(webview)->findcontroller); EV_WEB_VIEW(webview)->zoom_level = 1.0; EV_WEB_VIEW(webview)->findoptions |= WEBKIT_FIND_OPTIONS_NONE; -#endif return webview; } @@ -442,36 +430,6 @@ ev_web_view_handle_link(EvWebView *webview,EvLink *link) } /* Searching */ -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -jump_to_find_result_on_page(EvWebView *webview, - EvWebViewFindDirection direction) -{ - gboolean forward,wrap; - - if (direction == EV_WEB_VIEW_FIND_NEXT) { - forward = TRUE; - wrap = FALSE; - } - else { - forward = FALSE; - wrap = FALSE; - } - - if (webview->search->search_jump) { - wrap = TRUE; - } - webkit_web_view_search_text (WEBKIT_WEB_VIEW(webview), - webview->search->search_string, - webview->search->case_sensitive, - forward, - wrap); - - webview->search->search_jump = FALSE; -} -#endif - -#if GTK_CHECK_VERSION (3, 0, 0) static void results_counted_cb(WebKitFindController *findcontroller, guint match_count, @@ -485,40 +443,23 @@ results_counted_cb(WebKitFindController *findcontroller, webview->search->search_jump = FALSE; } } -#endif + /* * Jump to find results once we have changed the page in the webview. */ -#if GTK_CHECK_VERSION (3, 0, 0) static void jump_to_find_results(EvWebView *webview, WebKitLoadEvent load_event, gpointer data) -#else -static void -jump_to_find_results(EvWebView *webview, - GParamSpec *pspec, - gpointer data) -#endif { -#if !GTK_CHECK_VERSION (3, 0, 0) - gint n_results; - gboolean forward ; - gboolean wrap ; - - if (webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(webview)) != WEBKIT_LOAD_FINISHED) { - return; - } -#else if ( load_event != WEBKIT_LOAD_FINISHED) { return; } -#endif + if (!webview->search->search_string) { return; } -#if GTK_CHECK_VERSION (3, 0, 0) if (webview->search->direction == EV_WEB_VIEW_FIND_NEXT) { webview->findoptions &= ~WEBKIT_FIND_OPTIONS_BACKWARDS; webview->findoptions &= ~WEBKIT_FIND_OPTIONS_WRAP_AROUND; @@ -532,33 +473,6 @@ jump_to_find_results(EvWebView *webview, webview->search->search_string, webview->findoptions, G_MAXUINT); -#else - n_results = webkit_web_view_mark_text_matches (WEBKIT_WEB_VIEW(webview), - webview->search->search_string, - webview->search->case_sensitive, - 0); - - ev_web_view_find_set_highlight_search(webview,TRUE); - - if (webview->search->direction == EV_WEB_VIEW_FIND_NEXT) { - forward = TRUE ; - wrap = FALSE; - } - else { - forward = FALSE; - wrap = TRUE ; - } - - if (n_results > 0 && webview->search->on_result < n_results) { - webkit_web_view_search_text (WEBKIT_WEB_VIEW(webview), - webview->search->search_string, - webview->search->case_sensitive, - forward, - wrap); - - webview->search->search_jump = FALSE; - } -#endif webview->search->search_jump = FALSE; } @@ -599,9 +513,6 @@ jump_to_find_page (EvWebView *webview, EvWebViewFindDirection direction, gint sh page = page + n_pages; if (page == webview->current_page && ev_web_view_find_get_n_results(webview,page) > 0) { -#if !GTK_CHECK_VERSION (3, 0, 0) - jump_to_find_result_on_page(webview,EV_WEB_VIEW_FIND_NEXT); -#else if (direction == EV_WEB_VIEW_FIND_PREV) { webview->findoptions |= WEBKIT_FIND_OPTIONS_WRAP_AROUND; webview->findoptions |= WEBKIT_FIND_OPTIONS_BACKWARDS; @@ -621,17 +532,12 @@ jump_to_find_page (EvWebView *webview, EvWebViewFindDirection direction, gint sh /*Highlight all the results.*/ G_MAXUINT); webview->search->search_jump = FALSE; -#endif break; } if (ev_web_view_find_get_n_results (webview, page) > 0) { webview->search->direction = direction; -#if !GTK_CHECK_VERSION (3, 0, 0) - webkit_web_view_unmark_text_matches (WEBKIT_WEB_VIEW(webview)); -#else webkit_find_controller_search_finish(webview->findcontroller); -#endif ev_document_model_set_page (webview->model, page); break; } @@ -646,14 +552,12 @@ ev_web_view_find_changed (EvWebView *webview, guint *results, gchar *text,gboole webview->search->search_string = g_strdup(text); webview->search->case_sensitive = case_sensitive; if (webview->search->search_jump == TRUE) { -#if GTK_CHECK_VERSION (3, 0, 0) if (!case_sensitive) { webview->findoptions |= WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE; } else { webview->findoptions &= ~WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE; } -#endif jump_to_find_page (webview, EV_WEB_VIEW_FIND_NEXT, 0); } } @@ -671,11 +575,7 @@ ev_web_view_find_next (EvWebView *webview) jump_to_find_page (webview, EV_WEB_VIEW_FIND_NEXT, 1); } else { -#if GTK_CHECK_VERSION (3, 0, 0) webkit_find_controller_search_next(webview->findcontroller); -#else - jump_to_find_result_on_page (webview, EV_WEB_VIEW_FIND_NEXT); -#endif } } @@ -688,11 +588,7 @@ ev_web_view_find_previous (EvWebView *webview) jump_to_find_page (webview, EV_WEB_VIEW_FIND_PREV, -1); webview->search->on_result = MAX (0, ev_web_view_find_get_n_results (webview, webview->current_page) - 1); } else { -#if GTK_CHECK_VERSION (3, 0, 0) webkit_find_controller_search_previous(webview->findcontroller); -#else - jump_to_find_result_on_page (webview,EV_WEB_VIEW_FIND_PREV); -#endif } } @@ -700,93 +596,52 @@ void ev_web_view_find_search_changed (EvWebView *webview) { /* search string has changed, focus on new search result */ -#if !GTK_CHECK_VERSION(3, 0, 0) - webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(webview)); -#endif if (webview->search->search_string) { g_free(webview->search->search_string); webview->search->search_string = NULL; } -#if GTK_CHECK_VERSION(3, 0, 0) + webkit_find_controller_search_finish(webview->findcontroller); -#endif - webview->search->search_jump = TRUE; } -#if !GTK_CHECK_VERSION (3, 0, 0) -void -ev_web_view_find_set_highlight_search (EvWebView *webview, gboolean value) -{ - webkit_web_view_set_highlight_text_matches (WEBKIT_WEB_VIEW(webview),value); -} -#endif - void ev_web_view_find_cancel (EvWebView *webview) { -#if GTK_CHECK_VERSION (3, 0, 0) webkit_find_controller_search_finish (webview->findcontroller); -#else - webkit_web_view_unmark_text_matches(WEBKIT_WEB_VIEW(webview)); - ev_web_view_find_set_highlight_search(webview,FALSE); -#endif } - - void ev_web_view_set_handler(EvWebView *webview,gboolean visible) { if (visible) { g_signal_connect(webview, -#if GTK_CHECK_VERSION (3, 0, 0) "load-changed", -#else - "notify::load-status", -#endif G_CALLBACK(jump_to_find_results), NULL); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect(webview->findcontroller, "counted-matches", G_CALLBACK(results_counted_cb), webview); -#endif } else { g_signal_handlers_disconnect_by_func(webview, jump_to_find_results, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_handlers_disconnect_by_func(webview, results_counted_cb, NULL); -#endif } } /* Selection and copying*/ -#if !GTK_CHECK_VERSION (3, 0, 0) -gboolean -ev_web_view_get_has_selection(EvWebView *webview) -{ - return webkit_web_view_has_selection(WEBKIT_WEB_VIEW(webview)); -} -#endif - void ev_web_view_select_all(EvWebView *webview) { -#if GTK_CHECK_VERSION (3, 0, 0) webkit_web_view_execute_editing_command(WEBKIT_WEB_VIEW(webview), WEBKIT_EDITING_COMMAND_SELECT_ALL); -#else - webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview)); -#endif } -#if GTK_CHECK_VERSION (3, 0, 0) static void copy_text_cb(WebKitWebView *webview, GAsyncResult *res, @@ -801,54 +656,34 @@ copy_text_cb(WebKitWebView *webview, WEBKIT_EDITING_COMMAND_COPY); } } -#endif void ev_web_view_copy(EvWebView *webview) { -#if !GTK_CHECK_VERSION (3, 0, 0) - /* If for some reason we don't have a selection any longer,best to be safe */ - if (ev_web_view_get_has_selection(webview) == FALSE) - return; - if (webkit_web_view_can_copy_clipboard(WEBKIT_WEB_VIEW(webview))) { - webkit_web_view_copy_clipboard(WEBKIT_WEB_VIEW(webview)); - } -#else webkit_web_view_can_execute_editing_command(WEBKIT_WEB_VIEW(webview), WEBKIT_EDITING_COMMAND_COPY, NULL, (GAsyncReadyCallback)copy_text_cb, NULL); - -#endif - } /*Zoom control*/ gboolean ev_web_view_zoom_in(EvWebView *webview) { -#if GTK_CHECK_VERSION (3, 0, 0) webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW(webview), (webview->zoom_level+= 0.1)); -#else - webkit_web_view_zoom_in(WEBKIT_WEB_VIEW(webview)); -#endif return TRUE; } gboolean ev_web_view_zoom_out(EvWebView *webview) { -#if GTK_CHECK_VERSION (3, 0, 0) if (webview->zoom_level == 1) return FALSE; webkit_web_view_set_zoom_level (WEBKIT_WEB_VIEW(webview), (webview->zoom_level -= 0.1)); -#else - webkit_web_view_zoom_out(WEBKIT_WEB_VIEW(webview)); -#endif return TRUE; } diff --git a/previewer/ev-previewer-window.c b/previewer/ev-previewer-window.c index c039d4e5..e92eb75d 100644 --- a/previewer/ev-previewer-window.c +++ b/previewer/ev-previewer-window.c @@ -29,10 +29,6 @@ #include "ev-previewer-window.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - struct _EvPreviewerWindow { GtkWindow base_instance; @@ -590,7 +586,7 @@ ev_previewer_window_constructor (GType type, view_sizing_mode_changed (window->model, NULL, window); - vbox = gtk_vbox_new (FALSE, 0); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); toolbar = gtk_ui_manager_get_widget (window->ui_manager, "/PreviewToolbar"); gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0); diff --git a/properties/ev-properties-view.c b/properties/ev-properties-view.c index e1a283bf..f4fab251 100644 --- a/properties/ev-properties-view.c +++ b/properties/ev-properties-view.c @@ -76,11 +76,8 @@ static const PropertyInfo properties_info[] = { struct _EvPropertiesView { GtkBox base_instance; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif + GtkWidget *labels[N_PROPERTIES]; gchar *uri; }; @@ -154,11 +151,7 @@ make_valid_utf8 (const gchar *name) static void set_property (EvPropertiesView *properties, -#if GTK_CHECK_VERSION (3, 0, 0) GtkGrid *grid, -#else - GtkTable *table, -#endif Property property, const gchar *text, gint *row) @@ -174,12 +167,7 @@ set_property (EvPropertiesView *properties, gtk_label_set_markup (GTK_LABEL (label), markup); g_free (markup); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (grid, label, 0, *row, 1, 1); -#else - gtk_table_attach (table, label, 0, 1, *row, *row + 1, - GTK_FILL, GTK_FILL, 0, 0); -#endif gtk_widget_show (label); } @@ -212,12 +200,7 @@ set_property (EvPropertiesView *properties, } if (!properties->labels[property]) { -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (grid, label, 1, *row, 1, 1); -#else - gtk_table_attach (table, label, 1, 2, *row, *row + 1, - GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); -#endif properties->labels[property] = label; } @@ -334,7 +317,6 @@ ev_regular_paper_size (const EvDocumentInfo *info) void ev_properties_view_set_info (EvPropertiesView *properties, const EvDocumentInfo *info) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; gchar *text; gint row = 0; @@ -401,74 +383,6 @@ ev_properties_view_set_info (EvPropertiesView *properties, const EvDocumentInfo text = ev_regular_paper_size (info); set_property (properties, GTK_GRID (grid), PAPER_SIZE_PROPERTY, text, &row); g_free (text); -#else - GtkWidget *table; - gchar *text; - gint row = 0; - - table = properties->table; - - if (info->fields_mask & EV_DOCUMENT_INFO_TITLE) { - set_property (properties, GTK_TABLE (table), TITLE_PROPERTY, info->title, &row); - } - set_property (properties, GTK_TABLE (table), URI_PROPERTY, properties->uri, &row); - if (info->fields_mask & EV_DOCUMENT_INFO_SUBJECT) { - set_property (properties, GTK_TABLE (table), SUBJECT_PROPERTY, info->subject, &row); - } - if (info->fields_mask & EV_DOCUMENT_INFO_AUTHOR) { - set_property (properties, GTK_TABLE (table), AUTHOR_PROPERTY, info->author, &row); - } - if (info->fields_mask & EV_DOCUMENT_INFO_KEYWORDS) { - set_property (properties, GTK_TABLE (table), KEYWORDS_PROPERTY, info->keywords, &row); - } - if (info->fields_mask & EV_DOCUMENT_INFO_PRODUCER) { - set_property (properties, GTK_TABLE (table), PRODUCER_PROPERTY, info->producer, &row); - } - if (info->fields_mask & EV_DOCUMENT_INFO_CREATOR) { - set_property (properties, GTK_TABLE (table), CREATOR_PROPERTY, info->creator, &row); - } - if (info->fields_mask & EV_DOCUMENT_INFO_CREATION_DATE) { - text = ev_document_misc_format_date (info->creation_date); - set_property (properties, GTK_TABLE (table), CREATION_DATE_PROPERTY, text, &row); - g_free (text); - } - if (info->fields_mask & EV_DOCUMENT_INFO_MOD_DATE) { - text = ev_document_misc_format_date (info->modified_date); - set_property (properties, GTK_TABLE (table), MOD_DATE_PROPERTY, text, &row); - g_free (text); - } - if (info->fields_mask & EV_DOCUMENT_INFO_FORMAT) { - set_property (properties, GTK_TABLE (table), FORMAT_PROPERTY, info->format, &row); - } - if (info->fields_mask & EV_DOCUMENT_INFO_N_PAGES) { - text = g_strdup_printf ("%d", info->n_pages); - set_property (properties, GTK_TABLE (table), N_PAGES_PROPERTY, text, &row); - g_free (text); - } - if (info->fields_mask & EV_DOCUMENT_INFO_LINEARIZED) - { - /* nice hack bro */ - if (info->linearized == 1) - { - set_property (properties, GTK_TABLE (table), LINEARIZED_PROPERTY, _("Yes"), &row); - } - else if (info->linearized == 0) - { - set_property (properties, GTK_TABLE (table), LINEARIZED_PROPERTY, _("No"), &row); - } - else - { - set_property (properties, GTK_TABLE (table), LINEARIZED_PROPERTY, info->linearized, &row); - } - } - if (info->fields_mask & EV_DOCUMENT_INFO_SECURITY) { - set_property (properties, GTK_TABLE (table), SECURITY_PROPERTY, info->security, &row); - } - if (info->fields_mask & EV_DOCUMENT_INFO_PAPER_SIZE) { - text = ev_regular_paper_size (info); - set_property (properties, GTK_TABLE (table), PAPER_SIZE_PROPERTY, text, &row); - g_free (text); -#endif } } @@ -476,22 +390,12 @@ static void ev_properties_view_init (EvPropertiesView *properties) { gtk_orientable_set_orientation (GTK_ORIENTABLE (properties), GTK_ORIENTATION_VERTICAL); -#if GTK_CHECK_VERSION (3, 0, 0) properties->grid = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (properties->grid), 12); gtk_grid_set_row_spacing (GTK_GRID (properties->grid), 6); gtk_container_set_border_width (GTK_CONTAINER (properties->grid), 12); gtk_box_pack_start (GTK_BOX (properties), properties->grid, TRUE, TRUE, 0); gtk_widget_show (properties->grid); -#else - properties->table = gtk_table_new (13, 2, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (properties->table), 12); - gtk_table_set_row_spacings (GTK_TABLE (properties->table), 6); - gtk_container_set_border_width (GTK_CONTAINER (properties->table), 12); - gtk_box_pack_start (GTK_BOX (properties), properties->table, - TRUE, TRUE, 0); - gtk_widget_show (properties->table); -#endif } void diff --git a/shell/eggfindbar.c b/shell/eggfindbar.c index 091a5b1a..ea34cd2a 100644 --- a/shell/eggfindbar.c +++ b/shell/eggfindbar.c @@ -26,10 +26,6 @@ #include "eggfindbar.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - struct _EggFindBarPrivate { gchar *search_string; @@ -166,23 +162,6 @@ egg_find_bar_class_init (EggFindBarClass *klass) FALSE, G_PARAM_READWRITE)); -#if !GTK_CHECK_VERSION (3, 0, 0) - /* Style properties */ - gtk_widget_class_install_style_property (widget_class, - g_param_spec_boxed ("all_matches_color", - "Highlight color", - "Color of highlight for all matches", - GDK_TYPE_COLOR, - G_PARAM_READABLE)); - - gtk_widget_class_install_style_property (widget_class, - g_param_spec_boxed ("current_match_color", - "Current color", - "Color of highlight for the current match", - GDK_TYPE_COLOR, - G_PARAM_READABLE)); -#endif - g_type_class_add_private (object_class, sizeof (EggFindBarPrivate)); binding_set = gtk_binding_set_by_class (klass); @@ -323,7 +302,7 @@ egg_find_bar_init (EggFindBar *find_bar) /* Find: |_____| */ item = gtk_tool_item_new (); - box = gtk_hbox_new (FALSE, 12); + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); alignment = gtk_alignment_new (0.0, 0.5, 1.0, 0.0); gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 2, 2); @@ -336,11 +315,7 @@ egg_find_bar_init (EggFindBar *find_bar) gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->find_entry); /* Prev */ -#if GTK_CHECK_VERSION (3, 0, 0) arrow = gtk_image_new_from_icon_name ("pan-start-symbolic", GTK_ICON_SIZE_BUTTON); -#else - arrow = gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE); -#endif priv->previous_button = gtk_tool_button_new (arrow, Q_("Find Pre_vious")); gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (priv->previous_button), TRUE); gtk_tool_item_set_is_important (priv->previous_button, TRUE); @@ -348,11 +323,7 @@ egg_find_bar_init (EggFindBar *find_bar) _("Find previous occurrence of the search string")); /* Next */ -#if GTK_CHECK_VERSION (3, 0, 0) arrow = gtk_image_new_from_icon_name ("pan-end-symbolic", GTK_ICON_SIZE_BUTTON); -#else - arrow = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_NONE); -#endif priv->next_button = gtk_tool_button_new (arrow, Q_("Find Ne_xt")); gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (priv->next_button), TRUE); gtk_tool_item_set_is_important (priv->next_button, TRUE); @@ -679,63 +650,6 @@ egg_find_bar_get_case_sensitive (EggFindBar *find_bar) return priv->case_sensitive; } -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -get_style_color (EggFindBar *find_bar, - const char *style_prop_name, - GdkColor *color) -{ - GdkColor *style_color; - - gtk_widget_ensure_style (GTK_WIDGET (find_bar)); - gtk_widget_style_get (GTK_WIDGET (find_bar), - "color", &style_color, NULL); - if (style_color) - { - *color = *style_color; - gdk_color_free (style_color); - } -} - -/** - * egg_find_bar_get_all_matches_color: - * - * Gets the color to use to highlight all the - * known matches. - * - * Since: 2.6 - */ -void -egg_find_bar_get_all_matches_color (EggFindBar *find_bar, - GdkColor *color) -{ - GdkColor found_color = { 0, 0, 0, 0x0f0f }; - - get_style_color (find_bar, "all_matches_color", &found_color); - - *color = found_color; -} - -/** - * egg_find_bar_get_current_match_color: - * - * Gets the color to use to highlight the match - * we're currently on. - * - * Since: 2.6 - */ -void -egg_find_bar_get_current_match_color (EggFindBar *find_bar, - GdkColor *color) -{ - GdkColor found_color = { 0, 0, 0, 0xffff }; - - get_style_color (find_bar, "current_match_color", &found_color); - - *color = found_color; -} -#endif - /** * egg_find_bar_set_status_text: * diff --git a/shell/eggfindbar.h b/shell/eggfindbar.h index 975f9790..5ad01804 100644 --- a/shell/eggfindbar.h +++ b/shell/eggfindbar.h @@ -68,10 +68,6 @@ const char* egg_find_bar_get_search_string (EggFindBar *find_bar); void egg_find_bar_set_case_sensitive (EggFindBar *find_bar, gboolean case_sensitive); gboolean egg_find_bar_get_case_sensitive (EggFindBar *find_bar); -void egg_find_bar_get_all_matches_color (EggFindBar *find_bar, - GdkColor *color); -void egg_find_bar_get_current_match_color (EggFindBar *find_bar, - GdkColor *color); void egg_find_bar_set_status_text (EggFindBar *find_bar, const char *text); diff --git a/shell/ev-annotation-properties-dialog.c b/shell/ev-annotation-properties-dialog.c index 68736b27..3d65b70f 100644 --- a/shell/ev-annotation-properties-dialog.c +++ b/shell/ev-annotation-properties-dialog.c @@ -35,11 +35,7 @@ struct _EvAnnotationPropertiesDialog { EvAnnotationType annot_type; EvAnnotation *annot; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *author; GtkWidget *color; @@ -90,23 +86,14 @@ static void ev_annotation_properties_dialog_constructed (GObject *object) { EvAnnotationPropertiesDialog *dialog = EV_ANNOTATION_PROPERTIES_DIALOG (object); -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid = dialog->grid; -#else - GtkWidget *table = dialog->table; -#endif GtkWidget *label; switch (dialog->annot_type) { case EV_ANNOTATION_TYPE_TEXT: label = gtk_label_new (_("Icon:")); gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), label, 0, 5, 1, 1); -#else - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 5, 6, - GTK_FILL, GTK_FILL, 0, 0); -#endif gtk_widget_show (label); dialog->icon = gtk_combo_box_text_new (); @@ -121,14 +108,8 @@ ev_annotation_properties_dialog_constructed (GObject *object) gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Circle")); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dialog->icon), _("Unknown")); gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->icon), 0); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_grid_attach (GTK_GRID (grid), dialog->icon, 1, 5, 1, 1); gtk_widget_set_hexpand (dialog->icon, TRUE); -#else - gtk_table_attach (GTK_TABLE (table), dialog->icon, - 1, 2, 5, 6, - GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); -#endif gtk_widget_show (dialog->icon); break; @@ -145,11 +126,7 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog GtkDialog *dialog = GTK_DIALOG (annot_dialog); GtkWidget *content_area; GtkWidget *label; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *hbox; gchar *markup; GdkColor color = { 0, 65535, 65535, 0 }; @@ -166,7 +143,6 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog content_area = gtk_dialog_get_content_area (dialog); gtk_box_set_spacing (GTK_BOX (content_area), 2); -#if GTK_CHECK_VERSION (3, 0, 0) grid = gtk_grid_new (); annot_dialog->grid = grid; gtk_grid_set_column_spacing (GTK_GRID (grid), 12); @@ -238,88 +214,6 @@ ev_annotation_properties_dialog_init (EvAnnotationPropertiesDialog *annot_dialog gtk_combo_box_set_active (GTK_COMBO_BOX (annot_dialog->popup_state), 1); gtk_grid_attach (GTK_GRID (grid), annot_dialog->popup_state, 1, 4, 1, 1); gtk_widget_set_hexpand (annot_dialog->popup_state, TRUE); -#else - table = gtk_table_new (5, 2, FALSE); - annot_dialog->table = table; - gtk_table_set_col_spacings (GTK_TABLE (table), 12); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_container_set_border_width (GTK_CONTAINER (table), 12); - gtk_box_pack_start (GTK_BOX (content_area), table, FALSE, FALSE, 0); - gtk_widget_show (table); - - label = gtk_label_new (_("Author:")); - gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (label); - - annot_dialog->author = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (annot_dialog->author), g_get_real_name ()); - gtk_table_attach (GTK_TABLE (table), annot_dialog->author, - 1, 2, 0, 1, - GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); - gtk_widget_show (annot_dialog->author); - - label = gtk_label_new (_("Color:")); - gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (label); - - annot_dialog->color = gtk_color_button_new_with_color (&color); - gtk_table_attach (GTK_TABLE (table), annot_dialog->color, - 1, 2, 1, 2, - GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); - gtk_widget_show (annot_dialog->color); - - label = gtk_label_new (_("Style:")); - gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (label); - - annot_dialog->opacity = gtk_hscale_new_with_range (0, 100, 5); - gtk_range_set_value (GTK_RANGE (annot_dialog->opacity), 100); - gtk_table_attach (GTK_TABLE (table), annot_dialog->opacity, - 1, 2, 2, 3, - GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); - gtk_widget_show (annot_dialog->opacity); - - hbox = gtk_hbox_new (FALSE, 6); - - label = gtk_label_new (NULL); - markup = g_strdup_printf ("%s", _("Transparent")); - gtk_label_set_markup (GTK_LABEL (label), markup); - g_free (markup); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - gtk_widget_show (label); - - label = gtk_label_new (NULL); - markup = g_strdup_printf ("%s", _("Opaque")); - gtk_label_set_markup (GTK_LABEL (label), markup); - g_free (markup); - gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0); - gtk_widget_show (label); - - gtk_table_attach (GTK_TABLE (table), hbox, - 1, 2, 3, 4, - GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); - gtk_widget_show (hbox); - - label = gtk_label_new (_("Initial window state:")); - gtk_misc_set_alignment (GTK_MISC (label), 0., 0.5); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5, - GTK_FILL, GTK_FILL, 0, 0); - gtk_widget_show (label); - - annot_dialog->popup_state = gtk_combo_box_text_new (); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (annot_dialog->popup_state), _("Open")); - gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (annot_dialog->popup_state), _("Close")); - gtk_combo_box_set_active (GTK_COMBO_BOX (annot_dialog->popup_state), 1); - gtk_table_attach (GTK_TABLE (table), annot_dialog->popup_state, - 1, 2, 4, 5, - GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); -#endif gtk_widget_show (annot_dialog->popup_state); } diff --git a/shell/ev-application.c b/shell/ev-application.c index c1bf42f5..b27ee512 100644 --- a/shell/ev-application.c +++ b/shell/ev-application.c @@ -269,12 +269,7 @@ ev_spawn (const char *uri, GList uri_list; GList *uris = NULL; -#if GTK_CHECK_VERSION (3, 0, 0) ctx = gdk_display_get_app_launch_context (gdk_screen_get_display (screen)); -#else - ctx = gdk_app_launch_context_new (); - gdk_app_launch_context_set_display (ctx, gdk_screen_get_display (screen)); -#endif gdk_app_launch_context_set_screen (ctx, screen); gdk_app_launch_context_set_timestamp (ctx, timestamp); diff --git a/shell/ev-message-area.c b/shell/ev-message-area.c index a545f2b1..8226537b 100644 --- a/shell/ev-message-area.c +++ b/shell/ev-message-area.c @@ -25,11 +25,6 @@ #include "ev-message-area.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - #define EV_MESSAGE_AREA_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EV_TYPE_MESSAGE_AREA, EvMessageAreaPrivate)) @@ -101,10 +96,10 @@ ev_message_area_init (EvMessageArea *area) area->priv = EV_MESSAGE_AREA_GET_PRIVATE (area); - area->priv->main_box = gtk_vbox_new (FALSE, 12); + area->priv->main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); - hbox = gtk_hbox_new (FALSE, 12); - vbox = gtk_vbox_new (FALSE, 12); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12); area->priv->label = gtk_label_new (NULL); gtk_label_set_use_markup (GTK_LABEL (area->priv->label), TRUE); diff --git a/shell/ev-navigation-action-widget.c b/shell/ev-navigation-action-widget.c index 27993699..de60674f 100644 --- a/shell/ev-navigation-action-widget.c +++ b/shell/ev-navigation-action-widget.c @@ -134,11 +134,7 @@ menu_position_func (GtkMenu *menu, gint monitor_num; GdkScreen *screen; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (button->menu), &menu_req, NULL); -#else - gtk_widget_size_request (GTK_WIDGET (button->menu), &menu_req); -#endif direction = gtk_widget_get_direction (widget); screen = gtk_widget_get_screen (GTK_WIDGET (menu)); diff --git a/shell/ev-password-view.c b/shell/ev-password-view.c index bd7d5222..12ccffb2 100644 --- a/shell/ev-password-view.c +++ b/shell/ev-password-view.c @@ -30,11 +30,6 @@ #include "ev-keyring.h" #include "ev-password-view.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - enum { UNLOCK, LAST_SIGNAL @@ -121,13 +116,9 @@ ev_password_view_init (EvPasswordView *password_view) password_view->priv->password_save = G_PASSWORD_SAVE_NEVER; -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_push_composite_child (); -#endif - /* set ourselves up */ align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0); - vbox = gtk_vbox_new (FALSE, 24); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 24); gtk_container_set_border_width (GTK_CONTAINER (vbox), 24); gtk_container_add (GTK_CONTAINER (password_view), align); gtk_container_add (GTK_CONTAINER (align), vbox); @@ -152,7 +143,7 @@ ev_password_view_init (EvPasswordView *password_view) gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); button = gtk_button_new_with_mnemonic (_("_Unlock Document")); @@ -160,9 +151,6 @@ ev_password_view_init (EvPasswordView *password_view) gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show_all (align); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_pop_composite_child (); -#endif } /* Public functions */ @@ -251,11 +239,7 @@ ev_password_view_ask_password (EvPasswordView *password_view) GtkWidget *content_area, *action_area; GtkWidget *entry_container; GtkWidget *hbox, *main_vbox, *vbox, *icon; -#if GTK_CHECK_VERSION (3, 0, 0) GtkWidget *grid; -#else - GtkWidget *table; -#endif GtkWidget *label; gchar *text, *markup, *file_name; @@ -284,15 +268,9 @@ ev_password_view_ask_password (EvPasswordView *password_view) gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK); gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_dialog_set_alternative_button_order (dialog, - GTK_RESPONSE_OK, - GTK_RESPONSE_CANCEL, - -1); -#endif /* Build contents */ - hbox = gtk_hbox_new (FALSE, 12); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0); gtk_widget_show (hbox); @@ -304,7 +282,7 @@ ev_password_view_ask_password (EvPasswordView *password_view) gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0); gtk_widget_show (icon); - main_vbox = gtk_vbox_new (FALSE, 18); + main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18); gtk_box_pack_start (GTK_BOX (hbox), main_vbox, TRUE, TRUE, 0); gtk_widget_show (main_vbox); @@ -325,7 +303,7 @@ ev_password_view_ask_password (EvPasswordView *password_view) FALSE, FALSE, 0); gtk_widget_show (label); - vbox = gtk_vbox_new (FALSE, 6); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); gtk_widget_show (vbox); @@ -339,19 +317,11 @@ ev_password_view_ask_password (EvPasswordView *password_view) FALSE, FALSE, 0); gtk_widget_show (entry_container); -#if GTK_CHECK_VERSION (3, 0, 0) grid = gtk_grid_new (); gtk_grid_set_column_spacing (GTK_GRID (grid), 12); gtk_grid_set_row_spacing (GTK_GRID (grid), 6); gtk_container_add (GTK_CONTAINER (entry_container), grid); gtk_widget_show (grid); -#else - table = gtk_table_new (1, 2, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (table), 12); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_container_add (GTK_CONTAINER (entry_container), table); - gtk_widget_show (table); -#endif label = gtk_label_new_with_mnemonic (_("_Password:")); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); @@ -364,21 +334,12 @@ ev_password_view_ask_password (EvPasswordView *password_view) g_signal_connect (password_view->priv->password_entry, "activate", G_CALLBACK (ev_password_dialog_entry_activated_cb), dialog); -#if GTK_CHECK_VERSION (3, 0, 0) + gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1); gtk_widget_show (label); gtk_grid_attach (GTK_GRID (grid), password_view->priv->password_entry, 1, 0, 1, 1); gtk_widget_set_hexpand (password_view->priv->password_entry, TRUE); -#else - gtk_table_attach (GTK_TABLE (table), label, - 0, 1, 0, 1, - GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); - gtk_widget_show (label); - - gtk_table_attach_defaults (GTK_TABLE (table), password_view->priv->password_entry, - 1, 2, 0, 1); -#endif gtk_widget_show (password_view->priv->password_entry); gtk_label_set_mnemonic_widget (GTK_LABEL (label), @@ -389,7 +350,7 @@ ev_password_view_ask_password (EvPasswordView *password_view) GtkWidget *remember_box; GSList *group; - remember_box = gtk_vbox_new (FALSE, 6); + remember_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (vbox), remember_box, FALSE, FALSE, 0); gtk_widget_show (remember_box); diff --git a/shell/ev-progress-message-area.c b/shell/ev-progress-message-area.c index f3f5e3ad..c50b6041 100644 --- a/shell/ev-progress-message-area.c +++ b/shell/ev-progress-message-area.c @@ -24,10 +24,6 @@ #include "ev-progress-message-area.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - #define EV_PROGRESS_MESSAGE_AREA_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), EV_TYPE_PROGRESS_MESSAGE_AREA, EvProgressMessageAreaPrivate)) @@ -89,7 +85,7 @@ ev_progress_message_area_init (EvProgressMessageArea *area) contents = _ev_message_area_get_main_box (EV_MESSAGE_AREA (area)); - vbox = gtk_vbox_new (FALSE, 6); + vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); area->priv->label = gtk_label_new (NULL); gtk_label_set_use_markup (GTK_LABEL (area->priv->label), TRUE); diff --git a/shell/ev-sidebar-annotations.c b/shell/ev-sidebar-annotations.c index 94fa3092..e188eb3b 100644 --- a/shell/ev-sidebar-annotations.c +++ b/shell/ev-sidebar-annotations.c @@ -29,10 +29,6 @@ #include "ev-job-scheduler.h" #include "ev-stock-icons.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_widget_render_icon(A,B,C,D) gtk_widget_render_icon_pixbuf(A,B,C) -#endif - enum { PROP_0, PROP_WIDGET @@ -132,10 +128,8 @@ ev_sidebar_annotations_add_annots_list (EvSidebarAnnotations *ev_annots) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow), GTK_SHADOW_IN); -#if GTK_CHECK_VERSION (3, 0, 0) // Use as much vertical space as available gtk_widget_set_vexpand (GTK_WIDGET (swindow), TRUE); -#endif /* Create tree view */ loading_model = ev_sidebar_annotations_create_simple_model (_("Loading…")); @@ -434,18 +428,16 @@ job_finished_callback (EvJobAnnots *job, if (EV_IS_ANNOTATION_TEXT (annot)) { if (!text_icon) { /* FIXME: use a better icon than EDIT */ - text_icon = gtk_widget_render_icon (priv->tree_view, - GTK_STOCK_EDIT, - GTK_ICON_SIZE_BUTTON, - NULL); + text_icon = gtk_widget_render_icon_pixbuf (priv->tree_view, + GTK_STOCK_EDIT, + GTK_ICON_SIZE_BUTTON); } pixbuf = text_icon; } else if (EV_IS_ANNOTATION_ATTACHMENT (annot)) { if (!attachment_icon) { - attachment_icon = gtk_widget_render_icon (priv->tree_view, - EV_STOCK_ATTACHMENT, - GTK_ICON_SIZE_BUTTON, - NULL); + attachment_icon = gtk_widget_render_icon_pixbuf (priv->tree_view, + EV_STOCK_ATTACHMENT, + GTK_ICON_SIZE_BUTTON); } pixbuf = attachment_icon; } diff --git a/shell/ev-sidebar-attachments.c b/shell/ev-sidebar-attachments.c index ddcaccda..a7c60f3f 100644 --- a/shell/ev-sidebar-attachments.c +++ b/shell/ev-sidebar-attachments.c @@ -264,11 +264,7 @@ ev_sidebar_attachments_popup_menu (GtkWidget *widget) EvSidebarAttachments *ev_attachbar = EV_SIDEBAR_ATTACHMENTS (widget); gint x, y; -#if GTK_CHECK_VERSION(3, 0, 0) ev_document_misc_get_pointer_position (widget, &x, &y); -#else - gtk_widget_get_pointer (widget, &x, &y); -#endif return ev_sidebar_attachments_popup_menu_show (ev_attachbar, x, y); } diff --git a/shell/ev-sidebar-bookmarks.c b/shell/ev-sidebar-bookmarks.c index 4f2c237f..2823328a 100644 --- a/shell/ev-sidebar-bookmarks.c +++ b/shell/ev-sidebar-bookmarks.c @@ -380,11 +380,7 @@ ev_sidebar_bookmarks_popup_menu (GtkWidget *widget) EvSidebarBookmarks *sidebar_bookmarks = EV_SIDEBAR_BOOKMARKS (widget); gint x, y; -#if GTK_CHECK_VERSION(3, 0, 0) ev_document_misc_get_pointer_position (widget, &x, &y); -#else - gtk_widget_get_pointer (widget, &x, &y); -#endif return ev_sidebar_bookmarks_popup_menu_show (sidebar_bookmarks, x, y, TRUE); } @@ -475,11 +471,7 @@ ev_sidebar_bookmarks_init (EvSidebarBookmarks *sidebar_bookmarks) gtk_container_add (GTK_CONTAINER (swindow), priv->tree_view); gtk_widget_show (priv->tree_view); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); -#else - hbox = gtk_hbutton_box_new (); -#endif priv->add_button = gtk_button_new_from_stock (GTK_STOCK_ADD); g_signal_connect (priv->add_button, "clicked", diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index 8f7f6517..0c420f57 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -685,14 +685,11 @@ static void ev_sidebar_init_icon_view (EvSidebarThumbnails *ev_sidebar_thumbnails) { EvSidebarThumbnailsPrivate *priv; -#if GTK_CHECK_VERSION (3, 0, 0) GtkCellRenderer *renderer; -#endif priv = ev_sidebar_thumbnails->priv; - priv->icon_view = gtk_icon_view_new_with_model (GTK_TREE_MODEL (priv->list_store)); -#if GTK_CHECK_VERSION (3, 0, 0) + renderer = g_object_new (GTK_TYPE_CELL_RENDERER_PIXBUF, "xalign", 0.5, "yalign", 1.0, @@ -712,10 +709,7 @@ ev_sidebar_init_icon_view (EvSidebarThumbnails *ev_sidebar_thumbnails) gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (priv->icon_view), renderer, FALSE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (priv->icon_view), renderer, "markup", 0, NULL); -#else - gtk_icon_view_set_markup_column (GTK_ICON_VIEW (priv->icon_view), 0); - gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (priv->icon_view), 1); -#endif + g_signal_connect (priv->icon_view, "selection-changed", G_CALLBACK (ev_sidebar_icon_selection_changed), ev_sidebar_thumbnails); @@ -750,11 +744,7 @@ ev_sidebar_thumbnails_init (EvSidebarThumbnails *ev_sidebar_thumbnails) * it's just a workaround for bug #449462 (GTK2 only) */ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->swindow), -#if GTK_CHECK_VERSION (3, 0, 0) GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); -#else - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); -#endif gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->swindow), GTK_SHADOW_IN); priv->vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->swindow)); diff --git a/shell/ev-sidebar.c b/shell/ev-sidebar.c index 5a775a91..8e072f48 100644 --- a/shell/ev-sidebar.c +++ b/shell/ev-sidebar.c @@ -32,10 +32,6 @@ #include "ev-sidebar.h" #include "ev-sidebar-page.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) -#endif - enum { PROP_0, @@ -235,11 +231,7 @@ ev_sidebar_select_button_press_cb (GtkWidget *widget, gtk_widget_get_allocation (widget, &allocation); width = allocation.width; gtk_widget_set_size_request (ev_sidebar->priv->menu, -1, -1); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (ev_sidebar->priv->menu, &requisition, NULL); -#else - gtk_widget_size_request (ev_sidebar->priv->menu, &requisition); -#endif gtk_widget_set_size_request (ev_sidebar->priv->menu, MAX (width, requisition.width), -1); @@ -357,7 +349,7 @@ ev_sidebar_init (EvSidebar *ev_sidebar) G_TYPE_INT); /* top option menu */ - hbox = gtk_hbox_new (FALSE, 0); + hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); ev_sidebar->priv->hbox = hbox; gtk_box_pack_start (GTK_BOX (ev_sidebar), hbox, FALSE, FALSE, 0); gtk_widget_show (hbox); @@ -371,7 +363,7 @@ ev_sidebar_init (EvSidebar *ev_sidebar) G_CALLBACK (ev_sidebar_select_button_key_press_cb), ev_sidebar); - select_hbox = gtk_hbox_new (FALSE, 0); + select_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); ev_sidebar->priv->label = gtk_label_new (""); gtk_box_pack_start (GTK_BOX (select_hbox), @@ -379,11 +371,7 @@ ev_sidebar_init (EvSidebar *ev_sidebar) FALSE, FALSE, 0); gtk_widget_show (ev_sidebar->priv->label); -#if GTK_CHECK_VERSION (3, 0, 0) arrow = gtk_image_new_from_icon_name ("pan-down-symbolic", GTK_ICON_SIZE_BUTTON); -#else - arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); -#endif gtk_box_pack_end (GTK_BOX (select_hbox), arrow, FALSE, FALSE, 0); gtk_widget_show (arrow); diff --git a/shell/ev-utils.c b/shell/ev-utils.c index 1363cace..8c9bae55 100644 --- a/shell/ev-utils.c +++ b/shell/ev-utils.c @@ -225,11 +225,7 @@ ev_gui_sanitise_popup_position (GtkMenu *menu, g_return_if_fail (widget != NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL); -#else - gtk_widget_size_request (GTK_WIDGET (menu), &req); -#endif monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y); gtk_menu_set_monitor (menu, monitor_num); @@ -255,11 +251,7 @@ ev_gui_menu_position_tree_selection (GtkMenu *menu, GtkAllocation allocation; GdkRectangle visible; -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_get_preferred_size (GTK_WIDGET (menu), &req, NULL); -#else - gtk_widget_size_request (GTK_WIDGET (menu), &req); -#endif gdk_window_get_origin (gtk_widget_get_window (widget), x, y); gtk_widget_get_allocation (widget, &allocation); diff --git a/shell/ev-window.c b/shell/ev-window.c index 20effead..f2e07e5d 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -101,10 +101,6 @@ #include "ev-media-player-keys.h" #endif /* ENABLE_DBUS */ -#if GTK_CHECK_VERSION (3, 0, 0) -#define gtk_vbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_VERTICAL,Y) -#endif - typedef enum { PAGE_MODE_DOCUMENT, PAGE_MODE_PASSWORD @@ -533,7 +529,6 @@ ev_window_update_actions (EvWindow *ev_window) ev_view_get_has_selection (view)); } #if ENABLE_EPUB -#if GTK_CHECK_VERSION (3, 0, 0) else if (webview) { /* * The webkit2 function for this is an asynchronous call, @@ -543,13 +538,6 @@ ev_window_update_actions (EvWindow *ev_window) ev_window_set_action_sensitive (ev_window,"EditCopy", has_pages); } -#else - else if(webview) { - ev_window_set_action_sensitive (ev_window, "EditCopy", - has_pages && - ev_web_view_get_has_selection (webview)); - } -#endif #endif ev_window_set_action_sensitive (ev_window, "EditFindNext", has_pages && can_find_in_page); @@ -983,17 +971,6 @@ view_selection_changed_cb (EvView *view, ev_window_set_action_sensitive (window, "EditCopy", ev_view_get_has_selection (view)); } -#if ENABLE_EPUB -#if !GTK_CHECK_VERSION (3, 0, 0) -static void -web_view_selection_changed_cb(EvWebView *webview, - EvWindow *window) -{ - ev_window_set_action_sensitive (window,"EditCopy", - ev_web_view_get_has_selection(webview)); -} -#endif -#endif static void view_layers_changed_cb (EvView *view, @@ -3098,12 +3075,6 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window) ev_document_factory_add_filters (fc, ev_window->priv->document); gtk_dialog_set_default_response (GTK_DIALOG (fc), GTK_RESPONSE_OK); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_dialog_set_alternative_button_order (GTK_DIALOG (fc), - GTK_RESPONSE_OK, - GTK_RESPONSE_CANCEL, - -1); -#endif gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fc), FALSE); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fc), TRUE); @@ -3145,12 +3116,7 @@ ev_window_cmd_send_to (GtkAction *action, GdkScreen *screen; screen = gtk_window_get_screen (GTK_WINDOW (ev_window)); -#if GTK_CHECK_VERSION (3, 0, 0) context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen)); -#else - context = gdk_app_launch_context_new (); - gdk_app_launch_context_set_display (context, gdk_screen_get_display (screen)); -#endif gdk_app_launch_context_set_screen (context, screen); gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ()); g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (context), &error); @@ -3740,13 +3706,6 @@ ev_window_check_document_modified (EvWindow *ev_window) GTK_RESPONSE_YES, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), - GTK_RESPONSE_YES, - GTK_RESPONSE_NO, - GTK_RESPONSE_CANCEL, - -1); -#endif g_signal_connect (dialog, "response", G_CALLBACK (document_modified_confirmation_dialog_response), @@ -3845,13 +3804,6 @@ ev_window_check_print_queue (EvWindow *ev_window) GTK_RESPONSE_YES, NULL); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), - GTK_RESPONSE_YES, - GTK_RESPONSE_NO, - GTK_RESPONSE_CANCEL, - -1); -#endif g_signal_connect (dialog, "response", G_CALLBACK (print_jobs_confirmation_dialog_response), @@ -4116,7 +4068,6 @@ fullscreen_toolbar_setup_item_properties (GtkUIManager *ui_manager) static void fullscreen_toolbar_remove_shadow (GtkWidget *toolbar) { -#if GTK_CHECK_VERSION (3, 0, 0) GtkCssProvider *provider; gtk_widget_set_name (toolbar, "ev-fullscreen-toolbar"); @@ -4131,25 +4082,6 @@ fullscreen_toolbar_remove_shadow (GtkWidget *toolbar) GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); } -#else - static gboolean done = FALSE; - - if (!done) { - gtk_rc_parse_string ( - "\n" - " style \"fullscreen-toolbar-style\"\n" - " {\n" - " GtkToolbar::shadow-type=GTK_SHADOW_NONE\n" - " }\n" - "\n" - " widget \"*.fullscreen-toolbar\" style \"fullscreen-toolbar-style\"\n" - "\n"); - done = TRUE; - } - - gtk_widget_set_name (toolbar, "fullscreen-toolbar"); -} -#endif static void ev_window_run_fullscreen (EvWindow *window) @@ -4625,11 +4557,7 @@ ev_window_cmd_edit_toolbar (GtkAction *action, EvWindow *ev_window) gtk_container_set_border_width (GTK_CONTAINER (editor), 5); gtk_box_set_spacing (GTK_BOX (EGG_TOOLBAR_EDITOR (editor)), 5); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_box_pack_start (GTK_BOX (content_area), editor, TRUE, TRUE, 0); -#else - gtk_container_add (GTK_CONTAINER (content_area), editor); -#endif egg_editable_toolbar_set_edit_mode (toolbar, TRUE); @@ -5688,9 +5616,6 @@ find_bar_visibility_changed_cb (EggFindBar *find_bar, } #if ENABLE_EPUB else { -#if !GTK_CHECK_VERSION(3, 0, 0) - ev_web_view_find_set_highlight_search(EV_WEB_VIEW(ev_window->priv->webview),visible); -#endif ev_web_view_find_search_changed(EV_WEB_VIEW(ev_window->priv->webview)); ev_web_view_set_handler(EV_WEB_VIEW(ev_window->priv->webview),visible); } @@ -6684,12 +6609,8 @@ launch_action (EvWindow *window, EvLinkAction *action) GAppInfo *app_info; GFile *file; GList file_list = {NULL}; -#if GTK_CHECK_VERSION (3, 0, 0) GdkAppLaunchContext *context; GdkScreen *screen; -#else - GAppLaunchContext *context; -#endif GError *error = NULL; if (filename == NULL) @@ -6720,7 +6641,6 @@ launch_action (EvWindow *window, EvLinkAction *action) return; } -#if GTK_CHECK_VERSION (3, 0, 0) screen = gtk_window_get_screen (GTK_WINDOW (window)); context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen)); gdk_app_launch_context_set_screen (context, screen); @@ -6728,16 +6648,6 @@ launch_action (EvWindow *window, EvLinkAction *action) file_list.data = file; if (!g_app_info_launch (app_info, &file_list, G_APP_LAUNCH_CONTEXT (context), &error)) { -#else - context = G_APP_LAUNCH_CONTEXT (gdk_app_launch_context_new ()); - gdk_app_launch_context_set_screen (GDK_APP_LAUNCH_CONTEXT (context), - gtk_window_get_screen (GTK_WINDOW (window))); - gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context), - gtk_get_current_event_time ()); - - file_list.data = file; - if (!g_app_info_launch (app_info, &file_list, context, &error)) { -#endif ev_window_error_message (window, error, "%s", _("Unable to launch external application.")); @@ -6758,7 +6668,6 @@ launch_external_uri (EvWindow *window, EvLinkAction *action) const gchar *uri = ev_link_action_get_uri (action); GError *error = NULL; gboolean ret; -#if GTK_CHECK_VERSION (3, 0, 0) GdkAppLaunchContext *context; GdkScreen *screen; @@ -6766,15 +6675,6 @@ launch_external_uri (EvWindow *window, EvLinkAction *action) context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen)); gdk_app_launch_context_set_screen (context, screen); gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ()); -#else - GAppLaunchContext *context; - - context = G_APP_LAUNCH_CONTEXT (gdk_app_launch_context_new ()); - gdk_app_launch_context_set_screen (GDK_APP_LAUNCH_CONTEXT (context), - gtk_window_get_screen (GTK_WINDOW (window))); - gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context), - gtk_get_current_event_time ()); -#endif if (!g_strstr_len (uri, strlen (uri), "://") && !g_str_has_prefix (uri, "mailto:")) { @@ -6799,17 +6699,10 @@ launch_external_uri (EvWindow *window, EvLinkAction *action) new_uri = g_strdup_printf ("file:///%s", uri); } } -#if GTK_CHECK_VERSION (3, 0, 0) ret = g_app_info_launch_default_for_uri (new_uri, G_APP_LAUNCH_CONTEXT (context), &error); g_free (new_uri); } else { ret = g_app_info_launch_default_for_uri (uri, G_APP_LAUNCH_CONTEXT (context), &error); -#else - ret = g_app_info_launch_default_for_uri (new_uri, context, &error); - g_free (new_uri); - } else { - ret = g_app_info_launch_default_for_uri (uri, context, &error); -#endif } if (ret == FALSE) { @@ -7081,12 +6974,6 @@ ev_view_popup_cmd_save_image_as (GtkAction *action, EvWindow *window) NULL); gtk_dialog_set_default_response (GTK_DIALOG (fc), GTK_RESPONSE_OK); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_dialog_set_alternative_button_order (GTK_DIALOG (fc), - GTK_RESPONSE_OK, - GTK_RESPONSE_CANCEL, - -1); -#endif gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fc), FALSE); gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fc), TRUE); @@ -7318,12 +7205,6 @@ ev_attachment_popup_cmd_save_attachment_as (GtkAction *action, EvWindow *window) NULL); gtk_dialog_set_default_response (GTK_DIALOG (fc), GTK_RESPONSE_OK); -#if !GTK_CHECK_VERSION(3,0,0) - gtk_dialog_set_alternative_button_order (GTK_DIALOG (fc), - GTK_RESPONSE_OK, - GTK_RESPONSE_CANCEL, - -1); -#endif gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (fc), TRUE); gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (fc), FALSE); @@ -7663,14 +7544,12 @@ ev_window_init (EvWindow *ev_window) ev_window->priv->chrome = EV_CHROME_NORMAL; ev_window->priv->title = ev_window_title_new (ev_window); -#if GTK_CHECK_VERSION(3, 0, 0) GtkStyleContext *context; context = gtk_widget_get_style_context (GTK_WIDGET (ev_window)); gtk_style_context_add_class (context, "atril-window"); -#endif - ev_window->priv->main_box = gtk_vbox_new (FALSE, 0); + ev_window->priv->main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (ev_window), ev_window->priv->main_box); gtk_widget_show (ev_window->priv->main_box); @@ -7753,10 +7632,8 @@ ev_window_init (EvWindow *ev_window) NULL)); g_object_unref (toolbars_model); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (ev_window->priv->toolbar)), GTK_STYLE_CLASS_PRIMARY_TOOLBAR); -#endif egg_editable_toolbar_show (EGG_EDITABLE_TOOLBAR (ev_window->priv->toolbar), "DefaultToolBar"); @@ -7766,11 +7643,7 @@ ev_window_init (EvWindow *ev_window) gtk_widget_show (ev_window->priv->toolbar); /* Add the main area */ -#if GTK_CHECK_VERSION (3, 0, 0) ev_window->priv->hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); -#else - ev_window->priv->hpaned = gtk_hpaned_new (); -#endif g_signal_connect (ev_window->priv->hpaned, "notify::position", G_CALLBACK (ev_window_sidebar_position_change_cb), @@ -7864,7 +7737,7 @@ ev_window_init (EvWindow *ev_window) ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar), sidebar_widget); - ev_window->priv->view_box = gtk_vbox_new (FALSE, 0); + ev_window->priv->view_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); ev_window->priv->scrolled_window = GTK_WIDGET (g_object_new (GTK_TYPE_SCROLLED_WINDOW, "shadow-type", GTK_SHADOW_IN, @@ -7883,11 +7756,6 @@ ev_window_init (EvWindow *ev_window) #if ENABLE_EPUB /*The webview, we won't add it now but it will replace the atril-view if a web(epub) document is encountered.*/ ev_window->priv->webview = ev_web_view_new(); ev_web_view_set_model(EV_WEB_VIEW(ev_window->priv->webview),ev_window->priv->model); -#if !GTK_CHECK_VERSION (3, 0, 0) - g_signal_connect_object (ev_window->priv->webview,"selection-changed", - G_CALLBACK(web_view_selection_changed_cb), - ev_window, 0); -#endif #endif page_cache_mb = g_settings_get_uint (ev_window_ensure_settings (ev_window), GS_PAGE_CACHE_SIZE); -- cgit v1.2.1