Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/ev-view.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2005-01-11 00:39:16 (GMT)
committer Marco Pesenti Gritti <marco@src.gnome.org>2005-01-11 00:39:16 (GMT)
commitff47948e26ca64f7f4897299a38858594ce39ed0 (patch)
tree0f3ee3608b7215f7eb492a33f9aa30784962cbd1 /shell/ev-view.c
parenta84947db66adf65becd125e65c208bb87a639766 (diff)
Fix several history bugs
2005-01-11 Marco Pesenti Gritti <marco@gnome.org> * shell/ev-history.c: (ev_history_init), (ev_history_add_link): * shell/ev-view.c: (ev_view_set_document), (ev_view_go_back), (ev_view_go_forward): * shell/ev-window.c: (register_custom_actions): Fix several history bugs
Diffstat (limited to 'shell/ev-view.c')
-rw-r--r--shell/ev-view.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/shell/ev-view.c b/shell/ev-view.c
index 2b04c87..cf2c469 100644
--- a/shell/ev-view.c
+++ b/shell/ev-view.c
@@ -910,6 +910,7 @@ ev_view_set_document (EvView *view,
g_object_unref (view->history);
}
view->history = ev_history_new ();
+ ev_history_add_page (view->history, ev_view_get_page (view));
}
}
@@ -964,15 +965,18 @@ go_to_index (EvView *view, int index)
void
ev_view_go_back (EvView *view)
{
- int index;
+ int index, n;
g_return_if_fail (EV_IS_HISTORY (view->history));
index = ev_history_get_current_index (view->history);
- index = MAX (0, index - 1);
+ n = ev_history_get_n_links (view->history);
- ev_history_set_current_index (view->history, index);
- go_to_index (view, index);
+ if (n > 0) {
+ index = MAX (0, index - 1);
+ ev_history_set_current_index (view->history, index);
+ go_to_index (view, index);
+ }
}
void
@@ -985,10 +989,11 @@ ev_view_go_forward (EvView *view)
index = ev_history_get_current_index (view->history);
n = ev_history_get_n_links (view->history);
- index = MIN (n - 1, index + 1);
-
- ev_history_set_current_index (view->history, index);
- go_to_index (view, index);
+ if (n > 0) {
+ index = MIN (n - 1, index + 1);
+ ev_history_set_current_index (view->history, index);
+ go_to_index (view, index);
+ }
}