Commit 2c8870e4 authored by Anuj Khare's avatar Anuj Khare Committed by Carlos Garcia Campos

Add keybindings to go back/forward in history

<alt>P to go back in history
<alt>N to go forward in history

Based on Spandana's patch.

https://bugzilla.gnome.org/show_bug.cgi?id=509029
parent 8ff63b36
......@@ -4609,6 +4609,22 @@ ev_window_cmd_view_zoom_out (GtkAction *action, EvWindow *ev_window)
ev_view_zoom_out (EV_VIEW (ev_window->priv->view));
}
static void
ev_window_cmd_go_back_history (GtkAction* action, EvWindow *ev_window)
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
ev_history_go_back(ev_window->priv->history);
}
static void
ev_window_cmd_go_forward_history (GtkAction* action, EvWindow* ev_window)
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
ev_history_go_forward(ev_window->priv->history);
}
static void
ev_window_cmd_go_previous_page (GtkAction *action, EvWindow *ev_window)
{
......@@ -6063,6 +6079,10 @@ static const GtkActionEntry entries[] = {
G_CALLBACK (ev_window_cmd_view_autoscroll) },
/* Go menu */
{ "GoBackHistory", NULL, "", "<alt>P", NULL,
G_CALLBACK (ev_window_cmd_go_back_history) },
{ "GoForwardHistory", NULL, "", "<alt>N", NULL,
G_CALLBACK (ev_window_cmd_go_forward_history) },
{ "GoPreviousPage", "go-up-symbolic", N_("_Previous Page"), "<control>Page_Up",
N_("Go to the previous page"),
G_CALLBACK (ev_window_cmd_go_previous_page) },
......@@ -6230,6 +6250,14 @@ activate_link_cb (GObject *object, EvLink *link, EvWindow *window)
gtk_widget_grab_focus (window->priv->view);
}
static void
history_changed_cb (EvHistory *history,
EvWindow *window)
{
ev_window_set_action_sensitive (window, "GoBackHistory", ev_history_can_go_back (window->priv->history));
ev_window_set_action_sensitive (window, "GoForwardHistory", ev_history_can_go_forward (window->priv->history));
}
static void
sidebar_layers_visibility_changed (EvSidebarLayers *layers,
EvWindow *window)
......@@ -7336,6 +7364,9 @@ ev_window_init (EvWindow *ev_window)
g_signal_connect (ev_window->priv->history, "activate-link",
G_CALLBACK (activate_link_cb),
ev_window);
g_signal_connect (ev_window->priv->history, "changed",
G_CALLBACK (history_changed_cb),
ev_window);
app_info = g_app_info_get_default_for_uri_scheme ("mailto");
ev_window->priv->has_mailto_handler = app_info != NULL;
......
......@@ -89,6 +89,8 @@
<placeholder name="ViewZoomItems"/>
</popup>
<accelerator name="BackHistoryAccel" action="GoBackHistory"/>
<accelerator name="ForwardHistoryAccel" action="GoForwardHistory"/>
<accelerator name="PageDownAccel" action="PageDown"/>
<accelerator name="PageUpAccel" action="PageUp"/>
<accelerator name="GoBackwardFastAccel" action="GoBackwardFast"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment