gnome-shell-system-monitor-applet
gnome-shell-system-monitor-applet copied to clipboard
Add compatibility with Gnome-Shell < 3.34 - for example RHEL 8 with 3…
Hello,
Just hitting this bug report:
https://bugzilla.redhat.com/show_bug.cgi?id=2184351
This pull request helps to resolve this issue:
Add compatibility with Gnome-Shell < 3.34 - for example RHEL 8 with 3.32.2 ModalDialog was converted to GObject.registerClass in 3.34
According to:
https://access.redhat.com/product-life-cycles?product=Red%20Hat%20Enterprise%20Linux,OpenShift%20Container%20Platform%204
RHEL 8 will be maintained until may 31 2029, and maybe until may 2031, so it's probably worth keeping its users have this extension working.
Cordially,
-- NVieville
The wrapping was introduced in https://github.com/paradoxxxzero/gnome-shell-system-monitor-applet/pull/777 (https://github.com/paradoxxxzero/gnome-shell-system-monitor-applet/pull/777/commits/25fb5f5744a9c009ce63694f598907ecda0aea36), from issue https://github.com/paradoxxxzero/gnome-shell-system-monitor-applet/issues/551
Hello,
Totally agree with you about deduplicating code. There is an example similar to your proposal here:
https://wiki.gnome.org/Attic/GnomeShell/Extensions/Writing#Version_Compatibility
As I didn't wanted to modify the original code, I just duplicate it and wrap it or not in the registerClass call. It was more of a quick and easy solution (KISS) to address the issue of launching the extension on RHEL 8. The example above also uses _init in place of constructor call, but I didn't inspect the consequences of such a switch.
Do you think a new proposal is needed? Or will you implement your proposal?
Thank you for your comment.
Cordially,
-- NVieville
Hello,
I've updated the change proposal according to your advice to not duplicate code. This proposal has been tested on RHEL 8 (gnome-shell 3.32.2) and Fedora 37 (gnome-shell 43.4) and it works as expected.
I would be very pleased if you could give me your opinion on a proposal of the form suggested here:
https://wiki.gnome.org/Projects/GnomeShell/Extensions/MigratingShellClasses#Migrating_from_Native_to_GObject
A patch against the actual proposal would look like this:
diff --git a/[email protected]/extension.js b/[email protected]/extension.js
index 5874451..0fc409b 100644
--- a/[email protected]/extension.js
+++ b/[email protected]/extension.js
@@ -283,9 +283,9 @@ const smStyleManager = class SystemMonitor_smStyleManager {
}
}
-const smDialogClass = class SystemMonitor_smDialog extends ModalDialog.ModalDialog {
- constructor() {
- super({styleClass: 'prompt-dialog'});
+var smDialog = class SystemMonitor_smDialog extends ModalDialog.ModalDialog {
+ _init() {
+ super._init({styleClass: 'prompt-dialog'});
let mainContentBox = new St.BoxLayout({style_class: 'prompt-dialog-main-layout',
vertical: false});
this.contentLayout.add(mainContentBox,
@@ -326,7 +326,12 @@ const smDialogClass = class SystemMonitor_smDialog extends ModalDialog.ModalDial
// Add compatibility with Gnome-Shell < 3.34 - for example RHEL 8 with 3.32.2
// ModalDialog was converted to GObject.registerClass in 3.34
-const smDialog = (shell_Version >= '3.34') ? GObject.registerClass(smDialogClass) : smDialogClass
+if (shell_Version >= '3.34') {
+ smDialog = GObject.registerClass(
+ {GTypeName: 'smDialog'},
+ smDialog
+ );
+}
const Chart = class SystemMonitor_Chart {
constructor(width, height, parent) {
This form has not been tested, and I don't measure the impact of switching from constructor to _init, not that of switching from const to var for the smDialog object either .
Any comment are welcome. Hope the proposal will fit the requirements and will be adopted.
Cordially,
-- NVieville
Hello,
The pull request have been updated according to my last message and as suggested here:
https://wiki.gnome.org/Projects/GnomeShell/Extensions/MigratingShellClasses#Migrating_from_Native_to_GObject
This new way to add compatibility with Gnome-Shell < 3.34 has been tested successfully on Fedora 37 and RHEL 8.
Hope this will help to provide this extension to these distributions.
Cordially,
-- NVieville