author | Wolfgang Rosenauer <wr@rosenauer.org> |
Mon, 25 Jun 2012 11:08:07 +0200 | |
branch | firefox13 |
changeset 489 | f5ef195f348b |
parent 417 | 62102cc5132a |
permissions | -rw-r--r-- |
414 | 1 |
# HG changeset patch |
2 |
# User Wolfgang Rosenauer <wr@rosenauer.org> |
|
417
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
3 |
# Parent c684863b1eb3bcae92ef24bc2ac511985b1ad7e4 |
414 | 4 |
Bug 737646 - no biff notification if notification-daemon not running |
5 |
||
6 |
diff --git a/toolkit/system/gnome/nsAlertsIconListener.cpp b/toolkit/system/gnome/nsAlertsIconListener.cpp |
|
7 |
--- a/toolkit/system/gnome/nsAlertsIconListener.cpp |
|
8 |
+++ b/toolkit/system/gnome/nsAlertsIconListener.cpp |
|
417
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
9 |
@@ -47,16 +47,17 @@ |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
10 |
#include <gdk/gdk.h> |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
11 |
|
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
12 |
// Compatibility macro for <libnotify-0.7 |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
13 |
#ifndef NOTIFY_CHECK_VERSION |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
14 |
#define NOTIFY_CHECK_VERSION(x,y,z) 0 |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
15 |
#endif |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
16 |
|
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
17 |
static bool gHasActions = false; |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
18 |
+static bool gHasCaps = false; |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
19 |
|
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
20 |
static void notify_action_cb(NotifyNotification *notification, |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
21 |
gchar *action, gpointer user_data) |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
22 |
{ |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
23 |
nsAlertsIconListener* alert = static_cast<nsAlertsIconListener*> (user_data); |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
24 |
alert->SendCallback(); |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
25 |
} |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
26 |
|
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
27 |
@@ -338,27 +339,34 @@ nsAlertsIconListener::InitAlertAsync(con |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
28 |
appShortName.AssignLiteral("Mozilla"); |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
29 |
} |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
30 |
|
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
31 |
if (!notify_init(appShortName.get())) |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
32 |
return NS_ERROR_FAILURE; |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
33 |
|
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
34 |
GList *server_caps = notify_get_server_caps(); |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
35 |
if (server_caps) { |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
36 |
+ gHasCaps = true; |
414 | 37 |
for (GList* cap = server_caps; cap != NULL; cap = cap->next) { |
38 |
if (!strcmp((char*) cap->data, "actions")) { |
|
39 |
gHasActions = true; |
|
40 |
break; |
|
41 |
} |
|
42 |
} |
|
43 |
g_list_foreach(server_caps, (GFunc)g_free, NULL); |
|
44 |
g_list_free(server_caps); |
|
45 |
} |
|
46 |
} |
|
47 |
||
417
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
48 |
+ if (!gHasCaps) { |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
49 |
+ // if notify_get_server_caps() failed above we need to assume |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
50 |
+ // there is no notification-server to display anything |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
51 |
+ return NS_ERROR_FAILURE; |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
52 |
+ } |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
53 |
+ |
414 | 54 |
if (!gHasActions && aAlertTextClickable) |
55 |
return NS_ERROR_FAILURE; // No good, fallback to XUL |
|
56 |
||
57 |
nsCOMPtr<nsIObserverService> obsServ = |
|
58 |
do_GetService("@mozilla.org/observer-service;1"); |
|
417
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
59 |
if (obsServ) |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
60 |
obsServ->AddObserver(this, "quit-application", true); |
62102cc5132a
fix mozilla-libnotify.patch
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
414
diff
changeset
|
61 |