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. */
27
static
dt_metadata_notify_handler_t
_handler
=
NULL
;
28
static
dt_metadata_tags_changed_handler_t
_tags_changed_handler
=
NULL
;
29
30
void
dt_metadata_set_notify_handler
(
dt_metadata_notify_handler_t
handler
)
31
{
32
_handler
=
handler
;
33
}
34
35
void
dt_metadata_notify
(
const
dt_metadata_notice_t
kind
,
const
char
*format, ...)
36
{
37
dt_metadata_notify_handler_t
handler
=
_handler
;
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
52
void
dt_metadata_set_tags_changed_handler
(
dt_metadata_tags_changed_handler_t
handler
)
53
{
54
_tags_changed_handler
=
handler
;
55
}
56
57
void
dt_metadata_tags_changed
(
void
)
58
{
59
dt_metadata_tags_changed_handler_t
handler
=
_tags_changed_handler
;
60
if
(
handler
)
handler
();
61
}
62
63
static
dt_metadata_geotags_changed_handler_t
_geotags_changed_handler
=
NULL
;
64
65
void
dt_metadata_set_geotags_changed_handler
(
dt_metadata_geotags_changed_handler_t
handler
)
66
{
67
_geotags_changed_handler
=
handler
;
68
}
69
70
void
dt_metadata_geotags_changed
(
const
GList
*imgs)
71
{
72
dt_metadata_geotags_changed_handler_t
handler
=
_geotags_changed_handler
;
73
if
(
handler
)
handler
(imgs);
74
}
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
kind
static const dt_adaptation_t kind
Definition
chromatic_adaptation.h:125
L
const float L
Definition
colorspaces_inline_conversions.h:494
mem_alloc.h
dt_free
#define dt_free(ptr)
Definition
mem_alloc.h:97
dt_metadata_geotags_changed
void dt_metadata_geotags_changed(const GList *imgs)
Definition
metadata/notify.c:70
dt_metadata_set_geotags_changed_handler
void dt_metadata_set_geotags_changed_handler(dt_metadata_geotags_changed_handler_t handler)
Definition
metadata/notify.c:65
dt_metadata_set_tags_changed_handler
void dt_metadata_set_tags_changed_handler(dt_metadata_tags_changed_handler_t handler)
Definition
metadata/notify.c:52
_tags_changed_handler
static dt_metadata_tags_changed_handler_t _tags_changed_handler
Definition
metadata/notify.c:28
dt_metadata_set_notify_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.
Definition
metadata/notify.c:30
_geotags_changed_handler
static dt_metadata_geotags_changed_handler_t _geotags_changed_handler
Definition
metadata/notify.c:63
_handler
static dt_metadata_notify_handler_t _handler
Definition
metadata/notify.c:27
dt_metadata_tags_changed
void dt_metadata_tags_changed(void)
Raise it. Internal to the module.
Definition
metadata/notify.c:57
dt_metadata_notify
void dt_metadata_notify(const dt_metadata_notice_t kind, const char *format,...)
Definition
metadata/notify.c:35
notify.h
Everything this module says to the outside world: messages for the user, and the fact that the tag vo...
dt_metadata_notice_t
dt_metadata_notice_t
Which affordance the message belongs in. The two are not interchangeable, and the module knows which ...
Definition
metadata/notify.h:48
dt_metadata_notify_handler_t
void(* dt_metadata_notify_handler_t)(const dt_metadata_notice_t kind, const char *message)
Receives one formatted, already-translated message.
Definition
metadata/notify.h:58
dt_metadata_geotags_changed_handler_t
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,...
Definition
metadata/notify.h:91
dt_metadata_tags_changed_handler_t
void typedef void(* dt_metadata_tags_changed_handler_t)(void)
The tag vocabulary changed: one was created, renamed, deleted, attached or detached....
Definition
metadata/notify.h:77
src
metadata
notify.c
Generated by
1.9.8