summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlof-Joachim Frahm <Olof.Frahm@web.de>2011-09-29 15:37:23 +0200
committerOlof-Joachim Frahm <Olof.Frahm@web.de>2011-09-29 15:37:23 +0200
commit0bab331e21a046a1ec775f188feadd300c9a57f8 (patch)
tree17a5746e6879d2341843a8ddae470c8e9d0dca74
parent88c1d182b11c442cf8c0930e682b7ad571e9212d (diff)
Thumbnail view now allows to execute actions.
Only if a previously selected item (mouse over, keyboard) is available though.
-rw-r--r--src/keyevents.c19
-rw-r--r--src/thumbnail.c7
-rw-r--r--src/thumbnail.h1
3 files changed, 23 insertions, 4 deletions
diff --git a/src/keyevents.c b/src/keyevents.c
index 827ab24..64194da 100644
--- a/src/keyevents.c
+++ b/src/keyevents.c
@@ -345,10 +345,21 @@ void feh_event_invoke_action(winwidget winwid, unsigned char action)
feh_reload_image(winwid, 1, 1);
else
winwidget_destroy(winwid);
- } else if (winwid->type == WIN_TYPE_THUMBNAIL)
- fputs("actions from the main thumb window aren't currently supported!\n"
- "For now, open the image to perform the action on it.\n",
- stdout);
+ } else if (winwid->type == WIN_TYPE_THUMBNAIL) {
+ feh_file *thumbfile;
+ /* also see events.c:306 */
+ thumbfile = feh_thumbnail_get_selected_file();
+
+ if (thumbfile) {
+ feh_action_run(thumbfile, opt.actions[action]);
+
+ /* so, reload/regenerate the thumbnail here? */
+ if (!opt.hold_actions[action])
+ winwidget_destroy(winwid);
+ }
+ else
+ fputs("no thumbnail selected\n", stderr);
+ }
}
return;
}
diff --git a/src/thumbnail.c b/src/thumbnail.c
index 16dbcf3..033fd85 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -1005,6 +1005,13 @@ inline void feh_thumbnail_show_selected()
feh_thumbnail_show_fullsize(td.selected->file);
}
+inline feh_file* feh_thumbnail_get_selected_file()
+{
+ if (td.selected)
+ return td.selected->file;
+ return NULL;
+}
+
int feh_thumbnail_setup_thumbnail_dir(void)
{
int status = 0;
diff --git a/src/thumbnail.h b/src/thumbnail.h
index a70b603..9b95726 100644
--- a/src/thumbnail.h
+++ b/src/thumbnail.h
@@ -86,6 +86,7 @@ void feh_thumbnail_select(winwidget winwid, feh_thumbnail *thumbnail);
void feh_thumbnail_select_next(winwidget winwid, int jump);
void feh_thumbnail_select_prev(winwidget winwid, int jump);
void feh_thumbnail_show_selected();
+feh_file *feh_thumbnail_get_selected_file();
int feh_thumbnail_setup_thumbnail_dir(void);