NeoMutt  2025-12-11-694-ga89709
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
module.c File Reference

Definition of the Sidebar Module. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "module_data.h"
+ Include dependency graph for module.c:

Go to the source code of this file.

Functions

static bool sidebar_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool sidebar_config_define_variables (struct NeoMutt *n, struct ConfigSet *cs)
 Define the Config Variables - Implements Module::config_define_variables()
 
static bool sidebar_commands_register (struct NeoMutt *n, struct CommandArray *ca)
 Register NeoMutt Commands - Implements Module::commands_register()
 
static bool sidebar_cleanup (struct NeoMutt *n)
 Clean up a Module - Implements Module::cleanup()
 

Variables

struct ConfigDef SidebarVars []
 Config definitions for the sidebar.
 
const struct Command SbCommands []
 Sidebar Commands.
 
const struct Module ModuleSidebar
 Module for the Sidebar library.
 

Detailed Description

Definition of the Sidebar Module.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file module.c.

Function Documentation

◆ sidebar_init()

static bool sidebar_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 44 of file module.c.

45{
46 // struct SidebarModuleData *md = MUTT_MEM_CALLOC(1, struct SidebarModuleData);
47 // neomutt_set_module_data(n, MODULE_ID_SIDEBAR, md);
48
49 return true;
50}

◆ sidebar_config_define_variables()

static bool sidebar_config_define_variables ( struct NeoMutt * n,
struct ConfigSet * cs )
static

Define the Config Variables - Implements Module::config_define_variables()

Definition at line 55 of file module.c.

56{
58}
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition set.c:290
struct ConfigDef SidebarVars[]
Config definitions for the sidebar.
Definition config.c:94
+ Here is the call graph for this function:

◆ sidebar_commands_register()

static bool sidebar_commands_register ( struct NeoMutt * n,
struct CommandArray * ca )
static

Register NeoMutt Commands - Implements Module::commands_register()

Definition at line 63 of file module.c.

64{
65 return commands_register(ca, SbCommands);
66}
bool commands_register(struct CommandArray *ca, const struct Command *cmds)
Add commands to Commands array.
Definition command.c:51
const struct Command SbCommands[]
Sidebar Commands.
Definition sidebar.c:49
+ Here is the call graph for this function:

◆ sidebar_cleanup()

static bool sidebar_cleanup ( struct NeoMutt * n)
static

Clean up a Module - Implements Module::cleanup()

Definition at line 71 of file module.c.

72{
73 // struct SidebarModuleData *md = neomutt_get_module_data(n, MODULE_ID_SIDEBAR);
74 // ASSERT(md);
75
76 // FREE(&md);
77 return true;
78}

Variable Documentation

◆ SidebarVars

struct ConfigDef SidebarVars[]
extern

Config definitions for the sidebar.

Definition at line 94 of file config.c.

94 {
95 // clang-format off
96 { "sidebar_component_depth", DT_NUMBER, 0, 0, NULL,
97 "(sidebar) Strip leading path components from sidebar folders"
98 },
99 { "sidebar_delim_chars", DT_STRING, IP "/.", 0, NULL,
100 "(sidebar) Characters that separate nested folders"
101 },
102 { "sidebar_divider_char", DT_STRING, IP "\342\224\202", 0, NULL, // Box Drawings Light Vertical, U+2502
103 "(sidebar) Character to draw between the sidebar and index"
104 },
105 { "sidebar_folder_indent", DT_BOOL, false, 0, NULL,
106 "(sidebar) Indent nested folders"
107 },
108 { "sidebar_format", DT_EXPANDO|D_NOT_EMPTY, IP "%D%* %n", IP &SidebarFormatDef, NULL,
109 "(sidebar) printf-like format string for the sidebar panel"
110 },
111 { "sidebar_indent_string", DT_STRING, IP " ", 0, NULL,
112 "(sidebar) Indent nested folders using this string"
113 },
114 { "sidebar_new_mail_only", DT_BOOL, false, 0, NULL,
115 "(sidebar) Only show folders with new/flagged mail"
116 },
117 { "sidebar_next_new_wrap", DT_BOOL, false, 0, NULL,
118 "(sidebar) Wrap around when searching for the next mailbox with new mail"
119 },
120 { "sidebar_non_empty_mailbox_only", DT_BOOL, false, 0, NULL,
121 "(sidebar) Only show folders with a non-zero number of mail"
122 },
123 { "sidebar_on_right", DT_BOOL, false, 0, NULL,
124 "(sidebar) Display the sidebar on the right"
125 },
126 { "sidebar_short_path", DT_BOOL, false, 0, NULL,
127 "(sidebar) Abbreviate the paths using the `$folder` variable"
128 },
129 { "sidebar_sort", DT_SORT, SB_SORT_UNSORTED, IP SidebarSortMethods, NULL,
130 "(sidebar) Method to sort the sidebar"
131 },
132 { "sidebar_visible", DT_BOOL, false, 0, NULL,
133 "(sidebar) Show the sidebar"
134 },
135 { "sidebar_width", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 30, 0, NULL,
136 "(sidebar) Width of the sidebar"
137 },
138
139 { "sidebar_sort_method", DT_SYNONYM, IP "sidebar_sort", IP "2024-11-20" },
140
141 { NULL },
142 // clang-format on
143};
#define IP
Definition set.h:55
static const struct Mapping SidebarSortMethods[]
Sort methods for the sidebar.
Definition config.c:43
static const struct ExpandoDefinition SidebarFormatDef[]
Expando definitions.
Definition config.c:66
@ SB_SORT_UNSORTED
Sort into the order the mailboxes were configured.
Definition sort.h:36
@ DT_NUMBER
a number
Definition types.h:38
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_SYNONYM
synonym for another variable
Definition types.h:45
@ DT_STRING
a string
Definition types.h:44
@ DT_SORT
sorting methods
Definition types.h:43
@ DT_EXPANDO
an expando
Definition types.h:34
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition types.h:80
#define D_INTEGER_NOT_NEGATIVE
Negative numbers are not allowed.
Definition types.h:101

