56b20ef779
This will be required in the upcoming version of GJS. https://bugzilla.gnome.org/show_bug.cgi?id=775374
56 lines
1.4 KiB
C
56 lines
1.4 KiB
C
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
#include "config.h"
|
|
|
|
#include <girepository.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);
|
|
|
|
g_irepository_prepend_search_path (GNOME_SHELL_PKGLIBDIR);
|
|
|
|
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;
|
|
}
|