[gnome-shell/wip/new-notifications: 2/8] messageTray: Remove support for notifications with images
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/new-notifications: 2/8] messageTray: Remove support for notifications with images
- Date: Fri, 13 Dec 2013 18:26:54 +0000 (UTC)
commit 5b8bccb7a798e542074958fdb3e223a41591f436
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Dec 4 22:45:44 2013 -0500
messageTray: Remove support for notifications with images
This sufficiently complicates the code, and won't fit in the
new design.
data/theme/gnome-shell.css | 8 -----
js/ui/messageTray.js | 64 +------------------------------------------
js/ui/notificationDaemon.js | 8 +-----
3 files changed, 2 insertions(+), 78 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index fa00cbb..61d0bf5 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -1496,14 +1496,6 @@ StScrollBar StButton#vhandle:active {
height: 36px;
}
-/* We use row-span = 2 for the image cell, which prevents its height preferences to be
- taken into account during allocation, so its height ends up being limited by the height
- of the content in the other rows. To avoid showing a stretched image, we set the minimum
- height of the table to be ICON_SIZE + IMAGE_SIZE + spacing-rows = 24 + 125 + 10 = 159 */
-.notification-with-image {
- min-height: 159px;
-}
-
.summary-boxpointer {
-arrow-border-radius: 15px;
-arrow-background-color: rgba(0,0,0,0.9);
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 9f6eba3..20b4e3e 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -488,8 +488,6 @@ const Notification = new Lang.Class({
ICON_SIZE: 24,
- IMAGE_SIZE: 125,
-
_init: function(source, title, banner, params) {
this.source = source;
this.title = title;
@@ -510,7 +508,6 @@ const Notification = new Lang.Class({
this._titleDirection = Clutter.TextDirection.DEFAULT;
this._spacing = 0;
this._scrollPolicy = Gtk.PolicyType.AUTOMATIC;
- this._imageBin = null;
this._soundName = null;
this._soundFile = null;
this._soundPlayed = false;
@@ -542,14 +539,6 @@ const Notification = new Lang.Class({
y_expand: false,
y_fill: false });
- // This is an empty cell that overlaps with this._bannerBox cell to ensure
- // that this._bannerBox cell expands horizontally, while not forcing the
- // this._imageBin that is also in col: 2 to expand horizontally.
- this._table.add(new St.Bin(), { row: 0,
- col: 2,
- y_expand: false,
- y_fill: false });
-
this._titleLabel = new St.Label();
this._bannerBox.add_actor(this._titleLabel);
this._bannerUrlHighlighter = new URLHighlighter();
@@ -614,10 +603,8 @@ 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) {
@@ -706,7 +693,6 @@ const Notification = new Lang.Class({
visible: this.expanded });
this._table.add(this._scrollArea, { row: 1,
col: 2 });
- this._updateLastColumnSettings();
this._contentArea = new St.BoxLayout({ style_class: 'notification-body',
vertical: true });
this._scrollArea.add_actor(this._contentArea);
@@ -787,53 +773,9 @@ const Notification = new Lang.Class({
this._table.add_style_class_name('multi-line-notification');
this._table.add(this._actionArea, props);
- this._updateLastColumnSettings();
this.updated();
},
- _updateLastColumnSettings: function() {
- if (this._scrollArea)
- this._table.child_set(this._scrollArea, { col: this._imageBin ? 2 : 1,
- col_span: this._imageBin ? 1 : 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');
- }
- },
-
addButton: function(button, callback) {
if (!this._buttonBox) {
let box = new St.BoxLayout({ style_class: 'notification-actions' });
@@ -1050,8 +992,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)
@@ -1090,8 +1030,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 a04ed35..37c59de 100644
--- a/js/ui/notificationDaemon.js
+++ b/js/ui/notificationDaemon.js
@@ -378,8 +378,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
@@ -388,10 +386,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);
@@ -401,7 +396,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]