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 "core/lib.h"
34#include "extended.h"
35#include "init.h"
36#include "module_data.h"
37
38extern const struct Command KeyCommands[];
39
43static bool key_init(struct NeoMutt *n)
44{
45 struct KeyModuleData *mod_data = MUTT_MEM_CALLOC(1, struct KeyModuleData);
47
48 mod_data->notify = notify_new();
49 notify_set_parent(mod_data->notify, n->notify);
50
51 km_init(mod_data);
52
53 return true;
54}
55
59static bool key_commands_register(struct NeoMutt *n, struct CommandArray *ca)
60{
62}
63
67static bool key_cleanup(struct NeoMutt *n, void *data)
68{
69 struct KeyModuleData *mod_data = data;
70
71 notify_free(&mod_data->notify);
72
73 FREE(&mod_data);
74 return true;
75}
76
80static bool key_gui_init(struct NeoMutt *n)
81{
83 km_set_abort_key(&mod_data->abort_key);
84 return true;
85}
86
90static void key_gui_cleanup(struct NeoMutt *n)
91{
93 km_cleanup(mod_data);
94}
95
99const struct Module ModuleKey = {
101 "key",
102 key_init,
103 NULL, // config_define_types
104 NULL, // config_define_variables
109};
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.
Set up the extended keys.
const struct Module ModuleKey
Module for the Key library.
Definition module.c:99
void km_cleanup(struct KeyModuleData *mod_data)
Free the key maps.
Definition init.c:203
void km_init(struct KeyModuleData *mod_data)
Initialise all the menu keybindings.
Definition init.c:170
void km_set_abort_key(keycode_t *abort_key)
Parse the abort_key config string.
Definition init.c:236
const struct Command KeyCommands[]
All the registered Menus - moved to KeyModuleData All the registered SubMenus - moved to KeyModuleDat...
Definition init.c:48
Set up the key bindings.
static bool key_gui_init(struct NeoMutt *n)
Initialise the GUI - Implements Module::gui_init()
Definition module.c:80
static bool key_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:59
static void key_gui_cleanup(struct NeoMutt *n)
Clean up the GUI - Implements Module::gui_cleanup()
Definition module.c:90
static bool key_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:43
static bool key_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:67
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:73
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
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