NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
observer.h
Go to the documentation of this file.
1 
29 #ifndef MUTT_LIB_OBSERVER_H
30 #define MUTT_LIB_OBSERVER_H
31 
32 #include <stdbool.h>
33 #include "notify_type.h"
34 #include "queue.h"
35 
40 {
41  struct Notify *current;
44  void *event_data;
45  void *global_data;
46 };
47 
54 typedef int (*observer_t)(struct NotifyCallback *nc);
55 
59 struct Observer
60 {
63  void *global_data;
64 };
65 
70 {
71  struct Observer *observer;
72  STAILQ_ENTRY(ObserverNode) entries;
73 };
74 STAILQ_HEAD(ObserverList, ObserverNode);
75 
76 #endif /* MUTT_LIB_OBSERVER_H */
NotifyCallback
Data passed to a notification function.
Definition: observer.h:39
ObserverNode::observer
struct Observer * observer
An Observer.
Definition: observer.h:71
observer_t
int(* observer_t)(struct NotifyCallback *nc)
Prototype for a notification callback function.
Definition: observer.h:54
ObserverNode
List of Observers.
Definition: observer.h:69
ObserverNode::STAILQ_ENTRY
STAILQ_ENTRY(ObserverNode) entries
Linked list.
NotifyType
NotifyType
Notification Types.
Definition: notify_type.h:31
Observer::global_data
void * global_data
Private data to pass to callback.
Definition: observer.h:63
NotifyCallback::global_data
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
queue.h
NotifyCallback::current
struct Notify * current
Notify object being observed.
Definition: observer.h:41
NotifyCallback::event_data
void * event_data
Data from notify_send()
Definition: observer.h:44
notify_type.h
Notify
Notification API.
Definition: notify.c:39
Observer::callback
observer_t callback
Callback function for events.
Definition: observer.h:62
Observer
An observer of notifications.
Definition: observer.h:59
NotifyCallback::event_subtype
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:43
NotifyCallback::event_type
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
Observer::type
enum NotifyType type
Notification type to observe, e.g. NT_WINDOW.
Definition: observer.h:61
STAILQ_HEAD
STAILQ_HEAD(ObserverList, ObserverNode)