NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
observer.c File Reference
#include "config.h"
#include <stddef.h>
#include <stdbool.h>
#include "private.h"
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "lib.h"
#include "mutt_commands.h"
#include "mutt_globals.h"
+ Include dependency graph for observer.c:

Go to the source code of this file.

Functions

void sb_win_remove_observers (struct MuttWindow *win)
 Remove Observers from the Sidebar Window. More...
 
static bool calc_divider (struct SidebarWindowData *wdata)
 Decide what actions are required for the divider. More...
 
static struct MuttWindowsb_win_init (struct MuttWindow *dlg)
 Initialise and insert the Sidebar Window. More...
 
static void sb_init_data (struct MuttWindow *win)
 Initialise the Sidebar data. More...
 
static int sb_account_observer (struct NotifyCallback *nc)
 Account has changed - Implements observer_t. More...
 
static int sb_color_observer (struct NotifyCallback *nc)
 Color has changed - Implements observer_t. More...
 
static int sb_command_observer (struct NotifyCallback *nc)
 Command has changed - Implements observer_t. More...
 
static int sb_config_observer (struct NotifyCallback *nc)
 Config has changed - Implements observer_t. More...
 
static int sb_mailbox_observer (struct NotifyCallback *nc)
 Mailbox has changed - Implements observer_t. More...
 
static int sb_window_observer (struct NotifyCallback *nc)
 Window has changed - Implements observer_t. More...
 
void sb_win_add_observers (struct MuttWindow *win)
 Add Observers to the Sidebar Window. More...
 
int sb_insertion_observer (struct NotifyCallback *nc)
 Listen for new Dialogs - Implements observer_t. More...
 

Detailed Description

Sidebar observers

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file observer.c.

Function Documentation

◆ sb_win_remove_observers()

void sb_win_remove_observers ( struct MuttWindow win)

Remove Observers from the Sidebar Window.

Parameters
winSidebar Window

Definition at line 426 of file observer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ calc_divider()

static bool calc_divider ( struct SidebarWindowData wdata)
static

Decide what actions are required for the divider.

Parameters
wdataSidebar data
Return values
booltrue, if the width has changed

If the divider changes width, then Window will need to be reflowed.

Definition at line 50 of file observer.c.

