[gnome-shell/wip/fmuellner/notification-redux+sass: 11/122] messageTray: Remove support for Music notifications



commit 67f207e8b027953734f012e4c43fa91d0fa777be
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Feb 11 17:01:11 2015 +0100

    messageTray: Remove support for Music notifications

 js/ui/messageTray.js        |   12 +---------
 js/ui/notificationDaemon.js |    3 --
 js/ui/screenShield.js       |   50 ++++--------------------------------------
 3 files changed, 6 insertions(+), 59 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 129859e..65616f4 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -494,7 +494,6 @@ const Notification = new Lang.Class({
         this.resident = false;
         // 'transient' is a reserved keyword in JS, so we have to use an alternate variable name
         this.isTransient = false;
-        this.isMusic = false;
         this.forFeedback = false;
         this.expanded = false;
         this.focused = false;
@@ -1468,16 +1467,7 @@ const Source = new Lang.Class({
     // Default implementation is to destroy this source, but subclasses can override
     _lastNotificationRemoved: function() {
         this.destroy();
-    },
-
-    getMusicNotification: function() {
-        for (let i = 0; i < this.notifications.length; i++) {
-            if (this.notifications[i].isMusic)
-                return this.notifications[i];
-        }
-
-        return null;
-    },
+    }
 });
 Signals.addSignalMethods(Source.prototype);
 
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index 7f7b2f8..0d6a415 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -351,9 +351,6 @@ const FdoNotificationDaemon = new Lang.Class({
                 }));
         }
 
-        // Mark music notifications so they can be shown in the screen shield
-        notification.isMusic = (ndata.hints['category'] == 'x-gnome.music');
-
         let gicon = this._iconForNotificationData(icon, hints);
         let gimage = this._imageForNotificationData(hints);
 
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index d82c607..5a61e6b 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -103,16 +103,12 @@ const NotificationsBox = new Lang.Class({
                                         name: 'screenShieldNotifications',
                                         style_class: 'screen-shield-notifications-container' });
 
-        this._musicBin = new St.Bin({ style_class: 'screen-shield-notifications-container',
-                                      visible: false });
-
         this._scrollView = new St.ScrollView({ x_fill: false, x_align: St.Align.START,
                                                hscrollbar_policy: Gtk.PolicyType.NEVER });
         this._notificationBox = new St.BoxLayout({ vertical: true,
                                                    style_class: 'screen-shield-notifications-container' });
         this._scrollView.add_actor(this._notificationBox);
 
-        this.actor.add(this._musicBin);
         this.actor.add(this._scrollView, { x_fill: true, x_align: St.Align.START });
 
         this._sources = new Map();
@@ -139,12 +135,11 @@ const NotificationsBox = new Lang.Class({
     },
 
     _updateVisibility: function() {
-        this._musicBin.visible = this._musicBin.child != null && this._musicBin.child.visible;
         this._notificationBox.visible = this._notificationBox.get_children().some(function(a) {
             return a.visible;
         });
 
-        this.actor.visible = this._musicBin.visible || this._notificationBox.visible;
+        this.actor.visible = this._notificationBox.visible;
     },
 
     _makeNotificationCountText: function(count, isChat) {
@@ -192,7 +187,7 @@ const NotificationsBox = new Lang.Class({
         for (let i = 0; i < source.notifications.length; i++) {
             let n = source.notifications[i];
 
-            if (n.acknowledged || n.isMusic)
+            if (n.acknowledged)
                 continue;
 
             let body = '';
@@ -213,29 +208,13 @@ const NotificationsBox = new Lang.Class({
     },
 
     _showSource: function(source, obj, box) {
-        let musicNotification = source.getMusicNotification();
-
-        if (musicNotification != null &&
-            this._musicBin.child == null) {
-            musicNotification.acknowledged = true;
-            if (musicNotification.actor.get_parent() != null)
-                musicNotification.actor.get_parent().remove_actor(musicNotification.actor);
-            this._musicBin.child = musicNotification.actor;
-            this._musicBin.child.visible = obj.visible;
-
-            musicNotification.expand(false /* animate */);
-
-            obj.musicNotification = musicNotification;
-        }
-
         if (obj.detailed) {
             [obj.titleLabel, obj.countLabel] = this._makeNotificationDetailedSource(source, box);
         } else {
             [obj.titleLabel, obj.countLabel] = this._makeNotificationSource(source, box);
         }
 
-        box.visible = obj.visible &&
-            (source.unseenCount > (musicNotification ? 1 : 0));
+        box.visible = obj.visible && (source.unseenCount > 0);
     },
 
     _sourceAdded: function(tray, source, initial) {
@@ -246,8 +225,6 @@ const NotificationsBox = new Lang.Class({
             sourceCountChangedId: 0,
             sourceTitleChangedId: 0,
             sourceUpdatedId: 0,
-            sourceNotifyId: 0,
-            musicNotification: null,
             sourceBox: null,
             titleLabel: null,
             countLabel: null,
@@ -258,12 +235,6 @@ const NotificationsBox = new Lang.Class({
         this._showSource(source, obj, obj.sourceBox);
         this._notificationBox.add(obj.sourceBox, { x_fill: false, x_align: St.Align.START });
 
-        if (obj.musicNotification) {
-            obj.sourceNotifyId = source.connect('notify', Lang.bind(this, function(source, notification) {
-                notification.acknowledged = true;
-            }));
-        }
-
         obj.sourceCountChangedId = source.connect('count-updated', Lang.bind(this, function(source) {
             this._countChanged(source, obj);
         }));
@@ -324,8 +295,7 @@ const NotificationsBox = new Lang.Class({
             obj.countLabel.text = this._makeNotificationCountText(count, source.isChat);
         }
 
-        obj.sourceBox.visible = obj.visible &&
-            (source.unseenCount > (obj.musicNotification ? 1 : 0));
+        obj.sourceBox.visible = obj.visible && (source.unseenCount > 0);
 
         this._updateVisibility();
         if (obj.sourceBox.visible)
@@ -337,10 +307,7 @@ const NotificationsBox = new Lang.Class({
             return;
 
         obj.visible = source.policy.showInLockScreen;
-        if (obj.musicNotification)
-            obj.musicNotification.actor.visible = obj.visible;
-        obj.sourceBox.visible = obj.visible &&
-            source.unseenCount > (obj.musicNotification ? 1 : 0);
+        obj.sourceBox.visible = obj.visible && source.unseenCount > 0;
 
         this._updateVisibility();
         if (obj.sourceBox.visible)
@@ -367,13 +334,6 @@ const NotificationsBox = new Lang.Class({
         obj.sourceBox.destroy();
         obj.sourceBox = obj.titleLabel = obj.countLabel = null;
 
-        if (obj.musicNotification) {
-            this._musicBin.child = null;
-            obj.musicNotification = null;
-
-            source.disconnect(obj.sourceNotifyId);
-        }
-
         source.disconnect(obj.sourceDestroyId);
         source.disconnect(obj.sourceCountChangedId);
         source.disconnect(obj.sourceTitleChangedId);


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