[polari] main: Switch to new argv API



commit 42529b5a9b70378eecc2cc2b245f3fc9f0b164b7
Author: Florian Müllner <fmuellner gnome org>
Date:   Sat Feb 13 12:56:13 2021 +0100

    main: Switch to new argv API
    
    It's slightly more convenient on the C side.
    
    https://gitlab.gnome.org/GNOME/polari/-/merge_requests/177

 src/main.js  |  4 ++--
 src/polari.c | 10 +---------
 2 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/src/main.js b/src/main.js
index 7978597e..f7905fbf 100755
--- a/src/main.js
+++ b/src/main.js
@@ -3,7 +3,7 @@ import GLib from 'gi://GLib';
 import * as Config from './config.js';
 import * as Log from './logging.js';
 import { ngettext } from 'gettext';
-import { programInvocationName } from 'system';
+import { programInvocationName, programArgs } from 'system';
 
 imports.package.init({
     name: Config.PACKAGE_NAME,
@@ -38,4 +38,4 @@ import { Application } from './application.js';
 let application = new Application();
 if (GLib.getenv('POLARI_PERSIST'))
     application.hold();
-application.run([programInvocationName, ...ARGV]);
+application.run([programInvocationName, ...programArgs]);
diff --git a/src/polari.c b/src/polari.c
index eeec766a..8cb9d454 100644
--- a/src/polari.c
+++ b/src/polari.c
@@ -97,15 +97,7 @@ main (int argc, char *argv[])
     gjs_context_setup_debugger_console (context);
 
   js_argv = get_js_argv (argc, (const char * const *)argv);
-
-  if (!gjs_context_define_string_array (context, "ARGV",
-                                        -1, (const char **)js_argv,
-                                        &error))
-    {
-      g_message ("Failed to define ARGV: %s", error->message);
-
-      return 1;
-    }
+  gjs_context_set_argv (context, g_strv_length (js_argv), (const char **)js_argv);
 
   if (get_profiler_fd (&profiler_fd))
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]