diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | embed/mozilla/ExternalProtocolHandlers.cpp | 197 | ||||
-rw-r--r-- | embed/mozilla/ExternalProtocolHandlers.h | 156 | ||||
-rw-r--r-- | embed/mozilla/FilePicker.cpp | 5 | ||||
-rw-r--r-- | embed/mozilla/Makefile.am | 2 | ||||
-rw-r--r-- | embed/mozilla/MozRegisterComponents.cpp | 119 | ||||
-rw-r--r-- | embed/mozilla/MozRegisterComponents.h | 6 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-single.cpp | 32 |
8 files changed, 30 insertions, 500 deletions
@@ -1,3 +1,16 @@ +2004-04-07 Christian Biesinger <cbiesinger@web.de> + + * embed/mozilla/ExternalProtocolHandlers.cpp: + * embed/mozilla/ExternalProtocolHandlers.h: + * embed/mozilla/FilePicker.cpp: + * embed/mozilla/Makefile.am: + * embed/mozilla/MozRegisterComponents.cpp: + * embed/mozilla/MozRegisterComponents.h: + * embed/mozilla/mozilla-embed-single.cpp: + + Eliminate ExternalProtocolHandlers in favor of setting prefs to make Mozilla + not handle the protocols internally. + 2004-04-07 Christian Persch <chpe@cvs.gnome.org> * lib/eel-gconf-extensions.c: (eel_gconf_handle_error): diff --git a/embed/mozilla/ExternalProtocolHandlers.cpp b/embed/mozilla/ExternalProtocolHandlers.cpp deleted file mode 100644 index 5d9db4e47..000000000 --- a/embed/mozilla/ExternalProtocolHandlers.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (C) 2001 Philip Langdale - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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. - * - * $Id$ - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ExternalProtocolHandlers.h" -#include "nsCOMPtr.h" -#include "nsIComponentManager.h" -#include "nsIURI.h" -#include "nsCOMPtr.h" -#include "nsIChannel.h" -#include "nsIStorageStream.h" -#include "nsIInputStream.h" -#include "nsIOutputStream.h" -#include "nsNetUtil.h" -#include "nsIExternalProtocolService.h" -#include "nsCExternalHandlerService.h" - -NS_IMPL_ISUPPORTS2 (GIRCProtocolHandler, nsIProtocolHandler, nsIContentHandler) -NS_IMPL_ISUPPORTS2 (GFtpProtocolHandler, nsIProtocolHandler, nsIContentHandler) -NS_IMPL_ISUPPORTS2 (GMailtoProtocolHandler, nsIProtocolHandler, nsIContentHandler) -NS_IMPL_ISUPPORTS2 (GNewsProtocolHandler, nsIProtocolHandler, nsIContentHandler) - -static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID); - -/* Implementation file */ -NS_IMPL_ISUPPORTS1 (GBaseProtocolHandler, nsIProtocolHandler) - -GBaseProtocolHandler::GBaseProtocolHandler(const char *aScheme) -{ - mScheme.Assign(aScheme); -} - -GBaseProtocolHandler::~GBaseProtocolHandler() -{ -} - -/* readonly attribute string scheme; */ -NS_IMETHODIMP GBaseProtocolHandler::GetScheme(nsACString &aScheme) -{ - aScheme = mScheme; - return NS_OK; -} - -/* readonly attribute long defaultPort; */ -NS_IMETHODIMP GBaseProtocolHandler::GetDefaultPort(PRInt32 *aDefaultPort) -{ - if (aDefaultPort) - *aDefaultPort = -1; - else - return NS_ERROR_NULL_POINTER; - return NS_OK; -} - -/* readonly attribute short protocolFlags; */ -NS_IMETHODIMP GBaseProtocolHandler::GetProtocolFlags(PRUint32 *aProtocolFlags) -{ - if (aProtocolFlags) - *aProtocolFlags = nsIProtocolHandler::URI_STD; - else - return NS_ERROR_NULL_POINTER; - return NS_OK; -} - -/* nsIURI newURI (in string aSpec, in nsIURI aBaseURI); */ -NS_IMETHODIMP GBaseProtocolHandler::NewURI(const nsACString &aSpec, - const char *aOriginCharset, nsIURI *aBaseURI, - nsIURI **_retval) -{ - nsresult rv = NS_OK; - nsCOMPtr <nsIURI> newUri; - - rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull, - NS_GET_IID(nsIURI), - getter_AddRefs(newUri)); - - if (NS_SUCCEEDED(rv)) - { - newUri->SetSpec(aSpec); - rv = newUri->QueryInterface(NS_GET_IID(nsIURI), - (void **) _retval); - } - return rv; - -} - -/* nsIChannel newChannel (in nsIURI aURI); */ -NS_IMETHODIMP GBaseProtocolHandler::NewChannel(nsIURI *aURI, - nsIChannel **_retval) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -/* boolean allowPort (in long port, in string scheme); */ -NS_IMETHODIMP GBaseProtocolHandler::AllowPort(PRInt32 port, const char *scheme, - PRBool *_retval) -{ - *_retval = PR_FALSE; - return NS_OK; -} - -/* Implementation file */ -NS_IMPL_ISUPPORTS2 (GBaseProtocolContentHandler, nsIProtocolHandler, nsIContentHandler) - -GBaseProtocolContentHandler::GBaseProtocolContentHandler(const char *aScheme) : - GBaseProtocolHandler(aScheme) -{ - mMimeType = NS_LITERAL_CSTRING("application-x-gnome-") + mScheme; -} - -GBaseProtocolContentHandler::~GBaseProtocolContentHandler() -{ -} - -/* nsIChannel newChannel (in nsIURI aURI); */ -NS_IMETHODIMP GBaseProtocolContentHandler::NewChannel(nsIURI *aURI, - nsIChannel **_retval) -{ - nsresult rv; - nsCOMPtr<nsIStorageStream> sStream; - rv = NS_NewStorageStream(1, 16, getter_AddRefs(sStream)); - NS_ENSURE_SUCCESS (rv, rv); - - nsCOMPtr<nsIOutputStream> oStream; - rv = sStream->GetOutputStream(0, getter_AddRefs(oStream)); - NS_ENSURE_SUCCESS (rv, rv); - - PRUint32 bytes; - rv = oStream->Write("Dummy stream\0", 13, &bytes); - NS_ENSURE_SUCCESS (rv, rv); - - nsCOMPtr<nsIInputStream> iStream; - rv = sStream->NewInputStream(0, getter_AddRefs(iStream)); - NS_ENSURE_SUCCESS (rv, rv); - - nsCOMPtr<nsIChannel> channel; - rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aURI, - iStream, mMimeType, NS_LITERAL_CSTRING("")); - NS_ENSURE_SUCCESS (rv, rv); - - NS_IF_ADDREF (*_retval = channel); - - return rv; -} - -NS_IMETHODIMP GBaseProtocolContentHandler::HandleContent ( - const char * aContentType, - const char * aCommand, - nsISupports * aWindowContext, - nsIRequest *aRequest) -{ - NS_ENSURE_ARG (aRequest); - - nsresult rv = NS_OK; - - // First of all, get the content type and make sure it is a - // content type we know how to handle! - if (mMimeType.Equals(aContentType)) - { - nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest); - NS_ENSURE_TRUE (channel, NS_ERROR_FAILURE); - - nsCOMPtr<nsIURI> uri; - channel->GetURI(getter_AddRefs(uri)); - NS_ENSURE_TRUE (uri, NS_ERROR_FAILURE); - - rv = aRequest->Cancel(NS_BINDING_ABORTED); - NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE); - - nsCOMPtr<nsIExternalProtocolService> ps = - do_GetService (NS_EXTERNALPROTOCOLSERVICE_CONTRACTID); - NS_ENSURE_TRUE (ps, NS_ERROR_FAILURE); - - rv = ps->LoadUrl (uri); - } - - return rv; -} diff --git a/embed/mozilla/ExternalProtocolHandlers.h b/embed/mozilla/ExternalProtocolHandlers.h deleted file mode 100644 index 95073f99f..000000000 --- a/embed/mozilla/ExternalProtocolHandlers.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2001 Philip Langdale - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * 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. - * - * $Id$ - */ - -/* We are registering protocol handlers for news, mailto and irc - because mozilla load all modules on startup, so if you have these - components installed it will try to use them as protocol handlers. - Our implementation just forward to external protocol service. - Ftp is a special case, it can be handled by mozilla but we - want to use an external client when one is configured in GNOME - handlers. - IMPORTANT: there is no need to register handlers for other protocols - here. Once they are configured in GNOME, they will just work. -*/ - -#ifndef EXTERNAL_PROTOCOL_HANDLERS -#define EXTERNAL_PROTOCOL_HANDLERS - -#include "nsError.h" -#include "nsIContentHandler.h" -#include "nsIProtocolHandler.h" -#include "nsCURILoader.h" -#include "nsString.h" - -class GBaseProtocolHandler : public nsIProtocolHandler -{ - public: - NS_DECL_ISUPPORTS - NS_DECL_NSIPROTOCOLHANDLER - - GBaseProtocolHandler (const char *aScheme); - virtual ~GBaseProtocolHandler(); - protected: - nsCString mScheme; -}; - -class GBaseProtocolContentHandler : public GBaseProtocolHandler, - public nsIContentHandler -{ - public: - NS_DECL_ISUPPORTS - NS_DECL_NSICONTENTHANDLER - - NS_IMETHODIMP NewChannel(nsIURI *aURI, nsIChannel **_retval); - - GBaseProtocolContentHandler (const char *aScheme); - virtual ~GBaseProtocolContentHandler(); - protected: - nsCString mMimeType; -}; - -#define G_IRC_PROTOCOL_CID \ -{ /* aabe33d3-7455-4d8f-87e7-43e4541ace4e */ \ - 0xaabe33d3, \ - 0x7455, \ - 0x4d8f, \ - {0x87, 0xe7, 0x43, 0xe4, 0x54, 0x1a, 0xce, 0x4e} \ -} -#define G_IRC_PROTOCOL_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "irc" -#define G_IRC_PROTOCOL_CLASSNAME "Epiphany's irc Protocol Handler" -#define G_IRC_CONTENT_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX \ - "application-x-gnome-irc" -#define G_IRC_CONTENT_CLASSNAME "Epiphany's irc Content Handler" - -class GIRCProtocolHandler : public GBaseProtocolContentHandler -{ - public: - NS_DECL_ISUPPORTS - - GIRCProtocolHandler() : GBaseProtocolContentHandler("irc") {}; - virtual ~GIRCProtocolHandler() {}; -}; - -#define G_FTP_PROTOCOL_CID \ -{ /* 5a48bdf4-a422-4eb4-b073-0fc3bee8e670 */ \ - 0x5a48bdf4, \ - 0xa422, \ - 0x4eb4, \ - {0xb0, 0x73, 0x0f, 0xc3, 0xbe, 0xe8, 0xe6, 0x70} \ -} -#define G_FTP_PROTOCOL_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ftp" -#define G_FTP_PROTOCOL_CLASSNAME "Epiphany's FTP Protocol Handler" -#define G_FTP_CONTENT_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX \ - "application-x-gnome-ftp" -#define G_FTP_CONTENT_CLASSNAME "Epiphany's FTP Content Handler" - -class GFtpProtocolHandler : public GBaseProtocolContentHandler -{ - public: - NS_DECL_ISUPPORTS - GFtpProtocolHandler() : GBaseProtocolContentHandler("ftp") {}; - virtual ~GFtpProtocolHandler() {}; -}; - -#define G_MAILTO_PROTOCOL_CID \ -{ /* aabe33d3-7455-4d8f-87e7-43e4541ace4d */ \ - 0xaabe33d3, \ - 0x7455, \ - 0x4d8f, \ - {0x87, 0xe7, 0x43, 0xe4, 0x54, 0x1a, 0xce, 0x4d} \ -} -#define G_MAILTO_PROTOCOL_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "mailto" -#define G_MAILTO_PROTOCOL_CLASSNAME "Epiphany's mailto Protocol Handler" -#define G_MAILTO_CONTENT_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX \ - "application-x-gnome-mailto" -#define G_MAILTO_CONTENT_CLASSNAME "Epiphany's mailto Content Handler" - -class GMailtoProtocolHandler : public GBaseProtocolContentHandler -{ - public: - NS_DECL_ISUPPORTS - GMailtoProtocolHandler() : GBaseProtocolContentHandler("mailto") {}; - virtual ~GMailtoProtocolHandler() {}; - private: -}; - -#define G_NEWS_PROTOCOL_CID \ -{ /* 3583f8f9-abc7-4ff0-84cb-0eefcaec99f8 */ \ - 0x3583f8f9, \ - 0xabc7, \ - 0x4ff0, \ - {0x84, 0xcb, 0x0e, 0xef, 0xca, 0xec, 0x99, 0xf8} \ -} -#define G_NEWS_PROTOCOL_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "news" -#define G_NEWS_PROTOCOL_CLASSNAME "Epiphany's news Protocol Handler" -#define G_NEWS_CONTENT_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX \ - "application-x-gnome-news" -#define G_NEWS_CONTENT_CLASSNAME "Epiphany's news Content Handler" - -class GNewsProtocolHandler : public GBaseProtocolContentHandler -{ - public: - NS_DECL_ISUPPORTS - - GNewsProtocolHandler() : GBaseProtocolContentHandler("news") {}; - virtual ~GNewsProtocolHandler() {}; - private: -}; - -#endif /* EXTERNAL_PROTOCOL_HANDLERS */ diff --git a/embed/mozilla/FilePicker.cpp b/embed/mozilla/FilePicker.cpp index 39283c56e..9187915e1 100644 --- a/embed/mozilla/FilePicker.cpp +++ b/embed/mozilla/FilePicker.cpp @@ -90,10 +90,9 @@ NS_IMETHODIMP GFilePicker::Init(nsIDOMWindowInternal *parent, const PRUnichar *t { LOG ("GFilePicker::Init") - nsCOMPtr<nsIDOMWindow> dw = do_QueryInterface (parent); - if (dw) + if (parent) { - GtkWidget *pwin = MozillaFindGtkParent (dw); + GtkWidget *pwin = MozillaFindGtkParent (parent); gtk_window_set_transient_for (GTK_WINDOW (mDialog), GTK_WINDOW (pwin)); } diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am index e512ac9a3..ad5acc531 100644 --- a/embed/mozilla/Makefile.am +++ b/embed/mozilla/Makefile.am @@ -61,8 +61,6 @@ libephymozillaembed_la_SOURCES = \ EphySingle.h \ EventContext.cpp \ EventContext.h \ - ExternalProtocolHandlers.cpp \ - ExternalProtocolHandlers.h \ FilePicker.cpp \ FilePicker.h \ GlobalHistory.cpp \ diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp index a0a4ffd9b..fc5c92a85 100644 --- a/embed/mozilla/MozRegisterComponents.cpp +++ b/embed/mozilla/MozRegisterComponents.cpp @@ -26,7 +26,6 @@ #include "ContentHandler.h" #include "FilePicker.h" #include "GlobalHistory.h" -#include "ExternalProtocolHandlers.h" #include "PrintingPromptService.h" #include "MozDownload.h" #include "EphyAboutRedirector.h" @@ -56,10 +55,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(GFilePicker) NS_GENERIC_FACTORY_CONSTRUCTOR(GContentHandler) NS_GENERIC_FACTORY_CONSTRUCTOR(MozGlobalHistory) NS_GENERIC_FACTORY_CONSTRUCTOR(GPrintingPromptService) -NS_GENERIC_FACTORY_CONSTRUCTOR(GIRCProtocolHandler) -NS_GENERIC_FACTORY_CONSTRUCTOR(GFtpProtocolHandler) -NS_GENERIC_FACTORY_CONSTRUCTOR(GNewsProtocolHandler) -NS_GENERIC_FACTORY_CONSTRUCTOR(GMailtoProtocolHandler) NS_GENERIC_FACTORY_CONSTRUCTOR(EphyContentPolicy) #ifdef HAVE_MOZILLA_PSM @@ -146,36 +141,6 @@ static const nsModuleComponentInfo sAppComps[] = { GPrintingPromptServiceConstructor }, { - G_IRC_PROTOCOL_CLASSNAME, - G_IRC_PROTOCOL_CID, - G_IRC_PROTOCOL_CONTRACTID, - GIRCProtocolHandlerConstructor - }, - { - G_IRC_CONTENT_CLASSNAME, - G_IRC_PROTOCOL_CID, - G_IRC_CONTENT_CONTRACTID, - GIRCProtocolHandlerConstructor - }, - { - G_NEWS_PROTOCOL_CLASSNAME, - G_NEWS_PROTOCOL_CID, - G_NEWS_PROTOCOL_CONTRACTID, - GNewsProtocolHandlerConstructor - }, - { - G_NEWS_CONTENT_CLASSNAME, - G_NEWS_PROTOCOL_CID, - G_NEWS_CONTENT_CONTRACTID, - GNewsProtocolHandlerConstructor - }, - { - G_FTP_CONTENT_CLASSNAME, - G_FTP_PROTOCOL_CID, - G_FTP_CONTENT_CONTRACTID, - GFtpProtocolHandlerConstructor - }, - { EPHY_ABOUT_REDIRECTOR_CLASSNAME, EPHY_ABOUT_REDIRECTOR_CID, EPHY_ABOUT_REDIRECTOR_EPIPHANY_CONTRACTID, @@ -194,18 +159,6 @@ static const nsModuleComponentInfo sAppComps[] = { EphyAboutRedirectorConstructor }, { - G_MAILTO_PROTOCOL_CLASSNAME, - G_MAILTO_PROTOCOL_CID, - G_MAILTO_PROTOCOL_CONTRACTID, - GMailtoProtocolHandlerConstructor - }, - { - G_MAILTO_CONTENT_CLASSNAME, - G_MAILTO_PROTOCOL_CID, - G_MAILTO_CONTENT_CONTRACTID, - GMailtoProtocolHandlerConstructor - }, - { EPHY_CONTENT_POLICY_CLASSNAME, EPHY_CONTENT_POLICY_CID, EPHY_CONTENT_POLICY_CONTRACTID, @@ -214,18 +167,6 @@ static const nsModuleComponentInfo sAppComps[] = { }, }; -static const nsModuleComponentInfo sFtpComps = { - G_FTP_PROTOCOL_CLASSNAME, - G_FTP_PROTOCOL_CID, - G_FTP_PROTOCOL_CONTRACTID, - GFtpProtocolHandlerConstructor -}; - -static NS_DEFINE_CID(knsFtpProtocolHandlerCID, NS_FTPPROTOCOLHANDLER_CID); - -/* Annoying globals to track the mozilla ftp handler so it can be restored. */ -static PRBool ftpRegistered = PR_FALSE; -static nsCOMPtr<nsIFactory> nsFtpFactory; gboolean mozilla_register_components (void) @@ -280,64 +221,4 @@ mozilla_register_components (void) return ret; } -/** - * mozilla_register_FtpProtocolHandler: Register Ftp Protocol Handler - */ -gboolean -mozilla_register_FtpProtocolHandler (void) -{ - if (ftpRegistered == PR_TRUE) return TRUE; - nsresult rv; - - nsCOMPtr<nsIComponentManager> cm; - NS_GetComponentManager(getter_AddRefs(cm)); - NS_ENSURE_TRUE (cm, FALSE); - - rv = cm->GetClassObject(knsFtpProtocolHandlerCID, - NS_GET_IID(nsIFactory), - getter_AddRefs(nsFtpFactory)); - if (NS_FAILED (rv)) return FALSE; - - nsCOMPtr<nsIGenericFactory> ftpFactory; - NS_NewGenericFactory(getter_AddRefs(ftpFactory), &sFtpComps); - NS_ENSURE_TRUE (ftpFactory, FALSE); - - nsCOMPtr<nsIComponentRegistrar> cr; - NS_GetComponentRegistrar(getter_AddRefs(cr)); - NS_ENSURE_TRUE (cr, FALSE); - - rv = cr->RegisterFactory(sFtpComps.mCID, - sFtpComps.mDescription, - sFtpComps.mContractID, - ftpFactory); - NS_ENSURE_SUCCESS (rv, FALSE); - - ftpRegistered = PR_TRUE; - - return TRUE; -} - -/** - * mozilla_unregister_FtpProtocolHandler: Unregister Ftp Protocol Handler - */ -gboolean -mozilla_unregister_FtpProtocolHandler (void) -{ - if (ftpRegistered == PR_FALSE) return FALSE; - - nsresult rv; - nsCOMPtr<nsIComponentRegistrar> cr; - NS_GetComponentRegistrar(getter_AddRefs(cr)); - NS_ENSURE_TRUE (cr, FALSE); - - rv = cr->RegisterFactory(knsFtpProtocolHandlerCID, - NS_FTPPROTOCOLHANDLER_CLASSNAME, - G_FTP_PROTOCOL_CONTRACTID, - nsFtpFactory); - NS_ENSURE_SUCCESS (rv, FALSE); - - ftpRegistered = PR_FALSE; - - return TRUE; -} diff --git a/embed/mozilla/MozRegisterComponents.h b/embed/mozilla/MozRegisterComponents.h index 67dd0025d..81c7617f1 100644 --- a/embed/mozilla/MozRegisterComponents.h +++ b/embed/mozilla/MozRegisterComponents.h @@ -23,10 +23,4 @@ gboolean mozilla_register_components (void); -gboolean mozilla_register_FtpProtocolHandler (void); - -gboolean mozilla_unregister_FtpProtocolHandler (void); - -gboolean mozilla_register_MailtoProtocolHandler (void); - #endif /* MOZREGISTERCOMPONENTS_H */ diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index 221523df8..9435a7203 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -1,4 +1,4 @@ -/* +/* vim:set ts=8 noet sw=8: * Copyright (C) 2000-2003 Marco Pesenti Gritti * Copyright (C) 2003 Christian Persch * @@ -96,6 +96,7 @@ static void ephy_cookie_manager_iface_init (EphyCookieManagerIface *iface); static void ephy_password_manager_iface_init (EphyPasswordManagerIface *iface); static void ephy_permission_manager_iface_init (EphyPermissionManagerIface *iface); static void mozilla_embed_single_init (MozillaEmbedSingle *ges); +static gboolean have_gnome_url_handler (const gchar *protocol); static GObjectClass *parent_class = NULL; @@ -212,6 +213,19 @@ mozilla_set_default_prefs (MozillaEmbedSingle *mes) pref->SetCharPref ("general.useragent.vendor", "Epiphany"); pref->SetCharPref ("general.useragent.vendorSub", VERSION); + /* Make sure that Mozilla does not handle these protocols internally */ + pref->SetBoolPref("network.protocol-handler.external.news", TRUE); + pref->SetBoolPref("network.protocol-handler.external.mailto", TRUE); + pref->SetBoolPref("network.protocol-handler.external.irc", TRUE); + if (have_gnome_url_handler ("ftp")) + { + pref->SetBoolPref("network.protocol-handler.external.ftp", TRUE); + } + else + { + pref->SetBoolPref("network.protocol-handler.external.ftp", FALSE); + } + return TRUE; } @@ -351,20 +365,6 @@ have_gnome_url_handler (const gchar *protocol) return rv; } -static void -mozilla_register_external_protocols (void) -{ - /* FIXME register only when needed */ - if (have_gnome_url_handler ("ftp")) - { - mozilla_register_FtpProtocolHandler (); - } - else - { - mozilla_unregister_FtpProtocolHandler (); - } -} - static nsresult getUILang (nsAString& aUILang) { @@ -453,8 +453,6 @@ init_services (MozillaEmbedSingle *single) mozilla_register_components (); - mozilla_register_external_protocols (); - mozilla_init_observer (single); return TRUE; |