NeoMutt
2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
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/lib.h
"
36
#include "
lib.h
"
37
#include "
module_data.h
"
38
39
extern
struct
ConfigDef
SidebarVars
[];
40
41
extern
const
struct
Command
SbCommands
[];
42
46
static
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
);
50
neomutt_set_module_data
(n,
MODULE_ID_SIDEBAR
, mod_data);
51
52
mod_data->
notify
=
notify_new
();
53
notify_set_parent
(mod_data->
notify
, n->
notify
);
54
55
return
true
;
56
}
57
61
static
bool
sidebar_config_define_variables
(
struct
NeoMutt
*n,
struct
ConfigSet
*cs)
62
{
63
return
cs_register_variables
(cs,
SidebarVars
);
64
}
65
69
static
bool
sidebar_commands_register
(
struct
NeoMutt
*n,
struct
CommandArray *ca)
70
{
71
return
commands_register
(ca,
SbCommands
);
72
}
73
77
static
bool
sidebar_cleanup
(
struct
NeoMutt
*n,
void
*data)
78
{
79
struct
SidebarModuleData
*mod_data = data;
80
81
notify_free
(&mod_data->
notify
);
82
83
mutt_list_free
(&mod_data->
sidebar_pinned
);
84
FREE
(&mod_data);
85
return
true
;
86
}
87
91
static
bool
sidebar_gui_init
(
struct
NeoMutt
*n)
92
{
93
struct
GuiModuleData
*gui_data =
neomutt_get_module_data
(n,
MODULE_ID_GUI
);
94
sb_init
(gui_data ? gui_data->
all_dialogs_window
: NULL);
95
return
true
;
96
}
97
101
static
void
sidebar_gui_cleanup
(
struct
NeoMutt
*n)
102
{
103
struct
SidebarModuleData
*mod_data =
neomutt_get_module_data
(n,
MODULE_ID_SIDEBAR
);
104
struct
GuiModuleData
*gui_data =
neomutt_get_module_data
(n,
MODULE_ID_GUI
);
105
sb_cleanup
(&mod_data->
sidebar_pinned
, (gui_data ? gui_data->
all_dialogs_window
: NULL));
106
}
107
111
const
struct
Module
ModuleSidebar
= {
112
MODULE_ID_SIDEBAR
,
113
"sidebar"
,
114
sidebar_init
,
115
NULL,
// config_define_types
116
sidebar_config_define_variables
,
117
sidebar_commands_register
,
118
sidebar_gui_init
,
119
sidebar_gui_cleanup
,
120
sidebar_cleanup
,
121
};
lib.h
Convenience wrapper for the config headers.
cs_register_variables
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition
set.c:290
commands_register
bool commands_register(struct CommandArray *ca, const struct Command *cmds)
Add commands to Commands array.
Definition
command.c:51
lib.h
Convenience wrapper for the core headers.
ModuleSidebar
const struct Module ModuleSidebar
Module for the Sidebar library.
Definition
module.c:111
lib.h
Convenience wrapper for the gui headers.
mutt_list_free
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition
list.c:123
FREE
#define FREE(x)
Free memory and set the pointer to NULL.
Definition
memory.h:68
MUTT_MEM_CALLOC
#define MUTT_MEM_CALLOC(n, type)
Definition
memory.h:52
MODULE_ID_SIDEBAR
@ MODULE_ID_SIDEBAR
ModuleSidebar, Sidebar
Definition
module_api.h:93
MODULE_ID_GUI
@ MODULE_ID_GUI
ModuleGui, Graphical code
Definition
module_api.h:45
lib.h
Convenience wrapper for the library headers.
notify_new
struct Notify * notify_new(void)
Create a new notifications handler.
Definition
notify.c:62
notify_set_parent
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition
notify.c:95
notify_free
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition
notify.c:75
neomutt_set_module_data
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition
neomutt.c:680
neomutt_get_module_data
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition
neomutt.c:666
STAILQ_INIT
#define STAILQ_INIT(head)
Definition
queue.h:410
SidebarVars
struct ConfigDef SidebarVars[]
Config definitions for the sidebar.
Definition
config.c:95
lib.h
GUI display the mailboxes in a side panel.
sb_init
void sb_init(struct MuttWindow *all_dialogs_window)
Set up the Sidebar.
Definition
sidebar.c:214
sb_cleanup
void sb_cleanup(struct ListHead *sidebar_pinned, struct MuttWindow *all_dialogs_window)
Clean up the Sidebar.
Definition
sidebar.c:234
SbCommands
const struct Command SbCommands[]
Sidebar Commands.
Definition
sidebar.c:47
sidebar_config_define_variables
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
sidebar_cleanup
static bool sidebar_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup().
Definition
module.c:77
sidebar_gui_cleanup
static void sidebar_gui_cleanup(struct NeoMutt *n)
Clean up the GUI - Implements Module::gui_cleanup().
Definition
module.c:101
sidebar_commands_register
static bool sidebar_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register().
Definition
module.c:69
sidebar_init
static bool sidebar_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init().
Definition
module.c:46
sidebar_gui_init
static bool sidebar_gui_init(struct NeoMutt *n)
Initialise the GUI - Implements Module::gui_init().
Definition
module.c:91
module_data.h
Sidebar private Module data.
Command
Definition
command.h:161
ConfigDef
Definition
set.h:65
ConfigSet
Container for lots of config items.
Definition
set.h:251
GuiModuleData
Gui private Module data.
Definition
module_data.h:32
GuiModuleData::all_dialogs_window
struct MuttWindow * all_dialogs_window
Parent of all Dialogs.
Definition
module_data.h:36
Module
Definition
module_api.h:104
NeoMutt
Container for Accounts, Notifications.
Definition
neomutt.h:41
NeoMutt::notify
struct Notify * notify
Notifications handler.
Definition
neomutt.h:45
SidebarModuleData
Sidebar private Module data.
Definition
module_data.h:32
SidebarModuleData::sidebar_pinned
struct ListHead sidebar_pinned
List of mailboxes to always display in the sidebar.
Definition
module_data.h:36
SidebarModuleData::notify
struct Notify * notify
Notifications.
Definition
module_data.h:33