From f632510d2a8b96e25f529c9f408fa1bef9693557 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch
Date: Wed, 12 Jan 2022 10:58:06 +0100
Subject: Put reloading the image as its own action
---
fiv-view.c | 6 ++++++
fiv-view.h | 2 ++
fiv.c | 27 ++++++++++++++-------------
3 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/fiv-view.c b/fiv-view.c
index b8278ad..3a0b460 100644
--- a/fiv-view.c
+++ b/fiv-view.c
@@ -1064,11 +1064,14 @@ fiv_view_class_init(FivViewClass *klass)
bind(bs, GDK_KEY_plus, GDK_CONTROL_MASK, FIV_VIEW_COMMAND_ZOOM_IN);
bind(bs, GDK_KEY_minus, GDK_CONTROL_MASK, FIV_VIEW_COMMAND_ZOOM_OUT);
bind(bs, GDK_KEY_p, GDK_CONTROL_MASK, FIV_VIEW_COMMAND_PRINT);
+ bind(bs, GDK_KEY_r, GDK_CONTROL_MASK, FIV_VIEW_COMMAND_RELOAD);
bind(bs, GDK_KEY_s, GDK_CONTROL_MASK, FIV_VIEW_COMMAND_SAVE_PAGE);
bind(bs, GDK_KEY_s, GDK_MOD1_MASK, FIV_VIEW_COMMAND_SAVE_FRAME);
bind(bs, GDK_KEY_Return, GDK_MOD1_MASK, FIV_VIEW_COMMAND_INFO);
// The scale-to-fit binding is from gThumb, which has more such modes.
+ bind(bs, GDK_KEY_F5, 0, FIV_VIEW_COMMAND_RELOAD);
+ bind(bs, GDK_KEY_r, 0, FIV_VIEW_COMMAND_RELOAD);
bind(bs, GDK_KEY_plus, 0, FIV_VIEW_COMMAND_ZOOM_IN);
bind(bs, GDK_KEY_minus, 0, FIV_VIEW_COMMAND_ZOOM_OUT);
bind(bs, GDK_KEY_w, 0, FIV_VIEW_COMMAND_FIT_WIDTH);
@@ -1203,6 +1206,9 @@ fiv_view_command(FivView *self, FivViewCommand command)
return;
switch (command) {
+ break; case FIV_VIEW_COMMAND_RELOAD:
+ reload(self);
+
break; case FIV_VIEW_COMMAND_ROTATE_LEFT:
self->orientation = view_left[self->orientation];
gtk_widget_queue_resize(widget);
diff --git a/fiv-view.h b/fiv-view.h
index cec7093..54093b7 100644
--- a/fiv-view.h
+++ b/fiv-view.h
@@ -28,6 +28,8 @@ gboolean fiv_view_open(FivView *self, const gchar *uri, GError **error);
// And this is how you avoid glib-mkenums.
typedef enum _FivViewCommand {
#define FIV_VIEW_COMMANDS(XX) \
+ XX(FIV_VIEW_COMMAND_RELOAD, "reload") \
+ \
XX(FIV_VIEW_COMMAND_ROTATE_LEFT, "rotate-left") \
XX(FIV_VIEW_COMMAND_MIRROR, "mirror") \
XX(FIV_VIEW_COMMAND_ROTATE_RIGHT, "rotate-right") \
diff --git a/fiv.c b/fiv.c
index d188b25..69d6cb8 100644
--- a/fiv.c
+++ b/fiv.c
@@ -84,6 +84,7 @@ static struct key_group help_keys_browser[] = {
{"General", help_keys_general},
{"View", (struct key[]) {
{"F9", "Toggle navigation sidebar"},
+ {"F5 r