]> www.fi.muni.cz Git - evince.git/commitdiff
Move page next/previous functions from page chace to view and change it to
authorMarco Pesenti Gritti <mpg@redhat.com>
Mon, 19 Sep 2005 12:53:07 +0000 (12:53 +0000)
committerMarco Pesenti Gritti <marco@src.gnome.org>
Mon, 19 Sep 2005 12:53:07 +0000 (12:53 +0000)
2005-09-19  Marco Pesenti Gritti  <mpg@redhat.com>

        * 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
shell/ev-page-cache.c
shell/ev-page-cache.h
shell/ev-view.c
shell/ev-view.h
shell/ev-window.c

index 7f6f99613e6254d77ad74e447394ac8076449d62..ba3b363b618736b4f9105579afaf027083c75cc0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2005-09-19  Marco Pesenti Gritti  <mpg@redhat.com>
+
+       * 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  <mpg@redhat.com>
 
        * shell/ev-window.c: (update_sidebar_visibility),
index 29d2179bf8f11871b0398d3715f4c151f7427738..7409ded1c03401c6868ad362628e417629c6828f 100644 (file)
@@ -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 *
index 0d9d2b6a3b95f38bfe3705d3715622ffa753a832..6d8955e8454bb8bff347887e73fa3182d0066b5d 100644 (file)
@@ -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);
 
index 6fb577fce3a6e4910482bcc2bbbc222e0c3bcece..bc2196692ba468d9084a1ebd9ed890a020a7a994 100644 (file)
@@ -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;
 }
-
index ad60e707dd1b550f2c3e423dc9e113f68ec6517b..77914929413e52b18065eecbd19c38471bb24daf 100644 (file)
@@ -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
 
index 4c893f3bb67b896771ca69674ea20104f406116e..fa4c87735c5c0517b4b08a18288dbb39c124c2cf 100644 (file)
@@ -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