NeoMutt  2024-04-16-36-g75b6fb
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
config.c
Go to the documentation of this file.
1
31#include "config.h"
32#include <stddef.h>
33#include <stdbool.h>
34#include "private.h"
35#include "mutt/lib.h"
36#include "config/lib.h"
37#include "expando/lib.h"
38
42static const struct Mapping SortSidebarMethods[] = {
43 // clang-format off
44 { "path", SORT_PATH },
45 { "alpha", SORT_PATH },
46 { "name", SORT_PATH },
47 { "count", SORT_COUNT },
48 { "desc", SORT_DESC },
49 { "flagged", SORT_FLAGGED },
50 { "unsorted", SORT_ORDER },
51 { "mailbox-order", SORT_ORDER },
52 { "unread", SORT_UNREAD },
53 { "new", SORT_UNREAD },
54 { NULL, 0 },
55 // clang-format on
56};
57
64static const struct ExpandoDefinition SidebarFormatDef[] = {
65 // clang-format off
69 { "!", "flagged", ED_SIDEBAR, ED_SID_FLAGGED, E_TYPE_STRING, NULL },
70 { "a", "notify", ED_SIDEBAR, ED_SID_NOTIFY, E_TYPE_NUMBER, NULL },
71 { "B", "name", ED_SIDEBAR, ED_SID_NAME, E_TYPE_STRING, NULL },
72 { "d", "deleted-count", ED_SIDEBAR, ED_SID_DELETED_COUNT, E_TYPE_NUMBER, NULL },
73 { "D", "description", ED_SIDEBAR, ED_SID_DESCRIPTION, E_TYPE_STRING, NULL },
74 { "F", "flagged-count", ED_SIDEBAR, ED_SID_FLAGGED_COUNT, E_TYPE_NUMBER, NULL },
75 { "L", "limited-count", ED_SIDEBAR, ED_SID_LIMITED_COUNT, E_TYPE_NUMBER, NULL },
76 { "n", "new-mail", ED_SIDEBAR, ED_SID_NEW_MAIL, E_TYPE_STRING, NULL },
77 { "N", "unread-count", ED_SIDEBAR, ED_SID_UNREAD_COUNT, E_TYPE_NUMBER, NULL },
78 { "o", "old-count", ED_SIDEBAR, ED_SID_OLD_COUNT, E_TYPE_NUMBER, NULL },
79 { "p", "poll", ED_SIDEBAR, ED_SID_POLL, E_TYPE_NUMBER, NULL },
80 { "r", "read-count", ED_SIDEBAR, ED_SID_READ_COUNT, E_TYPE_NUMBER, NULL },
81 { "S", "message-count", ED_SIDEBAR, ED_SID_MESSAGE_COUNT, E_TYPE_NUMBER, NULL },
82 { "t", "tagged-count", ED_SIDEBAR, ED_SID_TAGGED_COUNT, E_TYPE_NUMBER, NULL },
83 { "Z", "unseen-count", ED_SIDEBAR, ED_SID_UNSEEN_COUNT, E_TYPE_NUMBER, NULL },
84 { NULL, NULL, 0, -1, -1, NULL }
85 // clang-format on
86};
87
91static struct ConfigDef SidebarVars[] = {
92 // clang-format off
93 { "sidebar_component_depth", DT_NUMBER, 0, 0, NULL,
94 "(sidebar) Strip leading path components from sidebar folders"
95 },
96 { "sidebar_delim_chars", DT_STRING, IP "/.", 0, NULL,
97 "(sidebar) Characters that separate nested folders"
98 },
99 { "sidebar_divider_char", DT_STRING, IP "\342\224\202", 0, NULL, // Box Drawings Light Vertical, U+2502
100 "(sidebar) Character to draw between the sidebar and index"
101 },
102 { "sidebar_folder_indent", DT_BOOL, false, 0, NULL,
103 "(sidebar) Indent nested folders"
104 },
105 { "sidebar_format", DT_EXPANDO|D_NOT_EMPTY, IP "%D%* %n", IP &SidebarFormatDef, NULL,
106 "(sidebar) printf-like format string for the sidebar panel"
107 },
108 { "sidebar_indent_string", DT_STRING, IP " ", 0, NULL,
109 "(sidebar) Indent nested folders using this string"
110 },
111 { "sidebar_new_mail_only", DT_BOOL, false, 0, NULL,
112 "(sidebar) Only show folders with new/flagged mail"
113 },
114 { "sidebar_next_new_wrap", DT_BOOL, false, 0, NULL,
115 "(sidebar) Wrap around when searching for the next mailbox with new mail"
116 },
117 { "sidebar_non_empty_mailbox_only", DT_BOOL, false, 0, NULL,
118 "(sidebar) Only show folders with a non-zero number of mail"
119 },
120 { "sidebar_on_right", DT_BOOL, false, 0, NULL,
121 "(sidebar) Display the sidebar on the right"
122 },
123 { "sidebar_short_path", DT_BOOL, false, 0, NULL,
124 "(sidebar) Abbreviate the paths using the `$folder` variable"
125 },
126 { "sidebar_sort_method", DT_SORT, SORT_ORDER, IP SortSidebarMethods, NULL,
127 "(sidebar) Method to sort the sidebar"
128 },
129 { "sidebar_visible", DT_BOOL, false, 0, NULL,
130 "(sidebar) Show the sidebar"
131 },
132 { "sidebar_width", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 30, 0, NULL,
133 "(sidebar) Width of the sidebar"
134 },
135 { NULL },
136 // clang-format on
137};
138
143{
145}
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:281
#define IP
Definition: set.h:54
@ E_TYPE_STRING
Data is a string.
Definition: definition.h:37
@ E_TYPE_NUMBER
Data is numeric.
Definition: definition.h:38
@ ED_SIDEBAR
Sidebar ED_SID_ ExpandoDataSidebar.
Definition: domain.h:55
@ ED_GLOBAL
Global ED_GLO_ ExpandoDataGlobal.
Definition: domain.h:44
Parse Expando string.
bool config_init_sidebar(struct ConfigSet *cs)
Register sidebar config variables - Implements module_init_config_t -.
Definition: config.c:142
struct ExpandoNode * node_padding_parse(const char *str, const char **parsed_until, int did, int uid, ExpandoParserFlags flags, struct ExpandoParseError *error)
Parse a Padding Expando - Implements ExpandoDefinition::parse() -.
Definition: node_padding.c:232
Convenience wrapper for the library headers.
static struct ConfigDef SidebarVars[]
Config definitions for the sidebar.
Definition: config.c:91
static const struct Mapping SortSidebarMethods[]
Sort methods for the sidebar.
Definition: config.c:42
static const struct ExpandoDefinition SidebarFormatDef[]
Expando definitions.
Definition: config.c:64
GUI display the mailboxes in a side panel.
@ ED_SID_FLAGGED_COUNT
Mailbox.msg_flagged.
Definition: private.h:61
@ ED_SID_READ_COUNT
Mailbox.msg_count, Mailbox.msg_unread.
Definition: private.h:69
@ ED_SID_DESCRIPTION
Mailbox.name.
Definition: private.h:59
@ ED_SID_NEW_MAIL
Mailbox.has_new.
Definition: private.h:65
@ ED_SID_UNSEEN_COUNT
Mailbox.msg_new.
Definition: private.h:72
@ ED_SID_POLL
Mailbox.poll_new_mail.
Definition: private.h:68
@ ED_SID_OLD_COUNT
Mailbox.msg_unread, Mailbox.msg_new.
Definition: private.h:67
@ ED_SID_MESSAGE_COUNT
Mailbox.msg_count.
Definition: private.h:63
@ ED_SID_LIMITED_COUNT
Mailbox.vcount.
Definition: private.h:62
@ ED_SID_UNREAD_COUNT
Mailbox.msg_unread.
Definition: private.h:71
@ ED_SID_TAGGED_COUNT
Mailbox.msg_tagged.
Definition: private.h:70
@ ED_SID_NOTIFY
Mailbox.notify_user.
Definition: private.h:66
@ ED_SID_NAME
SbEntry.box.
Definition: private.h:64
@ ED_SID_DELETED_COUNT
Mailbox.msg_deleted.
Definition: private.h:58
@ ED_SID_FLAGGED
Mailbox.msg_flagged.
Definition: private.h:60
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:40
@ SORT_PATH
Sort by the folder's path.
Definition: sort2.h:53
@ SORT_FLAGGED
Sort by the number of flagged emails.
Definition: sort2.h:52
@ SORT_DESC
Sort by the folder's description.
Definition: sort2.h:55
@ SORT_COUNT
Sort by number of emails in a folder.
Definition: sort2.h:50
@ SORT_UNREAD
Sort by the number of unread emails.
Definition: sort2.h:51
Definition: set.h:64
Container for lots of config items.
Definition: set.h:252
Definition of a format string.
Definition: definition.h:52
Mapping between user-readable string and a constant.
Definition: mapping.h:33
@ DT_NUMBER
a number
Definition: types.h:39
@ DT_BOOL
boolean option
Definition: types.h:32
@ DT_STRING
a string
Definition: types.h:45
@ DT_SORT
sorting methods
Definition: types.h:44
@ 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
@ ED_GLO_PADDING_EOL
Padding to end-of-line.
Definition: uid.h:36
@ ED_GLO_PADDING_HARD
Hard Padding.
Definition: uid.h:37
@ ED_GLO_PADDING_SOFT
Soft Padding.
Definition: uid.h:38