|
5 | 5 | * Copyright: 2023
|
6 | 6 | */
|
7 | 7 |
|
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"; |
23 | 12 |
|
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"; |
25 | 16 |
|
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"; |
31 | 21 |
|
32 |
| -const _ = ExtensionUtils.gettext; |
| 22 | +const GETTEXT_DOMAIN = "vso-update-check"; |
33 | 23 |
|
34 | 24 | /* Defaults */
|
35 | 25 | const FILE_CHECK_TIMEOUT = 60; // seconds
|
36 | 26 | const ABROOT_STAGE_FILE = "/tmp/ABSystem.Upgrade.stage";
|
37 | 27 | const ABROOT_USER_LOCK_FILE = "/tmp/ABSystem.Upgrade.user.lock";
|
38 | 28 |
|
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 { |
41 | 34 | _init() {
|
42 | 35 | super._init(0.0, _("Vanilla OS On-going Update Check"));
|
43 | 36 |
|
@@ -101,24 +94,18 @@ const VSOUpdateCheckIndicator = GObject.registerClass(
|
101 | 94 | }
|
102 | 95 | );
|
103 | 96 |
|
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); |
109 | 100 | }
|
110 | 101 |
|
111 | 102 | 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); |
114 | 105 | }
|
115 | 106 |
|
116 | 107 | disable() {
|
117 | 108 | this._updateCheckIndicator.destroy();
|
118 | 109 | this._updateCheckIndicator = null;
|
119 | 110 | }
|
120 | 111 | }
|
121 |
| - |
122 |
| -function init(meta) { |
123 |
| - return new VSOUpdateCheckExtension(meta.uuid); |
124 |
| -} |
0 commit comments