From: Richard Russon Date: Mon, 20 May 2019 11:42:20 +0000 (+0100) Subject: add central NeoMutt object X-Git-Tag: 2019-10-25~176^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=936ff8abb0b3abed244cc324fb3b39307f5a48f0;p=neomutt add central NeoMutt object --- diff --git a/Makefile.autosetup b/Makefile.autosetup index ff2259ad2..eb74db364 100644 --- a/Makefile.autosetup +++ b/Makefile.autosetup @@ -69,7 +69,7 @@ NEOMUTTOBJS= account.o addrbook.o alias.o bcache.o browser.o color.o commands.o mutt_account.o mutt_attach.o mutt_body.o mutt_header.o \ mutt_history.o mutt_logging.o mutt_parse.o mutt_signal.o \ mutt_socket.o mutt_thread.o mutt_window.o mx.o myvar.o \ - pager.o pattern.o postpone.o progress.o query.o recvattach.o \ + neomutt.o pager.o pattern.o postpone.o progress.o query.o recvattach.o \ recvcmd.o resize.o rfc1524.o rfc3676.o \ score.o send.o sendlib.o sidebar.o smtp.o sort.o state.o \ status.o system.o terminal.o version.o icommands.o diff --git a/main.c b/main.c index b1dce02b7..e8db95102 100644 --- a/main.c +++ b/main.c @@ -69,6 +69,7 @@ #include "muttlib.h" #include "mx.h" #include "ncrypt/ncrypt.h" +#include "neomutt.h" #include "options.h" #include "protos.h" #include "send.h" @@ -598,6 +599,8 @@ int main(int argc, char *argv[], char *envp[]) goto main_ok; // TEST04: neomutt -v } + NeoMutt = neomutt_new(); + Config = init_config(500); if (!Config) goto main_curses; @@ -1262,5 +1265,6 @@ main_exit: mutt_free_opts(); mutt_free_keys(); cs_free(&Config); + neomutt_free(&NeoMutt); return rc; } diff --git a/neomutt.c b/neomutt.c new file mode 100644 index 000000000..0c34cf8d2 --- /dev/null +++ b/neomutt.c @@ -0,0 +1,58 @@ +/** + * @file + * NeoMutt container for notifications + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @copyright + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +/** + * @page neomutt NeoMutt container for notifications + * + * NeoMutt container for notifications + */ + +#include "config.h" +#include "mutt/mutt.h" +#include "neomutt.h" + +struct NeoMutt *NeoMutt; ///< Global NeoMutt object + +/** + * neomutt_new - Create the master NeoMutt object + * @retval ptr New NeoMutt + */ +struct NeoMutt *neomutt_new(void) +{ + struct NeoMutt *n = mutt_mem_calloc(1, sizeof(*NeoMutt)); + + return n; +} + +/** + * neomutt_free - Free a NeoMutt + * @param[out] ptr NeoMutt to free + */ +void neomutt_free(struct NeoMutt **ptr) +{ + if (!ptr || !*ptr) + return; + + // struct NeoMutt *n = *ptr; + + FREE(ptr); +} diff --git a/neomutt.h b/neomutt.h new file mode 100644 index 000000000..d8d49a9d9 --- /dev/null +++ b/neomutt.h @@ -0,0 +1,41 @@ +/** + * @file + * NeoMutt container for notifications + * + * @authors + * Copyright (C) 2019 Richard Russon + * + * @copyright + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef MUTT_NEOMUTT_H +#define MUTT_NEOMUTT_H + +struct Notify; + +/** + * struct NeoMutt - Container for notifications + */ +struct NeoMutt +{ + struct Notify *notify; +}; + +extern struct NeoMutt *NeoMutt; + +struct NeoMutt *neomutt_new(void); +void neomutt_free(struct NeoMutt **ptr); + +#endif /* MUTT_NEOMUTT_H */