51 {
52  enum DivType type = SB_DIV_USER;
53  const char *c_sidebar_divider_char =
54  cs_subset_string(NeoMutt->sub, "sidebar_divider_char");
55 
56  // Calculate the width of the delimiter in screen cells
57  int width = mutt_strwidth(c_sidebar_divider_char);
58 
59  const bool c_ascii_chars = cs_subset_bool(NeoMutt->sub, "ascii_chars");
60  if (c_ascii_chars)
61  {
62  if (width < 1) // empty or bad
63  {
65  width = 1;
66  }
67  else
68  {
69  for (size_t i = 0; i < width; i++)
70  {
71  if (c_sidebar_divider_char[i] & ~0x7F) // high-bit is set
72  {
74  width = 1;
75  break;
76  }
77  }
78  }
79  }
80  else
81  {
82  if (width < 1) // empty or bad
83  {
84  type = SB_DIV_UTF8;
85  width = 1;
86  }
87  }
88 
89  const bool changed = (width != wdata->divider_width);
90 
91  wdata->divider_type = type;
92  wdata->divider_width = width;
93 
94  return changed;
95 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_win_init()

static struct MuttWindow* sb_win_init ( struct MuttWindow dlg)
static

Initialise and insert the Sidebar Window.

Parameters
dlgIndex Dialog
Return values
ptrSidebar Window

Definition at line 102 of file observer.c.

103 {
105 
106  struct MuttWindow *index_panel = TAILQ_FIRST(&dlg->children);
107  mutt_window_remove_child(dlg, index_panel);
108 
109  struct MuttWindow *pager_panel = TAILQ_FIRST(&dlg->children);
110  mutt_window_remove_child(dlg, pager_panel);
111 
112  struct MuttWindow *cont_right =
115  dlg->focus = cont_right;
116 
117  mutt_window_add_child(cont_right, index_panel);
118  mutt_window_add_child(cont_right, pager_panel);
119  cont_right->focus = index_panel;
120 
121  const short c_sidebar_width = cs_subset_number(NeoMutt->sub, "sidebar_width");
122  struct MuttWindow *win_sidebar =
124  c_sidebar_width, MUTT_WIN_SIZE_UNLIMITED);
125  const bool c_sidebar_visible =
126  cs_subset_bool(NeoMutt->sub, "sidebar_visible");
127  win_sidebar->state.visible = c_sidebar_visible && (c_sidebar_width > 0);
128  win_sidebar->wdata = sb_wdata_new();
129  win_sidebar->wdata_free = sb_wdata_free;
130 
131  calc_divider(win_sidebar->wdata);
132 
133  win_sidebar->recalc = sb_recalc;
134  win_sidebar->repaint = sb_repaint;
135 
136  const bool c_sidebar_on_right =
137  cs_subset_bool(NeoMutt->sub, "sidebar_on_right");
138  if (c_sidebar_on_right)
139  {
140  mutt_window_add_child(dlg, cont_right);
141  mutt_window_add_child(dlg, win_sidebar);
142  }
143  else
144  {
145  mutt_window_add_child(dlg, win_sidebar);
146  mutt_window_add_child(dlg, cont_right);
147  }
148 
149  sb_win_add_observers(win_sidebar);
150 
151  return win_sidebar;
152 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_init_data()

static void sb_init_data ( struct MuttWindow win)
static

Initialise the Sidebar data.

Parameters
winSidebar Window

Definition at line 158 of file observer.c.

159 {
160  struct SidebarWindowData *wdata = sb_wdata_get(win);
161  if (!wdata)
162  return;
163 
164  if (!ARRAY_EMPTY(&wdata->entries))
165  return;
166 
167  struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
169  struct MailboxNode *np = NULL;
170  STAILQ_FOREACH(np, &ml, entries)
171  {
172  if (!(np->mailbox->flags & MB_HIDDEN))
173  sb_add_mailbox(wdata, np->mailbox);
174  }
176 }
+ 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

Account has changed - Implements observer_t.

Definition at line 181 of file observer.c.

182 {
183  if ((nc->event_type != NT_ACCOUNT) || !nc->event_data || !nc->global_data)
184  return -1;
185 
186  struct MuttWindow *win = nc->global_data;
187  struct SidebarWindowData *wdata = sb_wdata_get(win);
188  struct EventAccount *ea = nc->event_data;
189 
190  struct MailboxNode *np = NULL;
191  STAILQ_FOREACH(np, &ea->account->mailboxes, entries)
192  {
193  sb_add_mailbox(wdata, np->mailbox);
194  }
195 
196  mutt_debug(LL_NOTIFY, "account\n");
197  win->actions |= WA_RECALC;
198  return 0;
199 }
+ 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

Color has changed - Implements observer_t.

Definition at line 204 of file observer.c.

205 {
206  if ((nc->event_type != NT_COLOR) || !nc->event_data || !nc->global_data)
207  return -1;
208 
209  struct EventColor *ev_c = nc->event_data;
210  struct MuttWindow *win = nc->global_data;
211 
212  enum ColorId color = ev_c->color;
213 
214  switch (color)
215  {
216  case MT_COLOR_INDICATOR:
217  case MT_COLOR_NORMAL:
226  case MT_COLOR_MAX: // Sent on `uncolor *`
227  mutt_debug(LL_NOTIFY, "color\n");
228  win->actions |= WA_REPAINT;
229  break;
230 
231  default:
232  break;
233  }
234  return 0;
235 }
+ Here is the caller graph for this function:

◆ sb_command_observer()

static int sb_command_observer ( struct NotifyCallback nc)
static

Command has changed - Implements observer_t.

Definition at line 240 of file observer.c.

241 {
242  if ((nc->event_type != NT_COMMAND) || !nc->event_data || !nc->global_data)
243  return -1;
244 
245  struct Command *cmd = nc->event_data;
246 
247  if ((cmd->parse != sb_parse_whitelist) && (cmd->parse != sb_parse_unwhitelist))
248  return 0;
249 
250  mutt_debug(LL_NOTIFY, "command\n");
251  struct MuttWindow *win = nc->global_data;
252  win->actions |= WA_RECALC;
253  return 0;
254 }
+ 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

Config has changed - Implements observer_t.

Definition at line 259 of file observer.c.

260 {
261  if ((nc->event_type != NT_CONFIG) || !nc->event_data || !nc->global_data)
262  return -1;
263 
265  return 0;
266 
267  struct EventConfig *ec = nc->event_data;
268 
269  if (!mutt_strn_equal(ec->name, "sidebar_", 8) && !mutt_str_equal(ec->name, "ascii_chars") &&
270  !mutt_str_equal(ec->name, "folder") && !mutt_str_equal(ec->name, "spool_file"))
271  {
272  return 0;
273  }
274 
275  mutt_debug(LL_NOTIFY, "config: %s\n", ec->name);
276 
277  if (mutt_str_equal(ec->name, "sidebar_next_new_wrap"))
278  return 0; // Affects the behaviour, but not the display
279 
280  struct MuttWindow *win = nc->global_data;
281  const bool c_sidebar_visible =
282  cs_subset_bool(NeoMutt->sub, "sidebar_visible");
283 
284  if (mutt_str_equal(ec->name, "sidebar_visible"))
285  {
286  window_set_visible(win, c_sidebar_visible);
287  win->parent->actions |= WA_REFLOW;
288  return 0;
289  }
290 
291  const short c_sidebar_width = cs_subset_number(NeoMutt->sub, "sidebar_width");
292  if (mutt_str_equal(ec->name, "sidebar_width"))
293  {
294  win->req_cols = c_sidebar_width;
295  win->parent->actions |= WA_REFLOW;
296  return 0;
297  }
298 
299  if (mutt_str_equal(ec->name, "spool_file"))
300  {
301  win->actions |= WA_REPAINT;
302  return 0;
303  }
304 
305  if (mutt_str_equal(ec->name, "sidebar_on_right"))
306  {
307  struct MuttWindow *parent = win->parent;
308  struct MuttWindow *first = TAILQ_FIRST(&parent->children);
309  const bool c_sidebar_on_right =
310  cs_subset_bool(NeoMutt->sub, "sidebar_on_right");
311 
312  if ((c_sidebar_on_right && (first == win)) || (!c_sidebar_on_right && (first != win)))
313  {
314  // Swap the Sidebar and the Container of the Index/Pager
315  TAILQ_REMOVE(&parent->children, first, entries);
316  TAILQ_INSERT_TAIL(&parent->children, first, entries);
317  }
318 
319  win->parent->actions |= WA_REFLOW;
320  return 0;
321  }
322 
323  if (mutt_str_equal(ec->name, "ascii_chars") ||
324  mutt_str_equal(ec->name, "sidebar_divider_char"))
325  {
326  struct SidebarWindowData *wdata = sb_wdata_get(win);
328  if (action == WA_REFLOW)
329  win->parent->actions |= WA_REFLOW;
330  else
331  win->actions |= action;
332  return 0;
333  }
334 
335  // All the remaining config changes...
336  win->actions |= WA_RECALC;
337  return 0;
338 }
+ 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

Mailbox has changed - Implements observer_t.

Definition at line 343 of file observer.c.

344 {
345  if ((nc->event_type != NT_MAILBOX) || !nc->event_data || !nc->global_data)
346  return -1;
347 
348  struct MuttWindow *win = nc->global_data;
349 
350  struct SidebarWindowData *wdata = sb_wdata_get(win);
351  struct EventMailbox *em = nc->event_data;
352 
353  if (nc->event_subtype == NT_MAILBOX_SWITCH)
354  {
355  sb_set_current_mailbox(wdata, em->mailbox);
356  }
357  else if (nc->event_subtype == NT_MAILBOX_ADD)
358  {
359  sb_add_mailbox(wdata, em->mailbox);
360  }
361  else if (nc->event_subtype == NT_MAILBOX_REMOVE)
362  {
363  sb_remove_mailbox(wdata, em->mailbox);
364  }
365 
366  mutt_debug(LL_NOTIFY, "mailbox\n");
367  win->actions |= WA_RECALC;
368  return 0;
369 }
+ 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

Window has changed - Implements observer_t.

Definition at line 374 of file observer.c.

375 {
376  if ((nc->event_type != NT_WINDOW) || !nc->event_data || !nc->global_data)
377  return -1;
378 
379  struct MuttWindow *win = nc->global_data;
380 
381  if (nc->event_subtype == NT_WINDOW_FOCUS)
382  {
383  if (!mutt_window_is_visible(win))
384  return 0;
385 
386  mutt_debug(LL_NOTIFY, "focus\n");
387  win->actions |= WA_RECALC;
388  }
389  else if (nc->event_subtype == NT_WINDOW_DELETE)
390  {
391  struct EventWindow *ew = nc->event_data;
392  if (ew->win != win)
393  return 0;
394 
395  mutt_debug(LL_NOTIFY, "delete\n");
397  }
398  else if (nc->event_subtype == NT_WINDOW_STATE)
399  {
400  mutt_debug(LL_DEBUG1, "state\n");
401  }
402  return 0;
403 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_win_add_observers()

void sb_win_add_observers ( struct MuttWindow win)

Add Observers to the Sidebar Window.

Parameters
winSidebar Window

Definition at line 409 of file observer.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_insertion_observer()

int sb_insertion_observer ( struct NotifyCallback nc)

Listen for new Dialogs - Implements observer_t.

Definition at line 442 of file observer.c.

443 {
444  if ((nc->event_type != NT_WINDOW) || (nc->event_subtype != NT_WINDOW_DIALOG))
445  return 0;
446 
447  struct EventWindow *ew = nc->event_data;
448  if (ew->win->type != WT_DLG_INDEX)
449  return 0;
450 
451  mutt_debug(LL_NOTIFY, "insertion\n");
452  if (ew->flags & WN_VISIBLE)
453  {
454  struct MuttWindow *win_sidebar = sb_win_init(ew->win);
455  sb_init_data(win_sidebar);
456  }
457  else if (ew->flags & WN_HIDDEN)
458  {
460  }
461 
462  return 0;
463 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:
sb_parse_whitelist
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
NT_WINDOW_STATE
@ NT_WINDOW_STATE
Window state has changed, e.g. WN_VISIBLE.
Definition: mutt_window.h:183
MT_COLOR_SIDEBAR_HIGHLIGHT
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
Definition: color.h:86
MailboxNode
List of Mailboxes.
Definition: mailbox.h:152
EventWindow::flags
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:194
NT_MAILBOX_REMOVE
@ NT_MAILBOX_REMOVE
A Mailbox is about to be destroyed.
Definition: mailbox.h:167
MUTT_WIN_ORIENT_HORIZONTAL
@ MUTT_WIN_ORIENT_HORIZONTAL
Window uses all available horizontal space.
Definition: mutt_window.h:36
mutt_strn_equal
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:593
calc_divider
static bool calc_divider(struct SidebarWindowData *wdata)
Decide what actions are required for the divider.
Definition: observer.c:50
NT_CONFIG
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:37
sb_account_observer
static int sb_account_observer(struct NotifyCallback *nc)
Account has changed - Implements observer_t.
Definition: observer.c:181
MuttWindow::req_cols
short req_cols
Number of columns required.
Definition: mutt_window.h:117
WA_RECALC
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:107
sb_config_observer
static int sb_config_observer(struct NotifyCallback *nc)
Config has changed - Implements observer_t.
Definition: observer.c:259
sb_mailbox_observer
static int sb_mailbox_observer(struct NotifyCallback *nc)
Mailbox has changed - Implements observer_t.
Definition: observer.c:343
NeoMutt::notify
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
EventWindow::win
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:193
MuttWindow
A division of the screen.
Definition: mutt_window.h:115
sb_command_observer
static int sb_command_observer(struct NotifyCallback *nc)
Command has changed - Implements observer_t.
Definition: observer.c:240
MuttWindow::wdata_free
void(* wdata_free)(struct MuttWindow *win, void **ptr)
Free the private data attached to the MuttWindow.
Definition: mutt_window.h:145
cs_subset_bool
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:69
sb_wdata_get
struct SidebarWindowData * sb_wdata_get(struct MuttWindow *win)
Get the Sidebar data for this window.
Definition: wdata.c:70
EventAccount
An Event that happened to an Account.
Definition: account.h:70
neomutt_mailboxlist_get_all
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
Definition: neomutt.c:160
sb_color_observer
static int sb_color_observer(struct NotifyCallback *nc)
Color has changed - Implements observer_t.
Definition: observer.c:204
sb_window_observer
static int sb_window_observer(struct NotifyCallback *nc)
Window has changed - Implements observer_t.
Definition: observer.c:374
LL_DEBUG1
@ LL_DEBUG1
Log at debug level 1.
Definition: logging.h:40
Mailbox::flags
uint8_t flags
e.g. MB_NORMAL
Definition: mailbox.h:134
MT_COLOR_INDICATOR
@ MT_COLOR_INDICATOR
Selected item in list.
Definition: color.h:73
mutt_strwidth
int mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition: curs_lib.c:1363
WindowState::visible
bool visible
Window is visible.
Definition: mutt_window.h:56
TAILQ_INSERT_TAIL
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:802
SidebarWindowData
Sidebar private Window data -.
Definition: private.h:61
NT_WINDOW_DIALOG
@ NT_WINDOW_DIALOG
A new Dialog Window has been created, e.g. WT_DLG_INDEX.
Definition: mutt_window.h:184
WindowActionFlags
uint8_t WindowActionFlags
Actions waiting to be performed on a MuttWindow.
Definition: mutt_window.h:104
MailboxNode::mailbox
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:154
ColorId
ColorId
List of all colored objects.
Definition: color.h:58
WN_HIDDEN
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:172
MUTT_WIN_SIZE_MAXIMISE
@ MUTT_WIN_SIZE_MAXIMISE
Window wants as much space as possible.
Definition: mutt_window.h:45
STAILQ_FOREACH
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
MT_COLOR_NORMAL
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:77
WT_SIDEBAR
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:99
NT_WINDOW
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:43
sb_repaint
int sb_repaint(struct MuttWindow *win)
Repaint the Sidebar display - Implements MuttWindow::repaint()
Definition: window.c:836
SB_DIV_ASCII
@ SB_DIV_ASCII
An ASCII vertical bar (pipe)
Definition: private.h:54
mutt_str_equal
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:871
EventMailbox
An Event that happened to a Mailbox.
Definition: mailbox.h:183
NT_WINDOW_DELETE
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:182
MB_HIDDEN
#define MB_HIDDEN
Definition: mailbox.h:38
sb_wdata_new
struct SidebarWindowData * sb_wdata_new(void)
Create new Window data for the Sidebar.
Definition: wdata.c:39
TAILQ_REMOVE
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:834
TAILQ_FIRST
#define TAILQ_FIRST(head)
Definition: queue.h:716
NT_MAILBOX
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition: notify_type.h:42
Command
A user-callable command.
Definition: mutt_commands.h:45
NT_COMMAND
@ NT_COMMAND
A Command has been executed, Command.
Definition: notify_type.h:36
sb_add_mailbox
void sb_add_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Add a Mailbox to the Sidebar.
Definition: sidebar.c:82
MuttWindow::focus
struct MuttWindow * focus
Focussed Window.
Definition: mutt_window.h:133
cs_subset_number
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition: helpers.c:111
MUTT_WIN_ORIENT_VERTICAL
@ MUTT_WIN_ORIENT_VERTICAL
Window uses all available vertical space.
Definition: mutt_window.h:35
mutt_window_is_visible
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:657
sb_win_add_observers
void sb_win_add_observers(struct MuttWindow *win)
Add Observers to the Sidebar Window.
Definition: observer.c:409
MT_COLOR_SIDEBAR_ORDINARY
@ MT_COLOR_SIDEBAR_ORDINARY
Mailbox with no new or flagged messages.
Definition: color.h:89
notify_observer_remove
bool notify_observer_remove(struct Notify *notify, observer_t callback, void *global_data)
Remove an observer from an object.
Definition: notify.c:207
NT_COLOR
@ NT_COLOR
Colour has changed, ColorId, EventColor.
Definition: notify_type.h:35
sb_wdata_free
void sb_wdata_free(struct MuttWindow *win, void **ptr)
Free Sidebar Window data - Implements MuttWindow::wdata_free()
Definition: wdata.c:49
Account::mailboxes
struct MailboxList mailboxes
List of Mailboxes.
Definition: account.h:41
SB_DIV_UTF8
@ SB_DIV_UTF8
A unicode line-drawing character.
Definition: private.h:55
MUTT_MAILBOX_ANY
@ MUTT_MAILBOX_ANY
Match any Mailbox type.
Definition: mailbox.h:45
MuttWindow::actions
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:125
mutt_window_new
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
Definition: mutt_window.c:166
NotifyCallback::global_data
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
NT_MAILBOX_SWITCH
@ NT_MAILBOX_SWITCH
Current Mailbox has changed.
Definition: mailbox.h:175
EventAccount::account
struct Account * account
The Account this Event relates to.
Definition: account.h:72
MT_COLOR_MAX
@ MT_COLOR_MAX
Definition: color.h:112
sb_init_data
static void sb_init_data(struct MuttWindow *win)
Initialise the Sidebar data.
Definition: observer.c:158
WN_VISIBLE
#define WN_VISIBLE
Window became visible.
Definition: mutt_window.h:171
WT_DLG_INDEX
@ WT_DLG_INDEX
Index Dialog, index_pager_init()
Definition: mutt_window.h:83
mutt_debug
#define mutt_debug(LEVEL,...)
Definition: logging.h:81
EventColor
An Event that happened to a Colour.
Definition: color.h:159
MUTT_WIN_SIZE_UNLIMITED
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition: mutt_window.h:49
notify_observer_add
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:169
DivType
DivType
Source of the sidebar divider character.
Definition: private.h:51
MuttWindow::parent
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:128
EventConfig
A config-change event.
Definition: subset.h:70
MuttWindow::repaint
int(* repaint)(struct MuttWindow *win)
Repaint the Window.
Definition: mutt_window.h:161
NotifyCallback::event_data
void * event_data
Data from notify_send()
Definition: observer.h:44
NT_WINDOW_FOCUS
@ NT_WINDOW_FOCUS
Window focus has changed.
Definition: mutt_window.h:185
sb_parse_unwhitelist
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
MuttWindow::state
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:120
STAILQ_HEAD_INITIALIZER
#define STAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:321
cs_subset_string
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:241
MT_COLOR_SIDEBAR_FLAGGED
@ MT_COLOR_SIDEBAR_FLAGGED
Mailbox with flagged messages.
Definition: color.h:85
NT_MAILBOX_ADD
@ NT_MAILBOX_ADD
A new Mailbox has been created.
Definition: mailbox.h:166
ARRAY_EMPTY
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition: array.h:70
WT_CONTAINER
@ WT_CONTAINER
Invisible shaping container Window.
Definition: mutt_window.h:70
window_set_visible
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:149
sb_set_current_mailbox
void sb_set_current_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Set the current Mailbox.
Definition: sidebar.c:165
LL_NOTIFY
@ LL_NOTIFY
Log of notifications.
Definition: logging.h:45
MT_COLOR_SIDEBAR_NEW
@ MT_COLOR_SIDEBAR_NEW
Mailbox with new mail.
Definition: color.h:88
EventColor::color
enum ColorId color
Definition: color.h:161
EventConfig::name
const char * name
Name of config item that changed.
Definition: subset.h:73
NeoMutt
Container for Accounts, Notifications.
Definition: neomutt.h:36
MuttWindow::type
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:137
MUTT_WIN_SIZE_FIXED
@ MUTT_WIN_SIZE_FIXED
Window has a fixed size.
Definition: mutt_window.h:44
sb_remove_mailbox
void sb_remove_mailbox(struct SidebarWindowData *wdata, struct Mailbox *m)
Remove a Mailbox from the Sidebar.
Definition: sidebar.c:111
NeoMutt::sub
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
MT_COLOR_SIDEBAR_DIVIDER
@ MT_COLOR_SIDEBAR_DIVIDER
Line dividing sidebar from the index/pager.
Definition: color.h:84
sb_recalc
int sb_recalc(struct MuttWindow *win)
Recalculate the Sidebar display - Implements MuttWindow::recalc()
Definition: window.c:642
WA_REFLOW
#define WA_REFLOW
Reflow the Window and its children.
Definition: mutt_window.h:106
MT_COLOR_SIDEBAR_SPOOLFILE
@ MT_COLOR_SIDEBAR_SPOOLFILE
$spool_file (Spool mailbox)
Definition: color.h:90
sb_win_init
static struct MuttWindow * sb_win_init(struct MuttWindow *dlg)
Initialise and insert the Sidebar Window.
Definition: observer.c:102
sb_win_remove_observers
void sb_win_remove_observers(struct MuttWindow *win)
Remove Observers from the Sidebar Window.
Definition: observer.c:426
NotifyCallback::event_subtype
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:43
NotifyCallback::event_type
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
mutt_window_add_child
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:565
MuttWindow::children
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:129
MuttWindow::recalc
int(* recalc)(struct MuttWindow *win)
Recalculate the Window data.
Definition: mutt_window.h:153
WA_REPAINT
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:108
MuttWindow::orient
enum MuttWindowOrientation orient
Which direction the Window will expand.
Definition: mutt_window.h:123
NT_CONFIG_INITIAL_SET
@ NT_CONFIG_INITIAL_SET
Config item's initial value has been set.
Definition: subset.h:64
EventWindow
An Event that happened to a Window.
Definition: mutt_window.h:191
SB_DIV_USER
@ SB_DIV_USER
User configured using $sidebar_divider_char.
Definition: private.h:53
MT_COLOR_SIDEBAR_INDICATOR
@ MT_COLOR_SIDEBAR_INDICATOR
Current open mailbox.
Definition: color.h:87
EventMailbox::mailbox
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition: mailbox.h:185
MT_COLOR_SIDEBAR_UNREAD
@ MT_COLOR_SIDEBAR_UNREAD
Mailbox with unread mail.
Definition: color.h:91
neomutt_mailboxlist_clear
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
Definition: neomutt.c:137
NT_ACCOUNT
@ NT_ACCOUNT
Account has changed, NotifyAccount, EventAccount.
Definition: notify_type.h:34
Command::parse
enum CommandResult(* parse)(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Function to parse a command.
Definition: mutt_commands.h:57
MuttWindow::wdata
void * wdata
Private data.
Definition: mutt_window.h:138
mutt_window_remove_child
struct MuttWindow * mutt_window_remove_child(struct MuttWindow *parent, struct MuttWindow *child)
Remove a child from a Window.
Definition: mutt_window.c:584