[epiphany/mcatanzaro/#661] Improve shortcuts for reload bypassing cache
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/mcatanzaro/#661] Improve shortcuts for reload bypassing cache
- Date: Mon, 4 Feb 2019 18:11:24 +0000 (UTC)
commit 05c6c451b391727972380af9747d406a47ddf4d6
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Mon Feb 4 12:05:16 2019 -0600
Improve shortcuts for reload bypassing cache
We'll reclaim Ctrl+Shift+R for reload bypassing cache, like all other
browsers, and use Ctrl+Alt+R for reader mode, matching Firefox.
Fixes #661
src/ephy-window.c | 6 +++--
src/resources/gtk/shortcuts-dialog.ui | 9 +++++++-
src/window-commands.c | 43 ++++++++++++++---------------------
src/window-commands.h | 3 +++
4 files changed, 32 insertions(+), 29 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index b3893bf31..033b88bdc 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -104,7 +104,7 @@ const struct {
{ "win.encoding", { NULL } },
{ "win.page-source", { "<Primary>U", NULL } },
{ "win.toggle-inspector", { "<shift><Primary>I", "F12", NULL } },
- { "win.toggle-reader-mode", { "<shift><Primary>r", NULL } },
+ { "win.toggle-reader-mode", { "<alt><Primary>r", NULL } },
{ "win.select-all", { "<Primary>A", NULL } },
@@ -119,7 +119,8 @@ const struct {
/* Navigation */
{ "toolbar.stop", { "Escape", "Stop", NULL } },
- { "toolbar.reload", { "<Primary>R", "<shift><Primary>R", "F5", "<Primary>F5", "<shift>F5",
"<shift><Primary>F5", "Refresh", "Reload", NULL } },
+ { "toolbar.reload", { "<Primary>R", "F5", "Refresh", "Reload", NULL } },
+ { "toolbar.reload-bypass-cache", { "<shift><Primary>R", "<shift>F5" } },
{ "toolbar.combined-stop-reload", { NULL } },
/* Tabs */
@@ -863,6 +864,7 @@ static const GActionEntry toolbar_entries [] = {
{ "stop", window_cmd_stop },
{ "reload", window_cmd_reload },
+ { "reload-bypass-cache", window_cmd_reload_bypass_cache },
{ "always-stop", window_cmd_stop },
{ "combined-stop-reload", window_cmd_combined_stop_reload, NULL, "false",
change_combined_stop_reload_state }
};
diff --git a/src/resources/gtk/shortcuts-dialog.ui b/src/resources/gtk/shortcuts-dialog.ui
index da2a6636f..536b1e7c3 100644
--- a/src/resources/gtk/shortcuts-dialog.ui
+++ b/src/resources/gtk/shortcuts-dialog.ui
@@ -91,6 +91,13 @@
<property name="accelerator">F5 <Primary>R</property>
</object>
</child>
+ <child>
+ <object class="GtkShortcutsShortcut">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes" context="shortcut window">Reload bypassing
cache</property>
+ <property name="accelerator"><shift>F5 <shift><Primary>R</property>
+ </object>
+ </child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
@@ -259,7 +266,7 @@
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
<property name="title" translatable="yes" context="shortcut window">Toggle reader
mode</property>
- <property name="accelerator"><shift><Primary>R</property>
+ <property name="accelerator"><alt><Primary>R</property>
</object>
</child>
</object>
diff --git a/src/window-commands.c b/src/window-commands.c
index ba230af99..7ae990063 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -746,49 +746,40 @@ window_cmd_stop (GSimpleAction *action,
webkit_web_view_stop_loading (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed));
}
-static gboolean
-event_with_shift (void)
+void
+window_cmd_reload (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
- GdkEvent *event;
- GdkEventType type = 0;
- guint state = 0;
-
- event = gtk_get_current_event ();
- if (event) {
- type = event->type;
+ EphyWindow *window = EPHY_WINDOW (user_data);
+ EphyEmbed *embed;
+ WebKitWebView *view;
- if (type == GDK_BUTTON_RELEASE) {
- state = event->button.state;
- } else if (type == GDK_KEY_PRESS || type == GDK_KEY_RELEASE) {
- state = event->key.state;
- }
+ embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+ g_assert (embed != NULL);
- gdk_event_free (event);
- }
+ gtk_widget_grab_focus (GTK_WIDGET (embed));
- return (state & GDK_SHIFT_MASK) != 0;
+ view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
+ webkit_web_view_reload (view);
}
void
-window_cmd_reload (GSimpleAction *action,
- GVariant *parameter,
- gpointer user_data)
+window_cmd_reload_bypass_cache (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
EphyWindow *window = EPHY_WINDOW (user_data);
EphyEmbed *embed;
WebKitWebView *view;
- embed = ephy_embed_container_get_active_child
- (EPHY_EMBED_CONTAINER (window));
+ embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
g_assert (embed != NULL);
gtk_widget_grab_focus (GTK_WIDGET (embed));
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
- if (event_with_shift ())
- webkit_web_view_reload_bypass_cache (view);
- else
- webkit_web_view_reload (view);
+ webkit_web_view_reload_bypass_cache (view);
}
void window_cmd_combined_stop_reload (GSimpleAction *action,
diff --git a/src/window-commands.h b/src/window-commands.h
index 0e8ad4a54..b60495ab8 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -71,6 +71,9 @@ void window_cmd_stop (GSimpleAction *action,
void window_cmd_reload (GSimpleAction *action,
GVariant *parameter,
gpointer user_data);
+void window_cmd_reload_bypass_cache (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
void window_cmd_combined_stop_reload (GSimpleAction *action,
GVariant *parameter,
gpointer user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]