Bug 737646 - no biff notification if notification-daemon not running. r=karlt
authorWolfgang Rosenauer <wr@rosenauer.org>
Mon, 26 Mar 2012 10:51:40 +0200
changeset 90293 9d156f164c8e9ea6adf957d16540d123283df0b2
parent 90292 ddb88db53379eba20b5f44149ca262fce8b3435e
child 90294 df36e7f3aba4fdcabdd67bc37d598bbdd672046a
push id22336
push usermbrubeck@mozilla.com
push dateMon, 26 Mar 2012 18:22:18 +0000
treeherdermozilla-central@a30fd69f1e0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs737646
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 737646 - no biff notification if notification-daemon not running. r=karlt
toolkit/system/gnome/nsAlertsIconListener.cpp
--- a/toolkit/system/gnome/nsAlertsIconListener.cpp
+++ b/toolkit/system/gnome/nsAlertsIconListener.cpp
@@ -48,16 +48,17 @@
 #include <gdk/gdk.h>
 
 // Compatibility macro for <libnotify-0.7
 #ifndef NOTIFY_CHECK_VERSION
 #define NOTIFY_CHECK_VERSION(x,y,z) 0
 #endif
 
 static bool gHasActions = false;
+static bool gHasCaps = false;
 
 static void notify_action_cb(NotifyNotification *notification,
                              gchar *action, gpointer user_data)
 {
   nsAlertsIconListener* alert = static_cast<nsAlertsIconListener*> (user_data);
   alert->SendCallback();
 }
 
@@ -339,27 +340,34 @@ nsAlertsIconListener::InitAlertAsync(con
       appShortName.AssignLiteral("Mozilla");
     }
 
     if (!notify_init(appShortName.get()))
       return NS_ERROR_FAILURE;
 
     GList *server_caps = notify_get_server_caps();
     if (server_caps) {
+      gHasCaps = true;
       for (GList* cap = server_caps; cap != NULL; cap = cap->next) {
         if (!strcmp((char*) cap->data, "actions")) {
           gHasActions = true;
           break;
         }
       }
       g_list_foreach(server_caps, (GFunc)g_free, NULL);
       g_list_free(server_caps);
     }
   }
 
+  if (!gHasCaps) {
+    // if notify_get_server_caps() failed above we need to assume
+    // there is no notification-server to display anything
+    return NS_ERROR_FAILURE;
+  }
+
   if (!gHasActions && aAlertTextClickable)
     return NS_ERROR_FAILURE; // No good, fallback to XUL
 
   nsCOMPtr<nsIObserverService> obsServ =
       do_GetService("@mozilla.org/observer-service;1");
   if (obsServ)
     obsServ->AddObserver(this, "quit-application", true);