NeoMutt  2021-10-29-43-g6b8931
Teaching an old dog new tricks
DOXYGEN
Observer API

Prototype for a notification callback function. More...

Functions

static int alias_alias_observer (struct NotifyCallback *nc)
 Notification that an Alias has changed - Implements observer_t -. More...
 
int alias_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
int query_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
int alias_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int attach_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int attach_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int autocrypt_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int autocrypt_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int browser_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int browser_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int attach_compose_observer (struct NotifyCallback *nc)
 Notification that the Compose data has changed - Implements observer_t -. More...
 
int cbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
int cbar_compose_observer (struct NotifyCallback *nc)
 Notification that the Compose data has changed - Implements observer_t -. More...
 
int cbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
int cbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int compose_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int compose_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int env_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int env_compose_observer (struct NotifyCallback *nc)
 Notification that the Compose data has changed - Implements observer_t -. More...
 
static int env_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int env_header_observer (struct NotifyCallback *nc)
 Notification that a User Header has changed - Implements observer_t -. More...
 
static int env_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
int ctx_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -. More...
 
static int postponed_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int postponed_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int alldialogs_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int msgwin_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int rootwin_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int rootwin_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int sbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int sbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int simple_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int simple_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int helpbar_binding_observer (struct NotifyCallback *nc)
 Notification that a Key Binding has changed - Implements observer_t -. More...
 
static int helpbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int helpbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int helpbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int index_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -. More...
 
static int ibar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int ibar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int ibar_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -. More...
 
static int ibar_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -. More...
 
static int ibar_menu_observer (struct NotifyCallback *nc)
 Notification that a Menu has changed - Implements observer_t -. More...
 
static int ibar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int index_altern_observer (struct NotifyCallback *nc)
 Notification that an 'alternates' command has occurred - Implements observer_t -. More...
 
static int index_attach_observer (struct NotifyCallback *nc)
 Notification that an 'attachments' command has occurred - Implements observer_t -. More...
 
static int index_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int index_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int index_menu_observer (struct NotifyCallback *nc)
 Notification that the Menu has changed - Implements observer_t -. More...
 
static int index_score_observer (struct NotifyCallback *nc)
 Notification that a 'score' command has occurred - Implements observer_t -. More...
 
static int index_subjrx_observer (struct NotifyCallback *nc)
 Notification that a 'subjectrx' command has occurred - Implements observer_t -. More...
 
static int index_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int ipanel_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int ipanel_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int index_shared_context_observer (struct NotifyCallback *nc)
 Notification that the Context has changed - Implements observer_t -. More...
 
static int index_shared_account_observer (struct NotifyCallback *nc)
 Notification that an Account has changed - Implements observer_t -. More...
 
static int index_shared_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -. More...
 
static int index_shared_email_observer (struct NotifyCallback *nc)
 Notification that an Email has changed - Implements observer_t -. More...
 
int main_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int menu_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int menu_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int menu_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
int main_hist_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
int main_log_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int gpgme_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int gpgme_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int pgp_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int pgp_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int dopager_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int dopager_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int pager_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int pager_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int pager_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -. More...
 
static int pager_pager_observer (struct NotifyCallback *nc)
 Notification that the Pager has changed - Implements observer_t -. More...
 
static int pager_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int pbar_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int pbar_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int pbar_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -. More...
 
static int pbar_pager_observer (struct NotifyCallback *nc)
 Notification that the Pager has changed - Implements observer_t -. More...
 
static int pbar_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int ppanel_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int ppanel_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int pattern_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int pattern_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int remailer_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int remailer_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
static int sb_account_observer (struct NotifyCallback *nc)
 Notification that an Account has changed - Implements observer_t -. More...
 
static int sb_color_observer (struct NotifyCallback *nc)
 Notification that a Color has changed - Implements observer_t -. More...
 
static int sb_command_observer (struct NotifyCallback *nc)
 Notification that a Command has occurred - Implements observer_t -. More...
 
static int sb_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
 
static int sb_index_observer (struct NotifyCallback *nc)
 Notification that the Index has changed - Implements observer_t -. More...
 
static int sb_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -. More...
 
static int sb_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 
int sb_insertion_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
 

Detailed Description

Prototype for a notification callback function.

Parameters
[in]ncCallback data
Return values
0Success
-1Error

Contract

Function Documentation

◆ alias_alias_observer()

static int alias_alias_observer ( struct NotifyCallback nc)
static

Notification that an Alias has changed - Implements observer_t -.

Definition at line 193 of file dlgalias.c.

194 {
195  if ((nc->event_type != NT_ALIAS) || !nc->global_data || !nc->event_data)
196  return -1;
197 
198  struct EventAlias *ev_a = nc->event_data;
199  struct Menu *menu = nc->global_data;
200  struct AliasMenuData *mdata = menu->mdata;
201  struct Alias *alias = ev_a->alias;
202 
203  if (nc->event_subtype == NT_ALIAS_ADD)
204  {
205  alias_array_alias_add(&mdata->ava, alias);
206 
207  if (alias_array_count_visible(&mdata->ava) != ARRAY_SIZE(&mdata->ava))
208  {
209  mutt_pattern_alias_func(NULL, mdata, menu);
210  }
211  }
212  else if (nc->event_subtype == NT_ALIAS_DELETE)
213  {
214  alias_array_alias_delete(&mdata->ava, alias);
215 
216  int vcount = alias_array_count_visible(&mdata->ava);
217  int index = menu_get_index(menu);
218  if ((index > (vcount - 1)) && (index > 0))
219  menu_set_index(menu, index - 1);
220  }
221 
222  alias_array_sort(&mdata->ava, mdata->sub);
223 
224  menu->max = alias_array_count_visible(&mdata->ava);
226  mutt_debug(LL_DEBUG5, "alias done, request WA_RECALC, MENU_REDRAW_FULL\n");
227 
228  return 0;
229 }
void alias_array_sort(struct AliasViewArray *ava, const struct ConfigSubset *sub)
Sort and reindex an AliasViewArray.
Definition: sort.c:157
@ NT_ALIAS_ADD
Alias has been added.
Definition: alias.h:54
@ NT_ALIAS_DELETE
Alias is about to be deleted.
Definition: alias.h:55
int alias_array_count_visible(struct AliasViewArray *ava)
Count number of visible Aliases.
Definition: array.c:91
int alias_array_alias_delete(struct AliasViewArray *ava, struct Alias *alias)
Delete an Alias from the AliasViewArray.
Definition: array.c:69
int alias_array_alias_add(struct AliasViewArray *ava, struct Alias *alias)
Add an Alias to the AliasViewArray.
Definition: array.c:45
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:83
#define mutt_debug(LEVEL,...)
Definition: logging.h:84
@ LL_DEBUG5
Log at debug level 5.
Definition: logging.h:44
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:55
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:632
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:608
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:622
@ NT_ALIAS
Alias has changed, NotifyAlias, EventAlias.
Definition: notify_type.h:35
int mutt_pattern_alias_func(char *prompt, struct AliasMenuData *mdata, struct Menu *menu)
Perform some Pattern matching for Alias.
Definition: pattern.c:243
AliasView array wrapper with Pattern information -.
Definition: gui.h:52
struct AliasViewArray ava
Array of AliasView.
Definition: gui.h:54
struct ConfigSubset * sub
Config items.
Definition: gui.h:55
A shortcut for an email address or addresses.
Definition: alias.h:34
An alias-change event.
Definition: alias.h:64
struct Alias * alias
Alias that changed.
Definition: alias.h:65
Definition: lib.h:67
void * mdata
Private data.
Definition: lib.h:153
int max
Number of entries in the menu.
Definition: lib.h:69
void * event_data
Data from notify_send()
Definition: observer.h:38
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:36
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:37
void * global_data
Data from notify_observer_add()
Definition: observer.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alias_window_observer()

int alias_window_observer ( struct NotifyCallback nc)

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 238 of file dlgalias.c.

239 {
240  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
241  return -1;
242 
243  if (nc->event_subtype != NT_WINDOW_DELETE)
244  return 0;
245 
246  struct MuttWindow *win_menu = nc->global_data;
247  struct EventWindow *ev_w = nc->event_data;
248  if (ev_w->win != win_menu)
249  return 0;
250 
251  struct Menu *menu = win_menu->wdata;
252 
256 
257  mutt_debug(LL_DEBUG5, "window delete done\n");
258  return 0;
259 }
static int alias_alias_observer(struct NotifyCallback *nc)
Notification that an Alias has changed - Implements observer_t -.
Definition: dlgalias.c:193
int alias_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: gui.c:43
int alias_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlgalias.c:238
bool notify_observer_remove(struct Notify *notify, observer_t callback, void *global_data)
Remove an observer from an object.
Definition: notify.c:228
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:206
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:53
An Event that happened to a Window.
Definition: mutt_window.h:216
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:217
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ query_window_observer()

int query_window_observer ( struct NotifyCallback nc)

Notification that a Window has changed - Implements observer_t -.

Definition at line 350 of file dlgquery.c.

351 {
352  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
353  return -1;
354 
355  if (nc->event_subtype != NT_WINDOW_DELETE)
356  return 0;
357 
358  struct MuttWindow *win_menu = nc->global_data;
359  struct EventWindow *ev_w = nc->event_data;
360  if (ev_w->win != win_menu)
361  return 0;
362 
363  struct Menu *menu = win_menu->wdata;
364 
367 
368  mutt_debug(LL_DEBUG5, "window delete done\n");
369  return 0;
370 }
int query_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlgquery.c:350
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alias_config_observer()

int alias_config_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t -.

The Address Book Window is affected by changes to $sort_alias.

Definition at line 43 of file gui.c.

