[gnome-shell] Allow for empty WM_CLASS and _NET_WM_NAME in tray icons



commit c48c80e4e990209ca7e82a719ae0f7448213a6a1
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Oct 24 14:31:41 2010 +0200

    Allow for empty WM_CLASS and _NET_WM_NAME in tray icons
    
    The system tray specification says the hint should be set, but some
    icons leave it empty anyway. Don't throw exceptions in that case.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=633028

 js/ui/notificationDaemon.js   |    2 +-
 js/ui/statusIconDispatcher.js |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 59c48d5..61de694 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -372,7 +372,7 @@ NotificationDaemon.prototype = {
     _onTrayIconAdded: function(o, icon) {
         let source = this._sources[icon.pid];
         if (!source)
-            source = this._newSource(icon.title, icon.pid);
+            source = this._newSource(icon.title || icon.wm_class || _("Unknown"), icon.pid);
         source.setTrayIcon(icon);
     },
 
diff --git a/js/ui/statusIconDispatcher.js b/js/ui/statusIconDispatcher.js
index fc754c9..8c796ac 100644
--- a/js/ui/statusIconDispatcher.js
+++ b/js/ui/statusIconDispatcher.js
@@ -36,7 +36,7 @@ StatusIconDispatcher.prototype = {
     },
 
     _onTrayIconAdded: function(o, icon) {
-        let wmClass = icon.wm_class.toLowerCase();
+        let wmClass = (icon.wm_class || 'unknown').toLowerCase();
         let role = STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass];
         if (role)
             this.emit('status-icon-added', icon, role);
@@ -45,7 +45,7 @@ StatusIconDispatcher.prototype = {
     },
 
     _onTrayIconRemoved: function(o, icon) {
-        let wmClass = icon.wm_class.toLowerCase();
+        let wmClass = (icon.wm_class || 'unknown').toLowerCase();
         let role = STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass];
         if (role)
             this.emit('status-icon-removed', icon);



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