/src/neomutt/helpbar/wdata.c
Line | Count | Source (jump to first uncovered line) |
1 | | /** |
2 | | * @file |
3 | | * Help Bar Window data |
4 | | * |
5 | | * @authors |
6 | | * Copyright (C) 2020 Richard Russon <rich@flatcap.org> |
7 | | * |
8 | | * @copyright |
9 | | * This program is free software: you can redistribute it and/or modify it under |
10 | | * the terms of the GNU General Public License as published by the Free Software |
11 | | * Foundation, either version 2 of the License, or (at your option) any later |
12 | | * version. |
13 | | * |
14 | | * This program is distributed in the hope that it will be useful, but WITHOUT |
15 | | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
16 | | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
17 | | * details. |
18 | | * |
19 | | * You should have received a copy of the GNU General Public License along with |
20 | | * this program. If not, see <http://www.gnu.org/licenses/>. |
21 | | */ |
22 | | |
23 | | /** |
24 | | * @page helpbar_wdata Data for the Help Bar |
25 | | * |
26 | | * #HelpbarWindowData stores the state of the Help Bar. |
27 | | */ |
28 | | |
29 | | #include "config.h" |
30 | | #include <stddef.h> |
31 | | #include "private.h" |
32 | | #include "mutt/lib.h" |
33 | | #include "gui/lib.h" |
34 | | |
35 | | /** |
36 | | * helpbar_wdata_new - Create new Window data for the Helpbar |
37 | | * @retval ptr New Window data |
38 | | */ |
39 | | struct HelpbarWindowData *helpbar_wdata_new(void) |
40 | 0 | { |
41 | 0 | return mutt_mem_calloc(1, sizeof(struct HelpbarWindowData)); |
42 | 0 | } |
43 | | |
44 | | /** |
45 | | * helpbar_wdata_free - Free Helpbar Window data - Implements MuttWindow::wdata_free() - @ingroup window_wdata_free |
46 | | */ |
47 | | void helpbar_wdata_free(struct MuttWindow *win, void **ptr) |
48 | 0 | { |
49 | 0 | struct HelpbarWindowData *wdata = *ptr; |
50 | | |
51 | | // We don't own the help_data |
52 | 0 | FREE(&wdata->help_str); |
53 | |
|
54 | 0 | FREE(ptr); |
55 | 0 | } |
56 | | |
57 | | /** |
58 | | * helpbar_wdata_get - Get the Helpbar data for this window |
59 | | * @param win Window |
60 | | */ |
61 | | struct HelpbarWindowData *helpbar_wdata_get(struct MuttWindow *win) |
62 | 0 | { |
63 | 0 | if (!win || (win->type != WT_HELP_BAR)) |
64 | 0 | return NULL; |
65 | | |
66 | 0 | return win->wdata; |
67 | 0 | } |