From 89727590e718d3628a0847689182e896df646b8a Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 12 Jul 2026 21:13:45 +0300 Subject: walkdir: navigator, shortcuts, window wiring, drop target, tests (ht0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit M2 (task ht0): walk the directory. - src/navigator.{c,h}: GObject (no GtkWidget) holding the folder listing — image-MIME filter + extension fallback, hide-RAW-sidecars (decision #33), sort name/time/size, cursor + prev/next/wrap, path-based marks (survive re-sort, pruned on rescan/monitor, cleared on remove), nearest-fallback, GFileMonitor debounced 250ms (decision #28), 'changed' signal. 92% gcov. - src/shortcuts.{c,h}: GtkShortcutController (MANAGED) binding h/l/Left/Right/ g/G/o/q to win.* actions; one table all milestones add to. - src/window.{c,h}: open file->parent+current / folder->first; h/l/g/G actions -> nav -> load -> viewer; single GCancellable last-write-wins (g_file_equal guard for M3 async); header title 'filename · n/total'; GtkDropTarget (GDK_TYPE_FILE_LIST, many->first, decision Z); GtkFileDialog open. - data/gschema: add hide-raw-sidecars key. - tests: unit test_navigator (12 subtests), integration test_walk_folder (temp fixtures walk + ./sample-images skip-if-absent). 8/8 green; ASan clean (GIO_USE_VFS=local in fixtures_env). Fixed during this milestone: a UAF (borrowed c_name used after unref), a cancellable double-ref leak, time::modified UINT64 vs INT64, and several test-harness leaks. Sub-agent review issues addressed (mark pruning on rescan/monitor, remove-before-cursor test, recursive temp-dir cleanup, callback _cb naming, connect-before-mutate). --- src/loader/detect.h | 18 +++++++++--------- src/loader/loader.h | 3 +-- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/loader') diff --git a/src/loader/detect.h b/src/loader/detect.h index 95e549c..77c64da 100644 --- a/src/loader/detect.h +++ b/src/loader/detect.h @@ -19,15 +19,15 @@ G_BEGIN_DECLS typedef enum { GGAZE_FMT_UNKNOWN = 0, - GGAZE_FMT_JPEG, /* FF D8 FF */ - GGAZE_FMT_PNG, /* 89 50 4E 47 0D 0A 1A 0A */ - GGAZE_FMT_GIF, /* "GIF8" */ - GGAZE_FMT_WEBP, /* RIFF .... WEBP */ - GGAZE_FMT_TIFF, /* II 2A 00 | MM 00 2A */ - GGAZE_FMT_ICO, /* 00 00 01 00 */ - GGAZE_FMT_JXL, /* FF 0A | "....JXL " container */ - GGAZE_FMT_AVIF, /* ftyp avif/avis */ - GGAZE_FMT_HEIF /* ftyp heic/heix/mif1 */ + GGAZE_FMT_JPEG, /* FF D8 FF */ + GGAZE_FMT_PNG, /* 89 50 4E 47 0D 0A 1A 0A */ + GGAZE_FMT_GIF, /* "GIF8" */ + GGAZE_FMT_WEBP, /* RIFF .... WEBP */ + GGAZE_FMT_TIFF, /* II 2A 00 | MM 00 2A */ + GGAZE_FMT_ICO, /* 00 00 01 00 */ + GGAZE_FMT_JXL, /* FF 0A | "....JXL " container */ + GGAZE_FMT_AVIF, /* ftyp avif/avis */ + GGAZE_FMT_HEIF /* ftyp heic/heix/mif1 */ } GgazeFormat; /* Sniff p_head (u_len bytes) and return the detected format. Never reads diff --git a/src/loader/loader.h b/src/loader/loader.h index 0795097..5b5c5e6 100644 --- a/src/loader/loader.h +++ b/src/loader/loader.h @@ -27,8 +27,7 @@ G_BEGIN_DECLS * registered with the loader at link time. */ typedef struct { gboolean (*can_load)(const guint8 *p_head, gsize u_len); - GdkTexture *(*load)(GFile *p_file, GCancellable *p_cancel, - GError **p_err); + GdkTexture *(*load)(GFile *p_file, GCancellable *p_cancel, GError **p_err); } GgazeLoaderBackend; /* Backends register a const instance; the dispatcher (loader.c) iterates -- cgit v1.2.3