Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
notify.h File Reference

Everything this module says to the outside world: messages for the user, and the fact that the tag vocabulary changed. More...

#include <glib.h>
+ Include dependency graph for metadata/notify.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef G_BEGIN_DECLS enum dt_metadata_notice_t dt_metadata_notice_t
 Which affordance the message belongs in. The two are not interchangeable, and the module knows which it means even though it does not know what either looks like.
 
typedef void(* dt_metadata_notify_handler_t) (const dt_metadata_notice_t kind, const char *message)
 Receives one formatted, already-translated message.
 
typedef 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, should look again.
 

Enumerations

enum  dt_metadata_notice_t {
  DT_METADATA_NOTICE_TOAST = 0 ,
  DT_METADATA_NOTICE_MESSAGE
}
 Which affordance the message belongs in. The two are not interchangeable, and the module knows which it means even though it does not know what either looks like. More...
 

Functions

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.
 
void dt_metadata_notify (const dt_metadata_notice_t kind, const char *format,...) G_GNUC_PRINTF(2
 Raise one message. Internal to the module: the format string is translated at the call site, because only the call site knows the plural form.
 
void dt_metadata_set_tags_changed_handler (dt_metadata_tags_changed_handler_t handler)
 
void dt_metadata_tags_changed (void)
 Raise it. Internal to the module.
 
void dt_metadata_set_geotags_changed_handler (dt_metadata_geotags_changed_handler_t handler)
 
void dt_metadata_geotags_changed (const GList *imgs)
 

Variables

void typedef void(* dt_metadata_tags_changed_handler_t )(void)
 The tag vocabulary changed: one was created, renamed, deleted, attached or detached. Whoever is showing tags should look again.
 

Detailed Description

Everything this module says to the outside world: messages for the user, and the fact that the tag vocabulary changed.

Setting a rating or a colour label on a batch reports what it did, and editing tags has to tell whoever is displaying them to look again. Both were done by calling into control/ (layer 3) from a layer-1 module – dt_control_log()/dt_toast_log() for the first, DT_DEBUG_CONTROL_SIGNAL_RAISE(..., DT_SIGNAL_TAG_CHANGED) for the second – which meant the module could not be built, tested or reused without the whole control loop, and that where a message appears was decided by the code that produced it.

The dependency is inverted instead: the module states the fact, and whoever is running it decides how to show it. With no handler installed – ansel-cli, a unit test – the message is silently dropped, which is the correct behaviour for both.

The same shape as dt_database_set_renamed_handler(); see src/database/database.h.

Definition in file metadata/notify.h.

Typedef Documentation

◆ dt_metadata_geotags_changed_handler_t

typedef 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, should look again.

Carries the image list because the signal it replaces did. The handler does the copying, at the raise site, exactly as the old call sites used to: imgs stays the caller's, and a handler that needs to keep it copies it.

Definition at line 91 of file metadata/notify.h.

◆ dt_metadata_notice_t

Which affordance the message belongs in. The two are not interchangeable, and the module knows which it means even though it does not know what either looks like.

◆ dt_metadata_notify_handler_t

typedef void(* dt_metadata_notify_handler_t) (const dt_metadata_notice_t kind, const char *message)

Receives one formatted, already-translated message.

Definition at line 58 of file metadata/notify.h.

Enumeration Type Documentation

◆ dt_metadata_notice_t

Which affordance the message belongs in. The two are not interchangeable, and the module knows which it means even though it does not know what either looks like.

Enumerator
DT_METADATA_NOTICE_TOAST 

Transient acknowledgement of something that succeeded ("Rating set to 3 for 12 images"). Was dt_toast_log().

DT_METADATA_NOTICE_MESSAGE 

The running commentary, including refusals ("no images selected to apply rating"). Was dt_control_log().

Definition at line 47 of file metadata/notify.h.

Function Documentation

◆ dt_metadata_geotags_changed()

void dt_metadata_geotags_changed ( const GList imgs)

Definition at line 70 of file metadata/notify.c.

References _geotags_changed_handler, and L.

Referenced by _image_import_internal(), and _pop_undo().

◆ dt_metadata_notify()

void dt_metadata_notify ( const dt_metadata_notice_t  kind,
const char *  format,
  ... 
)

Raise one message. Internal to the module: the format string is translated at the call site, because only the call site knows the plural form.

◆ dt_metadata_set_geotags_changed_handler()

void dt_metadata_set_geotags_changed_handler ( dt_metadata_geotags_changed_handler_t  handler)

Definition at line 65 of file metadata/notify.c.

References _geotags_changed_handler, and L.

Referenced by dt_init().

◆ 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 at line 30 of file metadata/notify.c.

References _handler, and L.

Referenced by _teardown(), dt_init(), test_channels_are_independent(), test_handler_can_be_removed(), test_kinds_stay_distinct(), and test_no_handler_is_silent().

◆ dt_metadata_set_tags_changed_handler()

void dt_metadata_set_tags_changed_handler ( dt_metadata_tags_changed_handler_t  handler)

◆ dt_metadata_tags_changed()

Variable Documentation

◆ dt_metadata_tags_changed_handler_t

void typedef void(* dt_metadata_tags_changed_handler_t) (void) ( void  )

The tag vocabulary changed: one was created, renamed, deleted, attached or detached. Whoever is showing tags should look again.

Deliberately carries no payload, because the signal it replaces carried none: every consumer re-reads. Raised on the thread that made the change – a handler that touches widgets is responsible for getting itself onto the GUI thread, exactly as the signal emission it replaces was.

Definition at line 77 of file metadata/notify.h.

Referenced by dt_metadata_tags_changed().