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
This commit is contained in:
Giovanni Campagna 2010-10-24 14:31:41 +02:00
parent a915af4b30
commit c48c80e4e9
2 changed files with 3 additions and 3 deletions

View File

@ -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);
},

View File

@ -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);