Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backward-compatible GNOME 3.36 support #1

Merged
merged 13 commits into from
May 20, 2021
Merged

Backward-compatible GNOME 3.36 support #1

merged 13 commits into from
May 20, 2021

Conversation

mwilck
Copy link
Owner

@mwilck mwilck commented May 4, 2020

This patch set makes argos compatibile with GNOME 3.36, while at the same time restoring compatibility with older GNOME shell versions (tested down to 3.26 so far). The git of the set is the first commit (a0f3a66). See the commit message there for detailed explanations.

Furthermore, it adds some minor fixes for warnings spit out by GNOME when argos is running, and adapts the meta data.

rammie and others added 7 commits May 4, 2020 17:44
This makes the extension compatible with GNOME 3.36 without giving up
support for older GNOME versions. Tested with 3.26, 3.34, 3.36; should run
on older versions as well.

Rationale for the implementation: there are two basic types of classes
in GNOME shell: plain ES6 classes, and classes that extend Gobject and
are created with GObject.registerClass(). Sometimes a plain class is
converted to a GObject class in a later GJS version. In this case, the
syntax for derived classes has to be converted from plain to GObject, too.
In extensions that need to support a broader range of GNOME versions,
these two class definitions can't be easily combined with conditional
code. The main reason is the different initialization of the object
itself (constructor vs. _init() and the base object (super() vs.
super._init()).

However, it's possible to separate the actual implementation from the
class definition, and use bind() to make access "this" in these functions
in different ways, depending on the way the class is defined.

For simple classes with just one method (constructor), such as
ArgosMenuItem, this can be done using a generic function.
Use a wrapper to implement GNOME-version-dependend access
to object.actor. This fixes the incompatibility with GNOME
<= 3.30 introduced by bda621e ("Remove deprecated use of object.actor
in ArgosButton").
Use GNOME-version dependent method to convert bytearray to
String. This fixes the incompatibility with earlier GNOME
versions introduced by da857c0 ("Use new method for converting byte
array to string).
JS WARNING: [utilities.js 135]: reference to undefined property "alternate"
Even older versions may be supported, too, but I didn't try yet.
The "version" field in metadata.json is for internal bookkeeping at
extensions.gnome.org only, and shouldn't be set by locally installed
extensions. Doing it nonetheless can have highly surprising effects,
including wiping the entire extension from disk without alerting the
user (see e.g.
https://gitlab.gnome.org/Infrastructure/extensions-web/issues/102#note_739364).
mwilck added 2 commits May 5, 2020 18:24
GNOME shell 3.36 has lost the AltSwitcher class that used to be
defined in ui.status.system with commit 147a743d8d79 ("system: Replace action
icons with regular menu items"). Import the code for this class in argos.
@BlackDex
Copy link

Hello @mwilck
Are you going to create a PR to the upstream project?
I currently use your version of this extension which works great!
But i think that everybody should be able to enjoy this extension :)

@mwilck
Copy link
Owner Author

mwilck commented May 20, 2020

@BlackDex, thanks! I don't want to compete with @rammie's upstream PR#111. I've just announced my work there, and in the Future of argos thread, for now.

@ketankr9
Copy link

@mwilck Thanks a lot for the fix.
You saved me from learning how to create extension in gnome 3.36 from scratch.

@wepanx
Copy link

wepanx commented Jun 29, 2020

@mwilck Many, many thanks! Works like a charm!

Would you mind creating a PR? As far as I understand, @rammie's PR in its current form is not mergable due to incompatibility with older GNOME shell releases and has not been updated for almost 4 months. However, your PR works. Maybe creating a PR, referencing @rammie's PR would be ok for both sides?

Would love to get a working extension via extensions.gnome.org in the end. ;-)

Thanks again for your work!

@mgajda
Copy link

mgajda commented Sep 23, 2020

Thanks a lot!

Would it possible to upload 3.36 support to https://extensions.gnome.org?

Fedora 33 ships with GNOME 3.38 (but with version validation disabled)
and this extension works fine there. Fedora 34 beta has GNOME 40 (with
version validation enabled) and the extension works once the version
is added to the list of supported versions.

Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
Mark this as compatible with GNOME 3.38 and 40
utilities.js: fix shellVersion for GNOME 40+ versioning scheme
@mwilck
Copy link
Owner Author

mwilck commented May 20, 2021

Merging this now.

@mwilck mwilck merged commit 6181b1c into master May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants