messageTray: Only take params in Notification
constructor
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3173>
This commit is contained in:

committed by
Florian Müllner

parent
251a5e9d20
commit
d54219c098
@ -351,28 +351,13 @@ class Action extends GObject.Object {
|
||||
});
|
||||
|
||||
export class Notification extends GObject.Object {
|
||||
_init(source, title, banner, params) {
|
||||
super._init({source});
|
||||
constructor(params) {
|
||||
super(params);
|
||||
|
||||
this.title = title;
|
||||
this.urgency = Urgency.NORMAL;
|
||||
// 'transient' is a reserved keyword in JS, so we have to use an alternate variable name
|
||||
this.isTransient = false;
|
||||
this.privacyScope = PrivacyScope.USER;
|
||||
this.forFeedback = false;
|
||||
this.body = null;
|
||||
this.useBodyMarkup = false;
|
||||
this.sound = null;
|
||||
this._soundPlayed = false;
|
||||
this.actions = [];
|
||||
this.setResident(false);
|
||||
this._actions = [];
|
||||
|
||||
// If called with only one argument we assume the caller
|
||||
// will call .update() later on. This is the case of
|
||||
// NotificationDaemon, which wants to use the same code
|
||||
// for new and updated notifications
|
||||
if (arguments.length !== 1)
|
||||
this.update(title, banner, params);
|
||||
if (!this.datetime)
|
||||
this.datetime = GLib.DateTime.new_now_local();
|
||||
}
|
||||
|
||||
// update:
|
||||
@ -415,6 +400,10 @@ export class Notification extends GObject.Object {
|
||||
this.emit('updated', params.clear);
|
||||
}
|
||||
|
||||
get actions() {
|
||||
return this._actions;
|
||||
}
|
||||
|
||||
get iconName() {
|
||||
if (this.gicon instanceof Gio.ThemedIcon)
|
||||
return this.gicon.iconName;
|
||||
@ -472,18 +461,18 @@ export class Notification extends GObject.Object {
|
||||
|
||||
this.destroy();
|
||||
});
|
||||
this.actions.push(action);
|
||||
this._actions.push(action);
|
||||
this.emit('action-added', action);
|
||||
}
|
||||
|
||||
clearActions() {
|
||||
if (this.actions.length === 0)
|
||||
if (this._actions.length === 0)
|
||||
return;
|
||||
|
||||
this.actions.forEach(action => {
|
||||
this._actions.forEach(action => {
|
||||
this.emit('action-removed', action);
|
||||
});
|
||||
this.actions = [];
|
||||
this._actions = [];
|
||||
}
|
||||
|
||||
setUrgency(urgency) {
|
||||
|
Reference in New Issue
Block a user