aboutsummaryrefslogtreecommitdiff
path: root/fastiv.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-20 13:03:30 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-20 13:04:26 +0100
commit2b8350ecebec5cca5edd25951bdb3f0c0b8ee4b5 (patch)
tree77030fea62c39aecffe2d3b6c3026e7dfba7f34b /fastiv.c
parent75994cd85aa6d207d8867f03ec3759de0b435b23 (diff)
downloadfiv-2b8350ecebec5cca5edd25951bdb3f0c0b8ee4b5.tar.gz
fiv-2b8350ecebec5cca5edd25951bdb3f0c0b8ee4b5.tar.xz
fiv-2b8350ecebec5cca5edd25951bdb3f0c0b8ee4b5.zip
Fix some issues with browser/view switching
Diffstat (limited to 'fastiv.c')
-rw-r--r--fastiv.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fastiv.c b/fastiv.c
index f37e9f8..7524021 100644
--- a/fastiv.c
+++ b/fastiv.c
@@ -146,6 +146,10 @@ load_directory(const gchar *dirname)
// XXX: When something outside the filtered entries is open, the index is
// kept at -1, and browsing doesn't work. How to behave here?
// Should we add it to the pointer array as an exception?
+ if (dirname) {
+ gtk_stack_set_visible_child(GTK_STACK(g.stack), g.browser_paned);
+ gtk_widget_grab_focus(g.browser_scroller);
+ }
}
static void
@@ -168,9 +172,6 @@ open(const gchar *path)
g_free(uri);
}
- gtk_window_set_title(GTK_WINDOW(g.window), path);
- gtk_stack_set_visible_child(GTK_STACK(g.stack), g.view_scroller);
-
gchar *basename = g_path_get_basename(path);
g_free(g.basename);
g.basename = basename;
@@ -187,6 +188,9 @@ open(const gchar *path)
}
}
g_free(dirname);
+
+ gtk_window_set_title(GTK_WINDOW(g.window), path);
+ gtk_stack_set_visible_child(GTK_STACK(g.stack), g.view_scroller);
}
static GtkWidget *
@@ -298,14 +302,7 @@ open_any_path(const char *path)
load_directory(canonical);
else
open(canonical);
-
g_free(canonical);
- if (g.files_index < 0) {
- gtk_stack_set_visible_child(GTK_STACK(g.stack), g.browser_paned);
- gtk_widget_grab_focus(g.browser_scroller);
- } else {
- gtk_stack_set_visible_child(GTK_STACK(g.stack), g.view_scroller);
- }
return success;
}