MessageTray: don't clear the banner text when adding to the body

ScreenShield uses Notification.bannerBodyText to fill the body of detailed
notifications, so use a separate boolean property to indicate it was already
added to the body.

https://bugzilla.gnome.org/show_bug.cgi?id=693822
This commit is contained in:
Giovanni Campagna 2013-02-14 17:12:26 +01:00
parent 6436452bc9
commit 07676d483d

View File

@ -359,6 +359,7 @@ const Notification = new Lang.Class({
this._customContent = false; this._customContent = false;
this.bannerBodyText = null; this.bannerBodyText = null;
this.bannerBodyMarkup = false; this.bannerBodyMarkup = false;
this._bannerBodyAdded = false;
this._titleFitsInBannerMode = true; this._titleFitsInBannerMode = true;
this._titleDirection = Clutter.TextDirection.DEFAULT; this._titleDirection = Clutter.TextDirection.DEFAULT;
this._spacing = 0; this._spacing = 0;
@ -521,6 +522,7 @@ const Notification = new Lang.Class({
// not fitting fully in the single-line mode. // not fitting fully in the single-line mode.
this.bannerBodyText = this._customContent ? null : banner; this.bannerBodyText = this._customContent ? null : banner;
this.bannerBodyMarkup = params.bannerMarkup; this.bannerBodyMarkup = params.bannerMarkup;
this._bannerBodyAdded = false;
banner = banner ? banner.replace(/\n/g, ' ') : ''; banner = banner ? banner.replace(/\n/g, ' ') : '';
@ -602,10 +604,9 @@ const Notification = new Lang.Class({
}, },
_addBannerBody: function() { _addBannerBody: function() {
if (this.bannerBodyText) { if (this.bannerBodyText && !this._bannerBodyAdded) {
let text = this.bannerBodyText; this._bannerBodyAdded = true;
this.bannerBodyText = null; this.addBody(this.bannerBodyText, this.bannerBodyMarkup);
this.addBody(text, this.bannerBodyMarkup);
} }
}, },
@ -897,7 +898,7 @@ const Notification = new Lang.Class({
}, },
_canExpandContent: function() { _canExpandContent: function() {
return this.bannerBodyText || return (this.bannerBodyText && !this._bannerBodyAdded) ||
(!this._titleFitsInBannerMode && !this._table.has_style_class_name('multi-line-notification')); (!this._titleFitsInBannerMode && !this._table.has_style_class_name('multi-line-notification'));
}, },