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

Everything the history, styles and presets code says to the outside world: messages for the user, and the fact that something changed. More...

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

Go to the source code of this file.

Typedefs

typedef void enum dt_history_change_t dt_history_change_t
 What changed. Each value stands for one signal this code used to raise itself.
 
typedef void(* dt_history_changed_handler_t) (const dt_history_change_t what)
 Whoever is displaying any of this should look again.
 
typedef void(* dt_history_images_changed_handler_t) (const GList *imgs)
 The development of these images changed. Was DT_SIGNAL_IMAGE_INFO_CHANGED.
 

Enumerations

enum  dt_history_change_t {
  DT_HISTORY_CHANGE_TAGS = 0 ,
  DT_HISTORY_CHANGE_STYLES ,
  DT_HISTORY_CHANGE_DEVELOP
}
 What changed. Each value stands for one signal this code used to raise itself. More...
 

Functions

void dt_history_set_message_handler (dt_history_message_handler_t handler)
 Install the handler, or NULL to remove it. Messages raised with none installed are dropped.
 
void dt_history_message (const char *format,...) G_GNUC_PRINTF(1
 Tell the user something. Was dt_control_log(). Internal to this code: the format string is translated at the call site, because only the call site knows the plural.
 
void dt_history_set_toast_handler (dt_history_toast_handler_t handler)
 
void dt_history_toast (const char *format,...) G_GNUC_PRINTF(1
 
void dt_history_set_changed_handler (dt_history_changed_handler_t handler)
 
void dt_history_changed (const dt_history_change_t what)
 Raise it. Internal to this code.
 
void dt_history_set_images_changed_handler (dt_history_images_changed_handler_t handler)
 
void dt_history_changed_images (const GList *imgs)
 

Variables

G_BEGIN_DECLS typedef void(* dt_history_message_handler_t )(const char *message)
 Receives one formatted, already-translated message for the user.
 
void typedef void(* dt_history_toast_handler_t )(const char *message)
 Same contract, transient acknowledgement flavour. Was dt_toast_log().
 

Detailed Description

Everything the history, styles and presets code says to the outside world: messages for the user, and the fact that something changed.

Copying a history stack, applying a style or renaming one reported what it did with dt_control_log(), and told the rest of the application with DT_DEBUG_CONTROL_SIGNAL_RAISE(dt_control_signal_get_global(), ...). Both are calls into control/ (layer 3) from code that has no other reason to know the control loop exists – which meant this code could not be built, tested or reused without it, and that where a message appears was decided by whatever produced it.

Inverted the same way metadata/notify.h inverts it: the code states the fact, and whoever is running it decides what that looks like. With no handler installed – ansel-cli, a unit test – the message is dropped and the notification goes nowhere, which is correct for both.

This lands in src/history when that module exists; it lives in common/ only because the module's layer is still an open question.

Definition in file history/notify.h.

Typedef Documentation

◆ dt_history_change_t

What changed. Each value stands for one signal this code used to raise itself.

◆ dt_history_changed_handler_t

typedef void(* dt_history_changed_handler_t) (const dt_history_change_t what)

Whoever is displaying any of this should look again.

Deliberately carries no payload, because the signals 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 85 of file history/notify.h.

◆ dt_history_images_changed_handler_t

typedef void(* dt_history_images_changed_handler_t) (const GList *imgs)

The development of these images changed. Was DT_SIGNAL_IMAGE_INFO_CHANGED.

Separate from dt_history_changed() because this one carries a payload, and the signal it replaces takes ownership of the list it is given. The handler therefore does the copying, at the raise site, exactly as the call site used to: imgs stays the caller's, and a handler that needs to keep it copies it.

Definition at line 99 of file history/notify.h.

Enumeration Type Documentation

◆ dt_history_change_t

What changed. Each value stands for one signal this code used to raise itself.

Enumerator
DT_HISTORY_CHANGE_TAGS 

Tags were attached or detached along with a history operation. Was DT_SIGNAL_TAG_CHANGED.

DT_HISTORY_CHANGE_STYLES 

A style was created, edited, renamed or deleted. Was DT_SIGNAL_STYLE_CHANGED.

DT_HISTORY_CHANGE_DEVELOP 

The development history of the interactive session changed – after an undo, or a bulk apply. Whoever is showing the history panel or the module order should resync. Was DT_SIGNAL_DEVELOP_HISTORY_CHANGE.

Definition at line 64 of file history/notify.h.

Function Documentation

◆ dt_history_changed()

◆ dt_history_changed_images()

void dt_history_changed_images ( const GList imgs)

Definition at line 93 of file history/notify.c.

References _images_changed_handler, and L.

Referenced by _history_action_finalize_list().

◆ dt_history_message()

void dt_history_message ( const char *  format,
  ... 
)

Tell the user something. Was dt_control_log(). Internal to this code: the format string is translated at the call site, because only the call site knows the plural.

◆ dt_history_set_changed_handler()

void dt_history_set_changed_handler ( dt_history_changed_handler_t  handler)

Definition at line 77 of file history/notify.c.

References _changed_handler, and L.

Referenced by dt_init().

◆ dt_history_set_images_changed_handler()

void dt_history_set_images_changed_handler ( dt_history_images_changed_handler_t  handler)

Definition at line 88 of file history/notify.c.

References _images_changed_handler, and L.

Referenced by dt_init().

◆ dt_history_set_message_handler()

void dt_history_set_message_handler ( dt_history_message_handler_t  handler)

Install the handler, or NULL to remove it. Messages raised with none installed are dropped.

Definition at line 31 of file history/notify.c.

References _message_handler, and L.

Referenced by dt_init().

◆ dt_history_set_toast_handler()

void dt_history_set_toast_handler ( dt_history_toast_handler_t  handler)

Definition at line 55 of file history/notify.c.

References _toast_handler, and L.

Referenced by dt_init().

◆ dt_history_toast()

void dt_history_toast ( const char *  format,
  ... 
)

Variable Documentation

◆ dt_history_message_handler_t

G_BEGIN_DECLS typedef void(* dt_history_message_handler_t) (const char *message) ( const char *  message)

Receives one formatted, already-translated message for the user.

Definition at line 48 of file history/notify.h.

Referenced by dt_history_message().

◆ dt_history_toast_handler_t

void typedef void(* dt_history_toast_handler_t) (const char *message) ( const char *  message)

Same contract, transient acknowledgement flavour. Was dt_toast_log().

Definition at line 59 of file history/notify.h.

Referenced by dt_history_toast().