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

Definition of the Browser Module. More...

#include "config.h"
#include <limits.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 browser_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool browser_config_define_variables (struct NeoMutt *n, struct ConfigSet *cs)
 Define the Config Variables - Implements Module::config_define_variables()
 
static bool browser_cleanup (struct NeoMutt *n, void *data)
 Clean up a Module - Implements Module::cleanup()
 
static bool browser_gui_init (struct NeoMutt *n)
 Initialise the GUI - Implements Module::gui_init()
 

Variables

struct ConfigDef BrowserVars []
 Config definitions for the browser.
 
const struct Module ModuleBrowser
 Module for the Browser library.
 

Detailed Description

Definition of the Browser 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

◆ browser_init()

static bool browser_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 43 of file module.c.

44{
45 struct BrowserModuleData *mod_data = MUTT_MEM_CALLOC(1, struct BrowserModuleData);
47
48 mod_data->notify = notify_new();
49 notify_set_parent(mod_data->notify, n->notify);
50
51 buf_alloc(&mod_data->last_dir, PATH_MAX);
53
54 return true;
55}
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
Definition buffer.c:337
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_BROWSER
ModuleBrowser, Mailbox Browser
Definition module_api.h:52
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
#define PATH_MAX
Definition mutt.h:49
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:677
Browser private Module data.
Definition module_data.h:32
struct Notify * notify
Notifications.
Definition module_data.h:33
struct Buffer last_dir
Browser: previous selected directory.
Definition module_data.h:35
struct Buffer last_dir_backup
Browser: backup copy of the current directory.
Definition module_data.h:36
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
+ Here is the call graph for this function:

◆ browser_config_define_variables()

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

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

Definition at line 60 of file module.c.

61{
63}
struct ConfigDef BrowserVars[]
Config definitions for the browser.
Definition config.c:138
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition set.c:290
+ Here is the call graph for this function:

◆ browser_cleanup()

static bool browser_cleanup ( struct NeoMutt * n,
void * data )
static

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

Definition at line 68 of file module.c.

69{
70 struct BrowserModuleData *mod_data = data;
71
72 notify_free(&mod_data->notify);
73
74 buf_dealloc(&mod_data->last_dir);
75 buf_dealloc(&mod_data->last_dir_backup);
76 FREE(&mod_data);
77 return true;
78}
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
Definition buffer.c:377
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition notify.c:75
+ Here is the call graph for this function:

◆ browser_gui_init()

static bool browser_gui_init ( struct NeoMutt * n)
static

Initialise the GUI - Implements Module::gui_init()

Definition at line 83 of file module.c.

84{
85 return true;
86}

Variable Documentation

◆ BrowserVars

struct ConfigDef BrowserVars[]
extern

Config definitions for the browser.

Definition at line 138 of file config.c.

138 {
139 // clang-format off
140 { "browser_abbreviate_mailboxes", DT_BOOL, true, 0, NULL,
141 "Abbreviate mailboxes using '~' and '=' in the browser"
142 },
144 "Sort method for the browser"
145 },
146 { "folder_format", DT_EXPANDO|D_NOT_EMPTY, IP "%2C %t %N %F %2l %-8.8u %-8.8g %8s %d %i", IP &FolderFormatDef, NULL,
147 "printf-like format string for the browser's display of folders"
148 },
149 { "group_index_format", DT_EXPANDO|D_NOT_EMPTY, IP "%4C %M%N %5s %-45.45f %d", IP &GroupIndexFormatDef, NULL,
150 "(nntp) printf-like format string for the browser's display of newsgroups"
151 },
152 { "mailbox_folder_format", DT_EXPANDO|D_NOT_EMPTY, IP "%2C %<n?%6n& > %6m %i", IP &FolderFormatDef, NULL,
153 "printf-like format string for the browser's display of mailbox folders"
154 },
155 { "mask", DT_REGEX|D_REGEX_MATCH_CASE|D_REGEX_ALLOW_NOT|D_REGEX_NOSUB, IP "!^\\.[^.]", 0, NULL,
156 "Only display files/dirs matching this regex in the browser"
157 },
158 { "show_only_unread", DT_BOOL, false, 0, NULL,
159 "(nntp) Only show subscribed newsgroups with unread articles"
160 },
161 { "browser_sort_dirs_first", DT_BOOL, false, 0, NULL,
162 "Group directories before files in the browser"
163 },
164
165 { "sort_browser", DT_SYNONYM, IP "browser_sort", IP "2024-11-20" },
166
167 { NULL },
168 // clang-format on
169};
static const struct ExpandoDefinition GroupIndexFormatDef[]
Expando definitions.
Definition config.c:117
static const struct ExpandoDefinition FolderFormatDef[]
Expando definitions.
Definition config.c:84
static const struct Mapping BrowserSortMethods[]
Sort methods for the folder/dir browser.
Definition config.c:43
@ BROWSER_SORT_ALPHA
Sort by name.
Definition sort.h:31
#define IP
Definition set.h:55
#define D_REGEX_ALLOW_NOT
Regex can begin with '!'.
Definition types.h:107
#define D_REGEX_MATCH_CASE
Case-sensitive matching.
Definition types.h:106
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_SYNONYM
synonym for another variable
Definition types.h:45
@ DT_SORT
sorting methods
Definition types.h:43
@ DT_EXPANDO
an expando
Definition types.h:34
@ DT_REGEX
regular expressions
Definition types.h:41
#define D_SORT_REVERSE
Sort flag for -reverse prefix.
Definition types.h:120
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition types.h:80
#define D_REGEX_NOSUB
Do not report what was matched (REG_NOSUB)
Definition types.h:108

◆ ModuleBrowser

const struct Module ModuleBrowser
Initial value:
= {
"browser",
NULL,
NULL,
NULL,
}
static bool browser_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:68
static bool browser_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:43
static bool browser_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:60
static bool browser_gui_init(struct NeoMutt *n)
Initialise the GUI - Implements Module::gui_init()
Definition module.c:83

Module for the Browser library.

Definition at line 91 of file module.c.

91 {
93 "browser",
95 NULL, // config_define_types
97 NULL, // commands_register
99 NULL, // gui_cleanup
101};