NeoMutt  2022-04-29-323-g5fcc6c
Teaching an old dog new tricks
DOXYGEN
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
35struct IndexSharedData;
36
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
55void sb_wdata_free(struct MuttWindow *win, void **ptr)
56{
57 struct SidebarWindowData *wdata = *ptr;
58
59 struct SbEntry **sbep = NULL;
60 ARRAY_FOREACH(sbep, &wdata->entries)
61 {
62 FREE(sbep);
63 }
64 ARRAY_FREE(&wdata->entries);
65
66 FREE(ptr);
67}
68
74{
75 if (!win || (win->type != WT_SIDEBAR))
76 return NULL;
77
78 return win->wdata;
79}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:211
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:203
#define ARRAY_INIT(head)
Initialize an array.
Definition: array.h:64
void sb_wdata_free(struct MuttWindow *win, void **ptr)
Free Sidebar Window data - Implements MuttWindow::wdata_free() -.
Definition: wdata.c:55
Convenience wrapper for the gui headers.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
#define FREE(x)
Definition: memory.h:43
Convenience wrapper for the library headers.
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:101
GUI display the mailboxes in a side panel.
struct SidebarWindowData * sb_wdata_new(struct MuttWindow *win, struct IndexSharedData *shared)
Create new Window data for the Sidebar.
Definition: wdata.c:43
struct SidebarWindowData * sb_wdata_get(struct MuttWindow *win)
Get the Sidebar data for this window.
Definition: wdata.c:73
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:37
void * wdata
Private data.
Definition: mutt_window.h:145
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:144
Info about folders in the sidebar.
Definition: private.h:41
Sidebar private Window data -.
Definition: private.h:65
struct IndexSharedData * shared
Shared Index Data.
Definition: private.h:67
struct MuttWindow * win
Sidebar Window.
Definition: private.h:66
struct SbEntryArray entries
Items to display in the sidebar.
Definition: private.h:68