NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
module.c
Go to the documentation of this file.
1
22
28
29#include "config.h"
30#include <stdbool.h>
31#include <stddef.h>
32#include "mutt/lib.h"
33#include "config/lib.h"
34#include "core/lib.h"
35#include "lib.h"
36#include "module_data.h"
37#include "type.h"
38
39extern struct ConfigDef MenuVars[];
40
44static bool menu_init(struct NeoMutt *n)
45{
46 struct MenuModuleData *mod_data = MUTT_MEM_CALLOC(1, struct MenuModuleData);
48
49 mod_data->notify = notify_new();
50 notify_set_parent(mod_data->notify, n->notify);
51
52 return true;
53}
54
58static bool menu_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
59{
61}
62
66static bool menu_gui_init(struct NeoMutt *n)
67{
69 menu_init2(mod_data->search_buffers);
70 return true;
71}
72
76static void menu_gui_cleanup(struct NeoMutt *n)
77{
79 ASSERT(mod_data);
80
81 for (int i = 0; i < MENU_MAX; i++)
82 FREE(&mod_data->search_buffers[i]);
83}
84
88static bool menu_cleanup(struct NeoMutt *n, void *data)
89{
90 struct MenuModuleData *mod_data = data;
91
92 notify_free(&mod_data->notify);
93
94 FREE(&mod_data);
95 return true;
96}
97
101const struct Module ModuleMenu = {
103 "menu",
104 menu_init,
105 NULL, // config_define_types
107 NULL, // commands_register
111};
Convenience wrapper for the config headers.
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition set.c:290
Convenience wrapper for the core headers.
const struct Module ModuleMenu
Module for the Menu library.
Definition module.c:101
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
struct ConfigDef MenuVars[]
Config definitions for the Menu library.
Definition config.c:37
GUI present the user with a selectable list.
void menu_init2(char **search_buffers)
Initialise all the Menus.
Definition menu.c:72
static bool menu_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:44
static void menu_gui_cleanup(struct NeoMutt *n)
Clean up the GUI - Implements Module::gui_cleanup()
Definition module.c:76
static bool menu_gui_init(struct NeoMutt *n)
Initialise the GUI - Implements Module::gui_init()
Definition module.c:66
static bool menu_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:58
static bool menu_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:88
Menu private Module data.
@ MODULE_ID_MENU
ModuleMenu, Menu
Definition module_api.h:77
Convenience wrapper for the library headers.
struct Notify * notify_new(void)
Create a new notifications handler.
Definition notify.c:62
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition notify.c:95
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition notify.c:75
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:677
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
#define ASSERT(COND)
Definition signal2.h:59
Container for lots of config items.
Definition set.h:251
Menu private Module data.
Definition module_data.h:32
char * search_buffers[MENU_MAX]
Previous search string, one for each MenuType.
Definition module_data.h:34
struct Notify * notify
Notifications.
Definition module_data.h:33
Container for Accounts, Notifications.
Definition neomutt.h:41
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
Menu types.
@ MENU_MAX
Definition type.h:52