NeoMutt  2021-02-05-89-gabe350
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 
40 {
41  struct SidebarWindowData *wdata = mutt_mem_calloc(1, sizeof(struct SidebarWindowData));
42  ARRAY_INIT(&wdata->entries);
43  return wdata;
44 }
45 
49 void sb_wdata_free(struct MuttWindow *win, void **ptr)
50 {
51  if (!ptr || !*ptr)
52  return;
53 
54  struct SidebarWindowData *wdata = *ptr;
55 
56  struct SbEntry **sbep = NULL;
57  ARRAY_FOREACH(sbep, &wdata->entries)
58  {
59  FREE(sbep);
60  }
61  ARRAY_FREE(&wdata->entries);
62 
63  FREE(ptr);
64 }
65 
71 {
72  if (!win || (win->type != WT_SIDEBAR))
73  return NULL;
74 
75  return win->wdata;
76 }
sb_wdata_free
void sb_wdata_free(struct MuttWindow *win, void **ptr)
Free Sidebar Window data - Implements MuttWindow::wdata_free()
Definition: wdata.c:49
mutt_mem_calloc
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
ARRAY_INIT
#define ARRAY_INIT(head)
Initialize an array.
Definition: array.h:61
MuttWindow
A division of the screen.
Definition: mutt_window.h:115
FREE
#define FREE(x)
Definition: memory.h:40
private.h
sb_wdata_new
struct SidebarWindowData * sb_wdata_new(void)
Create new Window data for the Sidebar.
Definition: wdata.c:39
SidebarWindowData
Sidebar private Window data -.
Definition: private.h:61
WT_SIDEBAR
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:99
sb_wdata_get
struct SidebarWindowData * sb_wdata_get(struct MuttWindow *win)
Get the Sidebar data for this window.
Definition: wdata.c:70
ARRAY_FOREACH
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:206
lib.h
ARRAY_FREE
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:198
MuttWindow::type
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:137
SbEntry
Info about folders in the sidebar.
Definition: private.h:38
lib.h
MuttWindow::wdata
void * wdata
Private data.
Definition: mutt_window.h:138