summaryrefslogtreecommitdiffstats
path: root/src/gnome-shell-portal-helper.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 15:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 15:07:22 +0000
commitf9d480cfe50ca1d7a0f0b5a2b8bb9932962bfbe7 (patch)
treece9e8db2d4e8799780fa72ae8f1953039373e2ee /src/gnome-shell-portal-helper.c
parentInitial commit. (diff)
downloadgnome-shell-f9d480cfe50ca1d7a0f0b5a2b8bb9932962bfbe7.tar.xz
gnome-shell-f9d480cfe50ca1d7a0f0b5a2b8bb9932962bfbe7.zip
Adding upstream version 3.38.6.upstream/3.38.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/gnome-shell-portal-helper.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/gnome-shell-portal-helper.c b/src/gnome-shell-portal-helper.c
new file mode 100644
index 0000000..a0bebb2
--- /dev/null
+++ b/src/gnome-shell-portal-helper.c
@@ -0,0 +1,52 @@
+/* -*- 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, (const char**)argv,
+ &error))
+ {
+ g_message("Failed to define ARGV: %s", error->message);
+ g_error_free (error);
+ g_object_unref (context);
+
+ return 1;
+ }
+
+
+ if (!gjs_context_eval (context,
+ "const Main = imports.portalHelper.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;
+}