NeoMutt  2024-12-12-14-g7b49f7
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
wdata.c
Go to the documentation of this file.
1
30#include "config.h"
31#include <stddef.h>
32#include "private.h"
33#include "mutt/lib.h"
34#include "gui/lib.h"
35
36struct IndexSharedData;
37
45{
47 wdata->win = win;
48 wdata->shared = shared;
49 ARRAY_INIT(&wdata->entries);
50 return wdata;
51}
52
56void sb_wdata_free(struct MuttWindow *win, void **ptr)
57{
58 if (!ptr || !*ptr)
59 return;
60
61 struct SidebarWindowData *wdata = *ptr;
62
63 struct SbEntry **sbep = NULL;
64 ARRAY_FOREACH(sbep, &wdata->entries)
65 {
66 FREE(sbep);
67 }
68 ARRAY_FREE(&wdata->entries);
69
70 FREE(ptr);
71}
72
78{
79 if (!win || (win->type != WT_SIDEBAR))
80 return NULL;
81
82 return win->wdata;
83}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:212
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:204
#define ARRAY_INIT(head)
Initialize an array.
Definition: array.h:65
void sb_wdata_free(struct MuttWindow *win, void **ptr)
Free Sidebar Window data - Implements MuttWindow::wdata_free() -.
Definition: wdata.c:56
Convenience wrapper for the gui headers.
#define FREE(x)
Definition: memory.h:55
#define MUTT_MEM_CALLOC(n, type)
Definition: memory.h:40
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:44
struct SidebarWindowData * sb_wdata_get(struct MuttWindow *win)
Get the Sidebar data for this window.
Definition: wdata.c:77
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:88
struct IndexSharedData * shared
Shared Index Data.
Definition: private.h:90
struct MuttWindow * win
Sidebar Window.
Definition: private.h:89
struct SbEntryArray entries
Items to display in the sidebar.
Definition: private.h:91