[gnome-shell/wip/fmuellner/notification-redux+sass: 87/145] notificationDaemon: Remove support for legacy status icons



commit c6fd3e57f96bffe2f2bcc0b412c2af9cd63003a8
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jun 13 15:06:45 2014 +0200

    notificationDaemon: Remove support for legacy status icons
    
    Tray icons make for a terrible UI on their own, but trying to
    shoehorn them into the notification system has only made them
    worse. At least for the time being this removal is temporary
    and support for tray icons will be back, but no longer as part
    of the notification system.

 js/ui/messageTray.js        |    2 +-
 js/ui/notificationDaemon.js |  107 ++++++-------------------------------------
 js/ui/overviewControls.js   |    3 -
 3 files changed, 15 insertions(+), 97 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index c9329ea..129859e 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -1313,7 +1313,7 @@ const Source = new Lang.Class({
     },
 
     get isClearable() {
-        return !this.trayIcon && !this.isChat && !this.resident;
+        return !this.isChat && !this.resident;
     },
 
     countUpdated: function() {
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 920252d..c09df63 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -91,21 +91,6 @@ const rewriteRules = {
     ]
 };
 
-const STANDARD_TRAY_ICON_IMPLEMENTATIONS = {
-    'bluetooth-applet': 'bluetooth',
-    'gnome-volume-control-applet': 'volume', // renamed to gnome-sound-applet
-                                             // when moved to control center
-    'gnome-sound-applet': 'volume',
-    'nm-applet': 'network',
-    'gnome-power-manager': 'battery',
-    'keyboard': 'keyboard',
-    'a11y-keyboard': 'a11y',
-    'kbd-scrolllock': 'keyboard',
-    'kbd-numlock': 'keyboard',
-    'kbd-capslock': 'keyboard',
-    'ibus-ui-gtk': 'keyboard'
-};
-
 const FdoNotificationDaemon = new Lang.Class({
     Name: 'FdoNotificationDaemon',
 
@@ -120,13 +105,10 @@ const FdoNotificationDaemon = new Lang.Class({
 
         this._nextNotificationId = 1;
 
-        Shell.WindowTracker.get_default().connect('notify::focus-app', Lang.bind(this, 
this._onFocusAppChanged));
-        Main.overview.connect('hidden', Lang.bind(this, this._onFocusAppChanged));
-
-        this._trayManager = new Shell.TrayManager();
-        this._trayIconAddedId = this._trayManager.connect('tray-icon-added', Lang.bind(this, 
this._onTrayIconAdded));
-        this._trayIconRemovedId = this._trayManager.connect('tray-icon-removed', Lang.bind(this, 
this._onTrayIconRemoved));
-        this._trayManager.manage_screen(global.screen, Main.messageTray.actor);
+        Shell.WindowTracker.get_default().connect('notify::focus-app',
+            Lang.bind(this, this._onFocusAppChanged));
+        Main.overview.connect('hidden',
+            Lang.bind(this, this._onFocusAppChanged));
     },
 
     _imageForNotificationData: function(hints) {
@@ -167,11 +149,10 @@ const FdoNotificationDaemon = new Lang.Class({
         return null;
     },
 
-    _lookupSource: function(title, pid, trayIcon) {
+    _lookupSource: function(title, pid) {
         for (let i = 0; i < this._sources.length; i++) {
             let source = this._sources[i];
-            if (source.pid == pid &&
-                (source.initialTitle == title || source.trayIcon || trayIcon))
+            if (source.pid == pid && source.initialTitle == title)
                 return source;
         }
         return null;
@@ -188,7 +169,7 @@ const FdoNotificationDaemon = new Lang.Class({
     //
     // Either a pid or ndata.notification is needed to retrieve or
     // create a source.
-    _getSource: function(title, pid, ndata, sender, trayIcon) {
+    _getSource: function(title, pid, ndata, sender) {
         if (!pid && !(ndata && ndata.notification))
             return null;
 
@@ -199,13 +180,13 @@ const FdoNotificationDaemon = new Lang.Class({
         if (ndata && ndata.notification)
             return ndata.notification.source;
 
-        let source = this._lookupSource(title, pid, trayIcon);
+        let source = this._lookupSource(title, pid);
         if (source) {
             source.setTitle(title);
             return source;
         }
 
-        let source = new FdoNotificationDaemonSource(title, pid, sender, trayIcon, ndata ? 
ndata.hints['desktop-entry'] : null);
+        let source = new FdoNotificationDaemonSource(title, pid, sender, ndata ? 
ndata.hints['desktop-entry'] : null);
 
         this._sources.push(source);
         source.connect('destroy', Lang.bind(this, function() {
@@ -503,20 +484,6 @@ const FdoNotificationDaemon = new Lang.Class({
     _emitActionInvoked: function(id, action) {
         this._dbusImpl.emit_signal('ActionInvoked',
                                    GLib.Variant.new('(us)', [id, action]));
-    },
-
-    _onTrayIconAdded: function(o, icon) {
-        let wmClass = icon.wm_class ? icon.wm_class.toLowerCase() : '';
-        if (STANDARD_TRAY_ICON_IMPLEMENTATIONS[wmClass] !== undefined)
-            return;
-
-        let source = this._getSource(icon.title || icon.wm_class || C_("program", "Unknown"), icon.pid, 
null, null, icon);
-    },
-
-    _onTrayIconRemoved: function(o, icon) {
-        let source = this._lookupSource(null, icon.pid, true);
-        if (source)
-            source.destroy();
     }
 });
 
@@ -524,10 +491,9 @@ const FdoNotificationDaemonSource = new Lang.Class({
     Name: 'FdoNotificationDaemonSource',
     Extends: MessageTray.Source,
 
-    _init: function(title, pid, sender, trayIcon, appId) {
+    _init: function(title, pid, sender, appId) {
         // Need to set the app before chaining up, so
         // methods called from the parent constructor can find it
-        this.trayIcon = trayIcon;
         this.pid = pid;
         this.app = this._getApp(appId);
 
@@ -547,12 +513,6 @@ const FdoNotificationDaemonSource = new Lang.Class({
                                                               Lang.bind(this, this._onNameVanished));
         else
             this._nameWatcherId = 0;
-
-        if (this.trayIcon) {
-            // Try again finding the app, using the WM_CLASS from the tray icon
-            this._setSummaryIcon(this.trayIcon);
-            this.useNotificationIcon = false;
-        }
     },
 
     _createPolicy: function() {
@@ -570,15 +530,14 @@ const FdoNotificationDaemonSource = new Lang.Class({
         // of which аre removed from DBus immediately.
         // Sender being removed from DBus would normally result in a tray icon being removed,
         // so allow the code path that handles the tray icon being removed to handle that case.
-        if (!this.trayIcon && this.app)
+        if (this.app)
             this.destroy();
     },
 
     processNotification: function(notification, gicon) {
         if (gicon)
             this._gicon = gicon;
-        if (!this.trayIcon)
-            this.iconUpdated();
+        this.iconUpdated();
 
         let tracker = Shell.WindowTracker.get_default();
         if (notification.resident && this.app && tracker.focus_app == this.app)
@@ -587,29 +546,6 @@ const FdoNotificationDaemonSource = new Lang.Class({
             this.notify(notification);
     },
 
-    handleSummaryClick: function(button) {
-        if (!this.trayIcon)
-            return false;
-
-        let event = Clutter.get_current_event();
-
-        // Left clicks are passed through only where there aren't unacknowledged
-        // notifications, so it possible to open them in summary mode; right
-        // clicks are always forwarded, as the right click menu is not useful for
-        // tray icons
-        if (button == 1 &&
-            this.notifications.length > 0)
-            return false;
-
-        let id = global.stage.connect('deactivate', Lang.bind(this, function () {
-            global.stage.disconnect(id);
-            this.trayIcon.click(event);
-        }));
-
-        Main.overview.hide();
-        return true;
-    },
-
     _getApp: function(appId) {
         let app;
 
@@ -617,16 +553,6 @@ const FdoNotificationDaemonSource = new Lang.Class({
         if (app != null)
             return app;
 
-        if (this.trayIcon) {
-            app = Shell.AppSystem.get_default().lookup_startup_wmclass(this.trayIcon.wm_class);
-            if (app != null)
-                return app;
-
-            app = Shell.AppSystem.get_default().lookup_desktop_wmclass(this.trayIcon.wm_class);
-            if (app != null)
-                return app;
-        }
-
         if (appId) {
             app = Shell.AppSystem.get_default().lookup_app(appId + '.desktop');
             if (app != null)
@@ -652,8 +578,7 @@ const FdoNotificationDaemonSource = new Lang.Class({
     },
 
     _lastNotificationRemoved: function() {
-        if (!this.trayIcon)
-            this.destroy();
+        this.destroy();
     },
 
     openApp: function() {
@@ -674,11 +599,7 @@ const FdoNotificationDaemonSource = new Lang.Class({
     },
 
     createIcon: function(size) {
-        if (this.trayIcon) {
-            return new Clutter.Clone({ width: size,
-                                       height: size,
-                                       source: this.trayIcon });
-        } else if (this.app) {
+        if (this.app) {
             return this.app.create_icon_texture(size);
         } else if (this._gicon) {
             return new St.Icon({ gicon: this._gicon,
diff --git a/js/ui/overviewControls.js b/js/ui/overviewControls.js
index b5f60de..3eb0375 100644
--- a/js/ui/overviewControls.js
+++ b/js/ui/overviewControls.js
@@ -457,9 +457,6 @@ const MessagesIndicator = new Lang.Class({
     },
 
     _onSourceAdded: function(tray, source) {
-        if (source.trayIcon)
-            return;
-
         source.connect('count-updated', Lang.bind(this, this._updateCount));
         this._sources.push(source);
         this._updateCount();


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