2023-05-25 21:23:24 +02:00
|
|
|
import Adw from 'gi://Adw?version=1';
|
|
|
|
import GLib from 'gi://GLib';
|
|
|
|
import GObject from 'gi://GObject';
|
|
|
|
|
2023-12-19 13:11:11 +01:00
|
|
|
import {setConsoleLogDomain} from 'console';
|
2020-03-19 20:38:16 +01:00
|
|
|
const Package = imports.package;
|
2012-01-18 21:21:56 -05:00
|
|
|
|
2020-03-19 20:38:16 +01:00
|
|
|
Package.initFormat();
|
2012-01-18 21:21:56 -05:00
|
|
|
|
2023-12-18 20:20:26 +01:00
|
|
|
import {ExtensionManager} from './extensionManager.js';
|
2023-12-19 15:14:19 +01:00
|
|
|
import {ExtensionsWindow} from './extensionsWindow.js';
|
2018-11-01 13:55:17 +01:00
|
|
|
|
2019-10-28 19:35:33 +01:00
|
|
|
var Application = GObject.registerClass(
|
2021-10-04 15:18:51 +02:00
|
|
|
class Application extends Adw.Application {
|
2019-05-28 23:22:37 +02:00
|
|
|
_init() {
|
2020-04-10 04:27:31 +02:00
|
|
|
GLib.set_prgname('gnome-extensions-app');
|
2023-08-07 00:40:20 +02:00
|
|
|
super._init({application_id: Package.name});
|
2020-11-18 02:16:26 +01:00
|
|
|
|
|
|
|
this.connect('window-removed', (a, window) => window.run_dispose());
|
2019-11-30 02:48:18 +01:00
|
|
|
}
|
|
|
|
|
2023-12-18 20:20:26 +01:00
|
|
|
get extensionManager() {
|
|
|
|
return this._extensionManager;
|
2019-11-30 02:48:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
vfunc_activate() {
|
2023-12-18 20:20:26 +01:00
|
|
|
this._extensionManager.checkForUpdates();
|
2019-11-30 02:48:18 +01:00
|
|
|
this._window.present();
|
|
|
|
}
|
|
|
|
|
|
|
|
vfunc_startup() {
|
|
|
|
super.vfunc_startup();
|
|
|
|
|
2022-07-06 14:16:38 +02:00
|
|
|
this.add_action_entries(
|
|
|
|
[{
|
|
|
|
name: 'quit',
|
|
|
|
activate: () => this._window.close(),
|
|
|
|
}]);
|
2020-10-28 21:42:48 +01:00
|
|
|
|
|
|
|
this.set_accels_for_action('app.quit', ['<Primary>q']);
|
|
|
|
|
2023-12-18 20:20:26 +01:00
|
|
|
this._extensionManager = new ExtensionManager();
|
2020-03-04 05:05:08 +01:00
|
|
|
|
2023-08-07 00:40:20 +02:00
|
|
|
this._window = new ExtensionsWindow({application: this});
|
2019-11-30 02:48:18 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-05-25 21:23:24 +02:00
|
|
|
/**
|
2023-07-30 15:56:59 +03:00
|
|
|
* Main entrypoint for the app
|
|
|
|
*
|
2023-05-25 21:23:24 +02:00
|
|
|
* @param {string[]} argv - command line arguments
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
export async function main(argv) {
|
2020-03-19 20:38:16 +01:00
|
|
|
Package.initGettext();
|
2023-12-19 13:11:11 +01:00
|
|
|
setConsoleLogDomain('Extensions');
|
2012-01-18 21:21:56 -05:00
|
|
|
|
2023-05-25 21:23:24 +02:00
|
|
|
await new Application().runAsync(argv);
|
2012-01-18 21:21:56 -05:00
|
|
|
}
|