[gnome-shell/wip/fmuellner/notification-redux: 1/128] notificationDaemon: Don't show legacy status icons



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

    notificationDaemon: Don't show legacy status icons
    
    What we have now is broken, everyone else is moving away from them, we
    don't like them either ...
    It's worth noting that while this removes status icons from the UI, we
    are still keeping support in the library, so extensions like TopIcons
    are still able to bring them back for users that can't live without.

 js/ui/messageTray.js        |    2 +-
 js/ui/notificationDaemon.js |   93 ++++++------------------------------------
 js/ui/overviewControls.js   |    3 -
 3 files changed, 15 insertions(+), 83 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 c2aeb15..0dd8cc2 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() {
@@ -524,10 +505,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 +527,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 +544,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 +560,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 +567,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 +592,7 @@ const FdoNotificationDaemonSource = new Lang.Class({
     },
 
     _lastNotificationRemoved: function() {
-        if (!this.trayIcon)
-            this.destroy();
+        this.destroy();
     },
 
     openApp: function() {
@@ -674,11 +613,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]