◆ SbCommands

const struct Command SbCommands[]
extern

Sidebar Commands.

Definition at line 49 of file sidebar.c.

49 {
50 // clang-format off
51 { "sidebar-pin", CMD_SIDEBAR_PIN, parse_sidebar_pin,
52 N_("Pin a mailbox in the sidebar (keep visible)"),
53 N_("sidebar-pin <mailbox> [ <mailbox> ... ]"),
54 "optionalfeatures.html#sidebar-pin" },
55 { "sidebar-unpin", CMD_SIDEBAR_UNPIN, parse_sidebar_unpin,
56 N_("Unpin a previously pinned mailbox in the sidebar"),
57 N_("sidebar-unpin { * | <mailbox> ... }"),
58 "optionalfeatures.html#sidebar-pin" },
59
60 // Deprecated
61 { "sidebar_pin", CMD_NONE, NULL, "sidebar-pin", NULL, NULL, CF_SYNONYM },
62 { "sidebar_unpin", CMD_NONE, NULL, "sidebar-unpin", NULL, NULL, CF_SYNONYM },
63 { "sidebar_whitelist", CMD_NONE, NULL, "sidebar-pin", NULL, NULL, CF_SYNONYM },
64 { "unsidebar_whitelist", CMD_NONE, NULL, "sidebar-unpin", NULL, NULL, CF_SYNONYM },
65
66 { NULL, CMD_NONE, NULL, NULL, NULL, NULL, CF_NO_FLAGS },
67 // clang-format on
68};
#define CF_SYNONYM
Command is a synonym for another command.
Definition command.h:49
#define CF_NO_FLAGS
No flags are set.
Definition command.h:48
@ CMD_SIDEBAR_PIN
:sidebar-pin
Definition command.h:111
@ CMD_SIDEBAR_UNPIN
:sidebar-unpin
Definition command.h:112
@ CMD_NONE
No Command.
Definition command.h:59
enum CommandResult parse_sidebar_pin(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'sidebar-pin' command - Implements Command::parse() -.
Definition commands.c:44
enum CommandResult parse_sidebar_unpin(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'sidebar-unpin' command - Implements Command::parse() -.
Definition commands.c:74
#define N_(a)
Definition message.h:32

◆ ModuleSidebar

const struct Module ModuleSidebar
Initial value:
= {
"sidebar",
NULL,
NULL,
NULL,
}
@ MODULE_ID_SIDEBAR
ModuleSidebar, Sidebar
Definition module_api.h:91
static bool sidebar_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:55
static bool sidebar_cleanup(struct NeoMutt *n)
Clean up a Module - Implements Module::cleanup()
Definition module.c:71
static bool sidebar_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:63
static bool sidebar_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:44

Module for the Sidebar library.

Definition at line 83 of file module.c.

83 {
85 "sidebar",
87 NULL, // config_define_types
90 NULL, // gui_init
91 NULL, // gui_cleanup
93};