44 {
45  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
46  return -1;
47 
48  struct EventConfig *ev_c = nc->event_data;
49 
50  if (!mutt_str_equal(ev_c->name, "sort_alias"))
51  return 0;
52 
53  struct Menu *menu = nc->global_data;
54 
56  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
57 
58  return 0;
59 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:715
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:42
A config-change event.
Definition: subset.h:70
const char * name
Name of config item that changed.
Definition: subset.h:72
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_config_observer()

int attach_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Address Book Window is affected by changes to $sort_attach.

Definition at line 147 of file dlg_attach.c.

148 {
149  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
150  return -1;
151 
152  struct EventConfig *ev_c = nc->event_data;
153 
154  if (!mutt_str_equal(ev_c->name, "attach_format") && !mutt_str_equal(ev_c->name, "message_format"))
155  return 0;
156 
157  struct Menu *menu = nc->global_data;
159  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
160 
161  return 0;
162 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_window_observer()

static int attach_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 451 of file dlg_attach.c.

452 {
453  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
454  return -1;
455 
456  if (nc->event_subtype != NT_WINDOW_DELETE)
457  return 0;
458 
459  struct MuttWindow *win_menu = nc->global_data;
460  struct EventWindow *ev_w = nc->event_data;
461  if (ev_w->win != win_menu)
462  return 0;
463 
464  struct Menu *menu = win_menu->wdata;
465 
468 
469  mutt_debug(LL_DEBUG5, "window delete done\n");
470  return 0;
471 }
static int attach_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_attach.c:147
static int attach_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_attach.c:451
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autocrypt_config_observer()

static int autocrypt_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Address Book Window is affected by changes to $sort_autocrypt.

Definition at line 292 of file dlgautocrypt.c.

293 {
294  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
295  return -1;
296 
297  struct EventConfig *ev_c = nc->event_data;
298 
299  if (!mutt_str_equal(ev_c->name, "autocrypt_acct_format"))
300  return 0;
301 
302  struct Menu *menu = nc->global_data;
304  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
305 
306  return 0;
307 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ autocrypt_window_observer()

static int autocrypt_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 316 of file dlgautocrypt.c.

317 {
318  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
319  return -1;
320 
321  if (nc->event_subtype != NT_WINDOW_DELETE)
322  return 0;
323 
324  struct MuttWindow *win_menu = nc->global_data;
325  struct EventWindow *ev_w = nc->event_data;
326  if (ev_w->win != win_menu)
327  return 0;
328 
329  struct Menu *menu = win_menu->wdata;
330 
333 
334  mutt_debug(LL_DEBUG5, "window delete done\n");
335  return 0;
336 }
static int autocrypt_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlgautocrypt.c:316
static int autocrypt_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlgautocrypt.c:292
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browser_config_observer()

static int browser_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 1170 of file browser.c.

1171 {
1172  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
1173  return -1;
1174 
1175  struct EventConfig *ev_c = nc->event_data;
1176 
1177  if (!mutt_str_equal(ev_c->name, "browser_abbreviate_mailboxes") &&
1178  !mutt_str_equal(ev_c->name, "date_format") && !mutt_str_equal(ev_c->name, "folder") &&
1179  !mutt_str_equal(ev_c->name, "folder_format") &&
1180  !mutt_str_equal(ev_c->name, "group_index_format") &&
1181  !mutt_str_equal(ev_c->name, "sort_browser"))
1182  {
1183  return 0;
1184  }
1185 
1186  struct Menu *menu = nc->global_data;
1188  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
1189 
1190  return 0;
1191 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ browser_window_observer()

static int browser_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 1200 of file browser.c.

1201 {
1202  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
1203  return -1;
1204 
1205  if (nc->event_subtype != NT_WINDOW_DELETE)
1206  return 0;
1207 
1208  struct MuttWindow *win_menu = nc->global_data;
1209  struct EventWindow *ev_w = nc->event_data;
1210  if (ev_w->win != win_menu)
1211  return 0;
1212 
1213  struct Menu *menu = win_menu->wdata;
1214 
1217 
1218  mutt_debug(LL_DEBUG5, "window delete done\n");
1219  return 0;
1220 }
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: browser.c:1170
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: browser.c:1200
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ attach_compose_observer()

static int attach_compose_observer ( struct NotifyCallback nc)
static

Notification that the Compose data has changed - Implements observer_t -.

Definition at line 178 of file attach.c.

179 {
180  if ((nc->event_type != NT_COMPOSE) || !nc->global_data)
181  return -1;
182 
183  if (nc->event_subtype != NT_COMPOSE_ATTACH)
184  return 0;
185 
186  struct MuttWindow *win_attach = nc->global_data;
187 
188  win_attach->actions |= WA_RECALC;
189  mutt_debug(LL_DEBUG5, "compose done, request WA_RECALC\n");
190 
191  return 0;
192 }
#define NT_COMPOSE_ATTACH
Attachments have changed.
Definition: private.h:36
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
@ NT_COMPOSE
Compose data has changed, NotifyCompose.
Definition: notify_type.h:41
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
+ Here is the caller graph for this function:

◆ cbar_color_observer()

int cbar_color_observer ( struct NotifyCallback nc)

Notification that a Color has changed - Implements observer_t -.

Definition at line 204 of file cbar.c.

205 {
206  if ((nc->event_type != NT_COLOR) || !nc->global_data || !nc->event_data)
207  return -1;
208 
209  struct EventColor *ev_c = nc->event_data;
210 
211  // MT_COLOR_MAX is sent on `uncolor *`
212  if ((ev_c->color != MT_COLOR_STATUS) && (ev_c->color != MT_COLOR_MAX))
213  return 0;
214 
215  struct MuttWindow *win_cbar = nc->global_data;
216  win_cbar->actions |= WA_REPAINT;
217  mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
218 
219  return 0;
220 }
@ MT_COLOR_MAX
Definition: color.h:88
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition: color.h:70
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:111
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:39
An Event that happened to a Colour.
Definition: notify2.h:53
enum ColorId color
Colour that has changed.
Definition: notify2.h:54
+ Here is the caller graph for this function:

◆ cbar_compose_observer()

int cbar_compose_observer ( struct NotifyCallback nc)

Notification that the Compose data has changed - Implements observer_t -.

Definition at line 225 of file cbar.c.

226 {
227  if ((nc->event_type != NT_COMPOSE) || !nc->global_data || !nc->event_data)
228  return -1;
229 
230  struct MuttWindow *win_cbar = nc->global_data;
231  win_cbar->actions |= WA_REPAINT;
232  mutt_debug(LL_DEBUG5, "compose done, request WA_REPAINT\n");
233 
234  return 0;
235 }
+ Here is the caller graph for this function:

◆ cbar_config_observer()

int cbar_config_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 240 of file cbar.c.

241 {
242  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
243  return -1;
244 
245  struct EventConfig *ev_c = nc->event_data;
246  if (!mutt_str_equal(ev_c->name, "compose_format"))
247  return 0;
248 
249  struct MuttWindow *win_cbar = nc->global_data;
250  win_cbar->actions |= WA_RECALC;
251  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
252 
253  return 0;
254 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cbar_window_observer()

int cbar_window_observer ( struct NotifyCallback nc)

Notification that a Window has changed - Implements observer_t -.

Definition at line 259 of file cbar.c.

260 {
261  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
262  return -1;
263 
264  struct MuttWindow *win_cbar = nc->global_data;
265  struct EventWindow *ev_w = nc->event_data;
266  if (ev_w->win != win_cbar)
267  return 0;
268 
269  if (nc->event_subtype == NT_WINDOW_STATE)
270  {
271  win_cbar->actions |= WA_RECALC;
272  mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
273  }
274  else if (nc->event_subtype == NT_WINDOW_DELETE)
275  {
276  struct MuttWindow *dlg = win_cbar->parent;
277  struct ComposeSharedData *shared = dlg->wdata;
278 
282  notify_observer_remove(win_cbar->notify, cbar_window_observer, win_cbar);
283 
284  mutt_debug(LL_DEBUG5, "window delete done\n");
285  }
286 
287  return 0;
288 }
int cbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: cbar.c:204
int cbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: cbar.c:240
int cbar_compose_observer(struct NotifyCallback *nc)
Notification that the Compose data has changed - Implements observer_t -.
Definition: cbar.c:225
int cbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: cbar.c:259
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
Definition: mutt_window.h:207
Shared Compose Data.
Definition: shared_data.h:33
struct Notify * notify
Notifications: NotifyCompose.
Definition: shared_data.h:39
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_config_observer()

static int compose_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 226 of file compose.c.

227 {
228  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
229  return -1;
230 
231  struct EventConfig *ev_c = nc->event_data;
232  struct MuttWindow *dlg = nc->global_data;
233 
234  if (!mutt_str_equal(ev_c->name, "status_on_top"))
235  return 0;
236 
237  struct MuttWindow *win_cbar = window_find_child(dlg, WT_STATUS_BAR);
238  if (!win_cbar)
239  return 0;
240 
241  TAILQ_REMOVE(&dlg->children, win_cbar, entries);
242 
243  const bool c_status_on_top = cs_subset_bool(ev_c->sub, "status_on_top");
244  if (c_status_on_top)
245  TAILQ_INSERT_HEAD(&dlg->children, win_cbar, entries);
246  else
247  TAILQ_INSERT_TAIL(&dlg->children, win_cbar, entries);
248 
249  mutt_window_reflow(dlg);
250  mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
251  return 0;
252 }
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:339
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:520
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
Definition: mutt_window.h:102
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:809
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:841
#define TAILQ_INSERT_HEAD(head, elm, field)
Definition: queue.h:796
const struct ConfigSubset * sub
Config Subset.
Definition: subset.h:71
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:136
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compose_window_observer()

static int compose_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 257 of file compose.c.

258 {
259  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
260  return -1;
261 
262  if (nc->event_subtype != NT_WINDOW_DELETE)
263  return 0;
264 
265  struct MuttWindow *dlg = nc->global_data;
266  struct EventWindow *ev_w = nc->event_data;
267  if (ev_w->win != dlg)
268  return 0;
269 
272  mutt_debug(LL_DEBUG5, "window delete done\n");
273 
274  return 0;
275 }
static int compose_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: compose.c:226
static int compose_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: compose.c:257
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_color_observer()

static int env_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 702 of file envelope.c.

703 {
704  if ((nc->event_type != NT_COLOR) || !nc->global_data || !nc->event_data)
705  return -1;
706 
707  struct EventColor *ev_c = nc->event_data;
708  struct MuttWindow *win_env = nc->global_data;
709 
710  enum ColorId color = ev_c->color;
711 
712  switch (color)
713  {
714  case MT_COLOR_BOLD:
720  case MT_COLOR_NORMAL:
721  case MT_COLOR_STATUS:
722  case MT_COLOR_MAX: // Sent on `uncolor *`
723  mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
724  win_env->actions |= WA_REPAINT;
725  break;
726 
727  default:
728  break;
729  }
730  return 0;
731 }
ColorId
List of all colored objects.
Definition: color.h:35
@ MT_COLOR_COMPOSE_SECURITY_ENCRYPT
Mail will be encrypted.
Definition: color.h:43
@ MT_COLOR_COMPOSE_SECURITY_NONE
Mail will not be encrypted or signed.
Definition: color.h:44
@ MT_COLOR_BOLD
Bold text.
Definition: color.h:40
@ MT_COLOR_COMPOSE_SECURITY_BOTH
Mail will be encrypted and signed.
Definition: color.h:42
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:53
@ MT_COLOR_COMPOSE_SECURITY_SIGN
Mail will be signed.
Definition: color.h:45
@ MT_COLOR_COMPOSE_HEADER
Header labels, e.g. From:
Definition: color.h:41
+ Here is the caller graph for this function:

◆ env_compose_observer()

static int env_compose_observer ( struct NotifyCallback nc)
static

Notification that the Compose data has changed - Implements observer_t -.

Definition at line 736 of file envelope.c.

737 {
738  if ((nc->event_type != NT_COMPOSE) || !nc->global_data)
739  return -1;
740 
742  return 0;
743 
744  struct MuttWindow *win_env = nc->global_data;
745 
746  win_env->actions |= WA_RECALC;
747  mutt_debug(LL_DEBUG5, "compose done, request WA_RECALC\n");
748 
749  return 0;
750 }
#define NT_COMPOSE_ENVELOPE
Envelope has changed.
Definition: private.h:37
+ Here is the caller graph for this function:

◆ env_config_observer()

static int env_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 755 of file envelope.c.

756 {
757  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
758  return -1;
759 
760  struct EventConfig *ev_c = nc->event_data;
761  struct MuttWindow *win_env = nc->global_data;
762 
763  switch (ev_c->name[0])
764  {
765  case 'a':
766  if (mutt_str_equal(ev_c->name, "autocrypt"))
767  break;
768  return 0;
769  case 'c':
770  if (mutt_str_equal(ev_c->name, "compose_show_user_headers") ||
771  mutt_str_equal(ev_c->name, "crypt_opportunistic_encrypt"))
772  {
773  break;
774  }
775  return 0;
776  case 'p':
777  if (mutt_str_equal(ev_c->name, "pgp_sign_as"))
778  break;
779  return 0;
780  case 's':
781  if (mutt_str_equal(ev_c->name, "smime_encrypt_with"))
782  break;
783  return 0;
784  case 'x':
785  if (mutt_str_equal(ev_c->name, "x_comment_to"))
786  break;
787  return 0;
788  default:
789  return 0;
790  }
791 
792  win_env->actions |= WA_RECALC;
793  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
794  return 0;
795 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_header_observer()

static int env_header_observer ( struct NotifyCallback nc)
static

Notification that a User Header has changed - Implements observer_t -.

Definition at line 800 of file envelope.c.

801 {
802  if ((nc->event_type != NT_HEADER) || !nc->global_data || !nc->event_data)
803  return -1;
804 
805  const struct EventHeader *ev_h = nc->event_data;
806  struct MuttWindow *win_env = nc->global_data;
807  // struct ComposeEnvelopeData *edata = win_env->wdata;
808  struct MuttWindow *dlg = win_env->parent;
809  struct ComposeSharedData *shared = dlg->wdata;
810 
811  struct Envelope *env = shared->email->env;
812 
814  {
815  header_set(&env->userhdrs, ev_h->header);
816  mutt_debug(LL_DEBUG5, "header done, request reflow\n");
817  env_recalc(win_env);
818  return 0;
819  }
820 
821  if (nc->event_subtype == NT_HEADER_DELETE)
822  {
823  struct ListNode *removed = header_find(&env->userhdrs, ev_h->header);
824  if (removed)
825  {
826  header_free(&env->userhdrs, removed);
827  mutt_debug(LL_DEBUG5, "header done, request reflow\n");
828  env_recalc(win_env);
829  }
830  return 0;
831  }
832 
833  return 0;
834 }
struct ListNode * header_set(struct ListHead *hdrlist, const char *header)
Set a header value in a list.
Definition: email.c:233
void header_free(struct ListHead *hdrlist, struct ListNode *target)
Free and remove a header from a header list.
Definition: email.c:245
struct ListNode * header_find(const struct ListHead *hdrlist, const char *header)
Find a header, matching on its field, in a list of headers.
Definition: email.c:180
@ NT_HEADER_CHANGE
An existing header has been changed.
Definition: email.h:171
@ NT_HEADER_ADD
Header has been added.
Definition: email.h:169
@ NT_HEADER_DELETE
Header has been removed.
Definition: email.h:170
static int env_recalc(struct MuttWindow *win)
Recalculate the Window data - Implements MuttWindow::recalc() -.
Definition: envelope.c:664
@ NT_HEADER
A header has changed, NotifyHeader EventHeader.
Definition: notify_type.h:46
struct Email * email
Email being composed.
Definition: shared_data.h:36
struct Envelope * env
Envelope information.
Definition: email.h:66
The header of an Email.
Definition: envelope.h:55
struct ListHead userhdrs
user defined headers
Definition: envelope.h:85
An event that happened to a header.
Definition: email.h:178
char * header
The contents of the header.
Definition: email.h:179
A List node for strings.
Definition: list.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ env_window_observer()

static int env_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 839 of file envelope.c.

840 {
841  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
842  return -1;
843 
844  struct MuttWindow *win_env = nc->global_data;
845  struct EventWindow *ev_w = nc->event_data;
846  if (ev_w->win != win_env)
847  return 0;
848 
849  if (nc->event_subtype == NT_WINDOW_STATE)
850  {
851  win_env->actions |= WA_RECALC;
852  mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
853  }
854  else if (nc->event_subtype == NT_WINDOW_DELETE)
855  {
856  struct ComposeSharedData *shared = win_env->parent->wdata;
857 
863  mutt_debug(LL_DEBUG5, "window delete done\n");
864  }
865 
866  return 0;
867 }
static int env_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: envelope.c:702
static int env_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: envelope.c:839
static int env_compose_observer(struct NotifyCallback *nc)
Notification that the Compose data has changed - Implements observer_t -.
Definition: envelope.c:736
static int env_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: envelope.c:755
static int env_header_observer(struct NotifyCallback *nc)
Notification that a User Header has changed - Implements observer_t -.
Definition: envelope.c:800
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ctx_mailbox_observer()

int ctx_mailbox_observer ( struct NotifyCallback nc)

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 313 of file context.c.

314 {
315  if ((nc->event_type != NT_MAILBOX) || !nc->global_data)
316  return -1;
317 
318  struct Context *ctx = nc->global_data;
319 
320  switch (nc->event_subtype)
321  {
322  case NT_MAILBOX_DELETE:
324  ctx_cleanup(ctx);
325  break;
326  case NT_MAILBOX_INVALID:
327  ctx_update(ctx);
328  break;
329  case NT_MAILBOX_UPDATE:
330  update_tables(ctx);
331  break;
332  case NT_MAILBOX_RESORT:
333  mutt_sort_headers(ctx->mailbox, ctx->threads, true, &ctx->vsize);
334  break;
335  default:
336  return 0;
337  }
338 
339  mutt_debug(LL_DEBUG5, "mailbox done\n");
340  return 0;
341 }
static void ctx_cleanup(struct Context *ctx)
Release memory and initialize a Context object.
Definition: context.c:105
static void update_tables(struct Context *ctx)
Update a Context structure's internal tables.
Definition: context.c:221
void ctx_update(struct Context *ctx)
Update the Context's message counts.
Definition: context.c:125
@ NT_MAILBOX_RESORT
Email list needs resorting.
Definition: mailbox.h:181
@ NT_MAILBOX_DELETE
Mailbox is about to be deleted.
Definition: mailbox.h:174
@ NT_MAILBOX_INVALID
Email list was changed.
Definition: mailbox.h:180
@ NT_MAILBOX_UPDATE
Update internal tables.
Definition: mailbox.h:183
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
Definition: mutt_thread.c:714
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition: notify_type.h:48
void mutt_sort_headers(struct Mailbox *m, struct ThreadsContext *threads, bool init, off_t *vsize)
Sort emails by their headers.
Definition: sort.c:356
The "current" mailbox.
Definition: context.h:38
struct Mailbox * mailbox
Current Mailbox.
Definition: context.h:49
off_t vsize
Size (in bytes) of the messages shown.
Definition: context.h:39
struct ThreadsContext * threads
Threads context.
Definition: context.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postponed_config_observer()

static int postponed_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Address Book Window is affected by changes to $sort_postponed.

Definition at line 116 of file dlg_postpone.c.

117 {
118  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
119  return -1;
120 
121  struct EventConfig *ev_c = nc->event_data;
122 
123  if (!mutt_str_equal(ev_c->name, "index_format") && !mutt_str_equal(ev_c->name, "sort"))
124  return 0;
125 
126  struct Menu *menu = nc->global_data;
128  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
129 
130  return 0;
131 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ postponed_window_observer()

static int postponed_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 140 of file dlg_postpone.c.

141 {
142  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
143  return -1;
144 
145  if (nc->event_subtype != NT_WINDOW_DELETE)
146  return 0;
147 
148  struct MuttWindow *win_menu = nc->global_data;
149  struct EventWindow *ev_w = nc->event_data;
150  if (ev_w->win != win_menu)
151  return 0;
152 
153  struct Menu *menu = win_menu->wdata;
154 
157 
158  mutt_debug(LL_DEBUG5, "window delete done\n");
159  return 0;
160 }
static int postponed_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_postpone.c:140
static int postponed_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_postpone.c:116
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alldialogs_window_observer()

static int alldialogs_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the All Dialogs window

Definition at line 179 of file dialog.c.

180 {
181  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
182  return -1;
183 
184  if (nc->event_subtype != NT_WINDOW_DELETE)
185  return 0;
186 
187  struct MuttWindow *win_alldlgs = nc->global_data;
188  struct EventWindow *ev_w = nc->event_data;
189  if (ev_w->win != win_alldlgs)
190  return 0;
191 
192  notify_observer_remove(win_alldlgs->notify, alldialogs_window_observer, win_alldlgs);
193 
194  AllDialogsWindow = NULL;
195  mutt_debug(LL_DEBUG5, "window delete done\n");
196  return 0;
197 }
struct MuttWindow * AllDialogsWindow
Parent of all Dialogs.
Definition: dialog.c:74
static int alldialogs_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dialog.c:179
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ msgwin_window_observer()

static int msgwin_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • State (this window): refresh the window
  • Delete (this window): clean up the resources held by the Message Window

Definition at line 141 of file msgwin.c.

142 {
143  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
144  return -1;
145 
146  struct MuttWindow *win_msg = nc->global_data;
147  struct EventWindow *ev_w = nc->event_data;
148  if (ev_w->win != win_msg)
149  return 0;
150 
151  if (nc->event_subtype == NT_WINDOW_STATE)
152  {
153  win_msg->actions |= WA_RECALC;
154  mutt_debug(LL_NOTIFY, "window state done, request WA_RECALC\n");
155  }
156  else if (nc->event_subtype == NT_WINDOW_DELETE)
157  {
159  MessageWindow = NULL;
160  mutt_debug(LL_DEBUG5, "window delete done\n");
161  }
162  return 0;
163 }
static int msgwin_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: msgwin.c:141
@ LL_NOTIFY
Log of notifications.
Definition: logging.h:45
struct MuttWindow * MessageWindow
Message Window, ":set", etc.
Definition: msgwin.c:88
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rootwin_config_observer()

static int rootwin_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Root Window is affected by changes to $status_on_top.

Definition at line 110 of file rootwin.c.

111 {
112  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
113  return -1;
114 
115  struct EventConfig *ev_c = nc->event_data;
116  struct MuttWindow *win_root = nc->global_data;
117 
118  if (!mutt_str_equal(ev_c->name, "status_on_top"))
119  return 0;
120 
121  struct MuttWindow *first = TAILQ_FIRST(&win_root->children);
122  if (!first)
123  return 0;
124 
125  const bool c_status_on_top = cs_subset_bool(NeoMutt->sub, "status_on_top");
126  if ((c_status_on_top && (first->type == WT_HELP_BAR)) ||
127  (!c_status_on_top && (first->type != WT_HELP_BAR)))
128  {
129  // Swap the HelpBar and the AllDialogsWindow
130  struct MuttWindow *next = TAILQ_NEXT(first, entries);
131  if (!next)
132  return 0;
133  TAILQ_REMOVE(&win_root->children, next, entries);
134  TAILQ_INSERT_HEAD(&win_root->children, next, entries);
135 
136  mutt_window_reflow(win_root);
137  mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
138  }
139 
140  return 0;
141 }
@ WT_HELP_BAR
Help Bar containing list of useful key bindings.
Definition: mutt_window.h:96
#define TAILQ_FIRST(head)
Definition: queue.h:723
#define TAILQ_NEXT(elm, field)
Definition: queue.h:832
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:144
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rootwin_window_observer()

static int rootwin_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Root Window

Definition at line 150 of file rootwin.c.

151 {
152  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
153  return -1;
154 
155  if (nc->event_subtype != NT_WINDOW_DELETE)
156  return 0;
157 
158  struct MuttWindow *win_root = nc->global_data;
159  struct EventWindow *ev_w = nc->event_data;
160  if (ev_w->win != win_root)
161  return 0;
162 
164  if (NeoMutt)
166 
167  mutt_debug(LL_DEBUG5, "window delete done\n");
168  return 0;
169 }
static int rootwin_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: rootwin.c:110
static int rootwin_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: rootwin.c:150
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sbar_color_observer()

static int sbar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

This function is triggered by changes to the colour settings, from the color or uncolor, mono or unmono commands.

Definition at line 117 of file sbar.c.

118 {
119  if ((nc->event_type != NT_COLOR) || !nc->global_data)
120  return -1;
121 
122  struct EventColor *ev_c = nc->event_data;
123 
124  // MT_COLOR_MAX is sent on `uncolor *`
125  if ((ev_c->color != MT_COLOR_STATUS) && (ev_c->color != MT_COLOR_MAX))
126  return 0;
127 
128  struct MuttWindow *win_sbar = nc->global_data;
129 
130  win_sbar->actions |= WA_REPAINT;
131  mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
132 
133  return 0;
134 }
+ Here is the caller graph for this function:

◆ sbar_window_observer()

static int sbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • State (this window): refresh the window
  • Delete (this window): clean up the resources held by the Simple Bar

Definition at line 144 of file sbar.c.

145 {
146  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
147  return -1;
148 
149  struct MuttWindow *win_sbar = nc->global_data;
150  struct EventWindow *ev_w = nc->event_data;
151  if (ev_w->win != win_sbar)
152  return 0;
153 
154  if (nc->event_subtype == NT_WINDOW_STATE)
155  {
156  win_sbar->actions |= WA_REPAINT;
157  mutt_debug(LL_DEBUG5, "window state done, request WA_REPAINT\n");
158  }
159  else if (nc->event_subtype == NT_WINDOW_DELETE)
160  {
162  notify_observer_remove(win_sbar->notify, sbar_window_observer, win_sbar);
163  mutt_debug(LL_DEBUG5, "window delete done\n");
164  }
165 
166  return 0;
167 }
static int sbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: sbar.c:117
static int sbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: sbar.c:144
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ simple_config_observer()

static int simple_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Simple Dialog is affected by changes to $status_on_top.

Definition at line 77 of file simple.c.

78 {
79  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
80  return -1;
81 
82  struct EventConfig *ev_c = nc->event_data;
83  if (!mutt_str_equal(ev_c->name, "status_on_top"))
84  return 0;
85 
86  struct MuttWindow *dlg = nc->global_data;
88  mutt_debug(LL_DEBUG5, "config done\n");
89  return 0;
90 }
bool window_status_on_top(struct MuttWindow *panel, struct ConfigSubset *sub)
Organise windows according to config variable.
Definition: mutt_window.c:750
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ simple_window_observer()

static int simple_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Simple Dialog

Definition at line 99 of file simple.c.

100 {
101  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
102  return -1;
103 
104  if (nc->event_subtype != NT_WINDOW_DELETE)
105  return 0;
106 
107  struct MuttWindow *dlg = nc->global_data;
108  struct EventWindow *ev_w = nc->event_data;
109  if (ev_w->win != dlg)
110  return 0;
111 
114 
115  mutt_debug(LL_DEBUG5, "window delete done\n");
116  return 0;
117 }
static int simple_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: simple.c:77
static int simple_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: simple.c:99
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ helpbar_binding_observer()

static int helpbar_binding_observer ( struct NotifyCallback nc)
static

Notification that a Key Binding has changed - Implements observer_t -.

This function is triggered by changes to the key bindings, from either of the bind or macro commands.

Definition at line 203 of file helpbar.c.

204 {
205  if ((nc->event_type != NT_BINDING) || !nc->global_data || !nc->event_data)
206  return -1;
207 
208  if (nc->event_subtype >= NT_MACRO_ADD)
209  return 0;
210 
211  struct MuttWindow *win_helpbar = nc->global_data;
212  struct HelpbarWindowData *wdata = helpbar_wdata_get(win_helpbar);
213  if (!wdata)
214  return 0;
215 
216  struct EventBinding *ev_b = nc->event_data;
217  if (wdata->help_menu != ev_b->menu)
218  return 0;
219 
220  win_helpbar->actions |= WA_RECALC;
221  mutt_debug(LL_DEBUG5, "binding done, request WA_RECALC\n");
222  return 0;
223 }
struct HelpbarWindowData * helpbar_wdata_get(struct MuttWindow *win)
Get the Helpbar data for this window.
Definition: wdata.c:61
@ NT_MACRO_ADD
Key macro has been added.
Definition: keymap.h:121
@ NT_BINDING
Key binding has changed, NotifyBinding, EventBinding.
Definition: notify_type.h:38
A key binding Event.
Definition: keymap.h:102
enum MenuType menu
Menu, e.g. MENU_PAGER.
Definition: keymap.h:103
Help Bar Window data -.
Definition: private.h:34
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
Definition: private.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ helpbar_color_observer()

static int helpbar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

This function is triggered by changes to the colour settings, from the color or uncolor, mono or unmono commands.

Definition at line 231 of file helpbar.c.

232 {
233  if ((nc->event_type != NT_COLOR) || !nc->global_data || !nc->event_data)
234  return -1;
235 
236  struct EventColor *ev_c = nc->event_data;
237 
238  // MT_COLOR_MAX is sent on `uncolor *`
239  if ((ev_c->color != MT_COLOR_STATUS) && (ev_c->color != MT_COLOR_MAX))
240  return 0;
241 
242  struct MuttWindow *win_helpbar = nc->global_data;
243 
244  win_helpbar->actions |= WA_REPAINT;
245  mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
246  return 0;
247 }
+ Here is the caller graph for this function:

◆ helpbar_config_observer()

static int helpbar_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

This function is triggered by changes to the config by the set, unset, reset, toggle, etc commands.

Definition at line 255 of file helpbar.c.

256 {
257  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
258  return -1;
259 
260  struct EventConfig *ev_c = nc->event_data;
261  if (!mutt_str_equal(ev_c->name, "help"))
262  return 0;
263 
264  struct MuttWindow *win_helpbar = nc->global_data;
265  win_helpbar->state.visible = cs_subset_bool(NeoMutt->sub, "help");
266 
267  mutt_window_reflow(win_helpbar->parent);
268  mutt_debug(LL_DEBUG5, "config done: '%s', request WA_REFLOW on parent\n", ev_c->name);
269  return 0;
270 }
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
bool visible
Window is visible.
Definition: mutt_window.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ helpbar_window_observer()

static int helpbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Focus (global): regenerate the list of key bindings
  • State (this window): regenerate the list of key bindings
  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 281 of file helpbar.c.

282 {
283  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
284  return -1;
285 
286  struct MuttWindow *win_helpbar = nc->global_data;
287 
288  if (nc->event_subtype == NT_WINDOW_FOCUS)
289  {
290  if (!mutt_window_is_visible(win_helpbar))
291  return 0;
292 
293  win_helpbar->actions |= WA_RECALC;
294  mutt_debug(LL_DEBUG5, "window focus: request WA_RECALC\n");
295  return 0;
296  }
297 
298  // The next two notifications must be specifically for us
299  struct EventWindow *ew = nc->event_data;
300  if (ew->win != win_helpbar)
301  return 0;
302 
303  if (nc->event_subtype == NT_WINDOW_STATE)
304  {
305  win_helpbar->actions |= WA_RECALC;
306  mutt_debug(LL_DEBUG5, "window state: request WA_RECALC\n");
307  }
308  else if (nc->event_subtype == NT_WINDOW_DELETE)
309  {
314  mutt_debug(LL_DEBUG5, "window delete done\n");
315  }
316 
317  return 0;
318 }
static int helpbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: helpbar.c:231
static int helpbar_binding_observer(struct NotifyCallback *nc)
Notification that a Key Binding has changed - Implements observer_t -.
Definition: helpbar.c:203
static int helpbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: helpbar.c:281
static int helpbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: helpbar.c:255
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:499
@ NT_WINDOW_FOCUS
Window focus has changed.
Definition: mutt_window.h:209
struct MuttWindow * RootWindow
Parent of all Windows.
Definition: rootwin.c:103
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_mailbox_observer()

static int index_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

If a Mailbox is closed, then set a pointer to NULL.

Definition at line 548 of file dlg_index.c.

549 {
550  if ((nc->event_type != NT_MAILBOX) || !nc->global_data)
551  return -1;
552 
553  if (nc->event_subtype != NT_MAILBOX_DELETE)
554  return 0;
555 
556  struct Mailbox **ptr = nc->global_data;
557  if (!ptr || !*ptr)
558  return 0;
559 
560  *ptr = NULL;
561  mutt_debug(LL_DEBUG5, "mailbox done\n");
562  return 0;
563 }
A mailbox.
Definition: mailbox.h:82
+ Here is the caller graph for this function:

◆ ibar_color_observer()

static int ibar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 172 of file ibar.c.

173 {
174  if ((nc->event_type != NT_COLOR) || !nc->global_data || !nc->event_data)
175  return -1;
176 
177  struct EventColor *ev_c = nc->event_data;
178 
179  // MT_COLOR_MAX is sent on `uncolor *`
180  if ((ev_c->color != MT_COLOR_STATUS) && (ev_c->color != MT_COLOR_MAX))
181  return 0;
182 
183  struct MuttWindow *win_ibar = nc->global_data;
184  win_ibar->actions |= WA_REPAINT;
185  mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
186 
187  return 0;
188 }
+ Here is the caller graph for this function:

◆ ibar_config_observer()

static int ibar_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 193 of file ibar.c.

194 {
195  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
196  return -1;
197 
198  struct EventConfig *ev_c = nc->event_data;
199  if ((ev_c->name[0] != 's') && (ev_c->name[0] != 't'))
200  return 0;
201 
202  if (!mutt_str_equal(ev_c->name, "status_format") &&
203  !mutt_str_equal(ev_c->name, "ts_enabled") &&
204  !mutt_str_equal(ev_c->name, "ts_icon_format") &&
205  !mutt_str_equal(ev_c->name, "ts_status_format"))
206  {
207  return 0;
208  }
209 
210  struct MuttWindow *win_ibar = nc->global_data;
211  win_ibar->actions |= WA_RECALC;
212  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
213 
214  return 0;
215 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ibar_index_observer()

static int ibar_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 220 of file ibar.c.

221 {
222  if ((nc->event_type != NT_INDEX) || !nc->global_data)
223  return -1;
224 
225  struct MuttWindow *win_ibar = nc->global_data;
226  if (!win_ibar)
227  return 0;
228 
229  struct IndexSharedData *shared = nc->event_data;
230  if (!shared)
231  return 0;
232 
234  {
235  win_ibar->actions |= WA_RECALC;
236  mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
237  }
238 
239  if (nc->event_subtype & NT_INDEX_EMAIL)
240  {
241  win_ibar->actions |= WA_RECALC;
242  mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
243  }
244 
245  return 0;
246 }
#define NT_INDEX_MAILBOX
Mailbox has changed.
Definition: lib.h:64
#define NT_INDEX_EMAIL
Email has changed.
Definition: lib.h:65
@ NT_INDEX
Index data has changed, NotifyIndex, IndexSharedData.
Definition: notify_type.h:47
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:37
+ Here is the caller graph for this function:

◆ ibar_mailbox_observer()

static int ibar_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 251 of file ibar.c.

252 {
253  if ((nc->event_type != NT_MAILBOX) || !nc->global_data)
254  return -1;
255 
256  struct MuttWindow *win_ibar = nc->global_data;
257  win_ibar->actions |= WA_RECALC;
258  mutt_debug(LL_DEBUG5, "mailbox done, request WA_RECALC\n");
259 
260  return 0;
261 }
+ Here is the caller graph for this function:

◆ ibar_menu_observer()

static int ibar_menu_observer ( struct NotifyCallback nc)
static

Notification that a Menu has changed - Implements observer_t -.

Definition at line 266 of file ibar.c.

267 {
268  if ((nc->event_type != NT_MENU) || !nc->global_data)
269  return -1;
270 
271  struct MuttWindow *win_ibar = nc->global_data;
272  win_ibar->actions |= WA_RECALC;
273  mutt_debug(LL_DEBUG5, "menu done, request WA_RECALC\n");
274 
275  return 0;
276 }
@ NT_MENU
Menu has changed, MenuRedrawFlags.
Definition: notify_type.h:49
+ Here is the caller graph for this function:

◆ ibar_window_observer()

static int ibar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 281 of file ibar.c.

282 {
283  if ((nc->event_type != NT_WINDOW) || !nc->global_data)
284  return -1;
285 
286  struct MuttWindow *win_ibar = nc->global_data;
287  struct EventWindow *ev_w = nc->event_data;
288  if (ev_w->win != win_ibar)
289  return 0;
290 
291  if (nc->event_subtype == NT_WINDOW_STATE)
292  {
293  win_ibar->actions |= WA_REPAINT;
294  mutt_debug(LL_DEBUG5, "window state done, request WA_REPAINT\n");
295  }
296  else if (nc->event_subtype == NT_WINDOW_DELETE)
297  {
298  struct MuttWindow *dlg = window_find_parent(win_ibar, WT_DLG_INDEX);
299  struct IndexSharedData *shared = dlg->wdata;
300 
306  notify_observer_remove(win_ibar->notify, ibar_window_observer, win_ibar);
307 
308  mutt_debug(LL_DEBUG5, "window delete done\n");
309  }
310 
311  return 0;
312 }
static int ibar_menu_observer(struct NotifyCallback *nc)
Notification that a Menu has changed - Implements observer_t -.
Definition: ibar.c:266
static int ibar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: ibar.c:281
static int ibar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: ibar.c:193
static int ibar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: ibar.c:172
static int ibar_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
Definition: ibar.c:251
static int ibar_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: ibar.c:220
struct MuttWindow * window_find_parent(struct MuttWindow *win, enum WindowType type)
Find a (grand-)parent of a Window by type.
Definition: mutt_window.c:545
@ WT_DLG_INDEX
Index Dialog, index_pager_init()
Definition: mutt_window.h:86
struct Notify * notify
Notifications: NotifyIndex, IndexSharedData.
Definition: shared_data.h:44
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_altern_observer()

static int index_altern_observer ( struct NotifyCallback nc)
static

Notification that an 'alternates' command has occurred - Implements observer_t -.

Definition at line 218 of file index.c.

219 {
220  if ((nc->event_type != NT_ALTERN) || !nc->global_data)
221  return -1;
222 
223  struct MuttWindow *win = nc->global_data;
224  struct MuttWindow *dlg = dialog_find(win);
225  struct IndexSharedData *shared = dlg->wdata;
226 
228  mutt_debug(LL_DEBUG5, "alternates done\n");
229  return 0;
230 }
void mutt_alternates_reset(struct Mailbox *m)
Clear the recipient valid flag of all emails.
Definition: alternates.c:72
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:83
@ NT_ALTERN
Alternates command changed, NotifyAlternates.
Definition: notify_type.h:36
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_attach_observer()

static int index_attach_observer ( struct NotifyCallback nc)
static

Notification that an 'attachments' command has occurred - Implements observer_t -.

Definition at line 235 of file index.c.

236 {
237  if ((nc->event_type != NT_ATTACH) || !nc->global_data)
238  return -1;
239 
240  struct MuttWindow *win = nc->global_data;
241  struct MuttWindow *dlg = dialog_find(win);
242  struct IndexSharedData *shared = dlg->wdata;
243 
245  mutt_debug(LL_DEBUG5, "attachments done\n");
246  return 0;
247 }
void mutt_attachments_reset(struct Mailbox *m)
Reset the attachment count for all Emails.
Definition: attachments.c:287
@ NT_ATTACH
Attachment command changed, NotifyAttach.
Definition: notify_type.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_color_observer()

static int index_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 252 of file index.c.

253 {
254  if ((nc->event_type != NT_COLOR) || !nc->global_data || !nc->event_data)
255  return -1;
256 
257  struct EventColor *ev_c = nc->event_data;
258 
259  const int c = ev_c->color;
260 
261  bool simple = (c == MT_COLOR_INDEX_COLLAPSED) || (c == MT_COLOR_INDEX_DATE) ||
262  (c == MT_COLOR_INDEX_LABEL) || (c == MT_COLOR_INDEX_NUMBER) ||
263  (c == MT_COLOR_INDEX_SIZE) || (c == MT_COLOR_INDEX_TAGS);
264 
265  bool lists = (c == MT_COLOR_INDEX) || (c == MT_COLOR_INDEX_AUTHOR) ||
266  (c == MT_COLOR_INDEX_FLAGS) || (c == MT_COLOR_INDEX_SUBJECT) ||
267  (c == MT_COLOR_INDEX_TAG);
268 
269  // The changes aren't relevant to the index menu
270  if (!simple && !lists)
271  return 0;
272 
273  struct MuttWindow *win = nc->global_data;
274  struct MuttWindow *dlg = dialog_find(win);
275  struct IndexSharedData *shared = dlg->wdata;
276 
277  struct Mailbox *m = shared->mailbox;
278  if (!m)
279  return 0;
280 
281  // Colour deleted from a list
282  if ((nc->event_subtype == NT_COLOR_RESET) && lists)
283  {
284  // Force re-caching of index colours
285  for (int i = 0; i < m->msg_count; i++)
286  {
287  struct Email *e = m->emails[i];
288  if (!e)
289  break;
290  e->pair = 0;
291  }
292  }
293 
294  struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
295  struct IndexPrivateData *priv = panel_index->wdata;
296  struct Menu *menu = priv->menu;
297  menu->redraw = MENU_REDRAW_FULL;
298  mutt_debug(LL_DEBUG5, "color done, request MENU_REDRAW_FULL\n");
299 
300  return 0;
301 }
@ MT_COLOR_INDEX_AUTHOR
Index: author field (takes a pattern)
Definition: color.h:77
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:86
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:87
@ MT_COLOR_INDEX_SUBJECT
Index: subject field (takes a pattern)
Definition: color.h:79
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:83
@ MT_COLOR_INDEX_TAG
Index: tag field (g, takes a pattern)
Definition: color.h:80
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:84
@ MT_COLOR_INDEX
Index: default colour (takes a pattern)
Definition: color.h:76
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:85
@ MT_COLOR_INDEX_FLAGS
Index: flags field (takes a pattern)
Definition: color.h:78
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:82
@ WT_INDEX
A panel containing the Index Window.
Definition: mutt_window.h:97
@ NT_COLOR_RESET
Color has been reset/removed.
Definition: notify2.h:42
The envelope/body of an email.
Definition: email.h:37
int pair
Color-pair to use when displaying in the index.
Definition: email.h:112
Private state data for the Index.
Definition: private_data.h:35
struct Menu * menu
Menu controlling the index.
Definition: private_data.h:44
int msg_count
Total number of messages.
Definition: mailbox.h:91
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
MenuRedrawFlags redraw
When to redraw the screen.
Definition: lib.h:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_config_observer()

static int index_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 306 of file index.c.

307 {
308  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
309  return -1;
310 
311  struct EventConfig *ev_c = nc->event_data;
312  struct MuttWindow *win = nc->global_data;
313 
314  const struct ConfigDef *cdef = ev_c->he->data;
315  ConfigRedrawFlags flags = cdef->type & R_REDRAW_MASK;
316 
317  if (flags & R_RESORT_SUB)
318  OptSortSubthreads = true;
319  if (flags & R_RESORT)
320  OptNeedResort = true;
321  if (flags & R_RESORT_INIT)
322  OptResortInit = true;
323 
324  if (mutt_str_equal(ev_c->name, "reply_regex"))
325  {
326  struct MuttWindow *dlg = dialog_find(win);
327  struct IndexSharedData *shared = dlg->wdata;
328  config_reply_regex(shared->mailbox);
329  mutt_debug(LL_DEBUG5, "config done\n");
330  }
331  else if (mutt_str_equal(ev_c->name, "sort"))
332  {
333  config_sort(ev_c->sub);
334  mutt_debug(LL_DEBUG5, "config done\n");
335  }
336  else if (mutt_str_equal(ev_c->name, "use_threads"))
337  {
338  config_use_threads(ev_c->sub);
339  mutt_debug(LL_DEBUG5, "config done\n");
340  }
341 
342  return 0;
343 }
static int config_sort(const struct ConfigSubset *sub)
React to changes to "sort".
Definition: index.c:108
static int config_use_threads(const struct ConfigSubset *sub)
React to changes to "use_threads".
Definition: index.c:156
static int config_reply_regex(struct Mailbox *m)
React to changes to $reply_regex.
Definition: index.c:182
bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: options.h:56
bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: options.h:59
bool OptNeedResort
(pseudo) used to force a re-sort
Definition: options.h:48
Definition: set.h:64
uint32_t type
Variable type, e.g. DT_STRING.
Definition: set.h:66
struct HashElem * he
Config item that changed.
Definition: subset.h:73
void * data
User-supplied data.
Definition: hash.h:47
#define R_RESORT
Resort the mailbox.
Definition: types.h:68
#define R_RESORT_SUB
Resort subthreads.
Definition: types.h:69
uint32_t ConfigRedrawFlags
Flags for redraw/resort, e.g. R_INDEX.
Definition: types.h:63
#define R_REDRAW_MASK
Mask for the Redraw Flags.
Definition: types.h:74
#define R_RESORT_INIT
Resort from scratch.
Definition: types.h:70
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_menu_observer()

static int index_menu_observer ( struct NotifyCallback nc)
static

Notification that the Menu has changed - Implements observer_t -.

Definition at line 348 of file index.c.

349 {
350  if ((nc->event_type != NT_MENU) || !nc->global_data)
351  return -1;
352 
353  struct MuttWindow *win = nc->global_data;
354  struct MuttWindow *dlg = dialog_find(win);
355  struct IndexSharedData *shared = dlg->wdata;
356  struct Menu *menu = win->wdata;
357 
358  const int index = menu_get_index(menu);
359  struct Email *e = mutt_get_virt_email(shared->mailbox, index);
360  index_shared_data_set_email(shared, e);
361 
362  return 0;
363 }
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: context.c:412
void index_shared_data_set_email(struct IndexSharedData *shared, struct Email *e)
Set the current Email for the Index and friends.
Definition: shared_data.c:228
int index
The absolute (unsorted) message number.
Definition: email.h:110
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:74
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_score_observer()

static int index_score_observer ( struct NotifyCallback nc)
static

Notification that a 'score' command has occurred - Implements observer_t -.

Definition at line 368 of file index.c.

369 {
370  if ((nc->event_type != NT_SCORE) || !nc->global_data)
371  return -1;
372 
373  struct MuttWindow *win = nc->global_data;
374  struct MuttWindow *dlg = dialog_find(win);
375  struct IndexSharedData *shared = dlg->wdata;
376 
377  struct Mailbox *m = shared->mailbox;
378  if (!m)
379  return 0;
380 
381  for (int i = 0; i < m->msg_count; i++)
382  {
383  struct Email *e = m->emails[i];
384  if (!e)
385  break;
386 
387  mutt_score_message(m, e, true);
388  e->pair = 0; // Force recalc of colour
389  }
390 
391  mutt_debug(LL_DEBUG5, "score done\n");
392  return 0;
393 }
@ NT_SCORE
Email scoring has changed.
Definition: notify_type.h:51
void mutt_score_message(struct Mailbox *m, struct Email *e, bool upd_mbox)
Apply scoring to an email.
Definition: score.c:160
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_subjrx_observer()

static int index_subjrx_observer ( struct NotifyCallback nc)
static

Notification that a 'subjectrx' command has occurred - Implements observer_t -.

Definition at line 398 of file index.c.

399 {
400  if ((nc->event_type != NT_SUBJRX) || !nc->global_data)
401  return -1;
402 
403  struct MuttWindow *win = nc->global_data;
404  struct MuttWindow *dlg = dialog_find(win);
405  struct IndexSharedData *shared = dlg->wdata;
406 
407  subjrx_clear_mods(shared->mailbox);
408  mutt_debug(LL_DEBUG5, "subjectrx done\n");
409  return 0;
410 }
@ NT_SUBJRX
Subject Regex has changed, NotifySubjRx.
Definition: notify_type.h:52
void subjrx_clear_mods(struct Mailbox *m)
Clear out all modified email subjects.
Definition: subjectrx.c:146
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_window_observer()

static int index_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 415 of file index.c.

416 {
417  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
418  return -1;
419 
420  if (nc->event_subtype != NT_WINDOW_DELETE)
421  return 0;
422 
423  struct MuttWindow *win = nc->global_data;
424  struct EventWindow *ev_w = nc->event_data;
425  if (ev_w->win != win)
426  return 0;
427 
428  struct Menu *menu = win->wdata;
429 
438 
439  mutt_debug(LL_DEBUG5, "window delete done\n");
440  return 0;
441 }
static int index_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: index.c:252
static int index_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: index.c:306
static int index_menu_observer(struct NotifyCallback *nc)
Notification that the Menu has changed - Implements observer_t -.
Definition: index.c:348
static int index_score_observer(struct NotifyCallback *nc)
Notification that a 'score' command has occurred - Implements observer_t -.
Definition: index.c:368
static int index_altern_observer(struct NotifyCallback *nc)
Notification that an 'alternates' command has occurred - Implements observer_t -.
Definition: index.c:218
static int index_subjrx_observer(struct NotifyCallback *nc)
Notification that a 'subjectrx' command has occurred - Implements observer_t -.
Definition: index.c:398
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an 'attachments' command has occurred - Implements observer_t -.
Definition: index.c:235
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: index.c:415
struct Notify * notify
Notifications.
Definition: lib.h:151
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ipanel_config_observer()

static int ipanel_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 72 of file ipanel.c.

73 {
74  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
75  return -1;
76 
77  struct EventConfig *ev_c = nc->event_data;
78  struct MuttWindow *panel_index = nc->global_data;
79 
80  if (mutt_str_equal(ev_c->name, "status_on_top"))
81  {
82  window_status_on_top(panel_index, NeoMutt->sub);
83  mutt_debug(LL_DEBUG5, "config done\n");
84  }
85 
86  return 0;
87 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ipanel_window_observer()

static int ipanel_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 92 of file ipanel.c.

93 {
94  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
95  return -1;
96 
98  return 0;
99 
100  struct MuttWindow *panel_index = nc->global_data;
101  struct EventWindow *ev_w = nc->event_data;
102  if (ev_w->win != panel_index)
103  return 0;
104 
106  notify_observer_remove(panel_index->notify, ipanel_window_observer, panel_index);
107  mutt_debug(LL_DEBUG5, "window delete done\n");
108 
109  return 0;
110 }
static int ipanel_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: ipanel.c:72
static int ipanel_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: ipanel.c:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_shared_context_observer()

static int index_shared_context_observer ( struct NotifyCallback nc)
static

Notification that the Context has changed - Implements observer_t -.

Definition at line 42 of file shared_data.c.

43 {
44  if ((nc->event_type != NT_CONTEXT) || !nc->global_data || !nc->event_data)
45  return -1;
46 
47  struct EventContext *ev_c = nc->event_data;
48  if (nc->event_subtype == NT_CONTEXT_ADD)
49  return 0;
50 
51  struct IndexSharedData *shared = nc->global_data;
52  if (ev_c->ctx != shared->ctx)
53  return 0;
54 
56  shared->ctx = NULL;
57 
58  // Relay the message
59  mutt_debug(LL_NOTIFY, "NT_INDEX_CONTEXT\n");
60  notify_send(shared->notify, NT_INDEX, NT_INDEX_CONTEXT, shared);
61  return 0;
62 }
@ NT_CONTEXT_DELETE
The Context is about to be destroyed.
Definition: context.h:61
@ NT_CONTEXT_ADD
The Context has been opened.
Definition: context.h:60
#define NT_INDEX_CONTEXT
Context has changed.
Definition: lib.h:63
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:171
@ NT_CONTEXT
Context has changed, NotifyContext, EventContext.
Definition: notify_type.h:43
An Event that happened to an Context.
Definition: context.h:69
struct Context * ctx
The Context this Event relates to.
Definition: context.h:70
struct Context * ctx
Current Mailbox view.
Definition: shared_data.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_shared_account_observer()

static int index_shared_account_observer ( struct NotifyCallback nc)
static

Notification that an Account has changed - Implements observer_t -.

Definition at line 67 of file shared_data.c.

68 {
69  if ((nc->event_type != NT_ACCOUNT) || !nc->global_data || !nc->event_data)
70  return -1;
71 
72  struct EventAccount *ev_a = nc->event_data;
73  if (nc->event_subtype == NT_ACCOUNT_ADD)
74  return 0;
75 
76  struct IndexSharedData *shared = nc->global_data;
77  if (ev_a->account != shared->account)
78  return 0;
79 
81  shared->account = NULL;
82 
83  // Relay the message
84  mutt_debug(LL_NOTIFY, "NT_INDEX_ACCOUNT\n");
85  notify_send(shared->notify, NT_INDEX, NT_INDEX_ACCOUNT, shared);
86  return 0;
87 }
@ NT_ACCOUNT_ADD
Account has been added.
Definition: account.h:69
@ NT_ACCOUNT_DELETE
Account is about to be deleted.
Definition: account.h:70
#define NT_INDEX_ACCOUNT
Account has changed.
Definition: lib.h:62
@ NT_ACCOUNT
Account has changed, NotifyAccount, EventAccount.
Definition: notify_type.h:34
An Event that happened to an Account.
Definition: account.h:79
struct Account * account
The Account this Event relates to.
Definition: account.h:80
struct Account * account
Current Account.
Definition: shared_data.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_shared_mailbox_observer()

static int index_shared_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 92 of file shared_data.c.

93 {
94  if ((nc->event_type != NT_MAILBOX) || !nc->global_data || !nc->event_data)
95  return -1;
96 
97  struct EventMailbox *ev_m = nc->event_data;
98  if (nc->event_subtype == NT_MAILBOX_ADD)
99  return 0;
100 
101  struct IndexSharedData *shared = nc->global_data;
102  if (ev_m->mailbox != shared->mailbox)
103  return 0;
104 
105  if (nc->event_subtype == NT_MAILBOX_DELETE)
106  shared->mailbox = NULL;
107 
108  // Relay the message
109  mutt_debug(LL_NOTIFY, "NT_INDEX_MAILBOX\n");
110  notify_send(shared->notify, NT_INDEX, NT_INDEX_MAILBOX, shared);
111  return 0;
112 }
@ NT_MAILBOX_ADD
Mailbox has been added.
Definition: mailbox.h:173
An Event that happened to a Mailbox.
Definition: mailbox.h:191
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:192
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_shared_email_observer()

static int index_shared_email_observer ( struct NotifyCallback nc)
static

Notification that an Email has changed - Implements observer_t -.

Definition at line 117 of file shared_data.c.

118 {
119  if ((nc->event_type != NT_EMAIL) || !nc->global_data || !nc->event_data)
120  return -1;
121 
122  struct EventEmail *ev_e = nc->event_data;
123  if (nc->event_subtype == NT_EMAIL_ADD)
124  return 0;
125 
126  struct IndexSharedData *shared = nc->global_data;
127  bool match = false;
128  for (int i = 0; i < ev_e->num_emails; i++)
129  {
130  if (ev_e->emails[i] == shared->email)
131  {
132  match = true;
133  break;
134  }
135  }
136 
137  if (!match)
138  return 0;
139 
140  if (nc->event_subtype == NT_EMAIL_DELETE)
141  shared->email = NULL;
142 
143  // Relay the message
144  mutt_debug(LL_NOTIFY, "NT_INDEX_EMAIL: %p\n", shared->email);
145  notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, shared);
146  return 0;
147 }
@ NT_EMAIL_ADD
Email has been added.
Definition: email.h:147
@ NT_EMAIL_DELETE
Email is about to be deleted.
Definition: email.h:148
@ NT_EMAIL
Email has changed, NotifyEmail, EventEmail.
Definition: notify_type.h:44
An Event that happened to an Email.
Definition: email.h:157
int num_emails
Number of Emails the event applies to.
Definition: email.h:158
struct Email ** emails
Emails affected by the event.
Definition: email.h:159
struct Email * email
Currently selected Email.
Definition: shared_data.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main_config_observer()

int main_config_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 863 of file keymap.c.

864 {
865  if ((nc->event_type != NT_CONFIG) || !nc->event_data)
866  return -1;
867 
868  struct EventConfig *ev_c = nc->event_data;
869 
870  if (!mutt_str_equal(ev_c->name, "abort_key"))
871  return 0;
872 
874  mutt_debug(LL_DEBUG5, "config done\n");
875  return 0;
876 }
void mutt_init_abort_key(void)
Parse the abort_key config string.
Definition: keymap.c:841
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_color_observer()

static int menu_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 40 of file observer.c.

41 {
42  if ((nc->event_type != NT_COLOR) || !nc->global_data || !nc->event_data)
43  return -1;
44 
45  struct EventColor *ev_c = nc->event_data;
46 
47  // MT_COLOR_MAX is sent on `uncolor *`
48  if ((ev_c->color != MT_COLOR_NORMAL) && (ev_c->color != MT_COLOR_INDICATOR) &&
49  (ev_c->color != MT_COLOR_MAX))
50  {
51  return 0;
52  }
53 
54  struct Menu *menu = nc->global_data;
55  struct MuttWindow *win = menu->win;
56 
57  menu->redraw = MENU_REDRAW_FULL;
58  win->actions |= WA_REPAINT;
59  mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT, MENU_REDRAW_FULL\n");
60 
61  return 0;
62 }
@ MT_COLOR_INDICATOR
Selected item in list.
Definition: color.h:49
+ Here is the caller graph for this function:

◆ menu_config_observer()

static int menu_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 67 of file observer.c.

68 {
69  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
70  return -1;
71 
72  struct EventConfig *ev_c = nc->event_data;
73  if (!mutt_str_startswith(ev_c->name, "arrow_") && !mutt_str_startswith(ev_c->name, "menu_"))
74  return 0;
75 
76  if (mutt_str_equal(ev_c->name, "menu_scroll"))
77  return 0; // This doesn't affect the display
78 
79  struct Menu *menu = nc->global_data;
80  menu_adjust(menu);
81 
82  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
83  return 0;
84 }
void menu_adjust(struct Menu *menu)
Reapply the config to the Menu.
Definition: move.c:308
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:158
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_window_observer()

static int menu_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 89 of file observer.c.

90 {
91  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
92  return -1;
93 
94  struct Menu *menu = nc->global_data;
95  struct MuttWindow *win = menu->win;
96  struct EventWindow *ev_w = nc->event_data;
97  if (ev_w->win != win)
98  return 0;
99 
100  if (nc->event_subtype == NT_WINDOW_STATE)
101  {
102  menu->pagelen = win->state.rows;
103  menu->redraw |= MENU_REDRAW_FULL;
104 
107  "window state done, request MENU_REDRAW_INDEX, WA_REPAINT\n");
108  }
109  else if (nc->event_subtype == NT_WINDOW_DELETE)
110  {
114  mutt_debug(LL_DEBUG5, "window delete done\n");
115  }
116 
117  return 0;
118 }
void mutt_color_observer_remove(observer_t callback, void *global_data)
Remove an observer.
Definition: notify.c:67
static int menu_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: observer.c:89
static int menu_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: observer.c:67
static int menu_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: observer.c:40
int pagelen
Number of entries per screen.
Definition: lib.h:72
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main_hist_observer()

int main_hist_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 61 of file mutt_history.c.

62 {
63  if ((nc->event_type != NT_CONFIG) || !nc->event_data)
64  return -1;
65 
66  struct EventConfig *ev_c = nc->event_data;
67 
68  if (!mutt_str_equal(ev_c->name, "history"))
69  return 0;
70 
72  mutt_debug(LL_DEBUG5, "history done\n");
73  return 0;
74 }
void mutt_hist_init(void)
Create a set of empty History ring buffers.
Definition: history.c:468
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ main_log_observer()

int main_log_observer ( struct NotifyCallback nc)

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 321 of file mutt_logging.c.

322 {
323  if ((nc->event_type != NT_CONFIG) || !nc->event_data)
324  return -1;
325 
326  struct EventConfig *ev_c = nc->event_data;
327 
328  if (mutt_str_equal(ev_c->name, "debug_file"))
329  {
330  const char *const c_debug_file = cs_subset_path(NeoMutt->sub, "debug_file");
331  mutt_log_set_file(c_debug_file);
332  }
333  else if (mutt_str_equal(ev_c->name, "debug_level"))
334  {
335  const short c_debug_level = cs_subset_number(NeoMutt->sub, "debug_level");
336  mutt_log_set_level(c_debug_level, true);
337  }
338  else
339  {
340  return 0;
341  }
342 
343  mutt_debug(LL_DEBUG5, "log done\n");
344  return 0;
345 }
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition: helpers.c:169
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Definition: helpers.c:194
int mutt_log_set_level(enum LogLevel level, bool verbose)
Change the logging level.
Definition: mutt_logging.c:262
int mutt_log_set_file(const char *file)
Change the logging file.
Definition: mutt_logging.c:236
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpgme_key_config_observer()

static int gpgme_key_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 1255 of file dlggpgme.c.

1256 {
1257  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
1258  return -1;
1259 
1260  struct EventConfig *ev_c = nc->event_data;
1261 
1262  if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
1263  !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
1264  {
1265  return 0;
1266  }
1267 
1268  struct Menu *menu = nc->global_data;
1270  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
1271 
1272  return 0;
1273 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gpgme_key_window_observer()

static int gpgme_key_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 1282 of file dlggpgme.c.

1283 {
1284  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
1285  return -1;
1286 
1287  if (nc->event_subtype != NT_WINDOW_DELETE)
1288  return 0;
1289 
1290  struct MuttWindow *win_menu = nc->global_data;
1291  struct EventWindow *ev_w = nc->event_data;
1292  if (ev_w->win != win_menu)
1293  return 0;
1294 
1295  struct Menu *menu = win_menu->wdata;
1296 
1299 
1300  mutt_debug(LL_DEBUG5, "window delete done\n");
1301  return 0;
1302 }
static int gpgme_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlggpgme.c:1255
static int gpgme_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlggpgme.c:1282
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_key_config_observer()

static int pgp_key_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 528 of file dlgpgp.c.

529 {
530  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
531  return -1;
532 
533  struct EventConfig *ev_c = nc->event_data;
534 
535  if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
536  !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
537  {
538  return 0;
539  }
540 
541  struct Menu *menu = nc->global_data;
543  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
544 
545  return 0;
546 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pgp_key_window_observer()

static int pgp_key_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 555 of file dlgpgp.c.

556 {
557  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
558  return -1;
559 
560  if (nc->event_subtype != NT_WINDOW_DELETE)
561  return 0;
562 
563  struct MuttWindow *win_menu = nc->global_data;
564  struct EventWindow *ev_w = nc->event_data;
565  if (ev_w->win != win_menu)
566  return 0;
567 
568  struct Menu *menu = win_menu->wdata;
569 
572 
573  mutt_debug(LL_DEBUG5, "window delete done\n");
574  return 0;
575 }
static int pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlgpgp.c:555
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlgpgp.c:528
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dopager_config_observer()

static int dopager_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 75 of file do_pager.c.

76 {
77  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
78  return -1;
79 
80  struct EventConfig *ev_c = nc->event_data;
81  if (!mutt_str_equal(ev_c->name, "status_on_top"))
82  return 0;
83 
84  struct MuttWindow *dlg = nc->global_data;
86  mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
87  return 0;
88 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dopager_window_observer()

static int dopager_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 93 of file do_pager.c.

94 {
95  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
96  return -1;
97 
99  return 0;
100 
101  struct MuttWindow *dlg = nc->global_data;
102  struct EventWindow *ev_w = nc->event_data;
103  if (ev_w->win != dlg)
104  return 0;
105 
108  mutt_debug(LL_DEBUG5, "window delete done\n");
109 
110  return 0;
111 }
static int dopager_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: do_pager.c:75
static int dopager_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: do_pager.c:93
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_color_observer()

static int pager_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 122 of file pager.c.

123 {
124  if ((nc->event_type != NT_COLOR) || !nc->global_data || !nc->event_data)
125  return -1;
126 
127  mutt_debug(LL_DEBUG5, "color done\n");
128  return 0;
129 }
+ Here is the caller graph for this function:

◆ pager_config_observer()

static int pager_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 134 of file pager.c.

135 {
136  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
137  return -1;
138 
139  struct EventConfig *ev_c = nc->event_data;
140  struct MuttWindow *win_pager = nc->global_data;
141 
142  if (mutt_str_equal(ev_c->name, "pager_index_lines"))
143  {
144  config_pager_index_lines(win_pager);
145  mutt_debug(LL_DEBUG5, "config done\n");
146  }
147 
148  return 0;
149 }
static int config_pager_index_lines(struct MuttWindow *win)
React to changes to $pager_index_lines.
Definition: pager.c:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_index_observer()

static int pager_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 154 of file pager.c.

155 {
156  if ((nc->event_type != NT_INDEX) || !nc->global_data)
157  return -1;
158 
159  struct MuttWindow *win_pager = nc->global_data;
160  if (!win_pager)
161  return 0;
162 
163  struct IndexSharedData *shared = nc->event_data;
164  if (!shared)
165  return 0;
166 
167  struct PagerPrivateData *priv = win_pager->wdata;
168  if (!priv)
169  return 0;
170 
172  {
174  win_pager->actions |= WA_RECALC;
175  mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
176  }
177 
178  if (nc->event_subtype & NT_INDEX_EMAIL)
179  {
181  win_pager->actions |= WA_RECALC;
182  mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
183  }
184 
185  return 0;
186 }
Private state data for the Pager.
Definition: private_data.h:41
struct Menu * menu
Pager Menu.
Definition: private_data.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pager_pager_observer()

static int pager_pager_observer ( struct NotifyCallback nc)
static

Notification that the Pager has changed - Implements observer_t -.

Definition at line 191 of file pager.c.

192 {
193  if ((nc->event_type != NT_PAGER) || !nc->global_data || !nc->event_data)
194  return -1;
195 
196  mutt_debug(LL_DEBUG5, "pager done\n");
197  return 0;
198 }
@ NT_PAGER
Pager data has changed, NotifyPager, PagerPrivateData.
Definition: notify_type.h:50
+ Here is the caller graph for this function:

◆ pager_window_observer()

static int pager_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 203 of file pager.c.

204 {
205  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
206  return -1;
207 
208  if (nc->event_subtype != NT_WINDOW_DELETE)
209  return 0;
210 
211  struct MuttWindow *win_pager = nc->global_data;
212  struct EventWindow *ev_w = nc->event_data;
213  if (ev_w->win != win_pager)
214  return 0;
215 
216  struct MuttWindow *dlg = window_find_parent(win_pager, WT_DLG_INDEX);
217  if (!dlg)
218  dlg = window_find_parent(win_pager, WT_DLG_DO_PAGER);
219 
220  struct IndexSharedData *shared = dlg->wdata;
221 
226  notify_observer_remove(win_pager->notify, pager_window_observer, win_pager);
227 
228  mutt_debug(LL_DEBUG5, "window delete done\n");
229 
230  return 0;
231 }
static int pager_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition: pager.c:191
static int pager_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: pager.c:122
static int pager_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: pager.c:134
static int pager_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: pager.c:154
static int pager_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: pager.c:203
@ WT_DLG_DO_PAGER
Pager Dialog, mutt_do_pager()
Definition: mutt_window.h:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pbar_color_observer()

static int pbar_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 177 of file pbar.c.

178 {
179  if ((nc->event_type != NT_COLOR) || !nc->global_data || !nc->event_data)
180  return -1;
181 
182  struct EventColor *ev_c = nc->event_data;
183  enum ColorId color = ev_c->color;
184 
185  if (color != MT_COLOR_STATUS)
186  return 0;
187 
188  struct MuttWindow *win_pbar = nc->global_data;
189  win_pbar->actions |= WA_REPAINT;
190  mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
191 
192  return 0;
193 }
+ Here is the caller graph for this function:

◆ pbar_config_observer()

static int pbar_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 198 of file pbar.c.

199 {
200  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
201  return -1;
202 
203  struct EventConfig *ev_c = nc->event_data;
204  if (!mutt_str_equal(ev_c->name, "pager_format"))
205  return 0;
206 
207  struct MuttWindow *win_pbar = nc->global_data;
208  win_pbar->actions |= WA_RECALC;
209  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
210 
211  return 0;
212 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pbar_index_observer()

static int pbar_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 217 of file pbar.c.

218 {
219  if ((nc->event_type != NT_INDEX) || !nc->global_data)
220  return -1;
221 
222  struct MuttWindow *win_pbar = nc->global_data;
223  if (!win_pbar)
224  return 0;
225 
226  struct IndexSharedData *shared = nc->event_data;
227  if (!shared)
228  return 0;
229 
231  {
232  win_pbar->actions |= WA_RECALC;
233  mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
234  }
235 
236  if (nc->event_subtype & NT_INDEX_EMAIL)
237  {
238  win_pbar->actions |= WA_RECALC;
239  mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
240  }
241 
242  return 0;
243 }
+ Here is the caller graph for this function:

◆ pbar_pager_observer()

static int pbar_pager_observer ( struct NotifyCallback nc)
static

Notification that the Pager has changed - Implements observer_t -.

Definition at line 248 of file pbar.c.

249 {
250  if ((nc->event_type != NT_PAGER) || !nc->global_data)
251  return -1;
252 
253  struct MuttWindow *win_pbar = nc->global_data;
254  if (!win_pbar)
255  return 0;
256 
257  if (nc->event_subtype & NT_PAGER_VIEW)
258  {
259  win_pbar->actions |= WA_RECALC;
260  mutt_debug(LL_DEBUG5, "pager done, request WA_RECALC\n");
261  }
262 
263  return 0;
264 }
#define NT_PAGER_VIEW
Pager View has changed.
Definition: lib.h:174
+ Here is the caller graph for this function:

◆ pbar_window_observer()

static int pbar_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 269 of file pbar.c.

270 {
271  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
272  return -1;
273 
274  struct MuttWindow *win_pbar = nc->global_data;
275  struct EventWindow *ev_w = nc->event_data;
276  if (ev_w->win != win_pbar)
277  return 0;
278 
279  if (nc->event_subtype == NT_WINDOW_STATE)
280  {
281  win_pbar->actions |= WA_RECALC | WA_REPAINT;
282  mutt_debug(LL_NOTIFY, "window state done, request WA_RECALC\n");
283  }
284  else if (nc->event_subtype == NT_WINDOW_DELETE)
285  {
286  struct PBarPrivateData *pbar_data = win_pbar->wdata;
287  struct IndexSharedData *shared = pbar_data->shared;
288 
292  notify_observer_remove(pbar_data->priv->notify, pbar_pager_observer, win_pbar);
293  notify_observer_remove(win_pbar->notify, pbar_window_observer, win_pbar);
294 
295  mutt_debug(LL_DEBUG5, "window delete done\n");
296  }
297 
298  return 0;
299 }
static int pbar_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: pbar.c:269
static int pbar_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: pbar.c:177
static int pbar_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: pbar.c:198
static int pbar_pager_observer(struct NotifyCallback *nc)
Notification that the Pager has changed - Implements observer_t -.
Definition: pbar.c:248
static int pbar_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: pbar.c:217
Data to draw the Pager Bar.
Definition: pbar.c:84
struct PagerPrivateData * priv
Private Pager data.
Definition: pbar.c:86
struct IndexSharedData * shared
Shared Index data.
Definition: pbar.c:85
struct Notify * notify
Notifications: NotifyPager, PagerPrivateData.
Definition: private_data.h:75
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ppanel_config_observer()

static int ppanel_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 73 of file ppanel.c.

74 {
75  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
76  return -1;
77 
78  struct EventConfig *ev_c = nc->event_data;
79  struct MuttWindow *panel_pager = nc->global_data;
80 
81  if (mutt_str_equal(ev_c->name, "status_on_top"))
82  {
83  window_status_on_top(panel_pager, NeoMutt->sub);
84  mutt_debug(LL_DEBUG5, "config done\n");
85  }
86 
87  return 0;
88 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ppanel_window_observer()

static int ppanel_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 93 of file ppanel.c.

94 {
95  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
96  return -1;
97 
99  return 0;
100 
101  struct MuttWindow *panel_pager = nc->global_data;
102  struct EventWindow *ev_w = nc->event_data;
103  if (ev_w->win != panel_pager)
104  return 0;
105 
107  notify_observer_remove(panel_pager->notify, ppanel_window_observer, panel_pager);
108  mutt_debug(LL_DEBUG5, "window delete done\n");
109 
110  return 0;
111 }
static int ppanel_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: ppanel.c:73
static int ppanel_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: ppanel.c:93
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pattern_config_observer()

static int pattern_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

The Address Book Window is affected by changes to $sort_pattern.

Definition at line 291 of file dlgpattern.c.

292 {
293  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
294  return -1;
295 
296  struct EventConfig *ev_c = nc->event_data;
297 
298  if (!mutt_str_equal(ev_c->name, "pattern_format"))
299  return 0;
300 
301  struct Menu *menu = nc->global_data;
303  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
304 
305  return 0;
306 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pattern_window_observer()

static int pattern_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

This function is triggered by changes to the windows.

  • Delete (this window): clean up the resources held by the Help Bar

Definition at line 315 of file dlgpattern.c.

316 {
317  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
318  return -1;
319 
320  if (nc->event_subtype != NT_WINDOW_DELETE)
321  return 0;
322 
323  struct MuttWindow *win_menu = nc->global_data;
324  struct EventWindow *ev_w = nc->event_data;
325  if (ev_w->win != win_menu)
326  return 0;
327 
328  struct Menu *menu = win_menu->wdata;
329 
332 
333  mutt_debug(LL_DEBUG5, "window delete done\n");
334  return 0;
335 }
static int pattern_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlgpattern.c:315
static int pattern_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlgpattern.c:291
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remailer_config_observer()

static int remailer_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 596 of file remailer.c.

597 {
598  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
599  return -1;
600 
601  struct EventConfig *ev_c = nc->event_data;
602  if (!mutt_str_equal(ev_c->name, "status_on_top"))
603  return 0;
604 
605  struct MuttWindow *dlg = nc->global_data;
607  mutt_debug(LL_DEBUG5, "config done\n");
608  return 0;
609 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remailer_window_observer()

static int remailer_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 614 of file remailer.c.

615 {
616  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
617  return -1;
618 
619  if (nc->event_subtype != NT_WINDOW_DELETE)
620  return 0;
621 
622  struct MuttWindow *dlg = nc->global_data;
623  struct EventWindow *ev_w = nc->event_data;
624  if (ev_w->win != dlg)
625  return 0;
626 
629  mutt_debug(LL_DEBUG5, "window delete done\n");
630 
631  return 0;
632 }
static int remailer_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: remailer.c:596
static int remailer_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: remailer.c:614
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_account_observer()

static int sb_account_observer ( struct NotifyCallback nc)
static

Notification that an Account has changed - Implements observer_t -.

Definition at line 183 of file observer.c.

184 {
185  if ((nc->event_type != NT_ACCOUNT) || !nc->global_data || !nc->event_data)
186  return -1;
187 
188  struct MuttWindow *win = nc->global_data;
189  struct SidebarWindowData *wdata = sb_wdata_get(win);
190  struct EventAccount *ev_a = nc->event_data;
191 
192  struct MailboxNode *np = NULL;
193  STAILQ_FOREACH(np, &ev_a->account->mailboxes, entries)
194  {
195  sb_add_mailbox(wdata, np->mailbox);
196  }
197 
198  win->actions |= WA_RECALC;
199  mutt_debug(LL_DEBUG5, "account done, request WA_RECALC\n");
200  return 0;
201 }
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
struct SidebarWindowData * sb_wdata_get(struct MuttWindow *win)
Get the Sidebar data for this window.
Definition: wdata.c:70
void sb_add_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Add a Mailbox to the Sidebar.
Definition: sidebar.c:84
struct MailboxList mailboxes
List of Mailboxes.
Definition: account.h:41
List of Mailboxes.
Definition: mailbox.h:157
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:158
Sidebar private Window data -.
Definition: private.h:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_color_observer()

static int sb_color_observer ( struct NotifyCallback nc)
static

Notification that a Color has changed - Implements observer_t -.

Definition at line 206 of file observer.c.

207 {
208  if ((nc->event_type != NT_COLOR) || !nc->global_data || !nc->event_data)
209  return -1;
210 
211  struct EventColor *ev_c = nc->event_data;
212  struct MuttWindow *win = nc->global_data;
213 
214  enum ColorId color = ev_c->color;
215 
216  switch (color)
217  {
218  case MT_COLOR_INDICATOR:
219  case MT_COLOR_NORMAL:
228  case MT_COLOR_MAX: // Sent on `uncolor *`
229  win->actions |= WA_REPAINT;
230  mutt_debug(LL_DEBUG5, "color done, request WA_REPAINT\n");
231  break;
232 
233  default:
234  break;
235  }
236  return 0;
237 }
@ MT_COLOR_SIDEBAR_DIVIDER
Line dividing sidebar from the index/pager.
Definition: color.h:60
@ MT_COLOR_SIDEBAR_NEW
Mailbox with new mail.
Definition: color.h:64
@ MT_COLOR_SIDEBAR_UNREAD
Mailbox with unread mail.
Definition: color.h:67
@ MT_COLOR_SIDEBAR_SPOOLFILE
$spool_file (Spool mailbox)
Definition: color.h:66
@ MT_COLOR_SIDEBAR_ORDINARY
Mailbox with no new or flagged messages.
Definition: color.h:65
@ MT_COLOR_SIDEBAR_INDICATOR
Current open mailbox.
Definition: color.h:63
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
Definition: color.h:62
@ MT_COLOR_SIDEBAR_FLAGGED
Mailbox with flagged messages.
Definition: color.h:61
+ Here is the caller graph for this function:

◆ sb_command_observer()

static int sb_command_observer ( struct NotifyCallback nc)
static

Notification that a Command has occurred - Implements observer_t -.

Definition at line 242 of file observer.c.

243 {
244  if ((nc->event_type != NT_COMMAND) || !nc->global_data || !nc->event_data)
245  return -1;
246 
247  struct Command *cmd = nc->event_data;
248 
249  if ((cmd->parse != sb_parse_whitelist) && (cmd->parse != sb_parse_unwhitelist))
250  return 0;
251 
252  struct MuttWindow *win = nc->global_data;
253  win->actions |= WA_RECALC;
254  mutt_debug(LL_DEBUG5, "command done, request WA_RECALC\n");
255  return 0;
256 }
enum CommandResult sb_parse_whitelist(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'sidebar_whitelist' command - Implements Command::parse() -.
Definition: commands.c:42
enum CommandResult sb_parse_unwhitelist(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unsidebar_whitelist' command - Implements Command::parse() -.
Definition: commands.c:61
@ NT_COMMAND
A Command has been executed, Command.
Definition: notify_type.h:40
enum CommandResult(* parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Definition: command.h:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_config_observer()

static int sb_config_observer ( struct NotifyCallback nc)
static

Notification that a Config Variable has changed - Implements observer_t -.

Definition at line 261 of file observer.c.

262 {
263  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
264  return -1;
265 
266  struct EventConfig *ev_c = nc->event_data;
267 
268  if (!mutt_strn_equal(ev_c->name, "sidebar_", 8) &&
269  !mutt_str_equal(ev_c->name, "ascii_chars") &&
270  !mutt_str_equal(ev_c->name, "folder") && !mutt_str_equal(ev_c->name, "spool_file"))
271  {
272  return 0;
273  }
274 
275  if (mutt_str_equal(ev_c->name, "sidebar_next_new_wrap"))
276  return 0; // Affects the behaviour, but not the display
277 
278  mutt_debug(LL_DEBUG5, "config: %s\n", ev_c->name);
279 
280  struct MuttWindow *win = nc->global_data;
281 
282  if (mutt_str_equal(ev_c->name, "sidebar_visible"))
283  {
284  const bool c_sidebar_visible =
285  cs_subset_bool(NeoMutt->sub, "sidebar_visible");
286  window_set_visible(win, c_sidebar_visible);
287  window_reflow(win->parent);
288  mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
289  return 0;
290  }
291 
292  if (mutt_str_equal(ev_c->name, "sidebar_width"))
293  {
294  const short c_sidebar_width =
295  cs_subset_number(NeoMutt->sub, "sidebar_width");
296  win->req_cols = c_sidebar_width;
297  window_reflow(win->parent);
298  mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
299  return 0;
300  }
301 
302  if (mutt_str_equal(ev_c->name, "spool_file"))
303  {
304  win->actions |= WA_REPAINT;
305  mutt_debug(LL_DEBUG5, "config done, request WA_REPAINT\n");
306  return 0;
307  }
308 
309  if (mutt_str_equal(ev_c->name, "sidebar_on_right"))
310  {
311  struct MuttWindow *parent = win->parent;
312  struct MuttWindow *first = TAILQ_FIRST(&parent->children);
313  const bool c_sidebar_on_right =
314  cs_subset_bool(NeoMutt->sub, "sidebar_on_right");
315 
316  if ((c_sidebar_on_right && (first == win)) || (!c_sidebar_on_right && (first != win)))
317  {
318  // Swap the Sidebar and the Container of the Index/Pager
319  TAILQ_REMOVE(&parent->children, first, entries);
320  TAILQ_INSERT_TAIL(&parent->children, first, entries);
321  }
322 
323  window_reflow(win->parent);
324  mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
325  return 0;
326  }
327 
328  if (mutt_str_equal(ev_c->name, "ascii_chars") ||
329  mutt_str_equal(ev_c->name, "sidebar_divider_char"))
330  {
331  struct SidebarWindowData *wdata = sb_wdata_get(win);
332  if (calc_divider(wdata))
333  {
334  window_reflow(win->parent);
335  mutt_debug(LL_DEBUG5, "config done, request WA_REFLOW\n");
336  }
337  return 0;
338  }
339 
340  // All the remaining config changes...
341  win->actions |= WA_RECALC;
342  mutt_debug(LL_DEBUG5, "config done, request WA_RECALC\n");
343  return 0;
344 }
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
Definition: string.c:404
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:163
void window_reflow(struct MuttWindow *win)
Reflow Windows.
Definition: reflow.c:222
static bool calc_divider(struct SidebarWindowData *wdata)
Decide what actions are required for the divider.
Definition: observer.c:50
short req_cols
Number of columns required.
Definition: mutt_window.h:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_index_observer()

static int sb_index_observer ( struct NotifyCallback nc)
static

Notification that the Index has changed - Implements observer_t -.

Definition at line 349 of file observer.c.

350 {
351  if ((nc->event_type != NT_INDEX) || !nc->global_data)
352  return -1;
353 
354  struct MuttWindow *win_ibar = nc->global_data;
355  if (!win_ibar)
356  return 0;
357 
358  struct IndexSharedData *shared = nc->event_data;
359  if (!shared)
360  return 0;
361 
363  {
364  struct SidebarWindowData *wdata = sb_wdata_get(win_ibar);
366 
367  win_ibar->actions |= WA_RECALC;
368  mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
369  }
370 
371  return 0;
372 }
void sb_set_current_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Set the current Mailbox.
Definition: sidebar.c:175
struct IndexSharedData * shared
Shared Index Data.
Definition: private.h:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_mailbox_observer()

static int sb_mailbox_observer ( struct NotifyCallback nc)
static

Notification that a Mailbox has changed - Implements observer_t -.

Definition at line 377 of file observer.c.

378 {
379  if ((nc->event_type != NT_MAILBOX) || !nc->global_data || !nc->event_data)
380  return -1;
381 
382  struct MuttWindow *win = nc->global_data;
383 
384  struct SidebarWindowData *wdata = sb_wdata_get(win);
385  struct EventMailbox *ev_m = nc->event_data;
386 
387  if (nc->event_subtype == NT_MAILBOX_SWITCH)
388  {
389  sb_set_current_mailbox(wdata, ev_m->mailbox);
390  }
391  else if (nc->event_subtype == NT_MAILBOX_ADD)
392  {
393  sb_add_mailbox(wdata, ev_m->mailbox);
394  }
395  else if (nc->event_subtype == NT_MAILBOX_DELETE)
396  {
397  sb_remove_mailbox(wdata, ev_m->mailbox);
398  }
399 
400  win->actions |= WA_RECALC;
401  mutt_debug(LL_DEBUG5, "mailbox done, request WA_RECALC\n");
402  return 0;
403 }
@ NT_MAILBOX_SWITCH
Current Mailbox has changed.
Definition: mailbox.h:182
void sb_remove_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Remove a Mailbox from the Sidebar.
Definition: sidebar.c:121
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_window_observer()

static int sb_window_observer ( struct NotifyCallback nc)
static

Notification that a Window has changed - Implements observer_t -.

Definition at line 408 of file observer.c.

409 {
410  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
411  return -1;
412 
413  struct MuttWindow *win = nc->global_data;
414  struct EventWindow *ev_w = nc->event_data;
415  if (ev_w->win != win)
416  return 0;
417 
418  if (nc->event_subtype == NT_WINDOW_STATE)
419  {
420  win->actions |= WA_RECALC;
421  mutt_debug(LL_DEBUG5, "window state done, request WA_RECALC\n");
422  }
423  else if (nc->event_subtype == NT_WINDOW_DELETE)
424  {
425  mutt_debug(LL_DEBUG5, "window delete done\n");
427  }
428  return 0;
429 }
void sb_win_remove_observers(struct MuttWindow *win)
Remove Observers from the Sidebar Window.
Definition: observer.c:453
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_insertion_window_observer()

int sb_insertion_window_observer ( struct NotifyCallback nc)

Notification that a Window has changed - Implements observer_t -.

Definition at line 470 of file observer.c.

471 {
472  if ((nc->event_type != NT_WINDOW) || !nc->event_data)
473  return -1;
474 
475  if (nc->event_subtype != NT_WINDOW_DIALOG)
476  return 0;
477 
478  struct EventWindow *ev_w = nc->event_data;
479  if (ev_w->win->type != WT_DLG_INDEX)
480  return 0;
481 
482  if (ev_w->flags & WN_VISIBLE)
483  {
484  mutt_debug(LL_DEBUG5, "insertion: visible\n");
485  struct MuttWindow *win_sidebar = sb_win_init(ev_w->win);
486  sb_init_data(win_sidebar);
487  }
488  else if (ev_w->flags & WN_HIDDEN)
489  {
490  mutt_debug(LL_DEBUG5, "insertion: hidden\n");
492  }
493 
494  return 0;
495 }
@ NT_WINDOW_DIALOG
A new Dialog Window has been created, e.g. WT_DLG_INDEX.
Definition: mutt_window.h:208
#define WN_VISIBLE
Window became visible.
Definition: mutt_window.h:192
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:193
static struct MuttWindow * sb_win_init(struct MuttWindow *dlg)
Initialise and insert the Sidebar Window.
Definition: observer.c:102
static void sb_init_data(struct MuttWindow *win)
Initialise the Sidebar data.
Definition: observer.c:160
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:218
+ Here is the call graph for this function:
+ Here is the caller graph for this function: