Commit 0639ac04 authored by Don Scorgie's avatar Don Scorgie

Add support for XULRunner / Firefox 3 backend Bug # 499744 - Patch from

* configure.in:
* m4/gecko.m4:
* src/Makefile.am:
* src/yelp-gecko-services.cpp:
* src/yelp-gecko-utils.cpp:
* src/yelp-io-channel.c:
* src/yelp-main.c (main):
Add support for XULRunner / Firefox 3 backend
Bug # 499744 - Patch from Christian Persch

svn path=/trunk/; revision=3131
parent 4f12aae0
2008-05-23 Don Scorgie <dscorgie@svn.gnome.org>
* configure.in:
* m4/gecko.m4:
* src/Makefile.am:
* src/yelp-gecko-services.cpp:
* src/yelp-gecko-utils.cpp:
* src/yelp-io-channel.c:
* src/yelp-main.c (main):
Add support for XULRunner / Firefox 3 backend
Bug # 499744 - Patch from Christian Persch
=== 2.22.1 ===
2008-04-07 Shaun McCance <shaunm@gnome.org>
......
......@@ -25,6 +25,8 @@ AC_HEADER_STDC
AM_PROG_LIBTOOL
AM_PATH_GLIB_2_0
AM_PROG_CC_C_O
GNOME_DEBUG_CHECK
GNOME_COMPILE_WARNINGS([maximum])
GNOME_CXX_WARNINGS
......@@ -174,27 +176,6 @@ esac
AC_SUBST([YELP_SEARCH_CFLAGS])
AC_SUBST([YELP_SEARCH_LIBS])
# *****
# Gecko
# *****
GECKO_INIT([MOZILLA])
AC_SUBST([MOZILLA])
AC_SUBST([MOZILLA_FLAVOUR])
AC_SUBST([MOZILLA_INCLUDE_ROOT])
AC_SUBST([MOZILLA_HOME])
AC_SUBST([MOZILLA_PREFIX])
AC_SUBST([MOZILLA_EXTRA_LIBS])
AC_SUBST([MOZILLA_GLUE_LIBS])
case "$MOZILLA" in
xulrunner) gecko_min_version=1.8 ;;
*firefox) gecko_min_version=1.5 ;;
*) AC_MSG_ERROR([$gecko_cv_gecko is not supported])
esac
PKG_CHECK_MODULES([MOZILLA_COMPONENT],[${gecko_cv_gecko}-xpcom >= $gecko_min_version $gecko_cv_extra_pkg_dependencies])
dnl ====================================
dnl = zlib for help converters
......@@ -235,6 +216,36 @@ dnl <= Check for bzip2 > 1.0.0
dnl =>
AC_SUBST(BZ_LIBS)
# *****
# Gecko
# *****
GECKO_INIT([MOZILLA])
GECKO_DEFINES
AC_SUBST([MOZILLA])
AC_SUBST([MOZILLA_FLAVOUR])
AC_SUBST([MOZILLA_INCLUDE_ROOT])
AC_SUBST([MOZILLA_HOME])
AC_SUBST([MOZILLA_PREFIX])
AC_SUBST([MOZILLA_EXTRA_LIBS])
AC_SUBST([MOZILLA_GLUE_LIBS])
case "$MOZILLA" in
xulrunner) gecko_min_version=1.8 ;;
libxul*) gecko_min_version=1.9 ;;
*firefox) gecko_min_version=1.5 ;;
*) AC_MSG_ERROR([$gecko_cv_gecko is not supported])
esac
if test $MOZILLA = libxul-embedding; then
PKG_CHECK_MODULES([MOZILLA_COMPONENT],[libxul-embedding $gecko_cv_extra_pkg_dependencies])
MOZILLA_COMPONENT_CFLAGS="$MOZILLA_COMPONENT_CFLAGS `$PKG_CONFIG --cflags ${gecko_cv_gecko}` `$PKG_CONFIG --define-variable=includetype=unstable --cflags ${gecko_cv_gecko}`"
else
PKG_CHECK_MODULES([MOZILLA_COMPONENT],[${gecko_cv_gecko}-xpcom >= $gecko_min_version $gecko_cv_extra_pkg_dependencies])
fi
# Set flags
AM_CPPFLAGS="$AM_CPPFLAGS $DEPRECATION_FLAGS"
......
......@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# GECKO_INIT(VARIABLE,[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
#
......@@ -32,6 +32,7 @@
# VARIABLE: Which gecko was found (e.g. "xulrunnner", "seamonkey", ...)
# VARIABLE_FLAVOUR: The flavour of the gecko that was found
# VARIABLE_HOME:
# VARIABLE_NSPR: set if nspr is provided by gecko flags
# VARIABLE_PREFIX:
# VARIABLE_INCLUDE_ROOT:
# VARIABLE_VERSION: The version of the gecko that was found
......@@ -51,7 +52,7 @@ AC_PROG_AWK
AC_MSG_CHECKING([which gecko to use])
AC_ARG_WITH([gecko],
AS_HELP_STRING([--with-gecko@<:@=mozilla|firefox|seamonkey|xulrunner@:>@],
AS_HELP_STRING([--with-gecko@<:@=mozilla|firefox|seamonkey|xulrunner|libxul-embedding|libxul@:>@],
[Which gecko engine to use (autodetected by default)]))
# Backward compat
......@@ -60,12 +61,15 @@ AC_ARG_WITH([mozilla],[],[with_gecko=$withval],[])
gecko_cv_gecko=$with_gecko
# Autodetect gecko
_geckos="xulrunner firefox mozilla-firefox seamonkey mozilla"
_geckos="xulrunner firefox mozilla-firefox seamonkey mozilla libxul-embedding libxul"
if test -z "$gecko_cv_gecko"; then
for lizard in $_geckos; do
if $PKG_CONFIG --exists $lizard-xpcom; then
gecko_cv_gecko=$lizard
break;
elif $PKG_CONFIG --exists $lizard-unstable; then
gecko_cv_gecko=$lizard
break;
fi
done
fi
......@@ -82,6 +86,14 @@ else
gecko_cv_have_gecko=yes
fi
AC_MSG_CHECKING([manual gecko home set])
AC_ARG_WITH([gecko-home],
AS_HELP_STRING([--with-gecko-home@<:@=[path]@:>@],
[Manually set MOZILLA_FIVE_HOME]))
gecko_cv_gecko_home=$with_gecko_home
# ****************
# Define variables
# ****************
......@@ -93,27 +105,38 @@ mozilla) gecko_cv_gecko_flavour=mozilla ;;
seamonkey) gecko_cv_gecko_flavour=mozilla ;;
*firefox) gecko_cv_gecko_flavour=toolkit ;;
xulrunner) gecko_cv_gecko_flavour=toolkit ;;
libxul*) gecko_cv_gecko_flavour=toolkit ;;
esac
_GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir ${gecko_cv_gecko}-xpcom`"
_GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
_GECKO_HOME="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
_GECKO_PREFIX="`$PKG_CONFIG --variable=prefix ${gecko_cv_gecko}-xpcom`"
if $PKG_CONFIG --exists ${gecko_cv_gecko}-xpcom; then
_GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir ${gecko_cv_gecko}-xpcom`"
_GECKO_CFLAGS="-I$_GECKO_INCLUDE_ROOT"
_GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
_GECKO_HOME="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
_GECKO_PREFIX="`$PKG_CONFIG --variable=prefix ${gecko_cv_gecko}-xpcom`"
_GECKO_NSPR=no # XXX asac: this is currently a blind guess and should be a AC test
else
_GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir ${gecko_cv_gecko}`/unstable"
_GECKO_CFLAGS="`$PKG_CONFIG --cflags ${gecko_cv_gecko}` `$PKG_CONFIG --cflags ${gecko_cv_gecko}-unstable`"
_GECKO_LIBDIR="`$PKG_CONFIG --variable=sdkdir ${gecko_cv_gecko}`/bin"
_GECKO_HOME=$with_gecko_home
_GECKO_PREFIX="`$PKG_CONFIG --variable=prefix ${gecko_cv_gecko}`"
_GECKO_NSPR=no # XXX asac: this is currently a blind guess and should be a AC test
fi
fi # if gecko_cv_have_gecko
if test "$gecko_cv_gecko_flavour" = "toolkit"; then
AC_DEFINE([HAVE_MOZILLA_TOOLKIT],[1],[Define if mozilla is of the toolkit flavour])
fi
AM_CONDITIONAL([HAVE_MOZILLA_TOOLKIT],[test "$gecko_cv_gecko_flavour" = "toolkit"])
$1[]=$gecko_cv_gecko
$1[]_FLAVOUR=$gecko_cv_gecko_flavour
$1[]_INCLUDE_ROOT=$_GECKO_INCLUDE_ROOT
$1[]_CFLAGS=$_GECKO_CFLAGS
$1[]_LIBDIR=$_GECKO_LIBDIR
$1[]_HOME=$_GECKO_HOME
$1[]_PREFIX=$_GECKO_PREFIX
$1[]_NSPR=$_GECKO_NSPR
# **************************************************************
# This is really gcc-only
......@@ -184,7 +207,7 @@ if test "$gecko_cv_have_gecko" = "yes"; then
AC_LANG_PUSH([C++])
_SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS -I$_GECKO_INCLUDE_ROOT"
CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS $_GECKO_CFLAGS"
AC_MSG_CHECKING([[whether we have a gtk 2 gecko build]])
AC_RUN_IFELSE(
......@@ -217,6 +240,18 @@ AC_COMPILE_IFELSE(
[gecko_cv_have_debug=no])
AC_MSG_RESULT([$gecko_cv_have_debug])
AC_MSG_CHECKING([[whether we have a xpcom glue]])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE(
[[
#ifndef XPCOM_GLUE
#error "no xpcom glue found"
#endif]]
)],
[gecko_cv_have_xpcom_glue=yes],
[gecko_cv_have_xpcom_glue=no])
AC_MSG_RESULT([$gecko_cv_have_xpcom_glue])
CPPFLAGS="$_SAVE_CPPFLAGS"
AC_LANG_POP([C++])
......@@ -228,9 +263,11 @@ if test "$gecko_cv_have_debug" = "yes"; then
AC_DEFINE([HAVE_GECKO_DEBUG],[1],[Define if gecko is a debug build])
fi
fi # if gecko_cv_have_gecko
if test "$gecko_cv_have_xpcom_glue" = "yes"; then
AC_DEFINE([HAVE_GECKO_XPCOM_GLUE],[1],[Define if xpcom glue is used])
fi
AM_CONDITIONAL([HAVE_GECKO_DEBUG],[test "$gecko_cv_have_debug" = "yes"])
fi # if gecko_cv_have_gecko
# ***********************
# Check for gecko version
......@@ -241,7 +278,7 @@ if test "$gecko_cv_have_gecko" = "yes"; then
AC_LANG_PUSH([C++])
_SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT"
CPPFLAGS="$CPPFLAGS $_GECKO_CFLAGS"
AC_CACHE_CHECK([for gecko version],
[gecko_cv_gecko_version],
......@@ -311,11 +348,6 @@ fi
fi # if gecko_cv_have_gecko
AM_CONDITIONAL([HAVE_GECKO_1_7],[test "$gecko_cv_gecko_version_int" -ge "1007000"])
AM_CONDITIONAL([HAVE_GECKO_1_8],[test "$gecko_cv_gecko_version_int" -ge "1008000"])
AM_CONDITIONAL([HAVE_GECKO_1_8_1],[test "$gecko_cv_gecko_version_int" -ge "1008001"])
AM_CONDITIONAL([HAVE_GECKO_1_9],[test "$gecko_cv_gecko_version_int" -ge "1009000"])
$1[]_VERSION=$gecko_cv_gecko_version
$1[]_VERSION_INT=$gecko_cv_gecko_version_int
......@@ -328,8 +360,11 @@ gecko_cv_glue_libs=
gecko_cv_extra_pkg_dependencies=
if test "$gecko_cv_gecko_version_int" -ge "1009000"; then
gecko_cv_extra_libs="-L$_GECKO_LIBDIR -lxul"
gecko_cv_glue_libs="-L$_GECKO_LIBDIR -lxpcomglue_s"
if ! test "$gecko_cv_have_xpcom_glue" = "yes"; then
gecko_cv_extra_libs="-L$_GECKO_LIBDIR -lxul"
else
gecko_cv_glue_libs="-L$_GECKO_LIBDIR -lxpcomglue"
fi
else
gecko_cv_extra_pkg_dependencies="${gecko_cv_gecko}-gtkmozembed"
fi
......@@ -340,6 +375,29 @@ $1[]_GLUE_LIBS="$gecko_cv_glue_libs"
])
# GECKO_DEFINES
#
# Defines the AM_CONDITIONALS for GECKO_INIT. This is a separate call
# so that you may call GECKO_INIT conditionally; but note that you must
# call GECKO_DEFINES _unconditionally_ !
AC_DEFUN([GECKO_DEFINES],
[
# Ensure we have an integer variable to compare with
if test -z "$gecko_cv_gecko_version_int"; then
gecko_cv_gecko_version_int=0
fi
AM_CONDITIONAL([HAVE_MOZILLA_TOOLKIT],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_flavour" = "toolkit"])
AM_CONDITIONAL([HAVE_GECKO_DEBUG],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_have_debug" = "yes"])
AM_CONDITIONAL([HAVE_GECKO_1_7],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1007000"])
AM_CONDITIONAL([HAVE_GECKO_1_8],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1008000"])
AM_CONDITIONAL([HAVE_GECKO_1_8_1],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1008001"])
AM_CONDITIONAL([HAVE_GECKO_1_9],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1009000"])
AM_CONDITIONAL([HAVE_GECKO_HOME],[test "x$_GECKO_HOME" != "x"])
AM_CONDITIONAL([HAVE_GECKO_DEBUG],[test "$gecko_cv_have_debug" = "yes"])
AM_CONDITIONAL([HAVE_GECKO_XPCOM_GLUE],[test "$gecko_cv_have_xpcom_glue" = "yes"])
])
# ***************************************************************************
# ***************************************************************************
# ***************************************************************************
......@@ -359,10 +417,20 @@ _SAVE_CPPFLAGS="$CPPFLAGS"
_SAVE_CXXFLAGS="$CXXFLAGS"
_SAVE_LDFLAGS="$LDFLAGS"
_SAVE_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS -I$_GECKO_INCLUDE_ROOT $($PKG_CONFIG --cflags-only-I ${gecko_cv_gecko}-xpcom)"
CXXFLAGS="$CXXFLAGS $_GECKO_EXTRA_CXXFLAGS $($PKG_CONFIG --cflags-only-other ${gecko_cv_gecko}-xpcom)"
LDFLAGS="$LDFLAGS $_GECKO_EXTRA_LDFLAGS -Wl,--rpath=$_GECKO_HOME"
LIBS="$LIBS $($PKG_CONFIG --libs ${gecko_cv_gecko}-xpcom)"
if test "${gecko_cv_gecko}" = "libxul-embedding" -o "${gecko_cv_gecko}" = "libxul"; then
CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-I ${gecko_cv_gecko}-unstable)"
CXXFLAGS="$CXXFLAGS $_GECKO_EXTRA_CXXFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-other ${gecko_cv_gecko}-unstable)"
LIBS="$LIBS $($PKG_CONFIG --libs ${gecko_cv_gecko}) -ldl"
else
CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-I ${gecko_cv_gecko}-xpcom)"
CXXFLAGS="$CXXFLAGS $_GECKO_EXTRA_CXXFLAGS $_GECKO_CFLAGS $($PKG_CONFIG --cflags-only-other ${gecko_cv_gecko}-xpcom)"
LIBS="$LIBS $($PKG_CONFIG --libs ${gecko_cv_gecko}-xpcom)"
fi
if test -n "$_GECKO_HOME"; then
LDFLAGS="$LDFLAGS $_GECKO_EXTRA_LDFLAGS -Wl,--rpath=$_GECKO_HOME"
else
LDFLAGS="$LDFLAGS $_GECKO_EXTRA_LDFLAGS"
fi
_GECKO_DISPATCH_INCLUDEDIRS="$2"
......@@ -371,9 +439,11 @@ _GECKO_DISPATCH_INCLUDEDIRS="$2"
# Mind you, it's useful to be able to test against uninstalled mozilla builds...
_GECKO_DISPATCH_INCLUDEDIRS="$_GECKO_DISPATCH_INCLUDEDIRS dom necko pref"
# Now add them to CPPFLAGS
# Now add them to CPPFLAGS - asac: well ... not anymore since 1.9 -> test whether they exist before adding.
for i in $_GECKO_DISPATCH_INCLUDEDIRS; do
CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT/$i"
if test -d "$_GECKO_INCLUDE_ROOT/$i"; then
CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT/$i"
fi
done
m4_indir([$1],m4_shiftn(2,$@))
......@@ -426,11 +496,17 @@ AC_DEFUN([GECKO_XPCOM_PROGRAM],
#include <mozilla-config.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef XPCOM_GLUE
#include <nsXPCOMGlue.h>
#else
#include <nsXPCOM.h>
#endif // XPCOM_GLUE
#include <nsCOMPtr.h>
#include <nsILocalFile.h>
#include <nsIServiceManager.h>
#ifdef HAVE_GECKO_1_8
#if defined(HAVE_GECKO_1_8) || defined(HAVE_GECKO_1_9)
#include <nsStringAPI.h>
#else
#include <nsString.h>
......@@ -438,16 +514,37 @@ AC_DEFUN([GECKO_XPCOM_PROGRAM],
]]
[$1],
[[
nsresult rv;
#ifdef XPCOM_GLUE
static const GREVersionRange greVersion = {
"1.8", PR_TRUE,
"1.9.*", PR_TRUE
};
char xpcomLocation[4096];
rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, 4096);
if (NS_FAILED(rv)) {
exit(123);
}
// Startup the XPCOM Glue that links us up with XPCOM.
XPCOMGlueStartup(xpcomLocation);
if (NS_FAILED(rv)) {
exit(124);
}
#endif // XPCOM_GLUE
// redirect unwanted mozilla debug output to the bit bucket
freopen ("/dev/null", "w", stdout);
nsresult rv;
nsCOMPtr<nsILocalFile> directory;
nsCOMPtr<nsILocalFile> directory = nsnull;
#ifndef XPCOM_GLUE
rv = NS_NewNativeLocalFile (NS_LITERAL_CSTRING("$_GECKO_HOME"), PR_FALSE,
getter_AddRefs (directory));
if (NS_FAILED (rv) || !directory) {
exit (126);
}
#endif
rv = NS_InitXPCOM2 (nsnull, directory, nsnull);
if (NS_FAILED (rv)) {
......@@ -595,21 +692,22 @@ fi
AC_DEFUN([GECKO_XPIDL],
[AC_REQUIRE([GECKO_INIT])dnl
_GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
if test ${gecko_cv_gecko} = "libxul-embedding" -o ${gecko_cv_gecko} = "libxul"; then
_GECKO_LIBDIR="`$PKG_CONFIG pkg-config --variable=sdkdir ${gecko_cv_gecko}`/bin"
else
_GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
fi
AC_PATH_PROG([XPIDL],[xpidl],[no],[$_GECKO_LIBDIR:$PATH])
if test ${gecko_cv_gecko} = "libxul-embedding" -o ${gecko_cv_gecko} = "libxul"; then
XPIDL_IDLDIR="`$PKG_CONFIG --variable=idldir ${gecko_cv_gecko}`"
else
XPIDL_IDLDIR="`$PKG_CONFIG --variable=idldir ${gecko_cv_gecko}-xpcom`"
# Older geckos don't have this variable, see
# https://bugzilla.mozilla.org/show_bug.cgi?id=240473
if test -z "$XPIDL_IDLDIR" -o ! -f "$XPIDL_IDLDIR/nsISupports.idl"; then
XPIDL_IDLDIR="`echo $_GECKO_LIBDIR | sed -e s!lib!share/idl!`"
fi
# Some distributions (Gentoo) have it in unusual places
if test -z "$XPIDL_IDLDIR" -o ! -f "$XPIDL_IDLDIR/nsISupports.idl"; then
XPIDL_IDLDIR="$_GECKO_INCLUDE_ROOT/idl"
fi
......
......@@ -65,10 +65,12 @@ mozilla_include_subdirs = \
yelp_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir)/src \
$(addprefix -I$(MOZILLA_INCLUDE_ROOT)/,$(mozilla_include_subdirs)) \
$(YELP_DEFINES) \
$(AM_CPPFLAGS)
yelp_CPPFLAGS += $(MOZILLA_COMPONENT_CFLAGS)
yelp_CPPFLAGS += $(addprefix -I$(MOZILLA_INCLUDE_ROOT)/,$(mozilla_include_subdirs))
yelp_CFLAGS = \
$(YELP_CFLAGS) \
$(YELP_SEARCH_CFLAGS) \
......@@ -92,7 +94,11 @@ yelp_LDADD = \
$(MOZILLA_EXTRA_LIBS) \
$(MOZILLA_GLUE_LIBS)
yelp_LDFLAGS = -R$(MOZILLA_HOME) $(AM_LDFLAGS)
yelp_LDFLAGS = $(AM_LDFLAGS)
if !HAVE_GECKO_XPCOM_GLUE
yelp_LDFLAGS += -R$(MOZILLA_HOME)
endif
#check_PROGRAMS = \
# test-document \
......
......@@ -21,7 +21,7 @@
*/
#include <mozilla-config.h>
#include "config.h"
#include <config.h>
#include <stdlib.h>
#include <unistd.h>
......@@ -30,12 +30,18 @@
#include <nsCOMPtr.h>
#include <nsIComponentManager.h>
#include <nsComponentManagerUtils.h>
#include <nsIComponentRegistrar.h>
#include <nsIGenericFactory.h>
#include <nsILocalFile.h>
#include <nsIPrintSettings.h>
#include <nsServiceManagerUtils.h>
#ifdef XPCOM_GLUE
#include <nsXPCOMGlue.h>
#else
#include <nsXPCOM.h>
#endif
#include "yelp-gecko-services.h"
......@@ -298,7 +304,6 @@ PrintListener::SetPrintSettings (YelpPrintInfo *settings,
target->SetPrintInColor (gtk_print_settings_get_use_color (settings->config));
target->SetPaperSizeUnit(nsIPrintSettings::kPaperSizeMillimeters);
target->SetPaperSize (nsIPrintSettings::kPaperSizeDefined);
GtkPaperSize *paperSize = gtk_page_setup_get_paper_size (settings->setup);
if (!paperSize) {
......@@ -437,15 +442,16 @@ yelp_register_printing ()
NS_ENSURE_SUCCESS (rv, );
nsCOMPtr<nsIGenericFactory> componentFactory;
rv = NS_NewGenericFactory(getter_AddRefs(componentFactory),
&(sAppComps[0]));
componentFactory = do_CreateInstance ("@mozilla.org/generic-factory;1", &rv);
if (NS_FAILED(rv) || !componentFactory)
{
g_warning ("Failed to make a factory for %s\n", sAppComps[0].mDescription);
return;
}
componentFactory->SetComponentInfo(&(sAppComps[0]));
rv = cr->RegisterFactory(sAppComps[0].mCID,
sAppComps[0].mDescription,
sAppComps[0].mContractID,
......
......@@ -27,6 +27,10 @@
#include <nsStringAPI.h>
#ifdef HAVE_GECKO_1_9
#include <gtkmozembed_glue.cpp>
#endif
#include <gtkmozembed.h>
#include <gtkmozembed_internal.h>
#include <nsCOMPtr.h>
......@@ -205,18 +209,45 @@ yelp_gecko_init (void)
#ifdef HAVE_GECKO_1_9
NS_LogInit ();
#endif
nsresult rv;
#ifdef XPCOM_GLUE
static const GREVersionRange greVersion = {
"1.9a", PR_TRUE,
"2", PR_TRUE
};
char xpcomLocation[PATH_MAX];
rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, sizeof (xpcomLocation));
NS_ENSURE_SUCCESS (rv, FALSE);
// Startup the XPCOM Glue that links us up with XPCOM.
rv = XPCOMGlueStartup(xpcomLocation);
NS_ENSURE_SUCCESS (rv, FALSE);
rv = GTKEmbedGlueStartup();
NS_ENSURE_SUCCESS (rv, FALSE);
rv = GTKEmbedGlueStartupInternal();
NS_ENSURE_SUCCESS (rv, FALSE);
char *lastSlash = strrchr(xpcomLocation, '/');
if (lastSlash)
*lastSlash = '\0';
gtk_moz_embed_set_path(xpcomLocation);
#else
#ifdef HAVE_GECKO_1_9
gtk_moz_embed_set_path (MOZILLA_HOME);
#else
gtk_moz_embed_set_comp_path (MOZILLA_HOME);
#endif
#endif // XPCOM_GLUE
gtk_moz_embed_push_startup ();
yelp_register_printing ();
nsresult rv;
nsCOMPtr<nsIPrefService> prefService (do_GetService (NS_PREFSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS (rv, FALSE);
......
......@@ -24,9 +24,21 @@
#include <config.h>
#endif
#ifdef HAVE_GECKO_1_9
/* This is needed to stop gecko's version of libz
* interfering and making gzopen et. al. crazy defines.
*/
#define MOZZCONF_H
#endif
#include <stdio.h>
#include <glib.h>
#include <glib/gi18n.h>
#include "yelp-error.h"
#include "yelp-io-channel.h"
#include <zlib.h>
#ifdef HAVE_LIBBZ2
#include <bzlib.h>
......@@ -36,9 +48,6 @@
#endif
#include <string.h>
#include "yelp-error.h"
#include "yelp-io-channel.h"
typedef struct _YelpIOChannel YelpIOChannel;
struct _YelpIOChannel {
GIOChannel channel;
......
......@@ -389,7 +389,8 @@ main (int argc, char **argv)
}
if (!yelp_html_initialize ()) {
g_error ("Could not initialize gecko!");
g_printerr ("Could not initialize gecko!\n");
exit (1);
}
if (files != NULL && files[0] != NULL) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment