messageTray: Defer creation of mainIcon
We need to make sure the Source is fully constructed before creating mainIcon, as SourceActor will query the count of the source. This fixes Telepathy Chats. https://bugzilla.gnome.org/show_bug.cgi?id=682045
This commit is contained in:
parent
341b6a1290
commit
8f129e1c9d
@ -1132,9 +1132,6 @@ const Source = new Lang.Class({
|
|||||||
this.isMuted = false;
|
this.isMuted = false;
|
||||||
|
|
||||||
this.notifications = [];
|
this.notifications = [];
|
||||||
|
|
||||||
this.mainIcon = new SourceActor(this, this.ICON_SIZE);
|
|
||||||
this._setSummaryIcon(this.createIcon(this.ICON_SIZE));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
get count() {
|
get count() {
|
||||||
@ -1178,10 +1175,23 @@ const Source = new Lang.Class({
|
|||||||
icon_size: size });
|
icon_size: size });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_ensureMainIcon: function(icon) {
|
||||||
|
if (this._mainIcon)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!icon)
|
||||||
|
icon = this.createIcon(this.ICON_SIZE);
|
||||||
|
|
||||||
|
this._mainIcon = new SourceActor(this, this.ICON_SIZE);
|
||||||
|
this._mainIcon.setIcon(icon);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
// Unlike createIcon, this always returns the same actor;
|
// Unlike createIcon, this always returns the same actor;
|
||||||
// there is only one summary icon actor for a Source.
|
// there is only one summary icon actor for a Source.
|
||||||
getSummaryIcon: function() {
|
getSummaryIcon: function() {
|
||||||
return this.mainIcon.actor;
|
this._ensureMainIcon();
|
||||||
|
return this._mainIcon.actor;
|
||||||
},
|
},
|
||||||
|
|
||||||
pushNotification: function(notification) {
|
pushNotification: function(notification) {
|
||||||
@ -1228,7 +1238,8 @@ const Source = new Lang.Class({
|
|||||||
|
|
||||||
//// Protected methods ////
|
//// Protected methods ////
|
||||||
_setSummaryIcon: function(icon) {
|
_setSummaryIcon: function(icon) {
|
||||||
this.mainIcon.setIcon(icon);
|
if (!this._ensureMainIcon(icon))
|
||||||
|
this._mainIcon.setIcon(icon);
|
||||||
},
|
},
|
||||||
|
|
||||||
open: function(notification) {
|
open: function(notification) {
|
||||||
|
Loading…
Reference in New Issue
Block a user