Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
thumbnail_notify.h
Go to the documentation of this file.
1/*
2 * This file is part of Ansel,
3 * Copyright (C) 2026 Aurélien PIERRE.
4 *
5 * Ansel is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * Ansel is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with Ansel. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef DT_COMMON_THUMBNAIL_NOTIFY_H
20#define DT_COMMON_THUMBNAIL_NOTIFY_H
21
22#include <glib.h>
23#include <stdint.h>
24
25/* "This image's rendered thumbnail is stale" -- announced by the backend, acted on by
26 * whoever is displaying thumbnails.
27 *
28 * The backend paths that invalidate a thumbnail (common/image.c, common/history.c) used
29 * to call dt_thumbtable_refresh_thumbnail() on dt_gui_get_ui()'s two thumbtables
30 * directly. That is common/ (layer 1) reaching into gui/ (layer 4): the bottom layer
31 * deciding that a widget should repaint.
32 *
33 * Routing it through control/'s signals would not fix that -- it only trades a
34 * common -> gui edge for a common -> control one. So the dependency is inverted instead:
35 * common/ declares the handler type and owns the slot, and the GUI REGISTERS itself at
36 * startup (gui/gtk.c). Nothing here includes anything from gui/.
37 *
38 * With no handler registered -- ansel-cli, ansel-generate-cache, any headless run -- the
39 * notification is a no-op. That is also why the callers no longer need their own
40 * "is there a GUI?" guard.
41 *
42 * Threading: the handler is set once during GUI init, before any worker thread can run a
43 * path that notifies, and never cleared. Handlers must be safe to invoke from whatever
44 * thread mutated the image -- dt_thumbtable_refresh_thumbnail() already marshals to the
45 * GUI thread itself.
46 */
47typedef void (*dt_thumbnail_refresh_handler_t)(int32_t imgid, gboolean refresh_filmstrip);
48
52
60void dt_thumbnail_notify_image_changed(int32_t imgid, gboolean refresh_filmstrip);
61
62#endif // DT_COMMON_THUMBNAIL_NOTIFY_H
typedef void((*dt_cache_allocate_t)(void *userdata, dt_cache_entry_t *entry))
void dt_thumbnail_notify_image_changed(int32_t imgid, gboolean refresh_filmstrip)
void(* dt_thumbnail_refresh_handler_t)(int32_t imgid, gboolean refresh_filmstrip)
void dt_thumbnail_notify_set_handler(dt_thumbnail_refresh_handler_t handler)