Skip to content

Commit

Permalink
Merge pull request #134 from mwilck/GNOME-42
Browse files Browse the repository at this point in the history
Javascript Fixes for GNOME shell 42

LGTM. If any more issues pop up, we can solve them later.
  • Loading branch information
mwilck authored Jul 12, 2022
2 parents 2f43228 + 028b229 commit 1180568
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 29 deletions.
29 changes: 16 additions & 13 deletions [email protected]/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

const Lang = imports.lang;
const GObject = imports.gi.GObject;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const PanelMenu = imports.ui.panelMenu;
Expand All @@ -21,12 +22,14 @@ const ArgosLineView = Extension.imports.lineview.ArgosLineView;
const ArgosMenuItem = Extension.imports.menuitem.ArgosMenuItem;
const Utilities = Extension.imports.utilities;

var ArgosButton = new Lang.Class({
Name: "ArgosButton",
Extends: PanelMenu.Button,
var ArgosButton = GObject.registerClass({
GTypeName: "ArgosButton",
},

_init: function(file, settings) {
this.parent(0, "", false);
class ArgosButton extends PanelMenu.Button {

_init(file, settings) {
super._init(0, "", false);

this._file = file;
this._updateInterval = settings.updateInterval;
Expand All @@ -52,9 +55,9 @@ var ArgosButton = new Lang.Class({
this.update();
}));
}
},
}

_onDestroy: function() {
_onDestroy() {
this._isDestroyed = true;

if (this._updateTimeout !== null)
Expand All @@ -63,18 +66,18 @@ var ArgosButton = new Lang.Class({
Mainloop.source_remove(this._cycleTimeout);

this.menu.removeAll();
},
}

update: function() {
update() {
if (this._updateTimeout !== null) {
Mainloop.source_remove(this._updateTimeout);
this._updateTimeout = null;
}

this._update();
},
}

_update: function() {
_update() {
if (this._updateRunning)
return;

Expand Down Expand Up @@ -106,9 +109,9 @@ var ArgosButton = new Lang.Class({
log("Unable to execute file '" + this._file.get_basename() + "': " + error);
this._updateRunning = false;
}
},
}

_processOutput: function(output) {
_processOutput(output) {
let buttonLines = [];
let dropdownLines = [];

Expand Down
22 changes: 12 additions & 10 deletions [email protected]/lineview.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,29 @@
* (https://gnu.org/licenses/gpl.html)
*/

const Lang = imports.lang;
const GObject = imports.gi.GObject;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const GdkPixbuf = imports.gi.GdkPixbuf;
const St = imports.gi.St;
const Clutter = imports.gi.Clutter;

var ArgosLineView = new Lang.Class({
Name: "ArgosLineView",
Extends: St.BoxLayout,
var ArgosLineView = GObject.registerClass({
GTypeName: "ArgosLineView",
},

_init: function(line) {
this.parent({
class ArgosLineView extends St.BoxLayout {

_init(line) {
super._init({
style_class: "argos-line-view"
});

if (typeof line !== "undefined")
this.setLine(line);
},
}

setLine: function(line) {
setLine(line) {
this.line = line;

this.remove_all_children();
Expand Down Expand Up @@ -105,9 +107,9 @@ var ArgosLineView = new Lang.Class({
}
}
}
},
}

setMarkup: function(markup) {
setMarkup(markup) {
this.setLine({
markup: markup
});
Expand Down
7 changes: 2 additions & 5 deletions [email protected]/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
"description": "Create GNOME Shell extensions in seconds",
"url": "https://github.com/p-e-w/argos",
"shell-version": [
"3.26",
"3.28",
"3.30",
"3.32",
"3.34",
"3.36",
"3.38",
"40",
"41"
"41",
"42"
]
}
11 changes: 10 additions & 1 deletion [email protected]/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,24 @@ function getShellVersion(str) {
let versionParts = str.split(".");
let versionNumber = 0;

if (versionParts.length === 2) {
if (versionParts.length < 2) {
log("Invalid GNOME Shell version '" + str + "'");
return 0;
}

let major = Number(versionParts[0]);

if (major >= 40) {
// GNOME 40 and newer versioning scheme
// https://discourse.gnome.org/t/new-gnome-versioning-scheme/4235
// must be > 3.x.y with x <= 38
// For 40.x, the 3rd digit is ignored
// 40.alpha -> 33997
// 41.beta -> 34098
// 41.rc -> 34099
// 41.0 -> 34100
// 40.1 -> 34001
// 40.1.1 -> 34001
let testReleases = new Map([["alpha", -3], ["beta", -2], ["rc", -1]]);
let minor = testReleases.get(versionParts[1]);
let major = Number(versionParts[0]);
Expand Down

0 comments on commit 1180568

Please sign in to comment.