[gnome-shell/wip/ptomato/remove-gjs-internal-api] WIP - Remove ShellJS gir



commit a1e41b651970ffdb176b981c1bda38294ad37a3f
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Oct 4 22:27:18 2016 -0700

    WIP - Remove ShellJS gir
    
    You can define a new importer object by importing a subdirectory in GJS.
    This is undocumented, but it is likely to at least hold until the whole
    thing moves to ES6 modules.

 js/misc/extensionUtils.js         |   11 ++---
 src/Makefile.am                   |   32 ++-------------
 src/gnome-shell-extension-prefs.c |   17 --------
 src/main.c                        |   15 -------
 src/shell-js.cpp                  |   78 -------------------------------------
 src/shell-js.h                    |   16 --------
 6 files changed, 8 insertions(+), 161 deletions(-)
---
diff --git a/js/misc/extensionUtils.js b/js/misc/extensionUtils.js
index 1d1221c..3196bf5 100644
--- a/js/misc/extensionUtils.js
+++ b/js/misc/extensionUtils.js
@@ -6,9 +6,7 @@
 const Lang = imports.lang;
 const Signals = imports.signals;
 
-const GLib = imports.gi.GLib;
 const Gio = imports.gi.Gio;
-const ShellJS = imports.gi.ShellJS;
 
 const Config = imports.misc.config;
 const FileUtils = imports.misc.fileUtils;
@@ -140,12 +138,11 @@ function createExtensionObject(uuid, dir, type) {
     return extension;
 }
 
