NeoMutt  2022-04-29-249-gaae397
Teaching an old dog new tricks
dlg_postpone.c File Reference

Postponed Email Selection Dialog. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "menu/lib.h"
#include "format_flags.h"
#include "functions.h"
#include "hdrline.h"
#include "keymap.h"
#include "mutt_logging.h"
#include "opcodes.h"
+ Include dependency graph for dlg_postpone.c:

Go to the source code of this file.


static void post_make_entry (struct Menu *menu, char *buf, size_t buflen, int line)
 Format a menu item for the email list - Implements Menu::make_entry() -. 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...
struct Emaildlg_select_postponed_email (struct Mailbox *m)
 Create a Menu to select a postponed message. More...


static const struct Mapping PostponeHelp []
 Help Bar for the Postponed email selection dialog. More...

Detailed Description

Postponed Email Selection Dialog.

  • Michael R. Elkins
  • Thomas Roessler

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

Definition in file dlg_postpone.c.

Function Documentation

◆ dlg_select_postponed_email()

struct Email * dlg_select_postponed_email ( struct Mailbox m)

Create a Menu to select a postponed message.

Return values

Definition at line 169 of file dlg_postpone.c.

173 struct Menu *menu = dlg->wdata;
175 menu->max = m->msg_count;
176 menu->mdata = m;
177 menu->mdata_free = NULL; // Menu doesn't own the data
178 menu->custom_search = true;
180 struct PostponeData pd = { false, m, menu, NULL };
181 dlg->wdata = &pd;
183 // NT_COLOR is handled by the SimpleDialog
187 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
188 sbar_set_title(sbar, _("Postponed Messages"));
190 /* The postponed mailbox is setup to have sorting disabled, but the global
191 * `$sort` variable may indicate something different. Sorting has to be
192 * disabled while the postpone menu is being displayed. */
193 const short c_sort = cs_subset_sort(NeoMutt->sub, "sort");
196 // ---------------------------------------------------------------------------
197 // Event Loop
198 int op = OP_NULL;
199 do
200 {
201 menu_tagging_dispatcher(menu->win, op);
202 window_redraw(NULL);
205 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
206 if (op < 0)
207 continue;
208 if (op == OP_NULL)
209 {
211 continue;
212 }
215 int rc = postpone_function_dispatcher(dlg, op);
217 if (rc == FR_UNKNOWN)
218 rc = menu_function_dispatcher(menu->win, op);
219 if (rc == FR_UNKNOWN)
220 rc = global_function_dispatcher(NULL, op);
221 } while (!pd.done);
222 // ---------------------------------------------------------------------------
224 cs_subset_str_native_set(NeoMutt->sub, "sort", c_sort, NULL);
225 simple_dialog_free(&dlg);
227 return;
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:292
Unknown function.
Definition: dispatcher.h:33
static const struct Mapping PostponeHelp[]
Help Bar for the Postponed email selection dialog.
Definition: dlg_postpone.c:88
int menu_tagging_dispatcher(struct MuttWindow *win, int op)
Perform tagging operations on the Menu - Implements function_dispatcher_t -.
Definition: tagging.c:223
int postpone_function_dispatcher(struct MuttWindow *win, int op)
Perform a Postpone function - Implements function_dispatcher_t -.
Definition: functions.c:129
int global_function_dispatcher(struct MuttWindow *win, int op)
Perform a Global function - Implements function_dispatcher_t -.
Definition: global.c:164
int menu_function_dispatcher(struct MuttWindow *win, int op)
Perform a Menu function - Implements function_dispatcher_t -.
Definition: functions.c:320
#define mutt_debug(LEVEL,...)
Definition: logging.h:84
static void post_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a menu item for the email list - Implements Menu::make_entry() -.
Definition: dlg_postpone.c:101
static int postponed_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_postpone.c:141
static int postponed_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_postpone.c:115
void simple_dialog_free(struct MuttWindow **ptr)
Destroy a simple index Dialog.
Definition: simple.c:166
struct MuttWindow * simple_dialog_new(enum MenuType mtype, enum WindowType wtype, const struct Mapping *help_data)
Create a simple index Dialog.
Definition: simple.c:129
int km_dokey(enum MenuType mtype)
Determine what a keypress should do.
Definition: keymap.c:795
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: keymap.c:1061
Log at debug level 1.
Definition: logging.h:40
#define _(a)
Definition: message.h:28
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
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:74
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:604
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:522
Status Bar containing extra info about the Index/Pager/etc.
Definition: mutt_window.h:102
Postpone Dialog, dlg_select_postponed_email()
Definition: mutt_window.h:89
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:55
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition: opcodes.c:46
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
Definition: sbar.c:224
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:48
int msg_count
Total number of messages.
Definition: mailbox.h:88
Definition: lib.h:69
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:76
void(* make_entry)(struct Menu *menu, char *buf, size_t buflen, int line)
Definition: lib.h:96
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition: lib.h:152
void * mdata
Private data.
Definition: lib.h:137
int max
Number of entries in the menu.
Definition: lib.h:71
bool custom_search
The menu implements its own non-Menusearch()-compatible search, trickle OP_SEARCH*.
Definition: lib.h:84
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
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
Data to pass to the Postpone Functions.
Definition: functions.h:34
struct Email * email
Selected Email.
Definition: functions.h:38
bool done
Should we close the Dialog?
Definition: functions.h:35
struct Menu * menu
Postponed Menu.
Definition: functions.h:37
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
Select a postponed email.
Definition: type.h:56
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ PostponeHelp

const struct Mapping PostponeHelp[]
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("Del"), OP_DELETE },
{ N_("Undel"), OP_UNDELETE },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
#define N_(a)
Definition: message.h:32

Help Bar for the Postponed email selection dialog.

Definition at line 88 of file dlg_postpone.c.