[evolution-rss] update gecko detection



commit db244fe6e918da9aa617f737ac8784f392d74f2a
Author: Lucian Langa <lucilanga gnome org>
Date:   Tue Mar 23 19:11:56 2010 +0200

    update gecko detection

 m4/gecko.m4         |   15 ++++-
 src/gecko-utils.cpp |  199 ++++++++++++++++++++++++++-------------------------
 2 files changed, 115 insertions(+), 99 deletions(-)
---
diff --git a/m4/gecko.m4 b/m4/gecko.m4
index b67892b..84c47fb 100644
--- a/m4/gecko.m4
+++ b/m4/gecko.m4
@@ -61,13 +61,15 @@ AC_ARG_WITH([mozilla],[],[with_gecko=$withval],[])
 gecko_cv_gecko=$with_gecko
 
 # Autodetect gecko
-#_geckos="xulrunner firefox mozilla-firefox seamonkey mozilla libxul"
 _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; then
+			gecko_cv_gecko=$lizard
+			break;
 		elif $PKG_CONFIG --exists $lizard-unstable; then
 			gecko_cv_gecko=$lizard
 			break;
@@ -347,6 +349,16 @@ if test "$gecko_cv_gecko_version_int" -ge "1009000"; then
 	gecko_cv_have_gecko_1_9=yes
 fi
 
+if test "${gecko_cv_gecko}" = "libxul-embedding" -o "${gecko_cv_gecko}" = "libxul"; then
+	PKG_CHECK_EXISTS([${gecko_cv_gecko} >= 1.9.1],[gecko_cv_have_gecko_1_9_1=yes gecko_cv_gecko_version="1.9.1" gecko_cv_gecko_version_int=1009001],[gecko_cv_have_gecko_1_9_1=no])
+else
+	gecko_cv_have_gecko_1_9_1=no
+fi
+
+if test "$gecko_cv_have_gecko_1_9_1" = "yes"; then
+        AC_DEFINE([HAVE_GECKO_1_9_1],[1],[Define if we have gecko 1.9.1])
+fi
+
 fi # if gecko_cv_have_gecko
 
 $1[]_VERSION=$gecko_cv_gecko_version
@@ -394,6 +406,7 @@ AM_CONDITIONAL([HAVE_GECKO_1_7],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_
 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_1_9_1],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_have_gecko_1_9_1" = "yes"])
 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"])
diff --git a/src/gecko-utils.cpp b/src/gecko-utils.cpp
index 27d8d76..dd9f92d 100644
--- a/src/gecko-utils.cpp
+++ b/src/gecko-utils.cpp
@@ -84,86 +84,86 @@ gecko_prefs_set_int (const gchar *key, gint value)
 	return NS_SUCCEEDED(gPrefBranch->SetIntPref (key, value));
 }
 
-/**
- *  * Takes a pointer to a mouse event and returns the mouse
- *   *  button number or -1 on error.
- *    */
+/*
+ * Takes a pointer to a mouse event and returns the mouse
+ * button number or -1 on error.
+ */
 extern "C"
 gint gecko_get_mouse_event_button(gpointer event) {
-        gint    button = 0;
-
-        g_return_val_if_fail (event, -1);
-
-        /* the following lines were found in the Galeon source */
-        nsIDOMMouseEvent *aMouseEvent = (nsIDOMMouseEvent *) event;
-        aMouseEvent->GetButton ((PRUint16 *) &button);
-
-        /* for some reason we get different numbers on PPC, this fixes
- *          * that up... -- MattA */
-        if (button == 65536)
-        {
-                button = 1;
-        }
-        else if (button == 131072)
-        {
-                button = 2;
-        }
-
-        return button;
+	gint    button = 0;
+
+	g_return_val_if_fail (event, -1);
+
+	/* the following lines were found in the Galeon source */
+	nsIDOMMouseEvent *aMouseEvent = (nsIDOMMouseEvent *) event;
+	aMouseEvent->GetButton ((PRUint16 *) &button);
+
+	/* for some reason we get different numbers on PPC, this fixes
+	 * that up... -- MattA */
+	if (button == 65536) {
+		button = 1;
+	} else if (button == 131072) {
+		button = 2;
+	}
+
+	return button;
 }
 
 extern "C" void
 gecko_set_zoom (GtkWidget *moz, gfloat zoom)
 {
 	nsCOMPtr<nsIWebBrowser>         mWebBrowser;
-        nsCOMPtr<nsIDOMWindow>          mDOMWindow;
-
-        gtk_moz_embed_get_nsIWebBrowser ((GtkMozEmbed *)moz, getter_AddRefs (mWebBrowser));
-        if (NULL == mWebBrowser) {
-                g_warning ("gecko_set_zoom(): Could not retrieve browser...");
-                return;
-        }
-        mWebBrowser->GetContentDOMWindow (getter_AddRefs (mDOMWindow));
-        if (NULL == mDOMWindow) {
-                g_warning ("gecko_set_zoom(): Could not retrieve DOM window...");
-                return;
-        }
-        mDOMWindow->SetTextZoom (zoom);
+	nsCOMPtr<nsIDOMWindow>          mDOMWindow;
+
+	gtk_moz_embed_get_nsIWebBrowser(
+		(GtkMozEmbed *)moz, getter_AddRefs (mWebBrowser));
+	if (NULL == mWebBrowser) {
+		g_warning ("gecko_set_zoom(): Could not retrieve browser...");
+		return;
+	}
+	mWebBrowser->GetContentDOMWindow(getter_AddRefs (mDOMWindow));
+	if (NULL == mDOMWindow) {
+		g_warning ("gecko_set_zoom(): Could not retrieve DOM window...");
+		return;
+	}
+	mDOMWindow->SetTextZoom (zoom);
 }
 
 extern "C" gfloat
 gecko_get_zoom (GtkWidget *embed)
 {
-        nsCOMPtr<nsIWebBrowser>         mWebBrowser;
-        nsCOMPtr<nsIDOMWindow>          mDOMWindow;
-        float zoom;
-
-        gtk_moz_embed_get_nsIWebBrowser ((GtkMozEmbed *)embed, getter_AddRefs (mWebBrowser));
-        if (NULL == mWebBrowser) {
-                g_warning ("gecko_get_zoom(): Could not retrieve browser...");
-                return 1.0;
-        }
-        mWebBrowser->GetContentDOMWindow (getter_AddRefs (mDOMWindow));
-        if (NULL == mDOMWindow) {
-                g_warning ("gecko_get_zoom(): Could not retrieve DOM window...");
-                return 1.0;
-        }
-        mDOMWindow->GetTextZoom (&zoom);
-        return zoom;
+	nsCOMPtr<nsIWebBrowser>         mWebBrowser;
+	nsCOMPtr<nsIDOMWindow>          mDOMWindow;
+	float zoom;
+
+	gtk_moz_embed_get_nsIWebBrowser (
+		(GtkMozEmbed *)embed, getter_AddRefs (mWebBrowser));
+	if (NULL == mWebBrowser) {
+		g_warning ("gecko_get_zoom(): Could not retrieve browser...");
+		return 1.0;
+	}
+	mWebBrowser->GetContentDOMWindow (getter_AddRefs (mDOMWindow));
+	if (NULL == mDOMWindow) {
+		g_warning ("gecko_get_zoom(): Could not retrieve DOM window...");
+		return 1.0;
+	}
+	mDOMWindow->GetTextZoom (&zoom);
+	return zoom;
 }
 
 static nsresult
 gecko_do_command (GtkMozEmbed *embed,
-            const char  *command)
+	const char  *command)
 {
-        nsCOMPtr<nsIWebBrowser>     webBrowser;
-        nsCOMPtr<nsICommandManager> cmdManager;
+	nsCOMPtr<nsIWebBrowser>     webBrowser;
+	nsCOMPtr<nsICommandManager> cmdManager;
 
-        gtk_moz_embed_get_nsIWebBrowser (embed, getter_AddRefs (webBrowser));
+	gtk_moz_embed_get_nsIWebBrowser (
+		embed, getter_AddRefs (webBrowser));
 
-        cmdManager = do_GetInterface (webBrowser);
+	cmdManager = do_GetInterface (webBrowser);
 
-        return cmdManager->DoCommand (command, nsnull, nsnull);
+	return cmdManager->DoCommand (command, nsnull, nsnull);
 }
 
 extern "C" void
@@ -191,42 +191,43 @@ gecko_init (void)
 #ifdef XPCOM_GLUE
 	static const GREVersionRange greVersion = {
 	"1.9a", PR_TRUE,
-	"2", PR_TRUE
+	"2.0", PR_TRUE,
 	};
 	char xpcomLocation[4096];
 	d("init XPCOM_GLUE\n");
-	rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, 4096);
+	rv = GRE_GetGREPathWithProperties(
+		&greVersion, 1, nsnull, 0, xpcomLocation, 4096);
 	if (NS_FAILED (rv))
-       {
-         g_warning ("Could not determine locale!\n");
-         return FALSE;
-       }
-
-       // Startup the XPCOM Glue that links us up with XPCOM.
-       rv = XPCOMGlueStartup(xpcomLocation);
-       if (NS_FAILED (rv))
-       {
-         g_warning ("Could not determine locale!\n");
-         return FALSE;
-       }
-
-       rv = GTKEmbedGlueStartup();
-       if (NS_FAILED (rv))
-       {
-         g_warning ("Could not startup glue!\n");
-         return FALSE;
-       }
-
-       rv = GTKEmbedGlueStartupInternal();
-       if (NS_FAILED (rv))
-       {
-         g_warning ("Could not startup internal glue!\n");
-         return FALSE;
-       }
-
-       char *lastSlash = strrchr(xpcomLocation, '/');
-       if (lastSlash)
-         *lastSlash = '\0';
+	{
+		g_warning ("Could not determine locale!\n");
+		return FALSE;
+	}
+
+	// Startup the XPCOM Glue that links us up with XPCOM.
+	rv = XPCOMGlueStartup(xpcomLocation);
+	if (NS_FAILED (rv))
+	{
+		g_warning ("Could not determine locale!\n");
+		return FALSE;
+	}
+
+	rv = GTKEmbedGlueStartup();
+	if (NS_FAILED (rv))
+	{
+		g_warning ("Could not startup glue!\n");
+		return FALSE;
+	}
+
+	rv = GTKEmbedGlueStartupInternal();
+	if (NS_FAILED (rv))
+	{
+		g_warning ("Could not startup internal glue!\n");
+		return FALSE;
+	}
+
+	char *lastSlash = strrchr(xpcomLocation, '/');
+	if (lastSlash)
+		*lastSlash = '\0';
 
 	gtk_moz_embed_set_path(xpcomLocation);
 #else
@@ -240,11 +241,12 @@ gecko_init (void)
 #endif /* XPCOM_GLUE */
 
 	d("load gecko prefs\n");
-	gchar *profile_dir = g_build_filename (g_get_home_dir (),
-					       ".evolution",
-					       "mail",
-					       "rss",
-					       NULL);
+	gchar *profile_dir = g_build_filename (
+				g_get_home_dir (),
+				".evolution",
+				"mail",
+				"rss",
+				NULL);
 
 	gtk_moz_embed_set_profile_path (profile_dir, "mozembed-rss");
 	g_free (profile_dir);
@@ -252,7 +254,8 @@ gecko_init (void)
 	d("embed push startup()\n");
 	gtk_moz_embed_push_startup ();
 
-	nsCOMPtr<nsIPrefService> prefService (do_GetService (NS_PREFSERVICE_CONTRACTID, &rv));
+	nsCOMPtr<nsIPrefService> prefService (
+				do_GetService (NS_PREFSERVICE_CONTRACTID, &rv));
 	NS_ENSURE_SUCCESS (rv, FALSE);
 
 	rv = CallQueryInterface (prefService, &gPrefBranch);
@@ -279,6 +282,6 @@ gecko_shutdown (void)
 #endif
 
 #ifdef HAVE_GECKO_1_9
-        NS_LogTerm ();
+	NS_LogTerm ();
 #endif
 }



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