NeoMutt
2023-11-03-107-g582dc1
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
wdata.c
Go to the documentation of this file.
1
29
#include "config.h"
30
#include <stddef.h>
31
#include "
private.h
"
32
#include "
mutt/lib.h
"
33
#include "
gui/lib.h
"
34
35
struct
IndexSharedData
;
36
43
struct
SidebarWindowData
*
sb_wdata_new
(
struct
MuttWindow
*
win
,
struct
IndexSharedData
*
shared
)
44
{
45
struct
SidebarWindowData
*
wdata
=
mutt_mem_calloc
(1,
sizeof
(
struct
SidebarWindowData
));
46
wdata
->win =
win
;
47
wdata
->shared =
shared
;
48
ARRAY_INIT
(&
wdata
->entries);
49
return
wdata
;
50
}
51
55
void
sb_wdata_free
(
struct
MuttWindow
*
win
,
void
**ptr)
56
{
57
if
(!ptr || !*ptr)
58
return
;
59
60
struct
SidebarWindowData
*
wdata
= *ptr;
61
62
struct
SbEntry
**sbep = NULL;
63
ARRAY_FOREACH
(sbep, &wdata->
entries
)
64
{
65
FREE
(sbep);
66
}
67
ARRAY_FREE
(&wdata->
entries
);
68
69
FREE
(ptr);
70
}
71
76
struct
SidebarWindowData
*
sb_wdata_get
(
struct
MuttWindow
*
win
)
77
{
78
if
(!
win
|| (
win
->
type
!=
WT_SIDEBAR
))
79
return
NULL;
80
81
return
win
->
wdata
;
82
}
ARRAY_FOREACH
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition:
array.h:211
ARRAY_FREE
#define ARRAY_FREE(head)
Release all memory.
Definition:
array.h:203
ARRAY_INIT
#define ARRAY_INIT(head)
Initialize an array.
Definition:
array.h:64
sb_wdata_free
void sb_wdata_free(struct MuttWindow *win, void **ptr)
Free Sidebar Window data - Implements MuttWindow::wdata_free() -.
Definition:
wdata.c:55
lib.h
Convenience wrapper for the gui headers.
mutt_mem_calloc
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition:
memory.c:50
FREE
#define FREE(x)
Definition:
memory.h:45
lib.h
Convenience wrapper for the library headers.
WT_SIDEBAR
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
Definition:
mutt_window.h:101
private.h
GUI display the mailboxes in a side panel.
sb_wdata_new
struct SidebarWindowData * sb_wdata_new(struct MuttWindow *win, struct IndexSharedData *shared)
Create new Window data for the Sidebar.
Definition:
wdata.c:43
sb_wdata_get
struct SidebarWindowData * sb_wdata_get(struct MuttWindow *win)
Get the Sidebar data for this window.
Definition:
wdata.c:76
IndexSharedData
Data shared between Index, Pager and Sidebar.
Definition:
shared_data.h:37
MuttWindow
Definition:
mutt_window.h:123
MuttWindow::wdata
void * wdata
Private data.
Definition:
mutt_window.h:145
MuttWindow::type
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition:
mutt_window.h:144
SbEntry
Info about folders in the sidebar.
Definition:
private.h:41
SidebarWindowData
Sidebar private Window data -.
Definition:
private.h:64
SidebarWindowData::shared
struct IndexSharedData * shared
Shared Index Data.
Definition:
private.h:66
SidebarWindowData::win
struct MuttWindow * win
Sidebar Window.
Definition:
private.h:65
SidebarWindowData::entries
struct SbEntryArray entries
Items to display in the sidebar.
Definition:
private.h:67