messageTray: Remove support for notifications with images
This sufficiently complicates the code, and won't fit in the new design.
This commit is contained in:
parent
e6e15489aa
commit
e5318d5235
@ -1556,14 +1556,6 @@ StScrollBar StButton#vhandle:active {
|
|||||||
height: 36px;
|
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 {
|
.summary-boxpointer {
|
||||||
-arrow-border-radius: 15px;
|
-arrow-border-radius: 15px;
|
||||||
-arrow-background-color: rgba(0,0,0,0.9);
|
-arrow-background-color: rgba(0,0,0,0.9);
|
||||||
|
@ -484,8 +484,6 @@ const Notification = new Lang.Class({
|
|||||||
|
|
||||||
ICON_SIZE: 24,
|
ICON_SIZE: 24,
|
||||||
|
|
||||||
IMAGE_SIZE: 125,
|
|
||||||
|
|
||||||
_init: function(source, title, banner, params) {
|
_init: function(source, title, banner, params) {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
@ -505,7 +503,6 @@ const Notification = new Lang.Class({
|
|||||||
this._titleFitsInBannerMode = true;
|
this._titleFitsInBannerMode = true;
|
||||||
this._spacing = 0;
|
this._spacing = 0;
|
||||||
this._scrollPolicy = Gtk.PolicyType.AUTOMATIC;
|
this._scrollPolicy = Gtk.PolicyType.AUTOMATIC;
|
||||||
this._imageBin = null;
|
|
||||||
this._soundName = null;
|
this._soundName = null;
|
||||||
this._soundFile = null;
|
this._soundFile = null;
|
||||||
this._soundPlayed = false;
|
this._soundPlayed = false;
|
||||||
@ -537,14 +534,6 @@ const Notification = new Lang.Class({
|
|||||||
y_expand: false,
|
y_expand: false,
|
||||||
y_fill: 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._titleLabel = new St.Label();
|
||||||
this._bannerBox.add_actor(this._titleLabel);
|
this._bannerBox.add_actor(this._titleLabel);
|
||||||
this._bannerUrlHighlighter = new URLHighlighter();
|
this._bannerUrlHighlighter = new URLHighlighter();
|
||||||
@ -609,10 +598,8 @@ const Notification = new Lang.Class({
|
|||||||
this._actionArea = null;
|
this._actionArea = null;
|
||||||
this._buttonBox = 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');
|
this._table.remove_style_class_name('multi-line-notification');
|
||||||
|
|
||||||
if (params.gicon) {
|
if (params.gicon) {
|
||||||
@ -702,7 +689,6 @@ const Notification = new Lang.Class({
|
|||||||
visible: this.expanded });
|
visible: this.expanded });
|
||||||
this._table.add(this._scrollArea, { row: 1,
|
this._table.add(this._scrollArea, { row: 1,
|
||||||
col: 2 });
|
col: 2 });
|
||||||
this._updateLastColumnSettings();
|
|
||||||
this._contentArea = new St.BoxLayout({ style_class: 'notification-body',
|
this._contentArea = new St.BoxLayout({ style_class: 'notification-body',
|
||||||
vertical: true });
|
vertical: true });
|
||||||
this._scrollArea.add_actor(this._contentArea);
|
this._scrollArea.add_actor(this._contentArea);
|
||||||
@ -783,53 +769,9 @@ const Notification = new Lang.Class({
|
|||||||
|
|
||||||
this._table.add_style_class_name('multi-line-notification');
|
this._table.add_style_class_name('multi-line-notification');
|
||||||
this._table.add(this._actionArea, props);
|
this._table.add(this._actionArea, props);
|
||||||
this._updateLastColumnSettings();
|
|
||||||
this.updated();
|
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) {
|
addButton: function(button, callback) {
|
||||||
if (!this._buttonBox) {
|
if (!this._buttonBox) {
|
||||||
let box = new St.BoxLayout({ style_class: 'notification-actions' });
|
let box = new St.BoxLayout({ style_class: 'notification-actions' });
|
||||||
@ -1049,8 +991,6 @@ const Notification = new Lang.Class({
|
|||||||
this.actor.remove_style_class_name('notification-unexpanded');
|
this.actor.remove_style_class_name('notification-unexpanded');
|
||||||
|
|
||||||
// Show additional content that we keep hidden in banner mode
|
// Show additional content that we keep hidden in banner mode
|
||||||
if (this._imageBin)
|
|
||||||
this._imageBin.show();
|
|
||||||
if (this._actionArea)
|
if (this._actionArea)
|
||||||
this._actionArea.show();
|
this._actionArea.show();
|
||||||
if (this._scrollArea)
|
if (this._scrollArea)
|
||||||
@ -1089,8 +1029,6 @@ const Notification = new Lang.Class({
|
|||||||
this.expanded = false;
|
this.expanded = false;
|
||||||
|
|
||||||
// Hide additional content that we keep hidden in banner mode
|
// Hide additional content that we keep hidden in banner mode
|
||||||
if (this._imageBin)
|
|
||||||
this._imageBin.hide();
|
|
||||||
if (this._actionArea)
|
if (this._actionArea)
|
||||||
this._actionArea.hide();
|
this._actionArea.hide();
|
||||||
if (this._scrollArea)
|
if (this._scrollArea)
|
||||||
|
@ -364,8 +364,6 @@ const FdoNotificationDaemon = new Lang.Class({
|
|||||||
let gicon = this._iconForNotificationData(icon, hints);
|
let gicon = this._iconForNotificationData(icon, hints);
|
||||||
let gimage = this._imageForNotificationData(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
|
// 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
|
// 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
|
// notify_notification_set_icon_from_pixbuf() from libnotify, which in turn sets
|
||||||
@ -374,10 +372,7 @@ const FdoNotificationDaemon = new Lang.Class({
|
|||||||
// So the logic here does the right thing for this case. If both an icon and either
|
// 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
|
// one of 'image-data' or 'image-path' are specified, we show both an icon and
|
||||||
// a large image.
|
// a large image.
|
||||||
if (gicon && gimage)
|
if (!gicon && gimage)
|
||||||
image = new St.Icon({ gicon: gimage,
|
|
||||||
icon_size: notification.IMAGE_SIZE });
|
|
||||||
else if (!gicon && gimage)
|
|
||||||
gicon = gimage;
|
gicon = gimage;
|
||||||
else if (!gicon)
|
else if (!gicon)
|
||||||
gicon = this._fallbackIconForNotificationData(hints);
|
gicon = this._fallbackIconForNotificationData(hints);
|
||||||
@ -387,7 +382,6 @@ const FdoNotificationDaemon = new Lang.Class({
|
|||||||
clear: true,
|
clear: true,
|
||||||
soundFile: hints['sound-file'],
|
soundFile: hints['sound-file'],
|
||||||
soundName: hints['sound-name'] });
|
soundName: hints['sound-name'] });
|
||||||
notification.setImage(image);
|
|
||||||
|
|
||||||
let hasDefaultAction = false;
|
let hasDefaultAction = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user