NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
index.c File Reference

Index Window. More...

#include "config.h"
#include <assert.h>
#include <stdbool.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "menu/lib.h"
#include "alternates.h"
#include "attachments.h"
#include "mutt_thread.h"
#include "muttlib.h"
#include "options.h"
#include "private_data.h"
#include "score.h"
#include "shared_data.h"
#include "subjectrx.h"
+ Include dependency graph for index.c:

Go to the source code of this file.

Functions

static void sort_use_threads_warn (void)
 alert the user to odd $sort settings More...
 
static int config_sort (const struct ConfigSubset *sub)
 React to changes to "sort". More...
 
static int config_use_threads (const struct ConfigSubset *sub)
 React to changes to "use_threads". More...
 
static int config_reply_regex (struct MuttWindow *dlg)
 React to changes to $reply_regex. 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_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...
 
struct MuttWindowindex_window_new (struct IndexSharedData *shared, struct IndexPrivateData *priv)
 Create a new Index Window (list of Emails) More...
 

Detailed Description

Index Window.

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 index.c.

Function Documentation

◆ sort_use_threads_warn()

static void sort_use_threads_warn ( void  )
static

alert the user to odd $sort settings

Definition at line 89 of file index.c.

90 {
91  static bool warned = false;
92  if (!warned)
93  {
95  _("Changing threaded display should prefer $use_threads over $sort"));
96  warned = true;
97  mutt_sleep(0);
98  }
99 }
#define _(a)
Definition: message.h:28
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:1461
#define mutt_warning(...)
Definition: logging.h:86
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ config_sort()

static int config_sort ( const struct ConfigSubset sub)
static

React to changes to "sort".

Parameters
subthe config subset that was just updated
Return values
0Successfully handled
-1Error

Definition at line 107 of file index.c.

108 {
109  const short c_sort = cs_subset_sort(sub, "sort");
110  const unsigned char c_use_threads = cs_subset_enum(sub, "use_threads");
111 
112  if (((c_sort & SORT_MASK) != SORT_THREADS) || (c_use_threads == UT_UNSET))
113  return 0;
114 
116 
117  /* Note: changing a config variable here kicks off a second round of
118  * observers before the first round has completed. Be careful that
119  * changes made here do not cause an infinite loop of toggling
120  * adjustments - the early exit above when $sort no longer uses
121  * SORT_THREADS ends the recursion.
122  */
123  int rc;
124  if ((c_use_threads == UT_FLAT) ||
125  (!(c_sort & SORT_REVERSE) == (c_use_threads == UT_REVERSE)))
126  {
127  /* If we were flat or the user wants to change thread
128  * directions, then leave $sort alone for now and change
129  * $use_threads to match the desired outcome. The 2nd-level
130  * observer for $use_threads will then adjust $sort, and our
131  * 3rd-level observer for $sort will be a no-op.
132  */
134  sub, "use_threads", (c_sort & SORT_REVERSE) ? UT_REVERSE : UT_THREADS, NULL);
135  }
136  else
137  {
138  /* We were threaded, and the user still wants the same thread
139  * direction. Adjust $sort based on $sort_aux, and the 2nd-level
140  * observer for $sort will be a no-op.
141  */
142  short c_sort_aux = cs_subset_sort(sub, "sort_aux");
143  c_sort_aux ^= (c_sort & SORT_REVERSE);
144  rc = cs_subset_str_native_set(sub, "sort", c_sort_aux, NULL);
145  }
146  return (CSR_RESULT(rc) == CSR_SUCCESS) ? 0 : -1;
147 }
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
Normal threading (root above subthreads)
Definition: mutt_thread.h:81
Not yet set by user, stick to legacy semantics.
Definition: mutt_thread.h:79
#define CSR_RESULT(x)
Definition: set.h:52
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
Definition: subset.c:305
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:292
Sort by email threads.
Definition: sort2.h:49
Unthreaded.
Definition: mutt_thread.h:80
unsigned char cs_subset_enum(const struct ConfigSubset *sub, const char *name)
Get a enumeration config item by name.
Definition: helpers.c:97
#define SORT_REVERSE
Reverse the order of the sort.
Definition: sort2.h:79
Reverse threading (subthreads above root)
Definition: mutt_thread.h:82
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:78
static void sort_use_threads_warn(void)
alert the user to odd $sort settings
Definition: index.c:89
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ config_use_threads()

