Skip to content

Commit 0bdc72f

Browse files
author
mirkobrombin
committed
feat: properly port to GNOME 46
1 parent 80705c8 commit 0bdc72f

File tree

2 files changed

+24
-37
lines changed

2 files changed

+24
-37
lines changed

vso@vanillaos.org/extension.js

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,32 @@
55
* Copyright: 2023
66
*/
77

8-
// following imports will be useful once we migrate the extension to GNOME 45
9-
// import St from "gi://St";
10-
// import GObject from "gi://GObject";
11-
// import Gio from "gi://Gio";
12-
// import GLib from "gi://GLib";
13-
14-
// import * as Main from "resource:///org/gnome/shell/ui/main.js";
15-
// import * as ExtensionUtils from "resource:///org/gnome/shell/misc/util.js";
16-
// import * as PanelMenu from "resource:///org/gnome/shell/ui/panelMenu.js";
17-
// import * as PopupMenu from "resource:///org/gnome/shell/ui/popupMenu.js";
18-
19-
// import {
20-
// gettext as _,
21-
// ngettext as __,
22-
// } from "resource:///org/gnome/shell/extensions/extension.js";
8+
import St from "gi://St";
9+
import GObject from "gi://GObject";
10+
import Gio from "gi://Gio";
11+
import GLib from "gi://GLib";
2312

24-
const GETTEXT_DOMAIN = "vso-update-check";
13+
import * as Main from "resource:///org/gnome/shell/ui/main.js";
14+
import * as PanelMenu from "resource:///org/gnome/shell/ui/panelMenu.js";
15+
import * as PopupMenu from "resource:///org/gnome/shell/ui/popupMenu.js";
2516

26-
const { GObject, St, Gio, GLib, Gtk } = imports.gi;
27-
const ExtensionUtils = imports.misc.extensionUtils;
28-
const Main = imports.ui.main;
29-
const PanelMenu = imports.ui.panelMenu;
30-
const PopupMenu = imports.ui.popupMenu;
17+
import {
18+
Extension,
19+
gettext as _,
20+
} from "resource:///org/gnome/shell/extensions/extension.js";
3121

32-
const _ = ExtensionUtils.gettext;
22+
const GETTEXT_DOMAIN = "vso-update-check";
3323

3424
/* Defaults */
3525
const FILE_CHECK_TIMEOUT = 60; // seconds
3626
const ABROOT_STAGE_FILE = "/tmp/ABSystem.Upgrade.stage";
3727
const ABROOT_USER_LOCK_FILE = "/tmp/ABSystem.Upgrade.user.lock";
3828

39-
const VSOUpdateCheckIndicator = GObject.registerClass(
40-
class VSOUpdateCheckIndicator extends PanelMenu.Button {
29+
const VSOUpdateIndicator = GObject.registerClass(
30+
{
31+
GTypeName: "VSOUpdateIndicator",
32+
},
33+
class VSOUpdateIndicator extends PanelMenu.Button {
4134
_init() {
4235
super._init(0.0, _("Vanilla OS On-going Update Check"));
4336

@@ -101,24 +94,18 @@ const VSOUpdateCheckIndicator = GObject.registerClass(
10194
}
10295
);
10396

104-
class VSOUpdateCheckExtension {
105-
constructor(uuid) {
106-
this._uuid = uuid;
107-
108-
ExtensionUtils.initTranslations(GETTEXT_DOMAIN);
97+
export default class VSOUpdateCheckExtension extends Extension {
98+
constructor(metadata) {
99+
super(metadata);
109100
}
110101

111102
enable() {
112-
this._updateCheckIndicator = new VSOUpdateCheckIndicator();
113-
Main.panel.addToStatusArea(this._uuid, this._updateCheckIndicator);
103+
this._updateCheckIndicator = new VSOUpdateIndicator();
104+
Main.panel.addToStatusArea(this.uuid, this._updateCheckIndicator);
114105
}
115106

116107
disable() {
117108
this._updateCheckIndicator.destroy();
118109
this._updateCheckIndicator = null;
119110
}
120111
}
121-
122-
function init(meta) {
123-
return new VSOUpdateCheckExtension(meta.uuid);
124-
}

vso@vanillaos.org/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"uuid": "vso@vanillaos.org",
55
"version": 1,
66
"shell-version": [
7-
"44", "46"
7+
"46"
88
]
9-
}
9+
}

0 commit comments

Comments
 (0)