[krb5-auth-dialog] Don't show notification before the applet is embedded in the panel



commit 6be2df896a34f1cfd22ea5acdff7a56f012a3717
Author: Guido Günther <agx sigxcpu org>
Date:   Thu Apr 23 21:06:19 2009 +0200

    Don't show notification before the applet is embedded in the panel
    
    based on a patch for 0.8 by Matthias Clasen
---
 ChangeLog              |    9 +++++++++
 src/krb5-auth-applet.c |   35 ++++++++++++++++++++++++++++-------
 2 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b41923e..20490f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Fri Apr 24 09:39:16 CEST 2009 Guido Günther <agx sigxcpu org>
+
+	* AUTHORS: add Matthias Clasen
+
+Fri Apr 24 09:35:59 CEST 2009 Guido Günther <agx sigxcpu org>
+
+	* src/krb5-auth-applet.c: Don't show notification before the applet is
+	  embedded in the panel (based on a patch for 0.8 by Matthias Clasen)
+
 Do Apr 23 18:35:32 CEST 2009 Guido Günther <agx sigxcpu org>
 
 	* configure.ac: release 0.9
diff --git a/src/krb5-auth-applet.c b/src/krb5-auth-applet.c
index 6e02ed8..b528ae9 100644
--- a/src/krb5-auth-applet.c
+++ b/src/krb5-auth-applet.c
@@ -371,13 +371,26 @@ ka_applet_select_icon(KaApplet* applet, int remaining)
 }
 
 
+#ifdef HAVE_LIBNOTIFY
+static gboolean
+show_notification (KaApplet *applet)
+{
+	/* wait for the panel to be settled before showing a bubble */
+	if (gtk_status_icon_is_embedded (applet->priv->tray_icon)) {
+		notify_notification_show (applet->priv->notification, NULL);
+	} else {
+		g_timeout_add_seconds (5, (GSourceFunc)show_notification, applet);
+	}
+	return FALSE;
+}
+
+
 static void
-ka_send_event_notification (KaApplet *applet G_GNUC_UNUSED,
-			    const char *summary G_GNUC_UNUSED,
-			    const char *message G_GNUC_UNUSED,
-			    const char *icon G_GNUC_UNUSED)
+ka_send_event_notification (KaApplet *applet,
+			    const char *summary,
+			    const char *message,
+			    const char *icon)
 {
-#ifdef HAVE_LIBNOTIFY
         const char *notify_icon;
 
 	g_return_if_fail (applet != NULL);
@@ -398,9 +411,17 @@ ka_send_event_notification (KaApplet *applet G_GNUC_UNUSED,
 		notify_notification_new_with_status_icon(summary, message, notify_icon, applet->priv->tray_icon);
 
 	notify_notification_set_urgency (applet->priv->notification, NOTIFY_URGENCY_NORMAL);
-	notify_notification_show (applet->priv->notification, NULL);
-#endif /* HAVE_LIBNOTIFY */
+	show_notification (applet);
+}
+#else
+static void
+ka_send_event_notification (KaApplet *applet G_GNUC_UNUSED,
+			    const char *summary G_GNUC_UNUSED,
+			    const char *message G_GNUC_UNUSED,
+			    const char *icon G_GNUC_UNUSED)
+{
 }
+#endif /* ! HAVE_LIBNOTIFY */
 
 
 /* update the tray icon's tooltip and icon */



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