From 077a39ed27a136c650be3cfb3447ab0a96259a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Istv=C3=A1n=20Derda?= Date: Sat, 9 Sep 2023 23:59:47 +0200 Subject: [PATCH] gnome shell ui imports --- port.sh | 2 ++ src/extension.js | 8 ++++---- src/shell/device.js | 4 ++-- src/shell/gmenu.js | 2 +- src/shell/keybindings.js | 2 +- src/shell/notification.js | 6 +++--- src/shell/tooltip.js | 2 +- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/port.sh b/port.sh index c2a4c9a6f..4e4d4481e 100755 --- a/port.sh +++ b/port.sh @@ -2,3 +2,5 @@ find . -type f -exec sed -i -E 's-(const|let|var) (.*) = *imports\.gi\.(.*);-imp find . -type f -name "*.js" -exec sed -i -E 's-^.*imports.*$-\0 //todo port import-g' {} + find . -type f -name "*.js" -exec sed -i -E 's-const (.*) = Extension\.imports\.([^.]*)\.?([^.]+)?;.*$-import * as \1 from "./\2/\3.js";-g' {} + find . -type f -name "*.js" -exec sed -i -E '/imports.misc.extensionUtils.getCurrentExtension/d' {} + +find src -type f -name "*.js" -exec sed -i -E 's_const (.*) = imports.ui.(.*);.*$_import * as \1 from "resource:///org/gnome/shell/ui/\2.js";_g' {} + + diff --git a/src/extension.js b/src/extension.js index 79e259c3a..34c69cb9e 100644 --- a/src/extension.js +++ b/src/extension.js @@ -8,11 +8,11 @@ import * as Gio from "gi://Gio"; import * as GObject from "gi://GObject"; import * as Gtk from "gi://Gtk"; -const Main = imports.ui.main; //todo port import -const PanelMenu = imports.ui.panelMenu; //todo port import -const PopupMenu = imports.ui.popupMenu; //todo port import +import * as Main from "resource:///org/gnome/shell/ui/main.js"; +import * as PanelMenu from "resource:///org/gnome/shell/ui/panelMenu.js"; +import * as PopupMenu from "resource:///org/gnome/shell/ui/popupMenu.js"; const QuickSettingsMenu = Main.panel.statusArea.quickSettings; -const QuickSettings = imports.ui.quickSettings; //todo port import +import * as QuickSettings from "resource:///org/gnome/shell/ui/quickSettings.js"; // Bootstrap import * as Utils from "./shell/utils.js"; diff --git a/src/shell/device.js b/src/shell/device.js index 25353121a..00552c8cb 100644 --- a/src/shell/device.js +++ b/src/shell/device.js @@ -8,8 +8,8 @@ import * as Clutter from "gi://Clutter"; import * as GObject from "gi://GObject"; import * as St from "gi://St"; -const PanelMenu = imports.ui.panelMenu; //todo port import -const PopupMenu = imports.ui.popupMenu; //todo port import +import * as PanelMenu from "resource:///org/gnome/shell/ui/panelMenu.js"; +import * as PopupMenu from "resource:///org/gnome/shell/ui/popupMenu.js"; // eslint-disable-next-line no-redeclare diff --git a/src/shell/gmenu.js b/src/shell/gmenu.js index a5cf5f975..38f706161 100644 --- a/src/shell/gmenu.js +++ b/src/shell/gmenu.js @@ -10,7 +10,7 @@ import * as Gio from "gi://Gio"; import * as GObject from "gi://GObject"; import * as St from "gi://St"; -const PopupMenu = imports.ui.popupMenu; //todo port import +import * as PopupMenu from "resource:///org/gnome/shell/ui/popupMenu.js"; import * as Tooltip from "./shell/tooltip.js"; diff --git a/src/shell/keybindings.js b/src/shell/keybindings.js index 22b6ed12a..4c1fbaf99 100644 --- a/src/shell/keybindings.js +++ b/src/shell/keybindings.js @@ -5,7 +5,7 @@ 'use strict'; const Config = imports.misc.config; //todo port import -const Main = imports.ui.main; //todo port import +import * as Main from "resource:///org/gnome/shell/ui/main.js"; import * as Meta from "gi://Meta"; import * as Shell from "gi://Shell"; diff --git a/src/shell/notification.js b/src/shell/notification.js index 0d8d29d09..75787a471 100644 --- a/src/shell/notification.js +++ b/src/shell/notification.js @@ -9,9 +9,9 @@ import * as GLib from "gi://GLib"; import * as GObject from "gi://GObject"; import * as St from "gi://St"; -const Main = imports.ui.main; //todo port import -const MessageTray = imports.ui.messageTray; //todo port import -const NotificationDaemon = imports.ui.notificationDaemon; //todo port import +import * as Main from "resource:///org/gnome/shell/ui/main.js"; +import * as MessageTray from "resource:///org/gnome/shell/ui/messageTray.js"; +import * as NotificationDaemon from "resource:///org/gnome/shell/ui/notificationDaemon.js"; // eslint-disable-next-line no-redeclare diff --git a/src/shell/tooltip.js b/src/shell/tooltip.js index 48c306d1f..61465381e 100644 --- a/src/shell/tooltip.js +++ b/src/shell/tooltip.js @@ -10,7 +10,7 @@ import * as GLib from "gi://GLib"; import * as Pango from "gi://Pango"; import * as St from "gi://St"; -const Main = imports.ui.main; //todo port import +import * as Main from "resource:///org/gnome/shell/ui/main.js"; /**