[gnome-shell/gnome-3-36] messageTray: Make NotificationPolicy properties read-only
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-36] messageTray: Make NotificationPolicy properties read-only
- Date: Mon, 4 May 2020 14:34:01 +0000 (UTC)
commit 048796d145dcf8b686d30a23dc08cc9c62ce62b3
Author: Philip Chimento <philip chimento gmail com>
Date: Tue Apr 21 00:25:14 2020 +0000
messageTray: Make NotificationPolicy properties read-only
These properties are never written; in the base class they are always
their default values, and in the subclasses the getters are overridden.
This will be necessary because GJS is adding checks to make sure that
readable properties always have a getter, writable properties always
have a setter, and that the variations of camelCase/snake_case are
handled correctly. It's supposedly backwards compatible, but that
assumes that code is not doing things like forgetting a setter on a
writable property. (If the missing setter had ever been called, it might
have led to a crash, which is why we've made this change.)
This is the minimally invasive patch which should work with both older
and newer versions of GJS. If you decide to require GJS 1.65.2, then
you'll also be able to remove the getters from NotificationPolicy as
well.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1205
(cherry picked from commit 6aa1b817c9f65bad2a9af9b772d6876e30babf03)
js/ui/messageTray.js | 29 +++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index fffdc786dc..f4ceb0ae79 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -136,29 +136,22 @@ var FocusGrabber = class FocusGrabber {
var NotificationPolicy = GObject.registerClass({
Properties: {
'enable': GObject.ParamSpec.boolean(
- 'enable', 'enable', 'enable',
- GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
- true),
+ 'enable', 'enable', 'enable', GObject.ParamFlags.READABLE, true),
'enable-sound': GObject.ParamSpec.boolean(
'enable-sound', 'enable-sound', 'enable-sound',
- GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
- true),
+ GObject.ParamFlags.READABLE, true),
'show-banners': GObject.ParamSpec.boolean(
'show-banners', 'show-banners', 'show-banners',
- GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
- true),
+ GObject.ParamFlags.READABLE, true),
'force-expanded': GObject.ParamSpec.boolean(
'force-expanded', 'force-expanded', 'force-expanded',
- GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
- false),
+ GObject.ParamFlags.READABLE, false),
'show-in-lock-screen': GObject.ParamSpec.boolean(
'show-in-lock-screen', 'show-in-lock-screen', 'show-in-lock-screen',
- GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
- false),
+ GObject.ParamFlags.READABLE, false),
'details-in-lock-screen': GObject.ParamSpec.boolean(
'details-in-lock-screen', 'details-in-lock-screen', 'details-in-lock-screen',
- GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
- false),
+ GObject.ParamFlags.READABLE, false),
},
}, class NotificationPolicy extends GObject.Object {
// Do nothing for the default policy. These methods are only useful for the
@@ -170,23 +163,23 @@ var NotificationPolicy = GObject.registerClass({
}
get enableSound() {
- return this.enable_sound;
+ return true;
}
get showBanners() {
- return this.show_banners;
+ return true;
}
get forceExpanded() {
- return this.force_expanded;
+ return false;
}
get showInLockScreen() {
- return this.show_in_lock_screen;
+ return false;
}
get detailsInLockScreen() {
- return this.details_in_lock_screen;
+ return false;
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]