[gnome-shell/wip/fmuellner/notification-redux+sass: 141/145] messageTray: Provide a hook for customizing banners



commit 8dce4455d52015f8abcc56f9c9d9a5db3a9ff0f6
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue Feb 17 03:27:11 2015 +0100

    messageTray: Provide a hook for customizing banners

 js/ui/messageTray.js |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 5d07ba3..89f4d7e 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -478,6 +478,15 @@ const Notification = new Lang.Class({
         }
     },
 
+    // Allow customizing the banner UI:
+    // the default implementation defers the creation to
+    // the source (which will create a NotificationBanner),
+    // so customization can be done by subclassing either
+    // Notification or Source
+    createBanner: function() {
+        return this.source.createBanner(this);
+    },
+
     activate: function() {
         this.emit('activated');
         if (!this.resident)
@@ -761,6 +770,10 @@ const Source = new Lang.Class({
         this.emit('title-changed');
     },
 
+    createBanner: function(notification) {
+        return new NotificationBanner(notification);
+    },
+
     // Called to create a new icon actor.
     // Provides a sane default implementation, override if you need
     // something more fancy.
@@ -1257,7 +1270,7 @@ const MessageTray = new Lang.Class({
             this.idleMonitor.add_user_active_watch(Lang.bind(this, this._onIdleMonitorBecameActive));
         }
 
-        this._banner = new NotificationBanner(this._notification);
+        this._banner = this._notification.createBanner();
         this._bannerClickedId = this._banner.connect('done-displaying',
                                                      Lang.bind(this, this._escapeTray));
         this._bannerUnfocusedId = this._banner.connect('unfocused', Lang.bind(this, function() {


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