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
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 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
77{
78 if (!win || (win->type != WT_SIDEBAR))
79 return NULL;
80
81 return win->wdata;
82}
#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:45
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:76
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:64
struct IndexSharedData * shared
Shared Index Data.
Definition: private.h:66
struct MuttWindow * win
Sidebar Window.
Definition: private.h:65
struct SbEntryArray entries
Items to display in the sidebar.
Definition: private.h:67