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

Definition of the Menu Module. More...

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

Go to the source code of this file.

Functions

static bool menu_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool menu_config_define_variables (struct NeoMutt *n, struct ConfigSet *cs)
 Define the Config Variables - Implements Module::config_define_variables()
 
static bool menu_gui_init (struct NeoMutt *n)
 Initialise the GUI - Implements Module::gui_init()
 
static void menu_gui_cleanup (struct NeoMutt *n)
 Clean up the GUI - Implements Module::gui_cleanup()
 
static bool menu_cleanup (struct NeoMutt *n, void *data)
 Clean up a Module - Implements Module::cleanup()
 

Variables

struct ConfigDef MenuVars []
 Config definitions for the Menu library.
 
const struct Module ModuleMenu
 Module for the Menu library.
 

Detailed Description

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

◆ menu_init()

static bool menu_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 44 of file module.c.

45{
46 struct MenuModuleData *mod_data = MUTT_MEM_CALLOC(1, struct MenuModuleData);
48
49 mod_data->notify = notify_new();
50 notify_set_parent(mod_data->notify, n->notify);
51
52 return true;
53}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_MENU
ModuleMenu, Menu
Definition module_api.h:77
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
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:677
Menu private Module data.
Definition module_data.h:32
struct Notify * notify
Notifications.
Definition module_data.h:33
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
+ Here is the call graph for this function:

◆ menu_config_define_variables()

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

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

Definition at line 58 of file module.c.

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

◆ menu_gui_init()

static bool menu_gui_init ( struct NeoMutt * n)
static

Initialise the GUI - Implements Module::gui_init()

Definition at line 66 of file module.c.

67{
69 menu_init2(mod_data->search_buffers);
70 return true;
71}
void menu_init2(char **search_buffers)
Initialise all the Menus.
Definition menu.c:72
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
char * search_buffers[MENU_MAX]
Previous search string, one for each MenuType.
Definition module_data.h:34
+ Here is the call graph for this function:

◆ menu_gui_cleanup()

static void menu_gui_cleanup ( struct NeoMutt * n)
static

Clean up the GUI - Implements Module::gui_cleanup()

Definition at line 76 of file module.c.

77{
79 ASSERT(mod_data);
80
81 for (int i = 0; i < MENU_MAX; i++)
82 FREE(&mod_data->search_buffers[i]);
83}
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define ASSERT(COND)
Definition signal2.h:59
@ MENU_MAX
Definition type.h:52
+ Here is the call graph for this function:

◆ menu_cleanup()

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

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

Definition at line 88 of file module.c.

89{
90 struct MenuModuleData *mod_data = data;
91
92 notify_free(&mod_data->notify);
93
94 FREE(&mod_data);
95 return true;
96}
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition notify.c:75
+ Here is the call graph for this function:

Variable Documentation

◆ MenuVars

struct ConfigDef MenuVars[]
extern

Config definitions for the Menu library.

Definition at line 37 of file config.c.

37 {
38 // clang-format off
39 { "arrow_cursor", DT_BOOL, false, 0, NULL,
40 "Use an arrow '->' instead of highlighting in the index"
41 },
42 { "arrow_string", DT_STRING|D_NOT_EMPTY, IP "->", 0, NULL,
43 "Use a custom string for arrow_cursor"
44 },
45 { "menu_context", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
46 "Number of lines of overlap when changing pages in the index"
47 },
48 { "menu_move_off", DT_BOOL, true, 0, NULL,
49 "Allow the last menu item to move off the bottom of the screen"
50 },
51 { "menu_scroll", DT_BOOL, false, 0, NULL,
52 "Scroll the menu/index by one line, rather than a page"
53 },
54 { NULL },
55 // clang-format on
56};
#define IP
Definition set.h:55
@ DT_NUMBER
a number
Definition types.h:38
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_STRING
a string
Definition types.h:44
#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

◆ ModuleMenu

const struct Module ModuleMenu
Initial value:
= {
"menu",
NULL,
NULL,
}
static bool menu_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:44
static void menu_gui_cleanup(struct NeoMutt *n)
Clean up the GUI - Implements Module::gui_cleanup()
Definition module.c:76
static bool menu_gui_init(struct NeoMutt *n)
Initialise the GUI - Implements Module::gui_init()
Definition module.c:66
static bool menu_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:58
static bool menu_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:88

Module for the Menu library.

Definition at line 101 of file module.c.

101 {
103 "menu",
104 menu_init,
105 NULL, // config_define_types
107 NULL, // commands_register
111};