NeoMutt  2024-11-14-34-g5aaf0d
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
gui.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <stdio.h>
31#include "mutt/lib.h"
32#include "config/lib.h"
33#include "gui/lib.h"
34#include "gui.h"
35#include "menu/lib.h"
36#include "functions.h"
37
44{
45 if (nc->event_type != NT_CONFIG)
46 return 0;
47 if (!nc->global_data || !nc->event_data)
48 return -1;
49
50 struct EventConfig *ev_c = nc->event_data;
51
52 if (!mutt_str_equal(ev_c->name, "sort_alias") && !mutt_str_equal(ev_c->name, "alias_format") &&
53 !mutt_str_equal(ev_c->name, "query_format"))
54 {
55 return 0;
56 }
57
58 struct Menu *menu = nc->global_data;
59
61 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
62
63 return 0;
64}
65
72void alias_set_title(struct MuttWindow *sbar, char *menu_name, char *limit)
73{
74 if (!limit)
75 {
76 sbar_set_title(sbar, menu_name);
77 return;
78 }
79
80 char buf[256] = { 0 };
81
82 int len = snprintf(buf, sizeof(buf), "%s - ", menu_name);
83
84 snprintf(buf + len, sizeof(buf) - len, _("Limit: %s"), limit);
85
86 sbar_set_title(sbar, buf);
87}
88
93{
94 struct Menu *menu = win->wdata;
95 struct AliasMenuData *mdata = menu->mdata;
96
97 alias_array_sort(&mdata->ava, mdata->sub);
98
100 mutt_debug(LL_DEBUG5, "recalc done, request WA_REPAINT\n");
101 return 0;
102}
void alias_array_sort(struct AliasViewArray *ava, const struct ConfigSubset *sub)
Sort and reindex an AliasViewArray.
Definition: sort.c:168
Convenience wrapper for the config headers.
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
int alias_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: gui.c:43
int alias_recalc(struct MuttWindow *win)
Recalculate the display of the Alias Window - Implements MuttWindow::recalc() -.
Definition: gui.c:92
Convenience wrapper for the gui headers.
void alias_set_title(struct MuttWindow *sbar, char *menu_name, char *limit)
Create a title string for the Menu.
Definition: gui.c:72
Shared code for the Alias and Query Dialogs.
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
GUI present the user with a selectable list.
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:59
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:184
Convenience wrapper for the library headers.
#define _(a)
Definition: message.h:28
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:660
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:110
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
Definition: sbar.c:227
Sidebar functions.
AliasView array wrapper with Pattern information -.
Definition: gui.h:54
struct Menu * menu
Menu.
Definition: gui.h:58
A config-change event.
Definition: subset.h:71
const char * name
Name of config item that changed.
Definition: subset.h:73
Definition: lib.h:79
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:86
void * mdata
Private data.
Definition: lib.h:147
void * wdata
Private data.
Definition: mutt_window.h:144
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:131
Data passed to a notification function.
Definition: observer.h:34
void * event_data
Data from notify_send()
Definition: observer.h:38
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:36
void * global_data
Data from notify_observer_add()
Definition: observer.h:39