This is an automated email from the git hooks/post-receive script.

git pushed a commit to reference refs/pull/125/head
in repository enlightenment.

View the commit online.

commit 40db07c2c1e20fd832a06cd7b9de8b53fcbbf1f4
Author: [email protected] <[email protected]>
AuthorDate: Sun Mar 22 13:40:59 2026 -0600

    fix: prevent NetworkManager "service missing" dialog spam on suspend/resume
    
    NetworkManager temporarily disappears from D-Bus during system suspend,
    triggering repeated "service missing" dialogs that spam the user. Add
    suspend/resume event tracking to suppress the dialog while the system is
    suspended. Additionally, use e_object_del_attach_func_set() to track dialog
    lifetime and prevent duplicate dialogs if NM exits while one is already
    displayed.
    
    Also fix src/bin/e_sys.c where the systemd PrepareForSleep handler was
    not dispatching E_EVENT_SYS_SUSPEND on the systemd path, preventing
    modules from detecting suspend events.
    
    Changes:
    - networkmanager: track system suspend state and suppress dialog during suspend
    - networkmanager: prevent duplicate "service missing" dialogs via cleanup callback
    - e_sys: dispatch E_EVENT_SYS_SUSPEND in systemd PrepareForSleep handler
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
---
 src/bin/e_sys.c                               |  1 +
 src/modules/networkmanager/e_networkmanager.c | 76 +++++++++++++++++++++++++--
 2 files changed, 73 insertions(+), 4 deletions(-)

diff --git a/src/bin/e_sys.c b/src/bin/e_sys.c
index 366b0d9fc..112670be6 100644
--- a/src/bin/e_sys.c
+++ b/src/bin/e_sys.c
@@ -386,6 +386,7 @@ _e_sys_systemd_signal_prepare_sleep(void *data EINA_UNUSED, const Eldbus_Message
    else
      {
         _e_sys_suspended = EINA_TRUE;
+        ecore_event_add(E_EVENT_SYS_SUSPEND, NULL, NULL, NULL);
         if (e_config->desklock_on_suspend)
           {
              if (!e_desklock_state_get())
diff --git a/src/modules/networkmanager/e_networkmanager.c b/src/modules/networkmanager/e_networkmanager.c
index 405311e75..aa723b357 100644
--- a/src/modules/networkmanager/e_networkmanager.c
+++ b/src/modules/networkmanager/e_networkmanager.c
@@ -30,6 +30,12 @@ static Eldbus_Connection *conn;
 static struct NM_Manager *nm_manager;
 static E_NM_Agent        *agent;
 
+static Eina_Bool          suspended;         /* system is in suspend/sleep */
+static Eina_Bool          dialog_open;       /* "service missing" dialog shown */
+static E_Dialog          *nm_missing_dialog; /* live dialog pointer, or NULL */
+static Ecore_Event_Handler *suspend_handler;
+static Ecore_Event_Handler *resume_handler;
+
 E_API int E_NM_EVENT_MANAGER_IN;
 E_API int E_NM_EVENT_MANAGER_OUT;
 
@@ -1985,6 +1991,16 @@ enm_manager_find_ap(struct NM_Manager *nm, const char *path)
 /* NM name owner lifecycle                                                     */
 /* -------------------------------------------------------------------------- */
 
+static void
+_nm_missing_dialog_del(void *obj EINA_UNUSED)
+{
+   /* Called by EFL when the dialog is destroyed by any means (OK button,
+    * window-close button, e_object_del from enter path, etc.). Reset both
+    * the flag and the pointer so a future exit can show the dialog again. */
+   nm_missing_dialog = NULL;
+   dialog_open       = EINA_FALSE;
+}
+
 static void
 _e_nm_system_name_owner_exit(Eina_Bool shutdown)
 {
@@ -1996,15 +2012,36 @@ _e_nm_system_name_owner_exit(Eina_Bool shutdown)
 
    ecore_event_add(E_NM_EVENT_MANAGER_OUT, NULL, NULL, NULL);
 
-   if (!shutdown)
-     e_util_dialog_show(_("NetworkManager Service Missing"),
-                        _("The NetworkManager service is not available.<br>"
-                          "Is <b>NetworkManager</b> daemon running?"));
+   if (!shutdown && !suspended && !dialog_open)
+     {
+        dialog_open = EINA_TRUE;
+        nm_missing_dialog =
+           e_util_dialog_internal(_("NetworkManager Service Missing"),
+                                  _("The NetworkManager service is not available.<br>"
+                                    "Is <b>NetworkManager</b> daemon running?"));
+        if (nm_missing_dialog)
+          e_object_del_attach_func_set(E_OBJECT(nm_missing_dialog),
+                                       _nm_missing_dialog_del);
+        else
+          dialog_open = EINA_FALSE; /* allocation failed — don't block future attempts */
+     }
 }
 
 static void
 _e_nm_system_name_owner_enter(const char *owner EINA_UNUSED)
 {
+   /* If our "NM missing" dialog is still on screen, dismiss it now that NM
+    * is back.  The del-attach callback resets dialog_open and
+    * nm_missing_dialog, so we must not touch those fields directly here. */
+   if (nm_missing_dialog)
+     {
+        e_object_del(E_OBJECT(nm_missing_dialog));
+        /* nm_missing_dialog and dialog_open are now reset by the callback */
+     }
+   else
+     {
+        dialog_open = EINA_FALSE;
+     }
    nm_manager = _manager_new();
    ecore_event_add(E_NM_EVENT_MANAGER_IN, NULL, NULL, NULL);
    enm_mod_manager_inout(nm_manager);
@@ -2022,6 +2059,24 @@ _e_nm_system_name_owner_changed(void *data EINA_UNUSED,
      _e_nm_system_name_owner_exit(EINA_FALSE);
 }
 
+/* -------------------------------------------------------------------------- */
+/* Suspend / resume tracking                                                   */
+/* -------------------------------------------------------------------------- */
+
+static Eina_Bool
+_e_nm_sys_suspend_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
+{
+   suspended = EINA_TRUE;
+   return ECORE_CALLBACK_PASS_ON;
+}
+
+static Eina_Bool
+_e_nm_sys_resume_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
+{
+   suspended = EINA_FALSE;
+   return ECORE_CALLBACK_PASS_ON;
+}
+
 /* -------------------------------------------------------------------------- */
 /* Public lifecycle                                                            */
 /* -------------------------------------------------------------------------- */
@@ -2041,6 +2096,11 @@ e_nm_system_init(Eldbus_Connection *eldbus_conn)
                                           NULL, EINA_TRUE);
    agent = enm_agent_new(eldbus_conn);
 
+   suspend_handler = ecore_event_handler_add(E_EVENT_SYS_SUSPEND,
+                                             _e_nm_sys_suspend_cb, NULL);
+   resume_handler  = ecore_event_handler_add(E_EVENT_SYS_RESUME,
+                                             _e_nm_sys_resume_cb, NULL);
+
    return init_count;
 }
 
@@ -2056,6 +2116,14 @@ e_nm_system_shutdown(void)
    init_count--;
    if (init_count > 0) return init_count;
 
+   if (suspend_handler) ecore_event_handler_del(suspend_handler);
+   if (resume_handler)  ecore_event_handler_del(resume_handler);
+   suspend_handler = NULL;
+   resume_handler  = NULL;
+   suspended         = EINA_FALSE;
+   dialog_open       = EINA_FALSE;
+   nm_missing_dialog = NULL;
+
    eldbus_name_owner_changed_callback_del(conn, NM_BUS_NAME,
                                           _e_nm_system_name_owner_changed,
                                           NULL);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to