summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-07-20 17:36:28 +0300
committerPaul Buetow <paul@buetow.org>2026-07-20 17:36:28 +0300
commit7f9dc97115bb59b62b92f58c8fb01697f15e5a10 (patch)
tree7cd49219664d7b1ba895f96fd406b81aac2c8f8c /src/window.c
parentf4eea795c070e5ddca183bc6ff2e4199e39a5cd1 (diff)
grid: sync flowbox selection to navigator.current on Enter/t (cu0)
Arrow-key navigation in the grid moved the GtkFlowBox selection but never updated navigator.current, so Enter (and toggling to large with t) opened the stale current image instead of the highlighted one. _on_flow_key emitted the activate signal directly without syncing, unlike the double-click path (_on_child_activated) which does sync. Add ggaze_grid_sync_current(): reads the selected flowbox child and calls navigator_set_current_file. Call it from _on_flow_key before emitting activate, and from _action_toggle_view's grid→large branch (then load the now-current image). Mirrors the existing double-click sync.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/window.c b/src/window.c
index 688f879..d978be3 100644
--- a/src/window.c
+++ b/src/window.c
@@ -243,7 +243,13 @@ _action_toggle_view(GSimpleAction *p_a, GVariant *p_v, gpointer p_data) {
if (g_strcmp0(c_cur, "large") == 0) {
gtk_stack_set_visible_child_name(GTK_STACK(p_win->p_stack), "grid");
} else {
+ /* Leaving the grid: sync navigator.current to the highlighted cell so
+ * the large view opens the selected image, then load it. */
+ if (p_win->p_grid != NULL) {
+ ggaze_grid_sync_current(p_win->p_grid);
+ }
gtk_stack_set_visible_child_name(GTK_STACK(p_win->p_stack), "large");
+ _load_current(p_win);
}
}