[gnome-shell/wip/fmuellner/notification-redux: 11/128] messageTray: Remove support for images in notifications



commit 9d08c760b5cfb73d7410234e73bdfb2bb254eb0e
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Feb 11 18:25:29 2015 +0100

    messageTray: Remove support for images in notifications
    
    The design says they are no longer a thing.

 js/ui/messageTray.js        |   52 ++++--------------------------------------
 js/ui/notificationDaemon.js |    8 +-----
 2 files changed, 6 insertions(+), 54 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 65616f4..ffc79a2 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -506,7 +506,6 @@ const Notification = new Lang.Class({
         this._titleFitsInBannerMode = true;
         this._spacing = 0;
         this._scrollPolicy = Gtk.PolicyType.AUTOMATIC;
-        this._imageBin = null;
         this._soundName = null;
         this._soundFile = null;
         this._soundPlayed = false;
@@ -610,10 +609,7 @@ const Notification = new Lang.Class({
             this._actionArea = null;
             this._buttonBox = null;
         }
-        if (params.clear)
-            this.unsetImage();
-
-        if (!this._scrollArea && !this._actionArea && !this._imageBin)
+        if (!this._scrollArea && !this._actionArea)
             this._table.remove_style_class_name('multi-line-notification');
 
         if (params.gicon) {
@@ -790,45 +786,11 @@ const Notification = new Lang.Class({
 
     _updateLastColumnSettings: function() {
         if (this._scrollArea)
-            this._table.child_set(this._scrollArea, { col: this._imageBin ? 2 : 1,
-                                                      col_span: this._imageBin ? 1 : 2 });
+            this._table.child_set(this._scrollArea, { col: 1,
+                                                      col_span: 2 });
         if (this._actionArea)
-            this._table.child_set(this._actionArea, { col: this._imageBin ? 2 : 1,
-                                                      col_span: this._imageBin ? 1 : 2 });
-    },
-
-    setImage: function(image) {
-        this.unsetImage();
-
-        if (!image)
-            return;
-
-        this._imageBin = new St.Bin({ opacity: 230,
-                                      child: image,
-                                      visible: this.expanded });
-
-        this._table.add_style_class_name('multi-line-notification');
-        this._table.add_style_class_name('notification-with-image');
-        this._addBannerBody();
-        this._updateLastColumnSettings();
-        this._table.add(this._imageBin, { row: 1,
-                                          col: 1,
-                                          row_span: 2,
-                                          x_expand: false,
-                                          y_expand: false,
-                                          x_fill: false,
-                                          y_fill: false });
-    },
-
-    unsetImage: function() {
-        if (this._imageBin) {
-            this._table.remove_style_class_name('notification-with-image');
-            this._table.remove_actor(this._imageBin);
-            this._imageBin = null;
-            this._updateLastColumnSettings();
-            if (!this._scrollArea && !this._actionArea)
-                this._table.remove_style_class_name('multi-line-notification');
-        }
+            this._table.child_set(this._actionArea, { col: 1,
+                                                      col_span: 2 });
     },
 
     addButton: function(button, callback) {
@@ -1060,8 +1022,6 @@ const Notification = new Lang.Class({
         this.actor.remove_style_class_name('notification-unexpanded');
 
         // Show additional content that we keep hidden in banner mode
-        if (this._imageBin)
-            this._imageBin.show();
         if (this._actionArea)
             this._actionArea.show();
         if (this._scrollArea)
@@ -1100,8 +1060,6 @@ const Notification = new Lang.Class({
         this.expanded = false;
 
         // Hide additional content that we keep hidden in banner mode
-        if (this._imageBin)
-            this._imageBin.hide();
         if (this._actionArea)
             this._actionArea.hide();
         if (this._scrollArea)
diff --git a/js/ui/notificationDaemon.js b/js/ui/notificationDaemon.js
index c8d57af..052181e 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -354,8 +354,6 @@ const FdoNotificationDaemon = new Lang.Class({
         let gicon = this._iconForNotificationData(icon, hints);
         let gimage = this._imageForNotificationData(hints);
 
-        let image = null;
-
         // If an icon is not specified, we use 'image-data' or 'image-path' hint for an icon
         // and don't show a large image. There are currently many applications that use
         // notify_notification_set_icon_from_pixbuf() from libnotify, which in turn sets
@@ -364,10 +362,7 @@ const FdoNotificationDaemon = new Lang.Class({
         // So the logic here does the right thing for this case. If both an icon and either
         // one of 'image-data' or 'image-path' are specified, we show both an icon and
         // a large image.
-        if (gicon && gimage)
-            image = new St.Icon({ gicon: gimage,
-                                  icon_size: notification.IMAGE_SIZE });
-        else if (!gicon && gimage)
+        if (!gicon && gimage)
             gicon = gimage;
         else if (!gicon)
             gicon = this._fallbackIconForNotificationData(hints);
@@ -377,7 +372,6 @@ const FdoNotificationDaemon = new Lang.Class({
                                              clear: true,
                                              soundFile: hints['sound-file'],
                                              soundName: hints['sound-name'] });
-        notification.setImage(image);
 
         let hasDefaultAction = false;
 


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