notification: Pass policy in the Source contructor
Commit 932ccac1
changed Source to use a regular constructor
instead of `_init()`.
Unfortunately that results in ordering issues for subclasses
that override `_createPolicy()`, if that method needs to access
any properties that are set in the constructor (as `this` is
only available after chaining up to the parent).
We can fix that by simply setting the policy from the constructor,
instead of relying on some overriden method being called.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3170>
This commit is contained in:

committed by
Marge Bot

parent
810391f41e
commit
3fc7ed4088
@ -824,20 +824,19 @@ export class ExtensionManager extends Signals.EventEmitter {
|
||||
|
||||
const ExtensionUpdateSource = GObject.registerClass(
|
||||
class ExtensionUpdateSource extends MessageTray.Source {
|
||||
_init() {
|
||||
let appSys = Shell.AppSystem.get_default();
|
||||
this._app = appSys.lookup_app('org.gnome.Extensions.desktop');
|
||||
if (!this._app)
|
||||
this._app = appSys.lookup_app('com.mattjakeman.ExtensionManager.desktop');
|
||||
constructor() {
|
||||
const appSys = Shell.AppSystem.get_default();
|
||||
const app =
|
||||
appSys.lookup_app('org.gnome.Extensions.desktop') ||
|
||||
appSys.lookup_app('com.mattjakeman.ExtensionManager.desktop');
|
||||
|
||||
super._init({
|
||||
title: this._app.get_name(),
|
||||
icon: this._app.get_icon(),
|
||||
super({
|
||||
title: app.get_name(),
|
||||
icon: app.get_icon(),
|
||||
policy: MessageTray.NotificationPolicy.newForApp(app),
|
||||
});
|
||||
}
|
||||
|
||||
_createPolicy() {
|
||||
return new MessageTray.NotificationApplicationPolicy(this._app.id);
|
||||
this._app = app;
|
||||
}
|
||||
|
||||
open() {
|
||||
|
Reference in New Issue
Block a user