Extension: Load icons from resources

This commit is contained in:
Romain Vigier
2022-04-04 22:23:48 +02:00
parent 6c952a6485
commit 5d6804ab0d
6 changed files with 28 additions and 13 deletions
+9 -1
View File
@@ -3,7 +3,7 @@
'use strict';
const { Gio } = imports.gi;
const { Gio, GLib } = imports.gi;
const { extensionUtils } = imports.misc;
const Me = extensionUtils.getCurrentExtension();
@@ -16,6 +16,7 @@ const { Timer } = Me.imports.modules.Timer;
class NightThemeSwitcher {
#resource = null;
#timer = null;
#switcherThemeGtk = null;
#switcherThemeShell = null;
@@ -32,6 +33,10 @@ class NightThemeSwitcher {
enable() {
console.debug('Enabling extension...');
this.#resource = Gio.Resource.load(GLib.build_filenamev([Me.path, 'resources', 'extension.gresource']));
Gio.resources_register(this.#resource);
this.#timer = new Timer();
this.#switcherThemeGtk = new SwitcherThemeGtk({ timer: this.#timer });
this.#switcherThemeIcon = new SwitcherThemeIcon({ timer: this.#timer });
@@ -80,6 +85,9 @@ class NightThemeSwitcher {
this.#timer = null;
}
if (this.#resource)
Gio.resources_unregister(this.#resource);
console.debug('Extension disabled.');
}