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 "gui/module_data.h"
36#include "lib.h"
37#include "module_data.h"
38
39extern struct ConfigDef SidebarVars[];
40
41extern const struct Command SbCommands[];
42
46static bool sidebar_init(struct NeoMutt *n)
47{
48 struct SidebarModuleData *mod_data = MUTT_MEM_CALLOC(1, struct SidebarModuleData);
49 STAILQ_INIT(&mod_data->sidebar_pinned);
51
52 mod_data->notify = notify_new();
53 notify_set_parent(mod_data->notify, n->notify);
54
55 return true;
56}
57
61static bool sidebar_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
62{
64}
65
69static bool sidebar_commands_register(struct NeoMutt *n, struct CommandArray *ca)
70{
71 return commands_register(ca, SbCommands);
72}
73
77static bool sidebar_cleanup(struct NeoMutt *n, void *data)
78{
79 struct SidebarModuleData *mod_data = data;
80
81 notify_free(&mod_data->notify);
82
84 FREE(&mod_data);
85 return true;
86}
87
91static bool sidebar_gui_init(struct NeoMutt *n)
92{
94 sb_init(gui_data ? gui_data->all_dialogs_window : NULL);
95 return true;
96}
97
101static void sidebar_gui_cleanup(struct NeoMutt *n)
102{
105 sb_cleanup(&mod_data->sidebar_pinned, (gui_data ? gui_data->all_dialogs_window : NULL));
106}
107
111const struct Module ModuleSidebar = {
113 "sidebar",
115 NULL, // config_define_types
121};
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
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 ModuleSidebar
Module for the Sidebar library.
Definition module.c:111
Gui private Module data.
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition list.c:123
#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_SIDEBAR
ModuleSidebar, Sidebar
Definition module_api.h:91
@ MODULE_ID_GUI
ModuleGui, Graphical code
Definition module_api.h:45
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 STAILQ_INIT(head)
Definition queue.h:410
struct ConfigDef SidebarVars[]
Config definitions for the sidebar.
Definition config.c:94
GUI display the mailboxes in a side panel.
void sb_init(struct MuttWindow *all_dialogs_window)
Set up the Sidebar.
Definition sidebar.c:214
void sb_cleanup(struct ListHead *sidebar_pinned, struct MuttWindow *all_dialogs_window)
Clean up the Sidebar.
Definition sidebar.c:234
const struct Command SbCommands[]
Sidebar Commands.
Definition sidebar.c:48
static bool sidebar_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:61
static bool sidebar_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:77
static void sidebar_gui_cleanup(struct NeoMutt *n)
Clean up the GUI - Implements Module::gui_cleanup()
Definition module.c:101
static bool sidebar_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:69
static bool sidebar_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:46
static bool sidebar_gui_init(struct NeoMutt *n)
Initialise the GUI - Implements Module::gui_init()
Definition module.c:91
Sidebar private Module data.
Container for lots of config items.
Definition set.h:251
Gui private Module data.
Definition module_data.h:32
struct MuttWindow * all_dialogs_window
Parent of all Dialogs.
Definition module_data.h:38
Container for Accounts, Notifications.
Definition neomutt.h:41
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
Sidebar private Module data.
Definition module_data.h:32
struct ListHead sidebar_pinned
List of mailboxes to always display in the sidebar.
Definition module_data.h:36
struct Notify * notify
Notifications.
Definition module_data.h:33