galeon r8950 - in trunk: . mozilla



Author: philipl
Date: Sun Feb  3 00:10:17 2008
New Revision: 8950
URL: http://svn.gnome.org/viewvc/galeon?rev=8950&view=rev

Log:
2008-02-02  Philip Langdale  <philipl alumni utexas net>

	* mozilla/MozillaPrivate.cpp: Adapt to new printer
	enumeration API - it might work - hard to say.
	Also disable user CSS stylesheets because, naturally,
	it doesn't work in 1.9.



Modified:
   trunk/ChangeLog
   trunk/mozilla/MozillaPrivate.cpp

Modified: trunk/mozilla/MozillaPrivate.cpp
==============================================================================
--- trunk/mozilla/MozillaPrivate.cpp	(original)
+++ trunk/mozilla/MozillaPrivate.cpp	Sun Feb  3 00:10:17 2008
@@ -24,20 +24,26 @@
 #include "config.h"
 #endif
 
-#define MOZILLA_INTERNAL_API
+#ifdef HAVE_NSSTRING_INTERNAL
 /***** BEGIN UNSAFE HEADERS ******/
+#define MOZILLA_INTERNAL_API
+#include <nsICSSLoader.h>
+#include <nsICSSStyleSheet.h>
+#include <nsIHTMLDocument.h>
+#endif
+
 #include <nsIPrintOptions.h>
 #include <nsIDocument.h>
 #include <nsIPresShell.h>
-#include <nsICSSLoader.h>
-#include <nsICSSStyleSheet.h>
+#include <nsIStyleSheet.h>
 #include <nsIScriptContext.h>
-#include <nsIHTMLDocument.h>
-#include <nsString.h>
+#include <nsStringAPI.h>
 
 #include "MozillaPrivate.h"
-/***** END UNSAFE HEADERS ******/
+#ifdef HAVE_NSSTRING_INTERNAL
 #undef MOZILLA_INTERNAL_API
+/***** END UNSAFE HEADERS ******/
+#endif
 
 #include <nsServiceManagerUtils.h>
 #include <nsISupportsPrimitives.h>
@@ -45,6 +51,7 @@
 #include <nsIPrintSettingsService.h>
 #include <nsIScriptGlobalObject.h>
 #include <nsISimpleEnumerator.h>
+#include <nsIStringEnumerator.h>
 #include <nsIDocShell.h>
 #include <nsIDOMWindow.h>
 #include <nsIDOMNSDocument.h>
@@ -73,13 +80,23 @@
         NS_Free(uDefaultPrinter);
 	NS_ENSURE_SUCCESS(rv, NULL);
 
+#ifdef HAVE_NSIPRINTOPTIONS_AVAILABLEPRINTERS
 	nsCOMPtr<nsISimpleEnumerator> printers;
 	rv = po->AvailablePrinters(getter_AddRefs(printers));
 	NS_ENSURE_SUCCESS(rv, NULL);
+#else
+	nsCOMPtr<nsIPrinterEnumerator> pe = do_QueryInterface(pss, &rv);
+	NS_ENSURE_SUCCESS(rv, NULL);
+
+	nsCOMPtr<nsIStringEnumerator> printers;
+	rv = pe->GetPrinterNameList(getter_AddRefs(printers));
+	NS_ENSURE_SUCCESS(rv, NULL);
+#endif
 
 	PRBool more = PR_FALSE;
 	gint index = 0;
 
+#ifdef HAVE_NSIPRINTOPTIONS_AVAILABLEPRINTERS
 	for (printers->HasMoreElements(&more), index = 0;
 	     more == PR_TRUE;
 	     printers->HasMoreElements(&more), index++)
@@ -94,6 +111,14 @@
 		nsAutoString name;
 		rv = printer->GetData(name);
 		NS_ENSURE_SUCCESS(rv, NULL);
+#else
+	for (printers->HasMore(&more), index = 0;
+	     more == PR_TRUE;
+	     printers->HasMore(&more), index++)
+	{
+		nsAutoString name;
+		rv = printers->GetNext(name);
+#endif
 
 		if (defaultPrinter.Equals(name)) *defaultPrinterIndex = index;
 
@@ -112,7 +137,11 @@
 		GaleonUtils::PrintSettingsToEmbedPrintInfo(ps, &info);
 		printerList = g_list_append(printerList, info);
 
+#if HAVE_NSIPRINTOPTIONS_AVAILABLEPRINTERS
 		rv = printers->HasMoreElements(&more);
+#else
+		rv = printers->HasMore(&more);
+#endif
 		NS_ENSURE_SUCCESS(rv, NULL);
 	}
 
@@ -145,6 +174,7 @@
 #endif
 	NS_ENSURE_TRUE (loader, NS_ERROR_FAILURE);
 
+#ifdef HAVE_NSSTRING_INTERNAL
 	/* load sheet */
 	nsCOMPtr<nsICSSStyleSheet> sheet;
 #ifdef HAVE_NSICSSLOADER_LOADSHEETSYNC
@@ -173,6 +203,9 @@
 	NS_ADDREF(*aStyleSheet = styleSheet);
 	
 	return NS_OK;
+#else
+	return NS_ERROR_FAILURE;
+#endif
 }
 
 nsresult



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