NeoMutt  2023-05-17-56-ga67199
Teaching an old dog new tricks
simple.c File Reference

Simple Dialog. More...

#include "config.h"
#include <stdbool.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "lib.h"
#include "menu/lib.h"
+ Include dependency graph for simple.c:

Go to the source code of this file.


static int simple_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -. More...
static int simple_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -. More...
struct MuttWindowsimple_dialog_new (enum MenuType mtype, enum WindowType wtype, const struct Mapping *help_data)
 Create a simple index Dialog. More...
void simple_dialog_free (struct MuttWindow **ptr)
 Destroy a simple index Dialog. More...

Detailed Description

Simple Dialog.

  • 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

Definition in file simple.c.

Function Documentation

◆ simple_dialog_new()

struct MuttWindow * simple_dialog_new ( enum MenuType  mtype,
enum WindowType  wtype,
const struct Mapping help_data 

Create a simple index Dialog.

mtypeMenu type, e.g. MENU_ALIAS
wtypeDialog type, e.g. WT_DLG_ALIAS
help_dataData for the Help Bar
Return values
ptrNew Dialog Window

Definition at line 129 of file simple.c.

135 dlg->help_menu = mtype;
136 dlg->help_data = help_data;
138 struct MuttWindow *win_menu = menu_window_new(mtype, NeoMutt->sub);
139 dlg->focus = win_menu;
140 dlg->wdata = win_menu->wdata;
142 struct MuttWindow *win_sbar = sbar_new();
143 const bool c_status_on_top = cs_subset_bool(NeoMutt->sub, "status_on_top");
144 if (c_status_on_top)
145 {
146 mutt_window_add_child(dlg, win_sbar);
147 mutt_window_add_child(dlg, win_menu);
148 }
149 else
150 {
151 mutt_window_add_child(dlg, win_menu);
152 mutt_window_add_child(dlg, win_sbar);
153 }
157 dialog_push(dlg);
159 return dlg;
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
void dialog_push(struct MuttWindow *dlg)
Display a Window to the user.
Definition: dialog.c:103
static int simple_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: simple.c:77
static int simple_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: simple.c:101
struct MuttWindow * menu_window_new(enum MenuType type, struct ConfigSubset *sub)
Create a new Menu Window.
Definition: window.c:138
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_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
Definition: mutt_window.c:440
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:180
Window uses all available vertical space.
Definition: mutt_window.h:38
Use as much space as possible.
Definition: mutt_window.h:52
Window wants as much space as possible.
Definition: mutt_window.h:48
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:55
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
struct MuttWindow * sbar_new(void)
Add the Simple Bar (status)
Definition: sbar.c:200
const struct Mapping * help_data
Data for the Help Bar.
Definition: mutt_window.h:142
struct MuttWindow * focus
Focused Window.
Definition: mutt_window.h:140
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
Definition: mutt_window.h:141
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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ simple_dialog_free()

void simple_dialog_free ( struct MuttWindow **  ptr)

Destroy a simple index Dialog.

ptrDialog Window to destroy

Definition at line 166 of file simple.c.

168 if (!ptr || !*ptr)
169 return;
171 dialog_pop();
172 mutt_window_free(ptr);
void dialog_pop(void)
Hide a Window from the user.
Definition: dialog.c:137
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:200
+ Here is the call graph for this function:
+ Here is the caller graph for this function: