NeoMutt  2025-12-11-435-g4ac674
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 "config/lib.h"
#include "core/lib.h"
+ Include dependency graph for module.c:

Go to the source code of this file.

Functions

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()
 

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_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 42 of file module.c.

43{
45}
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:93
+ 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 50 of file module.c.

51{
52 return commands_register(ca, SbCommands);
53}
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:

Variable Documentation

◆ SidebarVars

struct ConfigDef SidebarVars[]
extern

Config definitions for the sidebar.

Definition at line 93 of file config.c.

93 {
94 // clang-format off
95 { "sidebar_component_depth", DT_NUMBER, 0, 0, NULL,
96 "(sidebar) Strip leading path components from sidebar folders"
97 },
98 { "sidebar_delim_chars", DT_STRING, IP "/.", 0, NULL,
99 "(sidebar) Characters that separate nested folders"
100 },
101 { "sidebar_divider_char", DT_STRING, IP "\342\224\202", 0, NULL, // Box Drawings Light Vertical, U+2502
102 "(sidebar) Character to draw between the sidebar and index"
103 },
104 { "sidebar_folder_indent", DT_BOOL, false, 0, NULL,
105 "(sidebar) Indent nested folders"
106 },
107 { "sidebar_format", DT_EXPANDO|D_NOT_EMPTY, IP "%D%* %n", IP &SidebarFormatDef, NULL,
108 "(sidebar) printf-like format string for the sidebar panel"
109 },
110 { "sidebar_indent_string", DT_STRING, IP " ", 0, NULL,
111 "(sidebar) Indent nested folders using this string"
112 },
113 { "sidebar_new_mail_only", DT_BOOL, false, 0, NULL,
114 "(sidebar) Only show folders with new/flagged mail"
115 },
116 { "sidebar_next_new_wrap", DT_BOOL, false, 0, NULL,
117 "(sidebar) Wrap around when searching for the next mailbox with new mail"
118 },
119 { "sidebar_non_empty_mailbox_only", DT_BOOL, false, 0, NULL,
120 "(sidebar) Only show folders with a non-zero number of mail"
121 },
122 { "sidebar_on_right", DT_BOOL, false, 0, NULL,
123 "(sidebar) Display the sidebar on the right"
124 },
125 { "sidebar_short_path", DT_BOOL, false, 0, NULL,
126 "(sidebar) Abbreviate the paths using the `$folder` variable"
127 },
128 { "sidebar_sort", DT_SORT, SB_SORT_UNSORTED, IP SidebarSortMethods, NULL,
129 "(sidebar) Method to sort the sidebar"
130 },
131 { "sidebar_visible", DT_BOOL, false, 0, NULL,
132 "(sidebar) Show the sidebar"
133 },
134 { "sidebar_width", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 30, 0, NULL,
135 "(sidebar) Width of the sidebar"
136 },
137
138 { "sidebar_sort_method", DT_SYNONYM, IP "sidebar_sort", IP "2024-11-20" },
139
140 { NULL },
141 // clang-format on
142};
#define IP
Definition set.h:54
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,
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:42
static bool sidebar_commands_register(struct NeoMutt *n, struct CommandArray *ca)
Register NeoMutt Commands - Implements Module::commands_register()
Definition module.c:50

Module for the Sidebar library.

Definition at line 58 of file module.c.

58 {
60 "sidebar",
61 NULL, // init
62 NULL, // config_define_types
65 NULL, // gui_init
66 NULL, // gui_cleanup
67 NULL, // cleanup
68};