+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
+
2005-01-11 Kjartan Maraas <kmaraas@gnome.org>
* configure.ac: Add «nb» to ALL_LINGUAS.
history->priv = EV_HISTORY_GET_PRIVATE (history);
history->priv->links = NULL;
+ history->priv->current_index = -1;
}
static void
g_return_if_fail (EV_IS_HISTORY (history));
g_return_if_fail (EV_IS_LINK (link));
+ length = g_list_length (history->priv->links);
+ if (history->priv->current_index < length - 1) {
+ GList *l = g_list_nth (history->priv->links,
+ history->priv->current_index + 1);
+
+ if (l->prev) {
+ l->prev->next = NULL;
+ free_links_list (l);
+ } else {
+ free_links_list (history->priv->links);
+ history->priv->links = NULL;
+ }
+ }
+
g_object_ref (link);
history->priv->links = g_list_append (history->priv->links,
link);
length = g_list_length (history->priv->links);
history->priv->current_index = length - 1;
-
- g_print ("Set current\n");
}
void
g_object_unref (view->history);
}
view->history = ev_history_new ();
+ ev_history_add_page (view->history, ev_view_get_page (view));
}
}
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
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);
+ }
}
"direction", EV_NAVIGATION_DIRECTION_FORWARD,
NULL);
g_signal_connect (action, "activate",
- G_CALLBACK (ev_window_cmd_go_back), window);
+ G_CALLBACK (ev_window_cmd_go_forward), window);
gtk_action_group_add_action (group, action);
g_object_unref (action);