aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-10 03:13:33 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-10 03:20:40 +0100
commit0cda41732fb58aaf18e8743a3f832b137b32412a (patch)
tree47835fef302ad4fa01ee7ee86a26b23fec03350e
parentffda836a15c158872a15ec3c05a139e56c08f46d (diff)
downloadfiv-0cda41732fb58aaf18e8743a3f832b137b32412a.tar.gz
fiv-0cda41732fb58aaf18e8743a3f832b137b32412a.tar.xz
fiv-0cda41732fb58aaf18e8743a3f832b137b32412a.zip
Add C-n to open a new instance in the directory
Also, improve error messages when opening a file fails.
-rw-r--r--fastiv.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fastiv.c b/fastiv.c
index 7266212..a8af8dd 100644
--- a/fastiv.c
+++ b/fastiv.c
@@ -145,7 +145,10 @@ open(const gchar *path)
GError *error = NULL;
if (!fastiv_view_open(FASTIV_VIEW(g.view), path, &error)) {
+ char *base = g_filename_display_basename(path);
+ g_prefix_error(&error, "%s: ", base);
show_error_dialog(error);
+ g_free(base);
return;
}
@@ -253,6 +256,14 @@ on_key_press(G_GNUC_UNUSED GtkWidget *widget, GdkEvent *event,
case GDK_KEY_o:
on_open();
return TRUE;
+ case GDK_KEY_n: {
+ char *argv[] = {PROJECT_NAME, g.directory, NULL};
+ GError *error = NULL;
+ g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL,
+ NULL, &error);
+ g_clear_error(&error);
+ return TRUE;
+ }
}
break;
case 0: