Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
metadata/notify.c
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#include "metadata/notify.h"
20
21#include "system/mem_alloc.h"
22
23#include <stdarg.h>
24
25/* Written once, at startup, before any worker exists; read from whichever thread raises a
26 * message. A lock would be guarding against a race nobody can create. */
29
34
35void dt_metadata_notify(const dt_metadata_notice_t kind, const char *format, ...)
36{
38 if(handler == NULL) return; // headless, or a unit test: nothing to tell
39
40 va_list args;
41 va_start(args, format);
42 gchar *message = g_strdup_vprintf(format, args);
43 va_end(args);
44
45 if(message)
46 {
47 handler(kind, message);
48 dt_free(message);
49 }
50}
51
56
62
64
69
75
76// clang-format off
77// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
78// vim: shiftwidth=2 expandtab tabstop=2 cindent
79// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
80// clang-format on
static const dt_adaptation_t kind
#define dt_free(ptr)
Definition mem_alloc.h:97
void dt_metadata_geotags_changed(const GList *imgs)
void dt_metadata_set_geotags_changed_handler(dt_metadata_geotags_changed_handler_t handler)
void dt_metadata_set_tags_changed_handler(dt_metadata_tags_changed_handler_t handler)
static dt_metadata_tags_changed_handler_t _tags_changed_handler
void dt_metadata_set_notify_handler(dt_metadata_notify_handler_t handler)
Install the handler, or NULL to remove it. Messages raised with none installed are dropped.
static dt_metadata_geotags_changed_handler_t _geotags_changed_handler
static dt_metadata_notify_handler_t _handler
void dt_metadata_tags_changed(void)
Raise it. Internal to the module.
void dt_metadata_notify(const dt_metadata_notice_t kind, const char *format,...)
Everything this module says to the outside world: messages for the user, and the fact that the tag vo...
dt_metadata_notice_t
Which affordance the message belongs in. The two are not interchangeable, and the module knows which ...
void(* dt_metadata_notify_handler_t)(const dt_metadata_notice_t kind, const char *message)
Receives one formatted, already-translated message.
void(* dt_metadata_geotags_changed_handler_t)(const GList *imgs)
The geo-location of these images changed. Whoever is showing a map, or the geotag panel,...
void typedef void(* dt_metadata_tags_changed_handler_t)(void)
The tag vocabulary changed: one was created, renamed, deleted, attached or detached....