]> granicus.if.org Git - neomutt/commitdiff
notify: add global notifications
authorRichard Russon <rich@flatcap.org>
Wed, 3 Jul 2019 10:20:15 +0000 (11:20 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 13 Jul 2019 23:25:45 +0000 (00:25 +0100)
index.c
main.c
mutt/notify_type.h
neomutt.c
neomutt.h

diff --git a/index.c b/index.c
index 38c4c0f8bb98fbccdd9151a4826e5b1d8eb0d1be..ab9d4574467fee3ac205c46d01cc235d77edbf5b 100644 (file)
--- 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 40fb523e62d18d9ed14738c6d27ed988b9a7a6a4..b0bbee72704b0a32dc70d45ad2a765ba77e48c4d 100644 (file)
--- 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));
index eaa7a184f781b760abc41ca197ff9458f8e666a6..982a12b76b34b9c798eff737c8c4da6f00a3ae70 100644 (file)
@@ -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 */
index 1164906e8a570bf413450977a258f448bd56e18a..f116b83c2c3b56c27d2821127e4d0655c35a8701 100644 (file)
--- 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 <rich@flatcap.org>
@@ -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"
index d8d49a9d94e9f4bebed20b5b015cde49ad191fcd..bb2d20479a4c83cd4ab6c5854691ea0a6ab3a18d 100644 (file)
--- 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 <rich@flatcap.org>
 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 */