From 997a90d7cc9b458ec1c94821a12f9dd6f120ba10 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 23 Jan 2007 23:14:22 +0100 Subject: [PATCH] Actually make it work on 1.9. Had to disable some stuff, temporarily. --- configure.ac | 2 +- lib/python/Makefile.am | 4 +++- lib/python/_sugarmodule.c | 4 ++++ lib/src/sugar-browser.cpp | 18 +++++++++++++++--- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index f55b2f1b..47443dac 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,7 @@ if test "x$with_libxul_sdk" != x ; then # xulrunner 1.9 -GECKO_CFLAGS="-I$with_libxul_sdk/sdk/include" +GECKO_CFLAGS="-I$with_libxul_sdk/sdk/include -DXPCOM_GLUE" XPCOMGLUE_LIBS="-L$with_libxul_sdk/sdk/lib -lxpcomglue" MOZILLA_INCLUDE_DIR="$with_libxul_sdk/include" diff --git a/lib/python/Makefile.am b/lib/python/Makefile.am index fb16653b..7d249501 100644 --- a/lib/python/Makefile.am +++ b/lib/python/Makefile.am @@ -20,7 +20,9 @@ _sugar_la_LIBADD = \ $(top_builddir)/lib/src/libsugarprivate.la _sugar_la_SOURCES = \ - _sugarmodule.c + _sugarmodule.c \ + xulrunner.cpp \ + xulrunner.h nodist__sugar_la_SOURCES = _sugar.c diff --git a/lib/python/_sugarmodule.c b/lib/python/_sugarmodule.c index c576efb0..01b4e69f 100644 --- a/lib/python/_sugarmodule.c +++ b/lib/python/_sugarmodule.c @@ -2,6 +2,8 @@ #include "config.h" #endif +#include "xulrunner.h" + /* include this first, before NO_IMPORT_PYGOBJECT is defined */ #include @@ -17,6 +19,8 @@ init_sugar(void) { PyObject *m, *d; + xulrunner_startup(); + init_pygobject (); Pycairo_IMPORT; diff --git a/lib/src/sugar-browser.cpp b/lib/src/sugar-browser.cpp index eec10df5..fe94378a 100644 --- a/lib/src/sugar-browser.cpp +++ b/lib/src/sugar-browser.cpp @@ -17,6 +17,8 @@ * Boston, MA 02111-1307, USA. */ +#include + #include "sugar-browser.h" #include "GeckoContentHandler.h" #include "GeckoDownload.h" @@ -35,9 +37,6 @@ #include #include -NS_GENERIC_FACTORY_CONSTRUCTOR(GeckoContentHandler) -NS_GENERIC_FACTORY_CONSTRUCTOR(GeckoDownload) - enum { PROP_0, PROP_PROGRESS, @@ -48,6 +47,11 @@ enum { PROP_LOADING }; +#ifndef HAVE_GECKO_1_9 + +NS_GENERIC_FACTORY_CONSTRUCTOR(GeckoContentHandler) +NS_GENERIC_FACTORY_CONSTRUCTOR(GeckoDownload) + static const nsModuleComponentInfo sSugarComponents[] = { { "Gecko Content Handler", @@ -63,6 +67,8 @@ static const nsModuleComponentInfo sSugarComponents[] = { } }; +#endif + gboolean sugar_browser_startup(const char *profile_path, const char *profile_name) { @@ -97,6 +103,8 @@ sugar_browser_startup(const char *profile_path, const char *profile_name) g_warning ("failed to read user preferences, error: %x", rv); } +#ifndef HAVE_GECKO_1_9 + /* Register our components */ nsCOMPtr componentRegistrar; NS_GetComponentRegistrar(getter_AddRefs(componentRegistrar)); @@ -135,6 +143,8 @@ sugar_browser_startup(const char *profile_path, const char *profile_name) } } } + +#endif return TRUE; } @@ -370,6 +380,7 @@ sugar_browser_scroll_pixels(SugarBrowser *browser, int dx, int dy) { +#ifndef HAVE_GECKO_1_9 nsCOMPtr webBrowser; gtk_moz_embed_get_nsIWebBrowser (GTK_MOZ_EMBED(browser), getter_AddRefs(webBrowser)); @@ -387,6 +398,7 @@ sugar_browser_scroll_pixels(SugarBrowser *browser, NS_ENSURE_TRUE (DOMWindow, ); DOMWindow->ScrollBy (dx, dy); +#endif } void