static int config_use_threads ( const struct ConfigSubset sub)
static

React to changes to "use_threads".

Parameters
subthe config subset that was just updated
Return values
0Successfully handled
-1Error

Definition at line 155 of file index.c.

156 {
157  const short c_sort = cs_subset_sort(sub, "sort");
158  const unsigned char c_use_threads = cs_subset_enum(sub, "use_threads");
159 
160  if (((c_sort & SORT_MASK) != SORT_THREADS) || (c_use_threads == UT_UNSET))
161  return 0;
162 
164 
165  /* Note: changing a config variable here kicks off a second round of
166  * observers before the first round has completed. But since we
167  * aren't setting $sort to threads, the 2nd-level observer will be a
168  * no-op.
169  */
170  const short c_sort_aux = cs_subset_sort(sub, "sort_aux");
171  int rc = cs_subset_str_native_set(sub, "sort", c_sort_aux, NULL);
172  return (CSR_RESULT(rc) == CSR_SUCCESS) ? 0 : -1;
173 }
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
Not yet set by user, stick to legacy semantics.
Definition: mutt_thread.h:79
#define CSR_RESULT(x)
Definition: set.h:52
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
Definition: subset.c:305
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:292
Sort by email threads.
Definition: sort2.h:49
unsigned char cs_subset_enum(const struct ConfigSubset *sub, const char *name)
Get a enumeration config item by name.
Definition: helpers.c:97
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:78
static void sort_use_threads_warn(void)
alert the user to odd $sort settings
Definition: index.c:89
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ config_reply_regex()

static int config_reply_regex ( struct MuttWindow dlg)
static

React to changes to $reply_regex.

Parameters
dlgIndex Dialog
Return values
0Successfully handled
-1Error

Definition at line 181 of file index.c.

182 {
183  struct IndexSharedData *shared = dlg->wdata;
184  struct Mailbox *m = shared->mailbox;
185  if (!m)
186  return 0;
187 
188  regmatch_t pmatch[1];
189 
190  for (int i = 0; i < m->msg_count; i++)
191  {
192  struct Email *e = m->emails[i];
193  if (!e)
194  break;
195  struct Envelope *env = e->env;
196  if (!env || !env->subject)
197  continue;
198 
199  const struct Regex *c_reply_regex =
200  cs_subset_regex(NeoMutt->sub, "reply_regex");
201  if (mutt_regex_capture(c_reply_regex, env->subject, 1, pmatch))
202  {
203  env->real_subj = env->subject + pmatch[0].rm_eo;
204  continue;
205  }
206 
207  env->real_subj = env->subject;
208  }
209 
210  OptResortInit = true; /* trigger a redraw of the index */
211  return 0;
212 }
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
int msg_count
Total number of messages.
Definition: mailbox.h:91
The envelope/body of an email.
Definition: email.h:37
char * real_subj
Offset of the real subject.
Definition: envelope.h:67
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:36
Container for Accounts, Notifications.
Definition: neomutt.h:36
const struct Regex * cs_subset_regex(const struct ConfigSubset *sub, const char *name)
Get a regex config item by name.
Definition: helpers.c:243
struct Envelope * env
Envelope information.
Definition: email.h:90
A mailbox.
Definition: mailbox.h:81
WHERE bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: options.h:50
bool mutt_regex_capture(const struct Regex *regex, const char *str, size_t nmatch, regmatch_t matches[])
match a regex against a string, with provided options
Definition: regex.c:596
char * subject
Email&#39;s subject.
Definition: envelope.h:66
Cached regular expression.
Definition: regex3.h:89
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
void * wdata
Private data.
Definition: mutt_window.h:145
The header of an Email.
Definition: envelope.h:54
+ 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 217 of file index.c.

218 {
219  if ((nc->event_type != NT_ALTERN) || !nc->global_data)
220  return -1;
221 
222  struct MuttWindow *dlg = nc->global_data;
223  struct IndexSharedData *shared = dlg->wdata;
224 
226  mutt_debug(LL_DEBUG5, "alternates done\n");
227  return 0;
228 }
Alternates command changed, NotifyAlternates.
Definition: notify_type.h:36
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:36
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
void mutt_alternates_reset(struct Mailbox *m)
Clear the recipient valid flag of all emails.
Definition: alternates.c:73
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
Log at debug level 5.
Definition: logging.h:44
void * wdata
Private data.
Definition: mutt_window.h:145
+ 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 233 of file index.c.

234 {
235  if ((nc->event_type != NT_ATTACH) || !nc->global_data)
236  return -1;
237 
238  struct MuttWindow *dlg = nc->global_data;
239  struct IndexSharedData *shared = dlg->wdata;
240 
242  mutt_debug(LL_DEBUG5, "attachments done\n");
243  return 0;
244 }
Attachment command changed, NotifyAttach.
Definition: notify_type.h:37
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:36
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
void mutt_attachments_reset(struct Mailbox *m)
Reset the attachment count for all Emails.
Definition: attachments.c:287
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
Log at debug level 5.
Definition: logging.h:44
void * wdata
Private data.
Definition: mutt_window.h:145
+ 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 249 of file index.c.

250 {
251  if ((nc->event_type != NT_COLOR) || !nc->global_data || !nc->event_data)
252  return -1;
253 
254  struct EventColor *ev_c = nc->event_data;
255 
256  const int c = ev_c->color;
257 
258  bool simple = (c == MT_COLOR_INDEX_COLLAPSED) || (c == MT_COLOR_INDEX_DATE) ||
259  (c == MT_COLOR_INDEX_LABEL) || (c == MT_COLOR_INDEX_NUMBER) ||
260  (c == MT_COLOR_INDEX_SIZE) || (c == MT_COLOR_INDEX_TAGS);
261 
262  bool lists = (c == MT_COLOR_INDEX) || (c == MT_COLOR_INDEX_AUTHOR) ||
263  (c == MT_COLOR_INDEX_FLAGS) || (c == MT_COLOR_INDEX_SUBJECT) ||
264  (c == MT_COLOR_INDEX_TAG);
265 
266  // The changes aren't relevant to the index menu
267  if (!simple && !lists)
268  return 0;
269 
270  struct MuttWindow *win_index = nc->global_data;
271  struct MuttWindow *dlg = dialog_find(win_index);
272  struct IndexSharedData *shared = dlg->wdata;
273 
274  struct Mailbox *m = shared->mailbox;
275  if (!m)
276  return 0;
277 
278  // Colour deleted from a list
279  if ((nc->event_subtype == NT_COLOR_RESET) && lists)
280  {
281  // Force re-caching of index colours
282  for (int i = 0; i < m->msg_count; i++)
283  {
284  struct Email *e = m->emails[i];
285  if (!e)
286  break;
287  e->pair = 0;
288  }
289  }
290 
291  struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
292  struct IndexPrivateData *priv = panel_index->wdata;
293  struct Menu *menu = priv->menu;
294  menu->redraw = MENU_REDRAW_FULL;
295  mutt_debug(LL_DEBUG5, "color done, request MENU_REDRAW_FULL\n");
296 
297  return 0;
298 }
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:550
Index: index number.
Definition: color.h:90
int msg_count
Total number of messages.
Definition: mailbox.h:91
The envelope/body of an email.
Definition: email.h:37
Index: tags field (g, J)
Definition: color.h:92
Definition: lib.h:67
struct Menu * menu
Menu controlling the index.
Definition: private_data.h:44
An Event that happened to a Colour.
Definition: color.h:122
Private state data for the Index.
Definition: private_data.h:34
MenuRedrawFlags redraw
When to redraw the screen.
Definition: lib.h:72
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:36
Index: number of messages in collapsed thread.
Definition: color.h:87
A panel containing the Index Window.
Definition: mutt_window.h:97
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:43
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
Index: author field (takes a pattern)
Definition: color.h:82
Index: tag field (g, takes a pattern)
Definition: color.h:85
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
Index: date field.
Definition: color.h:88
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:39
Index: size field.
Definition: color.h:91
A mailbox.
Definition: mailbox.h:81
Color has been reset/removed.
Definition: color.h:137
enum ColorId color
Definition: color.h:124
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
void * event_data
Data from notify_send()
Definition: observer.h:44
Index: label field.
Definition: color.h:89
Index: subject field (takes a pattern)
Definition: color.h:84
Index: default colour (takes a pattern)
Definition: color.h:81
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
Log at debug level 5.
Definition: logging.h:44
void * wdata
Private data.
Definition: mutt_window.h:145
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:85
int pair
Color-pair to use when displaying in the index.
Definition: email.h:80
Index: flags field (takes a pattern)
Definition: color.h:83
+ 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 303 of file index.c.

304 {
305  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
306  return -1;
307 
308  struct EventConfig *ev_c = nc->event_data;
309  struct MuttWindow *dlg = nc->global_data;
310  const struct ConfigDef *cdef = ev_c->he->data;
311  ConfigRedrawFlags flags = cdef->type & R_REDRAW_MASK;
312 
313  if (flags & R_RESORT_SUB)
314  OptSortSubthreads = true;
315  if (flags & R_RESORT)
316  OptNeedResort = true;
317  if (flags & R_RESORT_INIT)
318  OptResortInit = true;
319 
320  if (mutt_str_equal(ev_c->name, "reply_regex"))
321  {
322  config_reply_regex(dlg);
323  mutt_debug(LL_DEBUG5, "config done\n");
324  }
325  else if (mutt_str_equal(ev_c->name, "sort"))
326  {
327  config_sort(ev_c->sub);
328  mutt_debug(LL_DEBUG5, "config done\n");
329  }
330  else if (mutt_str_equal(ev_c->name, "use_threads"))
331  {
332  config_use_threads(ev_c->sub);
333  mutt_debug(LL_DEBUG5, "config done\n");
334  }
335 
336  return 0;
337 }
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:904
static int config_use_threads(const struct ConfigSubset *sub)
React to changes to "use_threads".
Definition: index.c:155
WHERE bool OptNeedResort
(pseudo) used to force a re-sort
Definition: options.h:42
A config-change event.
Definition: subset.h:69
Definition: set.h:63
#define R_RESORT
Resort the mailbox.
Definition: types.h:68
static int config_sort(const struct ConfigSubset *sub)
React to changes to "sort".
Definition: index.c:107
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
struct HashElem * he
Config item that changed.
Definition: subset.h:73
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
#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
uint32_t type
Variable type, e.g. DT_STRING.
Definition: set.h:66
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
WHERE bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: options.h:50
void * event_data
Data from notify_send()
Definition: observer.h:44
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:42
void * data
User-supplied data.
Definition: hash.h:47
static int config_reply_regex(struct MuttWindow *dlg)
React to changes to $reply_regex.
Definition: index.c:181
#define R_RESORT_INIT
Resort from scratch.
Definition: types.h:70
WHERE bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: options.h:53
Log at debug level 5.
Definition: logging.h:44
const struct ConfigSubset * sub
Config Subset.
Definition: subset.h:71
const char * name
Name of config item that changed.
Definition: subset.h:72
#define R_REDRAW_MASK
Mask for the Redraw Flags.
Definition: types.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 342 of file index.c.

343 {
344  if ((nc->event_type != NT_SCORE) || !nc->global_data)
345  return -1;
346 
347  struct MuttWindow *dlg = nc->global_data;
348  struct IndexSharedData *shared = dlg->wdata;
349 
350  struct Mailbox *m = shared->mailbox;
351  if (!m)
352  return 0;
353 
354  for (int i = 0; i < m->msg_count; i++)
355  {
356  struct Email *e = m->emails[i];
357  if (!e)
358  break;
359 
360  mutt_score_message(m, e, true);
361  e->pair = 0; // Force recalc of colour
362  }
363 
364  mutt_debug(LL_DEBUG5, "score done\n");
365  return 0;
366 }
struct Email ** emails
Array of Emails.
Definition: mailbox.h:99
int msg_count
Total number of messages.
Definition: mailbox.h:91
The envelope/body of an email.
Definition: email.h:37
void mutt_score_message(struct Mailbox *m, struct Email *e, bool upd_mbox)
Apply scoring to an email.
Definition: score.c:161
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:36
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
A mailbox.
Definition: mailbox.h:81
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
Email scoring has changed.
Definition: notify_type.h:51
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
Log at debug level 5.
Definition: logging.h:44
void * wdata
Private data.
Definition: mutt_window.h:145
int pair
Color-pair to use when displaying in the index.
Definition: email.h:80
+ 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 371 of file index.c.

372 {
373  if ((nc->event_type != NT_SUBJRX) || !nc->global_data)
374  return -1;
375 
376  struct MuttWindow *dlg = nc->global_data;
377  struct IndexSharedData *shared = dlg->wdata;
378 
379  subjrx_clear_mods(shared->mailbox);
380  mutt_debug(LL_DEBUG5, "subjectrx done\n");
381  return 0;
382 }
void subjrx_clear_mods(struct Mailbox *m)
Clear out all modified email subjects.
Definition: subjectrx.c:147
Subject Regex has changed, NotifySubjRx.
Definition: notify_type.h:52
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:36
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
Log at debug level 5.
Definition: logging.h:44
void * wdata
Private data.
Definition: mutt_window.h:145
+ 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 387 of file index.c.

388 {
389  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
390  return -1;
391 
392  if (nc->event_subtype != NT_WINDOW_DELETE)
393  return 0;
394 
395  struct MuttWindow *win = nc->global_data;
396  struct EventWindow *ev_w = nc->event_data;
397  if (ev_w->win != win)
398  return 0;
399 
407 
408  mutt_debug(LL_DEBUG5, "window delete done\n");
409  return 0;
410 }
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:217
An Event that happened to a Window.
Definition: mutt_window.h:215
Window is about to be deleted.
Definition: mutt_window.h:206
static int index_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t.
Definition: index.c:249
Container for Accounts, Notifications.
Definition: neomutt.h:36
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:53
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t.
Definition: index.c:387
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:43
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:42
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
void * global_data
Data from notify_observer_add()
Definition: observer.h:45
static int index_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t.
Definition: index.c:303
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
void * event_data
Data from notify_send()
Definition: observer.h:44
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an &#39;attachments&#39; command has occurred - Implements observer_t.
Definition: index.c:233
static int index_altern_observer(struct NotifyCallback *nc)
Notification that an &#39;alternates&#39; command has occurred - Implements observer_t.
Definition: index.c:217
static int index_subjrx_observer(struct NotifyCallback *nc)
Notification that a &#39;subjectrx&#39; command has occurred - Implements observer_t.
Definition: index.c:371
bool notify_observer_remove(struct Notify *notify, observer_t callback, void *global_data)
Remove an observer from an object.
Definition: notify.c:228
Log at debug level 5.
Definition: logging.h:44
static int index_score_observer(struct NotifyCallback *nc)
Notification that a &#39;score&#39; command has occurred - Implements observer_t.
Definition: index.c:342
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_window_new()

struct MuttWindow* index_window_new ( struct IndexSharedData shared,
struct IndexPrivateData priv 
)

Create a new Index Window (list of Emails)

Return values
ptrNew Window

Definition at line 416 of file index.c.

418 {
420 
421  struct Menu *menu = win->wdata;
422  menu->mdata = priv;
423  priv->menu = menu;
424 
432 
433  return win;
434 }
Definition: lib.h:67
struct Menu * menu
Menu controlling the index.
Definition: private_data.h:44
Attachment command changed, NotifyAttach.
Definition: notify_type.h:37
Subject Regex has changed, NotifySubjRx.
Definition: notify_type.h:52
Alternates command changed, NotifyAlternates.
Definition: notify_type.h:36
static int index_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t.
Definition: index.c:249
Container for Accounts, Notifications.
Definition: neomutt.h:36
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:53
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t.
Definition: index.c:387
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:76
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:189
static int index_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t.
Definition: index.c:303
Colour has changed, NotifyColor, EventColor.
Definition: notify_type.h:39
void * mdata
Private data.
Definition: lib.h:155
Index panel (list of emails)
Definition: type.h:50
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:42
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an &#39;attachments&#39; command has occurred - Implements observer_t.
Definition: index.c:233
Email scoring has changed.
Definition: notify_type.h:51
static int index_altern_observer(struct NotifyCallback *nc)
Notification that an &#39;alternates&#39; command has occurred - Implements observer_t.
Definition: index.c:217
static int index_subjrx_observer(struct NotifyCallback *nc)
Notification that a &#39;subjectrx&#39; command has occurred - Implements observer_t.
Definition: index.c:371
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
void * wdata
Private data.
Definition: mutt_window.h:145
static int index_score_observer(struct NotifyCallback *nc)
Notification that a &#39;score&#39; command has occurred - Implements observer_t.
Definition: index.c:342
+ Here is the call graph for this function:
+ Here is the caller graph for this function: