Load JS from GResource

Since gjs can now load JS from a GResource, compile it in the
gnome-shell binary. This should be a bit faster, and make life easier
with JHBuild.
This commit is contained in:
Cosimo Cecchi
2013-07-01 23:54:53 -07:00
committed by Jasper St. Pierre
parent 9d2791d9f8
commit 1ebb162a00
6 changed files with 145 additions and 114 deletions

View File

@@ -75,8 +75,7 @@ gnome_shell_cflags = \
-DDATADIR=\"$(datadir)\" \
-DGNOME_SHELL_LIBEXECDIR=\"$(libexecdir)\" \
-DGNOME_SHELL_DATADIR=\"$(pkgdatadir)\" \
-DGNOME_SHELL_PKGLIBDIR=\"$(pkglibdir)\" \
-DJSDIR=\"$(pkgdatadir)/js\"
-DGNOME_SHELL_PKGLIBDIR=\"$(pkglibdir)\"
privlibdir = $(pkglibdir)
privlib_LTLIBRARIES = libgnome-shell-js.la libgnome-shell-menu.la libgnome-shell.la
@@ -171,6 +170,8 @@ libgnome_shell_sources = \
shell-util.c \
shell-window-tracker.c \
shell-wm.c \
../js/js-resources.c \
../js/js-resources.h \
$(NULL)
libgnome_shell_la_SOURCES = $(libgnome_shell_sources)
@@ -207,7 +208,7 @@ endif HAVE_MUTTER_WAYLAND
libgnome_shell_js_la_SOURCES = \
shell-js.h \
shell-js.cpp \
shell-js.cpp \
$(NULL)
libgnome_shell_js_la_LIBADD = \

View File

@@ -283,9 +283,16 @@ shell_global_init (ShellGlobal *global)
NULL);
ca_context_open (global->sound_context);
if (!shell_js)
shell_js = JSDIR;
search_path = g_strsplit (shell_js, ":", -1);
if (shell_js)
{
search_path = g_strsplit (shell_js, ":", -1);
}
else
{
search_path = g_malloc0 (2 * sizeof (char *));
search_path[0] = g_strdup ("resource:///org/gnome/shell");
}
global->js_context = g_object_new (GJS_TYPE_CONTEXT,
"search-path", search_path,
"js-version", "1.8",