[gnome-weather/wip/ewlsh/gtk4] Improve load script
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-weather/wip/ewlsh/gtk4] Improve load script
- Date: Sun, 30 Jan 2022 21:26:52 +0000 (UTC)
commit 562bb4e0da58bcab4d9038a556075e928746a7df
Author: Evan Welsh <contact evanwelsh com>
Date: Sun Jan 30 13:26:48 2022 -0800
Improve load script
src/app/main.js | 20 ++++++++------------
src/org.gnome.Weather.in | 8 +++-----
2 files changed, 11 insertions(+), 17 deletions(-)
---
diff --git a/src/app/main.js b/src/app/main.js
index a373e86..d66851d 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -28,6 +28,8 @@ import 'gi://Gtk?version=4.0';
import 'gi://Adw?version=1';
import 'gi://GWeather?version=4.0';
+import * as system from 'system';
+
import Adw from 'gi://Adw';
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
@@ -48,12 +50,6 @@ const ShellIntegrationInterface = new TextDecoder().decode(
Gio.resources_lookup_data('/org/gnome/shell/ShellWeatherIntegration.xml', 0).get_data()
);
-function initEnvironment() {
- window.getApp = function () {
- return Gio.Application.get_default();
- };
-}
-
const MAIN_WINDOW = {};
const Application = GObject.registerClass(
@@ -284,12 +280,12 @@ let ShellIntegration = class ShellIntegration {
}
};
-export function main(argv) {
- initEnvironment();
+globalThis.getApp = function () {
+ return Gio.Application.get_default();
+};
- let application = new Application();
+let application = new Application();
- application.run(argv);
+application.run([system.programInvocationName, ...system.programArgs]);
+application = null;
- application = null;
-}
diff --git a/src/org.gnome.Weather.in b/src/org.gnome.Weather.in
index b3a6153..901f7d1 100755
--- a/src/org.gnome.Weather.in
+++ b/src/org.gnome.Weather.in
@@ -4,9 +4,7 @@ imports.package.init({ name: "@APP_ID@",
prefix: "@prefix@",
libdir: "@libdir@" });
-import(`resource:///org/gnome/Weather@profile@/js/app/main.js`).then(({ main }) => {
- main([imports.system.programInvocationName, ...imports.system.programArgs]);
-}).catch(error => {
- logError(error);
- System.exit(1);
+import(`resource:///org/gnome/Weather@profile@/js/app/main.js`).catch(error => {
+ console.error(error);
+ imports.system.exit(1);
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]