extensionPrefs: Use imports.package.start()
We want to make the extensions app code more self-contained to make it easier to build separately, and ultimately make it available on flathub. One complication we are facing is that it is currently all over the source tree: - js/extensionPrefs for the main code - src for the launcher process - data for .desktop file and icons Switching from a C launcher to the imports.package module allows us to consolidate the first two, and will also take care of the annoying setup bits (defining JS search path, extending GI lookup, loading resources). https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1081
This commit is contained in:

committed by
Florian Müllner

parent
9829d56bfa
commit
e572d5d08c
@ -1,51 +0,0 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gjs/gjs.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
const char *search_path[] = { "resource:///org/gnome/shell", NULL };
|
||||
GError *error = NULL;
|
||||
GjsContext *context;
|
||||
int status;
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
context = g_object_new (GJS_TYPE_CONTEXT,
|
||||
"search-path", search_path,
|
||||
NULL);
|
||||
|
||||
if (!gjs_context_define_string_array(context, "ARGV",
|
||||
argc - 1, (const char**)argv + 1,
|
||||
&error))
|
||||
{
|
||||
g_message("Failed to defined ARGV: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (context);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!gjs_context_eval (context,
|
||||
"const Main = imports.extensionPrefs.main; Main.main(ARGV);",
|
||||
-1,
|
||||
"<main>",
|
||||
&status,
|
||||
&error))
|
||||
{
|
||||
g_message ("Execution of main.js threw exception: %s", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (context);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
g_object_unref (context);
|
||||
return 0;
|
||||
}
|
@ -249,15 +249,6 @@ executable('gnome-shell', 'main.c',
|
||||
install: true
|
||||
)
|
||||
|
||||
executable('gnome-shell-extension-prefs',
|
||||
'gnome-shell-extension-prefs.c', prefs_resources,
|
||||
c_args: tools_cflags,
|
||||
dependencies: tools_deps,
|
||||
include_directories: [conf_inc],
|
||||
install: true
|
||||
)
|
||||
|
||||
|
||||
if have_networkmanager
|
||||
executable('gnome-shell-portal-helper',
|
||||
'gnome-shell-portal-helper.c', portal_resources,
|
||||
|
Reference in New Issue
Block a user