summaryrefslogtreecommitdiffstats
path: root/source/xap/blueman/0001-Notification-Also-check-if-notification-daemon-suppo.patch
blob: fd244f3f63633ffe17a7f79dd579df47af343a7e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From fe902c8827fccae8df93d9deff53e22917d69369 Mon Sep 17 00:00:00 2001
From: Sander Sweers <infirit@gmail.com>
Date: Mon, 16 May 2016 16:22:14 +0200
Subject: [PATCH 1/2] Notification: Also check if notification daemon supports
 body

This is the absolute minimum we require from the notification daemon. With
this we fix the when no daemon is available (not running or installed).
See [1] what prompted this change.

[1] https://github.com/blueman-project/blueman/issues/519#issuecomment-218976647
---
 blueman/gui/Notification.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/blueman/gui/Notification.py b/blueman/gui/Notification.py
index 41fdd69..6f3d3dc 100644
--- a/blueman/gui/Notification.py
+++ b/blueman/gui/Notification.py
@@ -161,10 +161,18 @@ class Notification(object):
     def actions_supported():
         return "actions" in Notify.get_server_caps()
 
+    @staticmethod
+    def body_supported():
+        return "body" in Notify.get_server_caps()
+
     def __new__(cls, summary, message, timeout=-1, actions=None, actions_cb=None, pixbuf=None, status_icon=None):
-        if not Config('org.blueman.general')['notification-daemon'] or (actions and not cls.actions_supported()):
-            # Use fallback as user does not want to use a notification daemon or we have to show actions and the
-            # notification daemon does not provide them
+        forced_fallback = not Config('org.blueman.general')['notification-daemon']
+
+        if forced_fallback or not cls.body_supported() or (actions and not cls.actions_supported()):
+            # Use fallback in the case:
+            # * user does not want to use a notification daemon
+            # * the notification daemon is not available
+            # * we have to show actions and the notification daemon does not provide them
             klass = _NotificationDialog
         else:
             klass = _NotificationBubble
-- 
2.8.3