[jhbuild] Don't show a status icon if the notification server supports persistence



commit 4caed90e5c96074f6486a66d2101da719e8ce01d
Author: William Jon McCann <jmccann redhat com>
Date:   Fri Oct 8 22:18:17 2010 -0400

    Don't show a status icon if the notification server supports persistence
    
    Available in notification-daemon > 0.6 or gnome-shell

 jhbuild/utils/trayicon.py |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/jhbuild/utils/trayicon.py b/jhbuild/utils/trayicon.py
index 315ce09..bbca615 100644
--- a/jhbuild/utils/trayicon.py
+++ b/jhbuild/utils/trayicon.py
@@ -21,6 +21,7 @@ import sys
 import os
 import subprocess
 import signal
+import dbus
 
 class TrayIcon:
     proc = None
@@ -31,6 +32,17 @@ class TrayIcon:
         if not os.environ.get('DISPLAY'):
             return
         try:
+            bus = dbus.SessionBus()
+            proxy = bus.get_object('org.freedesktop.Notifications',
+                                   '/org/freedesktop/Notifications')
+            caps = proxy.GetCapabilities()
+            for item in caps:
+                if item == "persistence":
+                    return
+        except:
+            pass
+
+        try:
             self._run_zenity()
         except AttributeError:
             # 'cStringIO.StringO' object has no attribute 'fileno'



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