extensions-app: Split out ExtensionManager
The extension handling is currently intertwined with the UI. Splitting it out provides a clearer separation, and will allow us to switch to a model-based UI later. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3067>
This commit is contained in:

committed by
Marge Bot

parent
3d070fdc6b
commit
f7ded3e509
@ -1,6 +1,5 @@
|
||||
import Adw from 'gi://Adw?version=1';
|
||||
import GLib from 'gi://GLib';
|
||||
import Gio from 'gi://Gio';
|
||||
import GObject from 'gi://GObject';
|
||||
|
||||
import {setConsoleLogDomain} from 'console';
|
||||
@ -8,25 +7,9 @@ const Package = imports.package;
|
||||
|
||||
Package.initFormat();
|
||||
|
||||
import {ExtensionManager} from './extensionManager.js';
|
||||
import {ExtensionsWindow} from './extensionsWindow.js';
|
||||
|
||||
const GnomeShellIface = loadInterfaceXML('org.gnome.Shell.Extensions');
|
||||
const GnomeShellProxy = Gio.DBusProxy.makeProxyWrapper(GnomeShellIface);
|
||||
|
||||
function loadInterfaceXML(iface) {
|
||||
const uri = `resource:///org/gnome/Extensions/dbus-interfaces/${iface}.xml`;
|
||||
const f = Gio.File.new_for_uri(uri);
|
||||
|
||||
try {
|
||||
let [ok_, bytes] = f.load_contents(null);
|
||||
return new TextDecoder().decode(bytes);
|
||||
} catch (e) {
|
||||
console.error(`Failed to load D-Bus interface ${iface}`);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
var Application = GObject.registerClass(
|
||||
class Application extends Adw.Application {
|
||||
_init() {
|
||||
@ -36,12 +19,12 @@ class Application extends Adw.Application {
|
||||
this.connect('window-removed', (a, window) => window.run_dispose());
|
||||
}
|
||||
|
||||
get shellProxy() {
|
||||
return this._shellProxy;
|
||||
get extensionManager() {
|
||||
return this._extensionManager;
|
||||
}
|
||||
|
||||
vfunc_activate() {
|
||||
this._shellProxy.CheckForUpdatesAsync().catch(console.error);
|
||||
this._extensionManager.checkForUpdates();
|
||||
this._window.present();
|
||||
}
|
||||
|
||||
@ -56,8 +39,7 @@ class Application extends Adw.Application {
|
||||
|
||||
this.set_accels_for_action('app.quit', ['<Primary>q']);
|
||||
|
||||
this._shellProxy = new GnomeShellProxy(Gio.DBus.session,
|
||||
'org.gnome.Shell.Extensions', '/org/gnome/Shell/Extensions');
|
||||
this._extensionManager = new ExtensionManager();
|
||||
|
||||
this._window = new ExtensionsWindow({application: this});
|
||||
}
|
||||
|
Reference in New Issue
Block a user