[seed] libseed: Fix include of Seed.js in non-standard prefix



commit 9aa7102b6accf366518b6d60f92d53bb08845263
Author: Robert Carr <racarr svn gnome org>
Date:   Tue May 26 03:32:48 2009 -0400

    libseed: Fix include of Seed.js in non-standard prefix
---
 configure.ac           |    6 ++++++
 libseed/Makefile.am    |    3 ++-
 libseed/seed-engine.c  |   18 ++++++++----------
 libseed/seed-path.h.in |    1 +
 4 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index 576ac19..1613fae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,6 +90,10 @@ PKG_CHECK_MODULES(GOBJECT_INTROSPECTION, gobject-introspection-1.0 >= 0.6.3)
 AC_SUBST(GOBJECT_INTROSPECTION_CFLAGS)
 AC_SUBST(GOBJECT_INTROSPECTION_LDFLAGS)
 
+dnl ========================GNOME-js common====================================
+PKG_CHECK_MODULES(GNOME_JS, gnome-js-common)
+m4_define([gnome-js-dir], [`pkg-config --variable=moduledir gnome-js-common`])
+
 dnl =============================Modules=======================================
 dnl ==== canvas ====
 AC_ARG_ENABLE(canvas-module,
@@ -410,6 +414,8 @@ modules/dbus/util/Makefile
 modules/libxml/Makefile
 modules/cairo/Makefile
 modules/gtkbuilder/Makefile
+
+libseed/seed-path.h
 ])
 AC_OUTPUT
 
diff --git a/libseed/Makefile.am b/libseed/Makefile.am
index a8a86bf..cce43ef 100644
--- a/libseed/Makefile.am
+++ b/libseed/Makefile.am
@@ -22,7 +22,8 @@ libseed_la_SOURCES = \
 	seed-types.c \
 	seed-types.h \
 	seed-importer.c \
-	seed-importer.h 
+	seed-importer.h \
+	seed-path.h
 
 libseed_la_CFLAGS = \
 	-Wall \
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index d4c1d73..08e2203 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -16,6 +16,7 @@
  */
 
 #include "seed-private.h"
+#include "seed-path.h"
 
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -348,7 +349,7 @@ seed_gobject_init_method_invoked (JSContextRef ctx,
   GIBaseInfo *info;
   GTypelib *typelib;
   InitMethodCallback c;
-  SeedArgvPrivates *priv;
+  SeedArgvPrivates *priv = NULL;
   gboolean allocated = FALSE;
 
   if (argumentCount != 1 && argumentCount != 2)
@@ -393,7 +394,7 @@ seed_gobject_init_method_invoked (JSContextRef ctx,
   typelib = g_base_info_get_typelib (info);
   g_typelib_symbol (typelib, g_function_info_get_symbol ((GIFunctionInfo *)info), (gpointer *)&c);
   // Backwards compatibility
-  if (argumentCount == 2)
+  if (!priv)
     {
       c(NULL, NULL);
       return JSValueMakeUndefined (ctx);
@@ -1353,11 +1354,11 @@ seed_init (gint * argc, gchar *** argv)
 
   seed_gtype_init (eng);
 
+
+
   defaults_script =
-	  JSStringCreateWithUTF8CString ("try{Seed.include(\"/usr/share/"
-					 "seed/extensions/Seed.js\");} catch(e){}"
-					 "Seed.include(\"/usr/local/share"
-					 "/seed/extensions/Seed.js\");");
+	  JSStringCreateWithUTF8CString ("Seed.include(\""SEED_PREFIX_PATH"\");");
+
   JSEvaluateScript (eng->context, defaults_script, NULL, NULL, 0, NULL);
 
   base_info_info =
@@ -1435,10 +1436,7 @@ seed_init_with_context_group (gint * argc,
   seed_gtype_init (eng);
 
   defaults_script =
-    JSStringCreateWithUTF8CString ("try{Seed.include(\"/usr/share/"
-				   "seed/extensions/Seed.js\");} catch(e){}"
-				   "Seed.include(\"/usr/local/share"
-				   "/seed/extensions/Seed.js\");");
+	  JSStringCreateWithUTF8CString ("Seed.include(\""SEED_PREFIX_PATH"\");");
   JSEvaluateScript (eng->context, defaults_script, NULL, NULL, 0, NULL);
   JSStringRelease (defaults_script);
 
diff --git a/libseed/seed-path.h.in b/libseed/seed-path.h.in
new file mode 100644
index 0000000..ef52348
--- /dev/null
+++ b/libseed/seed-path.h.in
@@ -0,0 +1 @@
+#define SEED_PREFIX_PATH "@prefix@""/lib/seed/"



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