NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
private.h File Reference
#include <stdbool.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "gui/lib.h"
+ Include dependency graph for private.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SbEntry
 Info about folders in the sidebar. More...
 
struct  SidebarWindowData
 Sidebar private Window data -. More...
 

Enumerations

enum  DivType { SB_DIV_USER, SB_DIV_ASCII, SB_DIV_UTF8 }
 Source of the sidebar divider character. More...
 

Functions

void sb_add_mailbox (struct SidebarWindowData *wdata, struct Mailbox *m)
 Add a Mailbox to the Sidebar. More...
 
void sb_remove_mailbox (struct SidebarWindowData *wdata, struct Mailbox *m)
 Remove a Mailbox from the Sidebar. More...
 
void sb_set_current_mailbox (struct SidebarWindowData *wdata, struct Mailbox *m)
 Set the current Mailbox. More...
 
bool select_next (struct SidebarWindowData *wdata)
 Selects the next unhidden mailbox. More...
 
bool select_prev (struct SidebarWindowData *wdata)
 Selects the previous unhidden mailbox. More...
 
int sb_insertion_observer (struct NotifyCallback *nc)
 Listen for new Dialogs - Implements observer_t. More...
 
void sb_win_add_observers (struct MuttWindow *win)
 Add Observers to the Sidebar Window. More...
 
void sb_sort_entries (struct SidebarWindowData *wdata, enum SortType sort)
 Sort the Sidebar entries. More...
 
void sb_wdata_free (struct MuttWindow *win, void **ptr)
 Free Sidebar Window data - Implements MuttWindow::wdata_free() More...
 
struct SidebarWindowDatasb_wdata_get (struct MuttWindow *win)
 Get the Sidebar data for this window. More...
 
struct SidebarWindowDatasb_wdata_new (void)
 Create new Window data for the Sidebar. More...
 
int sb_recalc (struct MuttWindow *win)
 Recalculate the Sidebar display - Implements MuttWindow::recalc() More...
 
int sb_repaint (struct MuttWindow *win)
 Repaint the Sidebar display - Implements MuttWindow::repaint() More...
 

Variables

struct ListHead SidebarWhitelist
 List of mailboxes to always display in the sidebar. More...
 

Detailed Description

GUI display the mailboxes in a side panel

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 private.h.

Enumeration Type Documentation

◆ DivType

enum DivType

Source of the sidebar divider character.

Enumerator
SB_DIV_USER 

User configured using $sidebar_divider_char.

SB_DIV_ASCII 

An ASCII vertical bar (pipe)

SB_DIV_UTF8 

A unicode line-drawing character.

Definition at line 51 of file private.h.

52 {
53  SB_DIV_USER,
54  SB_DIV_ASCII,
55  SB_DIV_UTF8,
56 };

Function Documentation

◆ sb_add_mailbox()

void sb_add_mailbox ( struct SidebarWindowData wdata,
struct Mailbox m 
)

Add a Mailbox to the Sidebar.

Parameters
wdataSidebar data
mMailbox to add

The Sidebar will be re-sorted, and the indices updated, when sb_recalc() is called.

Definition at line 82 of file sidebar.c.

