1 /**
2  * @file
3  * Private state data for the Pager
4  *
5  * @authors
6  * Copyright (C) 2021 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 pager_private_data Private state data for the Pager
25  *
26  * Private state data for the Pager
27  */
28 
29 #include "config.h"
30 #include "mutt/lib.h"
31 #include "private_data.h"
32 #include "pager/lib.h"
33 
34 /**
35  * pager_private_data_free - Free Pager Data
36  * @param win Window
37  * @param ptr Pager Data to free
38  */
pager_private_data_free(struct MuttWindow * win,void ** ptr)39 void pager_private_data_free(struct MuttWindow *win, void **ptr)
40 {
41   if (!ptr || !*ptr)
42     return;
43 
44   struct PagerPrivateData *priv = *ptr;
45 
46   mutt_debug(LL_NOTIFY, "NT_PAGER_DELETE: %p\n", priv);
47   notify_send(priv->notify, NT_PAGER, NT_PAGER_DELETE, priv);
48   notify_free(&priv->notify);
49 
50   FREE(ptr);
51 }
52 
53 /**
54  * pager_private_data_new - Create new Pager Data
55  * @retval ptr New PagerPrivateData
56  */
pager_private_data_new(void)57 struct PagerPrivateData *pager_private_data_new(void)
58 {
59   struct PagerPrivateData *priv = mutt_mem_calloc(1, sizeof(struct PagerPrivateData));
60 
61   priv->notify = notify_new();
62 
63   // TODO initialize fields
64 
65   return priv;
66 }
67