aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas Cornu <ncornu@aldebaran.com>2017-03-06 16:44:39 +0100
committerNicolas Cornu <ncornu@aldebaran.com>2017-03-06 16:46:33 +0100
commitffffb53a1d2c21fa5334b78a1f2bf0b440ebbeb6 (patch)
treed3aa4cd11ff9671dc2cfe0d89677f95f2892798e /src
parentf489b0363b059aa7161d2a92a98c2dc8c067b8a8 (diff)
downloadimv-ffffb53a1d2c21fa5334b78a1f2bf0b440ebbeb6.tar.gz
Add command 'X' to remove image from disk too
Diffstat (limited to 'src')
-rw-r--r--src/main.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index a8396aa..1e3df67 100644
--- a/src/main.c
+++ b/src/main.c
@@ -417,7 +417,17 @@ int main(int argc, char** argv)
break;
case SDLK_x:
if(!e.key.repeat) {
- imv_navigator_remove(&nav, imv_navigator_selection(&nav));
+ char* path = strdup(imv_navigator_selection(&nav));
+ imv_navigator_remove(&nav, path);
+
+ if (SDL_GetModState() & KMOD_SHIFT) {
+ if (remove(path)) {
+ fprintf(stderr, "Warning: can't remove %s from disk.\n", path);
+ }
+ }
+
+ free(path);
+
/* reset slideshow delay */
delay_msec = 0;
}