From: Richard Russon Date: Wed, 3 Jul 2019 10:20:15 +0000 (+0100) Subject: notify: add global notifications X-Git-Tag: 2019-10-25~139^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a19fbcc623a171ce573bc6334aa2c85d5b0687ab;p=neomutt notify: add global notifications --- diff --git a/index.c b/index.c index 38c4c0f8b..ab9d45744 100644 --- a/index.c +++ b/index.c @@ -63,6 +63,7 @@ #include "muttlib.h" #include "mx.h" #include "ncrypt/ncrypt.h" +#include "neomutt.h" #include "opcodes.h" #include "options.h" #include "pager.h" @@ -1713,6 +1714,7 @@ int mutt_index_menu(void) oldcount = Context ? Context->mailbox->msg_count : 0; mutt_startup_shutdown_hook(MUTT_SHUTDOWN_HOOK); + notify_send(NeoMutt->notify, NT_GLOBAL, NT_GLOBAL_SHUTDOWN, 0); if (!Context || ((check = mx_mbox_close(&Context)) == 0)) done = true; diff --git a/main.c b/main.c index 40fb523e6..b0bbee727 100644 --- a/main.c +++ b/main.c @@ -1214,6 +1214,7 @@ int main(int argc, char *argv[], char *envp[]) mutt_folder_hook(mutt_b2s(folder), NULL); mutt_startup_shutdown_hook(MUTT_STARTUP_HOOK); + notify_send(NeoMutt->notify, NT_GLOBAL, NT_GLOBAL_STARTUP, 0); repeat_error = true; struct Mailbox *m = mx_path_resolve(mutt_b2s(folder)); diff --git a/mutt/notify_type.h b/mutt/notify_type.h index eaa7a184f..982a12b76 100644 --- a/mutt/notify_type.h +++ b/mutt/notify_type.h @@ -35,8 +35,6 @@ enum NotifyType NT_MAILBOX, ///< Mailbox has changed NT_EMAIL, ///< Email has changed NT_WINDOW, ///< Window has changed - - NT_MAX, }; #endif /* MUTT_LIB_NOTIFY_TYPE_H */ diff --git a/neomutt.c b/neomutt.c index 1164906e8..f116b83c2 100644 --- a/neomutt.c +++ b/neomutt.c @@ -1,6 +1,6 @@ /** * @file - * NeoMutt container for notifications + * Container for Accounts, Notifications * * @authors * Copyright (C) 2019 Richard Russon @@ -21,9 +21,9 @@ */ /** - * @page neomutt NeoMutt container for notifications + * @page neomutt Container for Accounts, Notifications * - * NeoMutt container for notifications + * Container for Accounts, Notifications */ #include "config.h" diff --git a/neomutt.h b/neomutt.h index d8d49a9d9..bb2d20479 100644 --- a/neomutt.h +++ b/neomutt.h @@ -1,6 +1,6 @@ /** * @file - * NeoMutt container for notifications + * Container for Accounts, Notifications * * @authors * Copyright (C) 2019 Richard Russon @@ -26,16 +26,26 @@ struct Notify; /** - * struct NeoMutt - Container for notifications + * struct NeoMutt - Container for Accounts, Notifications */ struct NeoMutt { - struct Notify *notify; + struct Notify *notify; ///< Notifications handler }; extern struct NeoMutt *NeoMutt; +/** + * NotifyGlobal - Events not associated with an object + */ +enum NotifyGlobal +{ + NT_GLOBAL_STARTUP = 1, ///< NeoMutt is initialised + NT_GLOBAL_SHUTDOWN, ///< NeoMutt is about to close + NT_GLOBAL_TIMEOUT, ///< A timer has elapsed +}; + +void neomutt_free(struct NeoMutt **ptr); struct NeoMutt *neomutt_new(void); -void neomutt_free(struct NeoMutt **ptr); #endif /* MUTT_NEOMUTT_H */