NeoMutt  2025-12-11-980-ge38c27
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 "core/lib.h"
34#include "init.h"
35#include "module_data.h"
36
37extern const struct Command KeyCommands[];
38
42static bool key_init(struct NeoMutt *n)
43{
44 struct KeyModuleData *mod_data = MUTT_MEM_CALLOC(1, struct KeyModuleData);
46
47 mod_data->notify = notify_new();
48 notify_set_parent(mod_data->notify, n->notify);
49
50 km_init(mod_data);
51
52 return true;
53}
54
58static bool key_commands_register(struct NeoMutt *n, struct CommandArray *ca)
59{
61}
62
66static bool key_cleanup(struct NeoMutt *n, void *data)
67{
68 struct KeyModuleData *mod_data = data;
69
70 notify_free(&mod_data->notify);
71
72 FREE(&mod_data);
73 return true;
74}
75
79static bool key_gui_init(struct NeoMutt *n)
80{
82 km_set_abort_key(&mod_data->abort_key);
83 return true;
84}
85
89static void key_gui_cleanup(struct NeoMutt *n)
90{
92 km_cleanup(mod_data);
93}
94
98const struct Module ModuleKey = {
100 "key",
101 key_init,
102 NULL, // config_define_types
103 NULL, // config_define_variables
108};
bool commands_register(struct CommandArray *ca, const struct Command *cmds)
Add commands to Commands array.
Definition command.c:51
Convenience wrapper for the core headers.
const struct Module ModuleKey
Module for the Key library.
Definition module.c:98
void km_cleanup(struct KeyModuleData *mod_data)
Free the key maps.
Definition init.c:205
void km_init(struct KeyModuleData *mod_data)
Initialise all the menu keybindings.
Definition init.c:172
void km_set_abort_key(keycode_t *abort_key)
Parse the abort_key config string.
Definition init.c:234
const struct Command KeyCommands[]
All the registered Menus - moved to KeyModuleData All the registered SubMenus - moved to KeyModuleDat...
Definition init.c:49
Set up the key bindings.
static bool key_gui_init(struct NeoMutt *n)
Initialise the GUI - Implements Module::gui_init()
Definition module.c:79
static bool key_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:58
static void key_gui_cleanup(struct NeoMutt *n)
Clean up the GUI - Implements Module::gui_cleanup()
Definition module.c:89
static bool key_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:42
static bool key_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:66
Key private Module data.
#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
@ MODULE_ID_KEY
ModuleKey, Key mappings
Definition module_api.h:74
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:680
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:666
Key private Module data.
Definition module_data.h:34
keycode_t abort_key
Key to abort prompts, normally Ctrl-G.
Definition module_data.h:38
struct Notify * notify
Notifications.
Definition module_data.h:35
Container for Accounts, Notifications.
Definition neomutt.h:41
struct Notify * notify
Notifications handler.
Definition neomutt.h:45