[krb5-auth-dialog] Add a band aid for #642666



commit ab3c8a7335af2b9a881eb05c1e71e2679ac46338
Author: Guido Günther <agx sigxcpu org>
Date:   Thu Feb 24 13:20:13 2011 +0100

    Add a band aid for #642666

 src/ka-applet.c |   34 ++++++++++++++++++++++------------
 1 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/src/ka-applet.c b/src/ka-applet.c
index 7252574..7de9204 100644
--- a/src/ka-applet.c
+++ b/src/ka-applet.c
@@ -950,21 +950,31 @@ ka_ns_check_persistence (KaApplet *self)
 {
     GList   *caps;
     GList   *l;
+    gboolean is_autostart = g_getenv("DESKTOP_AUTOSTART_ID") ? TRUE : FALSE;
+    gint    seconds = 5;
 
     self->priv->ns_persistence = FALSE;
-    caps = notify_get_server_caps ();
-    if (caps == NULL) {
+    do {
+        caps = notify_get_server_caps ();
+        if (caps == NULL)
             g_warning ("Failed to read server caps");
-            return;
-    }
-
-    l = g_list_find_custom (caps, "persistence", (GCompareFunc)strcmp);
-    if (l != NULL) {
-        self->priv->ns_persistence = TRUE;
-        KA_DEBUG ("Notification server supports persistence.");
-    }
-    g_list_foreach (caps, (GFunc) g_free, NULL);
-    g_list_free (caps);
+        else {
+            l = g_list_find_custom (caps, "persistence", (GCompareFunc)strcmp);
+            if (l != NULL) {
+                self->priv->ns_persistence = TRUE;
+                KA_DEBUG ("Notification server supports persistence.");
+            }
+            g_list_foreach (caps, (GFunc) g_free, NULL);
+            g_list_free (caps);
+        }
+        /* During session start we have to wait until the shell is fully up
+         * to reliably detect the persistence property (#642666) */
+        if (is_autostart && !self->priv->ns_persistence) {
+            sleep(1);
+            seconds--;
+        } else
+            break;
+    } while (seconds);
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]