listModes: Port listModes command to ES module

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1499>
This commit is contained in:
Evan Welsh 2023-06-07 22:13:24 -07:00 committed by Florian Müllner
parent b6e97fe449
commit 12f6d7027b
3 changed files with 11 additions and 5 deletions

View File

@ -75,6 +75,7 @@
<file>ui/keyboard.js</file>
<file>ui/layout.js</file>
<file>ui/lightbox.js</file>
<file>ui/listModes.js</file>
<file>ui/locatePointer.js</file>
<file>ui/lookingGlass.js</file>
<file>ui/magnifier.js</file>

5
js/ui/listModes.js Normal file
View File

@ -0,0 +1,5 @@
import './environment.js';
import {listModes} from './sessionMode.js';
listModes();

View File

@ -489,8 +489,7 @@ list_modes (const char *option_name,
{
ShellGlobal *global;
GjsContext *context;
const char *script;
int status;
uint8_t status;
/* Many of our imports require global to be set, so rather than
* tayloring our imports carefully here to avoid that dependency,
@ -503,9 +502,10 @@ list_modes (const char *option_name,
shell_introspection_init ();
script = "imports.ui.environment.init();"
"imports.ui.sessionMode.listModes();";
if (!gjs_context_eval (context, script, -1, "<main>", &status, NULL))
if (!gjs_context_eval_module_file (context,
"resource:///org/gnome/shell/ui/listModes.js",
&status,
NULL))
g_message ("Retrieving list of available modes failed.");
g_object_unref (context);