NeoMutt  2024-10-02-37-gfa9146
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"))
53 return 0;
54
55 struct Menu *menu = nc->global_data;
56
58 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
59
60 return 0;
61}
62
69void alias_set_title(struct MuttWindow *sbar, char *menu_name, char *limit)
70{
71 if (!limit)
72 {
73 sbar_set_title(sbar, menu_name);
74 return;
75 }
76
77 char buf[256] = { 0 };
78
79 int len = snprintf(buf, sizeof(buf), "%s - ", menu_name);
80
81 snprintf(buf + len, sizeof(buf) - len, _("Limit: %s"), limit);
82
83 sbar_set_title(sbar, buf);
84}
85
90{
91 struct Menu *menu = win->wdata;
92 struct AliasMenuData *mdata = menu->mdata;
93
94 alias_array_sort(&mdata->ava, mdata->sub);
95
97 mutt_debug(LL_DEBUG5, "recalc done, request WA_REPAINT\n");
98 return 0;
99}
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:89
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:69
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