[gnome-builder] devhelp: Add previous/next history page shortcuts



commit 8c298f6fa418e66b8ccde72a9f5aeadc82dc9c1b
Author: vanadiae <vanadiae35 gmail com>
Date:   Mon Aug 2 15:54:16 2021 +0200

    devhelp: Add previous/next history page shortcuts
    
    The same as what we have in nautilus/epiphany.

 src/plugins/devhelp/gbp-devhelp-page.c | 46 ++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
---
diff --git a/src/plugins/devhelp/gbp-devhelp-page.c b/src/plugins/devhelp/gbp-devhelp-page.c
index 20f035118..1d19c6dc8 100644
--- a/src/plugins/devhelp/gbp-devhelp-page.c
+++ b/src/plugins/devhelp/gbp-devhelp-page.c
@@ -164,6 +164,30 @@ gbp_devhelp_page_get_property (GObject    *object,
     }
 }
 
+static void
+gbp_devhelp_page_actions_history_next (GSimpleAction *action,
+                                       GVariant      *param,
+                                       gpointer       user_data)
+{
+  GbpDevhelpPage *self = (GbpDevhelpPage *)user_data;
+
+  g_assert (GBP_IS_DEVHELP_PAGE (self));
+
+  webkit_web_view_go_forward (self->web_view);
+}
+
+static void
+gbp_devhelp_page_actions_history_previous (GSimpleAction *action,
+                                           GVariant      *param,
+                                           gpointer       user_data)
+{
+  GbpDevhelpPage *self = (GbpDevhelpPage *)user_data;
+
+  g_assert (GBP_IS_DEVHELP_PAGE (self));
+
+  webkit_web_view_go_back (self->web_view);
+}
+
 static void
 gbp_devhelp_page_actions_reveal_search (GSimpleAction *action,
                                         GVariant      *param,
@@ -310,6 +334,8 @@ setup_webview (WebKitWebView *web_view)
 static const GActionEntry actions[] = {
   { "print", gbp_devhelp_page_actions_print },
   { "reveal-search", gbp_devhelp_page_actions_reveal_search },
+  { "history-next", gbp_devhelp_page_actions_history_next },
+  { "history-previous", gbp_devhelp_page_actions_history_previous },
 };
 
 static void
@@ -365,4 +391,24 @@ gbp_devhelp_page_init (GbpDevhelpPage *self)
                                               "<Primary>f",
                                               DZL_SHORTCUT_PHASE_CAPTURE | DZL_SHORTCUT_PHASE_GLOBAL,
                                               I_("devhelp-view.reveal-search"));
+  dzl_shortcut_controller_add_command_action (controller,
+                                              I_("org.gnome.builder.devhelp-view.history-next"),
+                                              "<Alt>Right",
+                                              DZL_SHORTCUT_PHASE_CAPTURE | DZL_SHORTCUT_PHASE_GLOBAL,
+                                              I_("devhelp-view.history-next"));
+  dzl_shortcut_controller_add_command_action (controller,
+                                              I_("org.gnome.builder.devhelp-view.history-previous"),
+                                              "<Alt>Left",
+                                              DZL_SHORTCUT_PHASE_CAPTURE | DZL_SHORTCUT_PHASE_GLOBAL,
+                                              I_("devhelp-view.history-previous"));
+  dzl_shortcut_controller_add_command_action (controller,
+                                              I_("org.gnome.builder.devhelp-view.history-next"),
+                                              "<Alt>KP_Right",
+                                              DZL_SHORTCUT_PHASE_CAPTURE | DZL_SHORTCUT_PHASE_GLOBAL,
+                                              I_("devhelp-view.history-next"));
+  dzl_shortcut_controller_add_command_action (controller,
+                                              I_("org.gnome.builder.devhelp-view.history-previous"),
+                                              "<Alt>KP_Left",
+                                              DZL_SHORTCUT_PHASE_CAPTURE | DZL_SHORTCUT_PHASE_GLOBAL,
+                                              I_("devhelp-view.history-previous"));
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]