From 00a3581bfaaf0d5f825820c68b515415fe510b66 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Mon, 19 Sep 2005 12:53:07 +0000 Subject: [PATCH] Move page next/previous functions from page chace to view and change it to 2005-09-19 Marco Pesenti Gritti * shell/ev-page-cache.c: * shell/ev-page-cache.h: * shell/ev-view.c: (ev_view_binding_activated), (ev_view_next_page), (ev_view_previous_page), (ev_sizing_mode_get_type): * shell/ev-view.h: * shell/ev-window.c: (ev_window_cmd_go_previous_page), (ev_window_cmd_go_next_page): Move page next/previous functions from page chace to view and change it to move by 2 page steps in dual mode. --- ChangeLog | 14 ++++++++++++++ shell/ev-page-cache.c | 26 -------------------------- shell/ev-page-cache.h | 2 -- shell/ev-view.c | 41 ++++++++++++++++++++++++++++++++++++++--- shell/ev-view.h | 2 ++ shell/ev-window.c | 4 ++-- 6 files changed, 56 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f6f9961..ba3b363b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-09-19 Marco Pesenti Gritti + + * shell/ev-page-cache.c: + * shell/ev-page-cache.h: + * shell/ev-view.c: (ev_view_binding_activated), + (ev_view_next_page), (ev_view_previous_page), + (ev_sizing_mode_get_type): + * shell/ev-view.h: + * shell/ev-window.c: (ev_window_cmd_go_previous_page), + (ev_window_cmd_go_next_page): + + Move page next/previous functions from page chace to + view and change it to move by 2 page steps in dual mode. + 2005-09-19 Marco Pesenti Gritti * shell/ev-window.c: (update_sidebar_visibility), diff --git a/shell/ev-page-cache.c b/shell/ev-page-cache.c index 29d2179b..7409ded1 100644 --- a/shell/ev-page-cache.c +++ b/shell/ev-page-cache.c @@ -487,32 +487,6 @@ ev_page_cache_get_info (EvPageCache *page_cache) return page_cache->page_info; } - -gboolean -ev_page_cache_next_page (EvPageCache *page_cache) -{ - g_return_val_if_fail (EV_IS_PAGE_CACHE (page_cache), FALSE); - - if (page_cache->current_page >= page_cache->n_pages - 1) - return FALSE; - - ev_page_cache_set_current_page (page_cache, page_cache->current_page + 1); - return TRUE; - -} - -gboolean -ev_page_cache_prev_page (EvPageCache *page_cache) -{ - g_return_val_if_fail (EV_IS_PAGE_CACHE (page_cache), FALSE); - - if (page_cache->current_page <= 0) - return FALSE; - - ev_page_cache_set_current_page (page_cache, page_cache->current_page - 1); - return TRUE; -} - #define PAGE_CACHE_STRING "ev-page-cache" EvPageCache * diff --git a/shell/ev-page-cache.h b/shell/ev-page-cache.h index 0d9d2b6a..6d8955e8 100644 --- a/shell/ev-page-cache.h +++ b/shell/ev-page-cache.h @@ -66,8 +66,6 @@ void ev_page_cache_set_current_page (EvPageCache *page_cache, int page); gboolean ev_page_cache_set_page_label (EvPageCache *page_cache, const char *page_label); -gboolean ev_page_cache_next_page (EvPageCache *page_cache); -gboolean ev_page_cache_prev_page (EvPageCache *page_cache); EvPageCache *ev_page_cache_get (EvDocument *document); diff --git a/shell/ev-view.c b/shell/ev-view.c index 6fb577fc..bc219669 100644 --- a/shell/ev-view.c +++ b/shell/ev-view.c @@ -689,10 +689,10 @@ ev_view_binding_activated (EvView *view, if (view->presentation) { switch (scroll) { case GTK_SCROLL_STEP_BACKWARD: - ev_page_cache_prev_page (view->page_cache); + ev_view_previous_page (view); break; case GTK_SCROLL_STEP_FORWARD: - ev_page_cache_next_page (view->page_cache); + ev_view_next_page (view); break; default: break; @@ -3569,6 +3569,42 @@ ev_view_show_cursor (EvView *view) ev_view_set_cursor (view, EV_VIEW_CURSOR_NORMAL); } +gboolean +ev_view_next_page (EvView *view) +{ + int page; + + g_return_val_if_fail (EV_IS_VIEW (view), FALSE); + + page = ev_page_cache_get_current_page (view->page_cache); + page = ev_view_get_dual_page (view) ? page + 2 : page + 1; + + if (page < ev_page_cache_get_n_pages (view->page_cache)) { + ev_page_cache_set_current_page (view->page_cache, page); + return TRUE; + } else { + return FALSE; + } +} + +gboolean +ev_view_previous_page (EvView *view) +{ + int page; + + g_return_val_if_fail (EV_IS_VIEW (view), FALSE); + + page = ev_page_cache_get_current_page (view->page_cache); + page = ev_view_get_dual_page (view) ? page - 2 : page - 1; + + if (page >= 0) { + ev_page_cache_set_current_page (view->page_cache, page); + return TRUE; + } else { + return FALSE; + } +} + /*** Enum description for usage in signal ***/ GType @@ -3586,4 +3622,3 @@ ev_sizing_mode_get_type (void) } return etype; } - diff --git a/shell/ev-view.h b/shell/ev-view.h index ad60e707..77914929 100644 --- a/shell/ev-view.h +++ b/shell/ev-view.h @@ -123,6 +123,8 @@ void ev_view_scroll (EvView *view, EvScrollType scroll); void ev_view_goto_link (EvView *view, EvLink *link); +gboolean ev_view_next_page (EvView *view); +gboolean ev_view_previous_page (EvView *view); G_END_DECLS diff --git a/shell/ev-window.c b/shell/ev-window.c index 4c893f3b..fa4c8773 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -2130,7 +2130,7 @@ ev_window_cmd_go_previous_page (GtkAction *action, EvWindow *ev_window) { g_return_if_fail (EV_IS_WINDOW (ev_window)); - ev_page_cache_prev_page (ev_window->priv->page_cache); + ev_view_previous_page (ev_window->priv->view); } static void @@ -2138,7 +2138,7 @@ ev_window_cmd_go_next_page (GtkAction *action, EvWindow *ev_window) { g_return_if_fail (EV_IS_WINDOW (ev_window)); - ev_page_cache_next_page (ev_window->priv->page_cache); + ev_view_next_page (ev_window->priv->view); } static void -- 2.43.5