-var _extension = null;
-
 function installImporter(extension) {
-    _extension = extension;
-    ShellJS.add_extension_importer('imports.misc.extensionUtils._extension', 'imports', extension.path);
-    _extension = null;
+    let oldSearchPath = imports.searchPath.slice();  // make a copy
+    imports.searchPath = [extension.path];
+    extension.imports = imports['.'];  // "subdir" creates a new importer object
+    imports.searchPath = oldSearchPath;
 }
 
 const ExtensionFinder = new Lang.Class({
diff --git a/src/Makefile.am b/src/Makefile.am
index e9aacfe..506bf91 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -78,7 +78,7 @@ gnome_shell_cflags =                          \
        -DGNOME_SHELL_PKGLIBDIR=\"$(pkglibdir)\"
 
 privlibdir = $(pkglibdir)
-privlib_LTLIBRARIES = libgnome-shell-js.la libgnome-shell-menu.la libgnome-shell.la
+privlib_LTLIBRARIES = libgnome-shell-menu.la libgnome-shell.la
 noinst_LTLIBRARIES += libgnome-shell-base.la
 
 shell_built_sources = \
@@ -200,7 +200,7 @@ gnome_shell_CPPFLAGS = \
 
 # Here, and after, we repeat mutter and bluetooth libraries just for the rpath
 # The dependency is already pulled in by libtool
-gnome_shell_LDADD = libgnome-shell.la libgnome-shell-js.la $(GNOME_SHELL_LIBS) $(MUTTER_LIBS)
+gnome_shell_LDADD = libgnome-shell.la $(GNOME_SHELL_LIBS) $(MUTTER_LIBS)
 gnome_shell_LDFLAGS = -rpath $(MUTTER_TYPELIB_DIR)
 gnome_shell_DEPENDENCIES = libgnome-shell.la
 
@@ -212,7 +212,7 @@ nodist_gnome_shell_extension_prefs_SOURCES = \
        $(top_builddir)/js/js-resources.h               \
        $(NULL)
 gnome_shell_extension_prefs_CPPFLAGS = $(gnome_shell_cflags)
-gnome_shell_extension_prefs_LDADD = libgnome-shell-js.la $(GNOME_SHELL_LIBS)
+gnome_shell_extension_prefs_LDADD = $(GNOME_SHELL_LIBS)
 gnome_shell_extension_prefs_LDFLAGS = -rpath $(MUTTER_TYPELIB_DIR)
 
 if HAVE_NETWORKMANAGER
@@ -226,30 +226,13 @@ nodist_gnome_shell_portal_helper_SOURCES = \
        $(top_builddir)/js/js-resources.h               \
        $(NULL)
 gnome_shell_portal_helper_CPPFLAGS = $(gnome_shell_cflags)
-gnome_shell_portal_helper_LDADD = libgnome-shell-js.la $(GNOME_SHELL_LIBS)
+gnome_shell_portal_helper_LDADD = $(GNOME_SHELL_LIBS)
 gnome_shell_portal_helper_LDFLAGS = -rpath $(MUTTER_TYPELIB_DIR)
 
 endif
 
 ########################################
 
-libgnome_shell_js_la_SOURCES =         \
-       shell-js.h                      \
-       shell-js.cpp                    \
-       $(NULL)
-
-libgnome_shell_js_la_LIBADD =          \
-       $(GNOME_SHELL_JS_LIBS)          \
-       $(NULL)
-
-libgnome_shell_js_la_LDFLAGS =         \
-       -avoid-version
-
-libgnome_shell_js_la_CPPFLAGS =                \
-       $(GNOME_SHELL_JS_CFLAGS)
-
-########################################
-
 shell_recorder_sources =        \
        shell-recorder.c        \
        shell-recorder.h
@@ -366,13 +349,6 @@ Shell_0_1_gir_SCANNERFLAGS =       \
 INTROSPECTION_GIRS += Shell-0.1.gir
 CLEANFILES += Shell-0.1.gir
 
-ShellJS-0.1.gir: libgnome-shell-js.la
-ShellJS_0_1_gir_CFLAGS = $(libgnome_shell_la_CPPFLAGS) -I $(srcdir)
-ShellJS_0_1_gir_LIBS = libgnome-shell-js.la
-ShellJS_0_1_gir_FILES = $(libgnome_shell_js_la_SOURCES)
-INTROSPECTION_GIRS += ShellJS-0.1.gir
-CLEANFILES += ShellJS-0.1.gir
-
 St-1.0.gir: libst-1.0.la
 St_1_0_gir_INCLUDES = Clutter-1.0 Gtk-3.0
 St_1_0_gir_CFLAGS = $(st_cflags) -DST_COMPILATION
diff --git a/src/gnome-shell-extension-prefs.c b/src/gnome-shell-extension-prefs.c
index 973f3c1..967e615 100644
--- a/src/gnome-shell-extension-prefs.c
+++ b/src/gnome-shell-extension-prefs.c
@@ -6,8 +6,6 @@
 #include <gjs/gjs.h>
 #include <glib/gi18n.h>
 
-#include "shell-js.h"
-
 int
 main (int argc, char *argv[])
 {
@@ -51,18 +49,3 @@ main (int argc, char *argv[])
 
   return 0;
 }
-
-
-/* HACK:
-   Add a dummy function that calls into libgnome-shell-js.so to ensure it's
-   linked to /usr/bin/gnome-shell-extension-prefs even when linking with
-   --as-needed. This function is never actually called.
-   https://bugzilla.gnome.org/show_bug.cgi?id=670477
-*/
-void _shell_link_to_shell_js (void);
-
-void
-_shell_link_to_shell_js (void)
-{
-  shell_js_add_extension_importer (NULL, NULL, NULL, NULL);
-}
diff --git a/src/main.c b/src/main.c
index e8ac998..25d2778 100644
--- a/src/main.c
+++ b/src/main.c
@@ -25,7 +25,6 @@
 
 #include "shell-global.h"
 #include "shell-global-private.h"
-#include "shell-js.h"
 #include "shell-perf-log.h"
 #include "st.h"
 
@@ -480,17 +479,3 @@ main (int argc, char **argv)
 
   return ecode;
 }
-
-/* HACK:
-   Add a dummy function that calls into libgnome-shell-js.so to ensure it's
-   linked to /usr/bin/gnome-shell even when linking with --as-needed.
-   This function is never actually called.
-   https://bugzilla.gnome.org/show_bug.cgi?id=670477
-*/
-void _shell_link_to_shell_js (void);
-
-void
-_shell_link_to_shell_js (void)
-{
-  shell_js_add_extension_importer (NULL, NULL, NULL, NULL);
-}


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