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 <limits.h>
31#include <stdbool.h>
32#include <stddef.h>
33#include "mutt/lib.h"
34#include "config/lib.h"
35#include "core/lib.h"
36#include "module_data.h"
37
38extern struct ConfigDef BrowserVars[];
39
43static bool browser_init(struct NeoMutt *n)
44{
45 struct BrowserModuleData *mod_data = MUTT_MEM_CALLOC(1, struct BrowserModuleData);
47
48 mod_data->notify = notify_new();
49 notify_set_parent(mod_data->notify, n->notify);
50
51 buf_alloc(&mod_data->last_dir, PATH_MAX);
53
54 return true;
55}
56
60static bool browser_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
61{
63}
64
68static bool browser_cleanup(struct NeoMutt *n, void *data)
69{
70 struct BrowserModuleData *mod_data = data;
71
72 notify_free(&mod_data->notify);
73
74 buf_dealloc(&mod_data->last_dir);
75 buf_dealloc(&mod_data->last_dir_backup);
76 FREE(&mod_data);
77 return true;
78}
79
83static bool browser_gui_init(struct NeoMutt *n)
84{
85 return true;
86}
87
91const struct Module ModuleBrowser = {
93 "browser",
95 NULL, // config_define_types
97 NULL, // commands_register
99 NULL, // gui_cleanup
101};
struct ConfigDef BrowserVars[]
Config definitions for the browser.
Definition config.c:138
static bool browser_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:68
static bool browser_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:43
static bool browser_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:60
const struct Module ModuleBrowser
Module for the Browser library.
Definition module.c:91
static bool browser_gui_init(struct NeoMutt *n)
Initialise the GUI - Implements Module::gui_init()
Definition module.c:83
Browser private Module data.
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition buffer.c:377
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
Definition buffer.c:337
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.
#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_BROWSER
ModuleBrowser, Mailbox Browser
Definition module_api.h:52
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
#define PATH_MAX
Definition mutt.h:49
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:677
Browser private Module data.
Definition module_data.h:32
struct Notify * notify
Notifications.
Definition module_data.h:33
struct Buffer last_dir
Browser: previous selected directory.
Definition module_data.h:35
struct Buffer last_dir_backup
Browser: backup copy of the current directory.
Definition module_data.h:36
Container for lots of config items.
Definition set.h:251
Container for Accounts, Notifications.
Definition neomutt.h:41
struct Notify * notify
Notifications handler.
Definition neomutt.h:45