messageTray: Remove support for images in notifications
The design says they are no longer a thing. https://bugzilla.gnome.org/show_bug.cgi?id=744815
This commit is contained in:
parent
240cdc6565
commit
f08e2b72d2
@ -507,7 +507,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;
|
||||
@ -611,10 +610,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) {
|
||||
@ -791,45 +787,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) {
|
||||
@ -1061,8 +1023,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)
|
||||
@ -1101,8 +1061,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)
|
||||
|
@ -357,20 +357,14 @@ 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
|
||||
// the 'image-data' hint. These applications don't typically pass in 'app_icon'
|
||||
// argument to Notify() and actually expect the pixbuf to be shown as an icon.
|
||||
// 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)
|
||||
// one of 'image-data' or 'image-path' are specified, the icon and takes precedence.
|
||||
if (!gicon && gimage)
|
||||
gicon = gimage;
|
||||
else if (!gicon)
|
||||
gicon = this._fallbackIconForNotificationData(hints);
|
||||
@ -380,7 +374,6 @@ const FdoNotificationDaemon = new Lang.Class({
|
||||
clear: true,
|
||||
soundFile: hints['sound-file'],
|
||||
soundName: hints['sound-name'] });
|
||||
notification.setImage(image);
|
||||
|
||||
let hasDefaultAction = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user