NeoMutt  2021-02-05-666-ge300cd
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 
35 struct IndexSharedData;
36 
42 {
43  struct SidebarWindowData *wdata = mutt_mem_calloc(1, sizeof(struct SidebarWindowData));
44  wdata->shared = shared;
45  ARRAY_INIT(&wdata->entries);
46  return wdata;
47 }
48 
52 void sb_wdata_free(struct MuttWindow *win, void **ptr)
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 }
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 ARRAY_FREE(head)
Release all memory.
Definition: array.h:198
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:206
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:36
Sidebar private Window data -.
Definition: private.h:62
Info about folders in the sidebar.
Definition: private.h:39
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:101
void sb_wdata_free(struct MuttWindow *win, void **ptr)
Free Sidebar Window data - Implements MuttWindow::wdata_free() -.
Definition: wdata.c:52
#define FREE(x)
Definition: memory.h:40
Convenience wrapper for the library headers.
struct IndexSharedData * shared
Definition: private.h:64
void * wdata
Private data.
Definition: mutt_window.h:145
enum WindowType type
Window type, e.g. WT_SIDEBAR.
Definition: mutt_window.h:144
#define ARRAY_INIT(head)
Initialize an array.
Definition: array.h:61