83 {
84  if (!m)
85  return;
86 
87  /* Any new/deleted mailboxes will cause a refresh. As long as
88  * they're valid, our pointers will be updated in prepare_sidebar() */
89 
90  struct SbEntry *entry = mutt_mem_calloc(1, sizeof(struct SbEntry));
91  entry->mailbox = m;
92 
93  if (wdata->top_index < 0)
94  wdata->top_index = ARRAY_SIZE(&wdata->entries);
95  if (wdata->bot_index < 0)
96  wdata->bot_index = ARRAY_SIZE(&wdata->entries);
97  if ((wdata->opn_index < 0) && Context &&
99  {
100  wdata->opn_index = ARRAY_SIZE(&wdata->entries);
101  }
102 
103  ARRAY_ADD(&wdata->entries, entry);
104 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_remove_mailbox()

void sb_remove_mailbox ( struct SidebarWindowData wdata,
struct Mailbox m 
)

Remove a Mailbox from the Sidebar.

Parameters
wdataSidebar data
mMailbox to remove

Definition at line 111 of file sidebar.c.

112 {
113  struct SbEntry **sbep = NULL;
114  ARRAY_FOREACH(sbep, &wdata->entries)
115  {
116  if (mutt_str_equal((*sbep)->mailbox->realpath, m->realpath))
117  {
118  struct SbEntry *sbe_remove = *sbep;
119  ARRAY_REMOVE(&wdata->entries, sbep);
120  FREE(&sbe_remove);
121 
122  if (wdata->opn_index == ARRAY_FOREACH_IDX)
123  {
124  // Open item was deleted
125  wdata->opn_index = -1;
126  }
127  else if ((wdata->opn_index > 0) && (wdata->opn_index > ARRAY_FOREACH_IDX))
128  {
129  // Open item is still visible, so adjust the index
130  wdata->opn_index--;
131  }
132 
133  if (wdata->hil_index == ARRAY_FOREACH_IDX)
134  {
135  // If possible, keep the highlight where it is
136  struct SbEntry **sbep_cur = ARRAY_GET(&wdata->entries, ARRAY_FOREACH_IDX);
137  if (!sbep_cur)
138  {
139  // The last entry was deleted, so backtrack
140  select_prev(wdata);
141  }
142  else if ((*sbep)->is_hidden)
143  {
144  // Find the next unhidden entry, or the previous
145  if (!select_next(wdata))
146  if (!select_prev(wdata))
147  wdata->hil_index = -1;
148  }
149  }
150  else if ((wdata->hil_index > 0) && (wdata->hil_index > ARRAY_FOREACH_IDX))
151  {
152  // Highlighted item is still visible, so adjust the index
153  wdata->hil_index--;
154  }
155  break;
156  }
157  }
158 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_set_current_mailbox()

void sb_set_current_mailbox ( struct SidebarWindowData wdata,
struct Mailbox m 
)

Set the current Mailbox.

Parameters
wdataSidebar data
mMailbox

Definition at line 165 of file sidebar.c.

166 {
167  wdata->opn_index = -1;
168 
169  struct SbEntry **sbep = NULL;
170  ARRAY_FOREACH(sbep, &wdata->entries)
171  {
172  if (m)
173  {
174  if (mutt_str_equal((*sbep)->mailbox->realpath, m->realpath))
175  {
176  wdata->opn_index = ARRAY_FOREACH_IDX;
177  wdata->hil_index = ARRAY_FOREACH_IDX;
178  break;
179  }
180  }
181  (*sbep)->is_hidden = ((*sbep)->mailbox->flags & MB_HIDDEN);
182  }
183 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ select_next()

bool select_next ( struct SidebarWindowData wdata)

Selects the next unhidden mailbox.

Parameters
wdataSidebar data
Return values
booltrue if the selection changed

Definition at line 44 of file functions.c.

45 {
46  if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
47  return false;
48 
49  struct SbEntry **sbep = NULL;
50  ARRAY_FOREACH_FROM(sbep, &wdata->entries, wdata->hil_index + 1)
51  {
52  if (!(*sbep)->is_hidden)
53  {
54  wdata->hil_index = ARRAY_FOREACH_IDX;
55  return true;
56  }
57  }
58 
59  return false;
60 }
+ Here is the caller graph for this function:

◆ select_prev()

bool select_prev ( struct SidebarWindowData wdata)

Selects the previous unhidden mailbox.

Parameters
wdataSidebar data
Return values
booltrue if the selection changed

Definition at line 112 of file functions.c.

113 {
114  if (ARRAY_EMPTY(&wdata->entries) || (wdata->hil_index < 0))
115  return false;
116 
117  struct SbEntry **sbep = NULL, **prev = NULL;
118  ARRAY_FOREACH_TO(sbep, &wdata->entries, wdata->hil_index)
119  {
120  if (!(*sbep)->is_hidden)
121  prev = sbep;
122  }
123 
124  if (prev)
125  {
126  wdata->hil_index = ARRAY_IDX(&wdata->entries, prev);
127  return true;
128  }
129 
130  return false;
131 }
+ 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_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_sort_entries()

void sb_sort_entries ( struct SidebarWindowData wdata,
enum SortType  sort 
)

Sort the Sidebar entries.

Parameters
wdataSidebar data
sortSort order, e.g. SORT_PATH

Sort the wdata->entries array according to the current sort config option $sidebar_sort_method. This calls qsort to do the work which calls our callback function "cb_qsort_sbe".

Once sorted, the prev/next links will be reconstructed.

Definition at line 177 of file sort.c.

178 {
180 
181  switch (sort & SORT_MASK)
182  {
183  case SORT_COUNT:
184  fn = sb_sort_count;
185  break;
186  case SORT_DESC:
187  fn = sb_sort_desc;
188  break;
189  case SORT_FLAGGED:
190  fn = sb_sort_flagged;
191  break;
192  case SORT_PATH:
193  fn = sb_sort_path;
194  break;
195  case SORT_UNREAD:
196  fn = sb_sort_unread;
197  break;
198  case SORT_ORDER:
199  fn = sb_sort_order;
200  default:
201  break;
202  }
203 
204  sb_sort_reverse = (sort & SORT_REVERSE);
205  ARRAY_SORT(&wdata->entries, fn);
206 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_wdata_free()

void sb_wdata_free ( struct MuttWindow win,
void **  ptr 
)

Free Sidebar Window data - Implements MuttWindow::wdata_free()

Definition at line 49 of file wdata.c.

50 {
51  if (!ptr || !*ptr)
52  return;
53 
54  struct SidebarWindowData *wdata = *ptr;
55 
56  struct SbEntry **sbep = NULL;
57  ARRAY_FOREACH(sbep, &wdata->entries)
58  {
59  FREE(sbep);
60  }
61  ARRAY_FREE(&wdata->entries);
62 
63  FREE(ptr);
64 }
+ Here is the caller graph for this function:

◆ sb_wdata_get()

struct SidebarWindowData* sb_wdata_get ( struct MuttWindow win)

Get the Sidebar data for this window.

Parameters
winWindow

Definition at line 70 of file wdata.c.

71 {
72  if (!win || (win->type != WT_SIDEBAR))
73  return NULL;
74 
75  return win->wdata;
76 }
+ Here is the caller graph for this function:

◆ sb_wdata_new()

struct SidebarWindowData* sb_wdata_new ( void  )

Create new Window data for the Sidebar.

Return values
ptrNew Window data

Definition at line 39 of file wdata.c.

40 {
41  struct SidebarWindowData *wdata = mutt_mem_calloc(1, sizeof(struct SidebarWindowData));
42  ARRAY_INIT(&wdata->entries);
43  return wdata;
44 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_recalc()

int sb_recalc ( struct MuttWindow win)

Recalculate the Sidebar display - Implements MuttWindow::recalc()

Definition at line 642 of file window.c.

643 {
644  if (!mutt_window_is_visible(win))
645  return 0;
646 
647  struct SidebarWindowData *wdata = sb_wdata_get(win);
648 
649  if (ARRAY_EMPTY(&wdata->entries))
650  {
651  struct MailboxList ml = STAILQ_HEAD_INITIALIZER(ml);
653  struct MailboxNode *np = NULL;
654  STAILQ_FOREACH(np, &ml, entries)
655  {
656  if (!(np->mailbox->flags & MB_HIDDEN))
657  sb_add_mailbox(wdata, np->mailbox);
658  }
660  }
661 
662  if (!prepare_sidebar(wdata, win->state.rows))
663  {
664  win->actions |= WA_REPAINT;
665  return 0;
666  }
667 
668  int num_rows = win->state.rows;
669  int num_cols = win->state.cols;
670 
671  if (ARRAY_EMPTY(&wdata->entries) || (num_rows <= 0))
672  return 0;
673 
674  if (wdata->top_index < 0)
675  return 0;
676 
677  int width = num_cols - wdata->divider_width;
678  int row = 0;
679  struct SbEntry **sbep = NULL;
680  ARRAY_FOREACH_FROM(sbep, &wdata->entries, wdata->top_index)
681  {
682  if (row >= num_rows)
683  break;
684 
685  if ((*sbep)->is_hidden)
686  continue;
687 
688  struct SbEntry *entry = (*sbep);
689  struct Mailbox *m = entry->mailbox;
690  struct Mailbox *m_ctx = ctx_mailbox(Context);
691 
692  const int entryidx = ARRAY_FOREACH_IDX;
693  entry->color =
694  calc_color(m, (entryidx == wdata->opn_index), (entryidx == wdata->hil_index));
695 
696  if (m_ctx && (m_ctx->realpath[0] != '\0') &&
697  mutt_str_equal(m->realpath, m_ctx->realpath))
698  {
699  m->msg_unread = m_ctx->msg_unread;
700  m->msg_count = m_ctx->msg_count;
701  m->msg_flagged = m_ctx->msg_flagged;
702  }
703 
704  const char *path = mailbox_path(m);
705 
706  const char *c_folder = cs_subset_string(NeoMutt->sub, "folder");
707  // Try to abbreviate the full path
708  const char *abbr = abbrev_folder(path, c_folder, m->type);
709  if (!abbr)
710  abbr = abbrev_url(path, m->type);
711  const char *short_path = abbr ? abbr : path;
712 
713  /* Compute the depth */
714  const char *last_part = abbr;
715  const char *c_sidebar_delim_chars =
716  cs_subset_string(NeoMutt->sub, "sidebar_delim_chars");
717  entry->depth = calc_path_depth(abbr, c_sidebar_delim_chars, &last_part);
718 
719  const bool short_path_is_abbr = (short_path == abbr);
720  const bool c_sidebar_short_path =
721  cs_subset_bool(NeoMutt->sub, "sidebar_short_path");
722  if (c_sidebar_short_path)
723  {
724  short_path = last_part;
725  }
726 
727  // Don't indent if we were unable to create an abbreviation.
728  // Otherwise, the full path will be indent, and it looks unusual.
729  const bool c_sidebar_folder_indent =
730  cs_subset_bool(NeoMutt->sub, "sidebar_folder_indent");
731  if (c_sidebar_folder_indent && short_path_is_abbr)
732  {
733  const short c_sidebar_component_depth =
734  cs_subset_number(NeoMutt->sub, "sidebar_component_depth");
735  if (c_sidebar_component_depth > 0)
736  entry->depth -= c_sidebar_component_depth;
737  }
738  else if (!c_sidebar_folder_indent)
739  entry->depth = 0;
740 
741  mutt_str_copy(entry->box, short_path, sizeof(entry->box));
742  make_sidebar_entry(entry->display, sizeof(entry->display), width, entry);
743  row++;
744  }
745 
746  win->actions |= WA_REPAINT;
747  return 0;
748 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sb_repaint()

int sb_repaint ( struct MuttWindow win)

Repaint the Sidebar display - Implements MuttWindow::repaint()

Definition at line 836 of file window.c.

837 {
838  if (!mutt_window_is_visible(win))
839  return 0;
840 
841  struct SidebarWindowData *wdata = sb_wdata_get(win);
842  const bool c_sidebar_on_right =
843  cs_subset_bool(NeoMutt->sub, "sidebar_on_right");
844 
845  int row = 0;
846  int num_rows = win->state.rows;
847  int num_cols = win->state.cols;
848 
849  if (wdata->top_index >= 0)
850  {
851  int col = 0;
852  if (c_sidebar_on_right)
853  col = wdata->divider_width;
854 
855  struct SbEntry **sbep = NULL;
856  ARRAY_FOREACH_FROM(sbep, &wdata->entries, wdata->top_index)
857  {
858  if (row >= num_rows)
859  break;
860 
861  if ((*sbep)->is_hidden)
862  continue;
863 
864  struct SbEntry *entry = (*sbep);
865  mutt_window_move(win, col, row);
867  mutt_window_printf("%s", entry->display);
868  mutt_refresh();
869  row++;
870  }
871  }
872 
873  fill_empty_space(win, row, num_rows - row, wdata->divider_width,
874  num_cols - wdata->divider_width);
875  draw_divider(wdata, win, num_rows, num_cols);
876 
877  return 0;
878 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ SidebarWhitelist

struct ListHead SidebarWhitelist

List of mailboxes to always display in the sidebar.

Definition at line 42 of file sidebar.c.

mutt_window_move
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:382
MailboxNode
List of Mailboxes.
Definition: mailbox.h:152
mutt_mem_calloc
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
EventWindow::flags
WindowNotifyFlags flags
Attributes of Window that changed.
Definition: mutt_window.h:194
mutt_window_printf
int mutt_window_printf(const char *fmt,...)
Write a formatted string to a Window.
Definition: mutt_window.c:550
Mailbox
A mailbox.
Definition: mailbox.h:81
ARRAY_ADD
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition: array.h:152
SORT_FLAGGED
@ SORT_FLAGGED
Sort by the number of flagged emails.
Definition: sort2.h:62
ARRAY_FOREACH_FROM
#define ARRAY_FOREACH_FROM(elem, head, from)
Iterate from an index to the end.
Definition: array.h:217
NT_CONFIG
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:37
ARRAY_INIT
#define ARRAY_INIT(head)
Initialize an array.
Definition: array.h:61
sb_account_observer
static int sb_account_observer(struct NotifyCallback *nc)
Account has changed - Implements observer_t.
Definition: observer.c:181
ctx_mailbox
struct Mailbox * ctx_mailbox(struct Context *ctx)
wrapper to get the mailbox in a Context, or NULL
Definition: context.c:429
SidebarWindowData::divider_width
short divider_width
Width of the divider in screen columns.
Definition: private.h:72
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
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
SORT_COUNT
@ SORT_COUNT
Sort by number of emails in a folder.
Definition: sort2.h:60
fill_empty_space
static void fill_empty_space(struct MuttWindow *win, int first_row, int num_rows, int div_width, int num_cols)
Wipe the remaining Sidebar space.
Definition: window.c:814
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
Context
The "current" mailbox.
Definition: context.h:38
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
Mailbox::flags
uint8_t flags
e.g. MB_NORMAL
Definition: mailbox.h:134
ARRAY_SORT
#define ARRAY_SORT(head, fn)
Sort an array.
Definition: array.h:271
FREE
#define FREE(x)
Definition: memory.h:40
SORT_REVERSE
#define SORT_REVERSE
Reverse the order of the sort.
Definition: sort2.h:81
sb_sort_unsorted
static int sb_sort_unsorted(const void *a, const void *b)
Sort Sidebar entries into their original order - Implements sort_t.
Definition: sort.c:157
select_next
bool select_next(struct SidebarWindowData *wdata)
Selects the next unhidden mailbox.
Definition: functions.c:44
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
SORT_MASK
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:80
draw_divider
static int draw_divider(struct SidebarWindowData *wdata, struct MuttWindow *win, int num_rows, int num_cols)
Draw a line between the sidebar and the rest of neomutt.
Definition: window.c:766
ARRAY_IDX
#define ARRAY_IDX(head, elem)
Return the index of an element of the array.
Definition: array.h:253
MailboxNode::mailbox
struct Mailbox * mailbox
Mailbox in the list.
Definition: mailbox.h:154
ARRAY_SIZE
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:83
WN_HIDDEN
#define WN_HIDDEN
Window became hidden.
Definition: mutt_window.h:172
prepare_sidebar
static bool prepare_sidebar(struct SidebarWindowData *wdata, int page_size)
Prepare the list of SbEntry's for the sidebar display.
Definition: window.c:556
sort_t
int(* sort_t)(const void *a, const void *b)
Prototype for a function to compare two emails.
Definition: sort.h:50
calc_color
static enum ColorId calc_color(const struct Mailbox *m, bool current, bool highlight)
Calculate the colour of a Sidebar row.
Definition: window.c:206
ARRAY_GET
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:105
STAILQ_FOREACH
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
select_prev
bool select_prev(struct SidebarWindowData *wdata)
Selects the previous unhidden mailbox.
Definition: functions.c:112
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_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
sb_sort_order
static int sb_sort_order(const void *a, const void *b)
Sort Sidebar entries by order of creation - Implements sort_t.
Definition: sort.c:144
SbEntry::box
char box[256]
Mailbox path (possibly abbreviated)
Definition: private.h:40
SidebarWindowData::top_index
int top_index
First mailbox visible in sidebar.
Definition: private.h:65
MB_HIDDEN
#define MB_HIDDEN
Definition: mailbox.h:38
NT_MAILBOX
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition: notify_type.h:42
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
ARRAY_REMOVE
#define ARRAY_REMOVE(head, elem)
Remove an entry from the array, shifting down the subsequent entries.
Definition: array.h:261
make_sidebar_entry
static void make_sidebar_entry(char *buf, size_t buflen, int width, struct SbEntry *sbe)
Turn mailbox data into a sidebar string.
Definition: window.c:456
Mailbox::type
enum MailboxType type
Mailbox type.
Definition: mailbox.h:105
ARRAY_FOREACH
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:206
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_window_is_visible
bool mutt_window_is_visible(struct MuttWindow *win)
Is the Window visible?
Definition: mutt_window.c:657
NT_COLOR
@ NT_COLOR
Colour has changed, ColorId, EventColor.
Definition: notify_type.h:35
SB_DIV_UTF8
@ SB_DIV_UTF8
A unicode line-drawing character.
Definition: private.h:55
Mailbox::msg_count
int msg_count
Total number of messages.
Definition: mailbox.h:91
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
abbrev_folder
static const char * abbrev_folder(const char *mbox, const char *folder, enum MailboxType type)
Abbreviate a Mailbox path using a folder.
Definition: window.c:94
sb_init_data
static void sb_init_data(struct MuttWindow *win)
Initialise the Sidebar data.
Definition: observer.c:158
ARRAY_FREE
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:198
ARRAY_FOREACH_TO
#define ARRAY_FOREACH_TO(elem, head, to)
Iterate from the beginning to an index.
Definition: array.h:228
WN_VISIBLE
#define WN_VISIBLE
Window became visible.
Definition: mutt_window.h:171
Context::mailbox
struct Mailbox * mailbox
Definition: context.h:50
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
calc_path_depth
static int calc_path_depth(const char *mbox, const char *delims, const char **last_part)
Calculate the depth of a Mailbox path.
Definition: window.c:244
SORT_UNREAD
@ SORT_UNREAD
Sort by the number of unread emails.
Definition: sort2.h:61
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
sb_sort_unread
static int sb_sort_unread(const void *a, const void *b)
Sort Sidebar entries by unread - Implements sort_t.
Definition: sort.c:123
sb_sort_desc
static int sb_sort_desc(const void *a, const void *b)
Sort Sidebar entries by description - Implements sort_t.
Definition: sort.c:65
Mailbox::msg_flagged
int msg_flagged
Number of flagged messages.
Definition: mailbox.h:93
Mailbox::realpath
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition: mailbox.h:84
WindowState::rows
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:58
SORT_ORDER
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:50
SidebarWindowData::opn_index
int opn_index
Current (open) mailbox.
Definition: private.h:66
SbEntry::display
char display[256]
Formatted string to display.
Definition: private.h:41
NotifyCallback::event_data
void * event_data
Data from notify_send()
Definition: observer.h:44
sb_sort_count
static int sb_sort_count(const void *a, const void *b)
Sort Sidebar entries by count - Implements sort_t.
Definition: sort.c:44
MuttWindow::state
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:120
SbEntry::depth
int depth
Indentation depth.
Definition: private.h:42
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
ARRAY_EMPTY
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition: array.h:70
SbEntry::color
enum ColorId color
Colour to use.
Definition: private.h:45
sb_sort_flagged
static int sb_sort_flagged(const void *a, const void *b)
Sort Sidebar entries by flagged - Implements sort_t.
Definition: sort.c:82
LL_NOTIFY
@ LL_NOTIFY
Log of notifications.
Definition: logging.h:45
NeoMutt
Container for Accounts, Notifications.
Definition: neomutt.h:36
abbrev_url
static const char * abbrev_url(const char *mbox, enum MailboxType type)
Abbreviate a url-style Mailbox path.
Definition: window.c:158
SidebarWindowData::hil_index
int hil_index
Highlighted mailbox.
Definition: private.h:67
MuttWindow::type
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:137
mutt_curses_set_color
void mutt_curses_set_color(enum ColorId color)
Set the current colour for text.
Definition: mutt_curses.c:57
SbEntry::mailbox
struct Mailbox * mailbox
Mailbox this represents.
Definition: private.h:43
SbEntry
Info about folders in the sidebar.
Definition: private.h:38
mutt_refresh
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:108
NeoMutt::sub
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
Mailbox::msg_unread
int msg_unread
Number of unread messages.
Definition: mailbox.h:92
WindowState::cols
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:57
sb_win_init
static struct MuttWindow * sb_win_init(struct MuttWindow *dlg)
Initialise and insert the Sidebar Window.
Definition: observer.c:102
mailbox_path
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:206
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
SidebarWindowData::bot_index
int bot_index
Last mailbox visible in sidebar.
Definition: private.h:68
sb_sort_path
static int sb_sort_path(const void *a, const void *b)
Sort Sidebar entries by path - Implements sort_t.
Definition: sort.c:103
WA_REPAINT
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:108
SORT_PATH
@ SORT_PATH
Sort by the folder's path.
Definition: sort2.h:63
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
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
sb_sort_reverse
static bool sb_sort_reverse
An extra parameter to control sort order.
Definition: sort.c:39
MuttWindow::wdata
void * wdata
Private data.
Definition: mutt_window.h:138
SORT_DESC
@ SORT_DESC
Sort by the folder's description.
Definition: sort2.h:65
mutt_str_copy
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:716