mpris: Use a scope specific message instead of a global one
Since the mpris implementation of the notification tray supports showing
multiple notification (one for each player), it doesn't make sense to
have only one global property to store the message, since that only
allows referencing one message at a time.
Instead, handle the MediaMessages completely inside the scope of
`_addPlayer()`, this should allow showing more than one message again,
which broke with commit 4dc44304df
[1].
[1] https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/791
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/833
This commit is contained in:
parent
55362aed3d
commit
d5e8f8cdf7
@ -256,18 +256,20 @@ class MediaSection extends MessageList.MessageListSection {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
let player = new MprisPlayer(busName);
|
let player = new MprisPlayer(busName);
|
||||||
|
let message = null;
|
||||||
player.connect('closed',
|
player.connect('closed',
|
||||||
() => {
|
() => {
|
||||||
this._players.delete(busName);
|
this._players.delete(busName);
|
||||||
});
|
});
|
||||||
player.connect('show', () => {
|
player.connect('show', () => {
|
||||||
this._message = new MediaMessage(player);
|
message = new MediaMessage(player);
|
||||||
this.addMessage(this._message, true);
|
this.addMessage(message, true);
|
||||||
});
|
});
|
||||||
player.connect('hide', () => {
|
player.connect('hide', () => {
|
||||||
this.removeMessage(this._message, true);
|
this.removeMessage(message, true);
|
||||||
this._message = null;
|
message = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
this._players.set(busName, player);
|
this._players.set(busName, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -288,10 +290,7 @@ class MediaSection extends MessageList.MessageListSection {
|
|||||||
if (!name.startsWith(MPRIS_PLAYER_PREFIX))
|
if (!name.startsWith(MPRIS_PLAYER_PREFIX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (newOwner && !oldOwner) {
|
if (newOwner && !oldOwner)
|
||||||
if (this._message)
|
|
||||||
this.removeMessage(this._message);
|
|
||||||
this._addPlayer(name);
|
this._addPlayer(name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user