summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-20 17:36:53 +0300
committerPaul Buetow <paul@buetow.org>2026-07-20 17:36:53 +0300
commitd97ed0600618cd12159f10e0bcba300cbcaee2ab (patch)
tree365fb3665ce45df2613a5f705e283ba2075054b4 /src/window.c
parent7f9dc97115bb59b62b92f58c8fb01697f15e5a10 (diff)
window: open directories in the grid view (3u0) and stop late load forcing large
ggaze_window_open always set the stack to "large" and loaded the first image even for a directory argument, contradicting the documented folder-to-grid behavior. A directory arg now shows the populated thumbnail grid; a file arg still opens large on that image. _show_texture additionally forced the stack to "large" whenever an image finished loading, which yanked a just-opened folder back out of the grid the moment its first image decoded. Drop the forced stack switch — the caller already sets the right view (file-open/toggle/grid-activate set large; directory-open sets grid), so _show_texture only needs to update the viewer's texture.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/window.c b/src/window.c
index d978be3..e28ca0a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -448,8 +448,12 @@ _on_grid_activate(GgazeGrid *p_grid, gpointer p_data) {
static void
_show_texture(GgazeWindow *p_win, GdkTexture *p_tex) {
+ /* Only update the viewer's texture here; do NOT force the stack to "large".
+ * The stack is owned by the caller: file-open / toggle / grid-activate set
+ * "large" themselves before loading, and directory-open sets "grid".
+ * Forcing large here would yank a just-opened folder back out of the grid
+ * view the moment its first image finishes loading. */
ggaze_viewer_set_texture(GGAZE_VIEWER(p_win->p_viewer), p_tex);
- gtk_stack_set_visible_child_name(GTK_STACK(p_win->p_stack), "large");
}
/* Prefetch callback: just cache the result (never touches the viewer). p_data
@@ -740,7 +744,8 @@ ggaze_window_open(GgazeWindow *p_win, GFile *p_arg) {
GFile *p_start = NULL;
GFileType e_type =
g_file_query_file_type(p_arg, G_FILE_QUERY_INFO_NONE, NULL);
- if (e_type == G_FILE_TYPE_DIRECTORY) {
+ gboolean b_is_dir = (e_type == G_FILE_TYPE_DIRECTORY);
+ if (b_is_dir) {
p_dir = (GFile *)g_object_ref(p_arg);
} else {
p_dir = g_file_get_parent(p_arg);
@@ -780,7 +785,12 @@ ggaze_window_open(GgazeWindow *p_win, GFile *p_arg) {
gtk_stack_add_named(GTK_STACK(p_win->p_stack), GTK_WIDGET(p_win->p_grid),
"grid");
- gtk_stack_set_visible_child_name(GTK_STACK(p_win->p_stack), "large");
+ /* Folder arg → start in the thumbnail grid (folder-to-grid behavior,
+ * docs/ui-and-interactions.md 33-47); file arg → large view on that image.
+ * _load_current is run either way so the large view is ready when toggled.
+ */
+ gtk_stack_set_visible_child_name(GTK_STACK(p_win->p_stack),
+ b_is_dir ? "grid" : "large");
_load_current(p_win);
}