[gnome-builder/wip/gtk4-port: 1352/1774] plugins/web-browser: implement reload action
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 1352/1774] plugins/web-browser: implement reload action
- Date: Mon, 11 Jul 2022 22:31:43 +0000 (UTC)
commit 1d1e393b789a1a4b05758290523f9648da206064
Author: Christian Hergert <chergert redhat com>
Date: Fri Jun 3 15:56:13 2022 -0700
plugins/web-browser: implement reload action
This needs to be global so we can apply the shortcut no matter where the
focus is (for the current page, if it's a browser).
.../web-browser/gbp-web-browser-workspace-addin.c | 33 ++++++++++++++++++++++
1 file changed, 33 insertions(+)
---
diff --git a/src/plugins/web-browser/gbp-web-browser-workspace-addin.c
b/src/plugins/web-browser/gbp-web-browser-workspace-addin.c
index 7725bee67..adca17c9a 100644
--- a/src/plugins/web-browser/gbp-web-browser-workspace-addin.c
+++ b/src/plugins/web-browser/gbp-web-browser-workspace-addin.c
@@ -38,10 +38,13 @@ static void web_browser_new_page_action (GbpWebBrowserWorkspaceAddin *self,
GVariant *param);
static void web_browser_focus_address_action (GbpWebBrowserWorkspaceAddin *self,
GVariant *param);
+static void web_browser_reload_action (GbpWebBrowserWorkspaceAddin *self,
+ GVariant *param);
IDE_DEFINE_ACTION_GROUP (GbpWebBrowserWorkspaceAddin, gbp_web_browser_workspace_addin, {
{ "new-page", web_browser_new_page_action },
{ "focus-address", web_browser_focus_address_action },
+ { "reload", web_browser_reload_action, "b" },
})
G_DEFINE_FINAL_TYPE_WITH_CODE (GbpWebBrowserWorkspaceAddin, gbp_web_browser_workspace_addin, G_TYPE_OBJECT,
@@ -145,3 +148,33 @@ web_browser_focus_address_action (GbpWebBrowserWorkspaceAddin *self,
IDE_EXIT;
}
+
+static void
+web_browser_reload_action (GbpWebBrowserWorkspaceAddin *self,
+ GVariant *param)
+{
+ IdePage *page;
+ gboolean ignore_cache;
+
+ IDE_ENTRY;
+
+ g_assert (GBP_IS_WEB_BROWSER_WORKSPACE_ADDIN (self));
+ g_assert (param != NULL);
+ g_assert (g_variant_is_of_type (param, G_VARIANT_TYPE_BOOLEAN));
+ g_assert (IDE_IS_WORKSPACE (self->workspace));
+
+ if (!(page = ide_workspace_get_most_recent_page (self->workspace)))
+ IDE_EXIT;
+
+ if (!IDE_IS_WEBKIT_PAGE (page))
+ IDE_EXIT;
+
+ ignore_cache = g_variant_get_boolean (param);
+
+ if (ignore_cache)
+ ide_webkit_page_reload_ignoring_cache (IDE_WEBKIT_PAGE (page));
+ else
+ ide_webkit_page_reload (IDE_WEBKIT_PAGE (page));
+
+ IDE_EXIT;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]