diff options
Diffstat (limited to 'embed')
-rw-r--r-- | embed/ephy-embed-shell.c | 17 | ||||
-rw-r--r-- | embed/ephy-embed-single.c | 13 | ||||
-rw-r--r-- | embed/ephy-embed-single.h | 2 | ||||
-rw-r--r-- | embed/mozilla/ContentHandler.cpp | 2 | ||||
-rw-r--r-- | embed/mozilla/EphyWrapper.cpp | 2 | ||||
-rw-r--r-- | embed/mozilla/Makefile.am | 85 | ||||
-rw-r--r-- | embed/mozilla/MozRegisterComponents.cpp | 14 | ||||
-rw-r--r-- | embed/mozilla/MozRegisterComponents.h | 17 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-single.cpp | 43 | ||||
-rw-r--r-- | embed/mozilla/mozilla-embed-single.h | 6 |
10 files changed, 102 insertions, 99 deletions
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c index e23bc79bc..61e8096a7 100644 --- a/embed/ephy-embed-shell.c +++ b/embed/ephy-embed-shell.c @@ -196,9 +196,24 @@ ephy_embed_shell_get_downloader_view (EphyEmbedShell *shell) EphyEmbedSingle * ephy_embed_shell_get_embed_single (EphyEmbedShell *shell) { + if (!shell->priv->embed_single) { - shell->priv->embed_single = ephy_embed_single_new ("mozilla"); + EphyEmbedSingle *single; + gboolean res; + + single = mozilla_embed_single_new (); + res = mozilla_embed_single_init_services + (MOZILLA_EMBED_SINGLE (single)); + + if (res) + { + shell->priv->embed_single = single; + } + else + { + g_object_unref (single); + } } return shell->priv->embed_single; diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c index 5346073a0..e329c4e74 100644 --- a/embed/ephy-embed-single.c +++ b/embed/ephy-embed-single.c @@ -129,19 +129,6 @@ ephy_embed_single_finalize (GObject *object) G_OBJECT_CLASS (parent_class)->finalize (object); } -EphyEmbedSingle * -ephy_embed_single_new (const char *type) -{ - if (strcmp (type, "mozilla") == 0) - { - return EPHY_EMBED_SINGLE (g_object_new - (MOZILLA_EMBED_SINGLE_TYPE, NULL)); - } - - g_assert_not_reached (); - return NULL; -} - gresult ephy_embed_single_clear_cache (EphyEmbedSingle *shell) { diff --git a/embed/ephy-embed-single.h b/embed/ephy-embed-single.h index 2e313b6ef..fd1964d32 100644 --- a/embed/ephy-embed-single.h +++ b/embed/ephy-embed-single.h @@ -156,8 +156,6 @@ struct EphyEmbedSingleClass GType ephy_embed_single_get_type (void); -EphyEmbedSingle *ephy_embed_single_new (const char *type); - gresult ephy_embed_single_clear_cache (EphyEmbedSingle *shell); gresult ephy_embed_single_set_offline_mode (EphyEmbedSingle *shell, diff --git a/embed/mozilla/ContentHandler.cpp b/embed/mozilla/ContentHandler.cpp index 4a0bbbd36..d06d3dbdd 100644 --- a/embed/mozilla/ContentHandler.cpp +++ b/embed/mozilla/ContentHandler.cpp @@ -184,9 +184,7 @@ extern "C" { #include "nsString.h" #include "nsIURI.h" #include "nsIURL.h" -#include "nsIMIMEInfo.h" #include "nsIChannel.h" -#include "nsIFTPChannel.h" #include "nsILocalFile.h" #include "nsIPrefService.h" #include "nsIDOMWindow.h" diff --git a/embed/mozilla/EphyWrapper.cpp b/embed/mozilla/EphyWrapper.cpp index a01072faf..1252f7ece 100644 --- a/embed/mozilla/EphyWrapper.cpp +++ b/embed/mozilla/EphyWrapper.cpp @@ -37,7 +37,6 @@ #include "nsIHistoryEntry.h" #include "nsIWebBrowserPrint.h" #include "nsIURI.h" -#include "nsIPresShell.h" #include "nsIMarkupDocumentViewer.h" #include "nsIComponentManager.h" #include "nsIScriptGlobalObject.h" @@ -66,7 +65,6 @@ #include "nsIDOMHTMLDocument.h" #include "nsIDOMHTMLCollection.h" #include "nsIDOMHTMLElement.h" -#include "caps/nsIPrincipal.h" #include "nsIDeviceContext.h" #include "nsIPresContext.h" #include "ContentHandler.h" diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am index 30ce0d2c7..fc7e8fdd5 100644 --- a/embed/mozilla/Makefile.am +++ b/embed/mozilla/Makefile.am @@ -1,51 +1,42 @@ INCLUDES = \ - -I$(top_srcdir)/lib \ - -I$(top_srcdir)/embed \ - -I$(top_srcdir) \ - $(WARN_CFLAGS) \ - $(MOZILLA_COMPONENT_CFLAGS) \ - -I$(MOZILLA_INCLUDE_ROOT) \ - -I$(MOZILLA_INCLUDE_ROOT)/appcomps \ - -I$(MOZILLA_INCLUDE_ROOT)/content \ - -I$(MOZILLA_INCLUDE_ROOT)/cookie \ - -I$(MOZILLA_INCLUDE_ROOT)/docshell \ - -I$(MOZILLA_INCLUDE_ROOT)/dom \ - -I$(MOZILLA_INCLUDE_ROOT)/exthandler \ - -I$(MOZILLA_INCLUDE_ROOT)/find \ - -I$(MOZILLA_INCLUDE_ROOT)/gfx \ - -I$(MOZILLA_INCLUDE_ROOT)/helperAppDlg \ - -I$(MOZILLA_INCLUDE_ROOT)/java \ - -I$(MOZILLA_INCLUDE_ROOT)/jsconsole \ - -I$(MOZILLA_INCLUDE_ROOT)/layout \ - -I$(MOZILLA_INCLUDE_ROOT)/mimetype \ - -I$(MOZILLA_INCLUDE_ROOT)/mozxfer \ - -I$(MOZILLA_INCLUDE_ROOT)/necko \ - -I$(MOZILLA_INCLUDE_ROOT)/necko2 \ - -I$(MOZILLA_INCLUDE_ROOT)/nkcache \ - -I$(MOZILLA_INCLUDE_ROOT)/oji \ - -I$(MOZILLA_INCLUDE_ROOT)/pref \ - -I$(MOZILLA_INCLUDE_ROOT)/progressDlg \ - -I$(MOZILLA_INCLUDE_ROOT)/sidebar \ - -I$(MOZILLA_INCLUDE_ROOT)/shistory \ - -I$(MOZILLA_INCLUDE_ROOT)/history \ - -I$(MOZILLA_INCLUDE_ROOT)/uconv \ - -I$(MOZILLA_INCLUDE_ROOT)/uriloader \ - -I$(MOZILLA_INCLUDE_ROOT)/unicharutil \ - -I$(MOZILLA_INCLUDE_ROOT)/wallet \ - -I$(MOZILLA_INCLUDE_ROOT)/webbrowserpersist \ - -I$(MOZILLA_INCLUDE_ROOT)/webbrwsr \ - -I$(MOZILLA_INCLUDE_ROOT)/webshell \ - -I$(MOZILLA_INCLUDE_ROOT)/widget \ - -I$(MOZILLA_INCLUDE_ROOT)/windowwatcher \ - -I$(MOZILLA_INCLUDE_ROOT)/typeaheadfind \ - $(GCONF_CFLAGS) \ - $(EPIPHANY_DEPENDENCY_CFLAGS) \ - -DG_DISABLE_DEPRECATED \ - -DGDK_DISABLE_DEPRECATED \ - -DGTK_DISABLE_DEPRECATED \ - -DGDK_PIXBUF_DISABLE_DEPRECATED \ - -DGNOME_DISABLE_DEPRECATED \ - -DSHARE_DIR=\"$(pkgdatadir)\" \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/embed \ + -I$(top_srcdir) \ + $(WARN_CFLAGS) \ + $(MOZILLA_COMPONENT_CFLAGS) \ + -I$(MOZILLA_INCLUDE_ROOT)/appcomps \ + -I$(MOZILLA_INCLUDE_ROOT)/content \ + -I$(MOZILLA_INCLUDE_ROOT)/cookie \ + -I$(MOZILLA_INCLUDE_ROOT)/docshell \ + -I$(MOZILLA_INCLUDE_ROOT)/dom \ + -I$(MOZILLA_INCLUDE_ROOT)/exthandler \ + -I$(MOZILLA_INCLUDE_ROOT)/find \ + -I$(MOZILLA_INCLUDE_ROOT)/gfx \ + -I$(MOZILLA_INCLUDE_ROOT)/helperAppDlg \ + -I$(MOZILLA_INCLUDE_ROOT)/layout \ + -I$(MOZILLA_INCLUDE_ROOT)/mimetype \ + -I$(MOZILLA_INCLUDE_ROOT)/necko \ + -I$(MOZILLA_INCLUDE_ROOT)/nkcache \ + -I$(MOZILLA_INCLUDE_ROOT)/pref \ + -I$(MOZILLA_INCLUDE_ROOT)/progressDlg \ + -I$(MOZILLA_INCLUDE_ROOT)/shistory \ + -I$(MOZILLA_INCLUDE_ROOT)/typeaheadfind \ + -I$(MOZILLA_INCLUDE_ROOT)/unicharutil \ + -I$(MOZILLA_INCLUDE_ROOT)/uriloader \ + -I$(MOZILLA_INCLUDE_ROOT)/wallet \ + -I$(MOZILLA_INCLUDE_ROOT)/webbrowserpersist \ + -I$(MOZILLA_INCLUDE_ROOT)/webbrwsr \ + -I$(MOZILLA_INCLUDE_ROOT)/webshell \ + -I$(MOZILLA_INCLUDE_ROOT)/widget \ + -I$(MOZILLA_INCLUDE_ROOT)/windowwatcher \ + $(GCONF_CFLAGS) \ + $(EPIPHANY_DEPENDENCY_CFLAGS) \ + -DG_DISABLE_DEPRECATED \ + -DGDK_DISABLE_DEPRECATED \ + -DGTK_DISABLE_DEPRECATED \ + -DGDK_PIXBUF_DISABLE_DEPRECATED \ + -DGNOME_DISABLE_DEPRECATED \ + -DSHARE_DIR=\"$(pkgdatadir)\" \ -include $(MOZILLA_INCLUDE_ROOT)/mozilla-config.h noinst_LTLIBRARIES = libephymozillaembed.la diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp index 353deba88..5a6c660c5 100644 --- a/embed/mozilla/MozRegisterComponents.cpp +++ b/embed/mozilla/MozRegisterComponents.cpp @@ -173,13 +173,11 @@ static const nsModuleComponentInfo sModuleComps[] = { static NS_DEFINE_CID(knsFtpProtocolHandlerCID, NS_FTPPROTOCOLHANDLER_CID); -//Annoying globals to track the mozilla ftp handler so it can be restored. +/* Annoying globals to track the mozilla ftp handler so it can be restored. */ static PRBool ftpRegistered = PR_FALSE; static nsCOMPtr<nsIFactory> nsFtpFactory; -/* FIXME why we need to use "C" here ???? */ - -extern "C" gboolean +gboolean mozilla_register_components (void) { gboolean ret = TRUE; @@ -214,7 +212,8 @@ mozilla_register_components (void) /** * mozilla_register_FtpProtocolHandler: Register Ftp Protocol Handler */ -extern "C" gboolean mozilla_register_FtpProtocolHandler (void) +gboolean +mozilla_register_FtpProtocolHandler (void) { if (ftpRegistered == PR_TRUE) return TRUE; @@ -251,7 +250,8 @@ extern "C" gboolean mozilla_register_FtpProtocolHandler (void) /** * mozilla_unregister_FtpProtocolHandler: Unregister Ftp Protocol Handler */ -extern "C" gboolean mozilla_unregister_FtpProtocolHandler (void) +gboolean +mozilla_unregister_FtpProtocolHandler (void) { if (ftpRegistered == PR_FALSE) return FALSE; @@ -273,7 +273,7 @@ extern "C" gboolean mozilla_unregister_FtpProtocolHandler (void) /** * mozilla_register_MailtoProtocolHandler: Register Mailto Protocol Handler */ -extern "C" gboolean +gboolean mozilla_register_MailtoProtocolHandler (void) { gboolean retVal = TRUE; diff --git a/embed/mozilla/MozRegisterComponents.h b/embed/mozilla/MozRegisterComponents.h index a263d9b74..1e4730c40 100644 --- a/embed/mozilla/MozRegisterComponents.h +++ b/embed/mozilla/MozRegisterComponents.h @@ -16,18 +16,15 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __MozRegisterComponents_h -#define __MozRegisterComponents_h +#ifndef MOZREGISTERCOMPONENTS_H +#define MOZREGISTERCOMPONENTS_H -#include <glib.h> +gboolean mozilla_register_components (void); -G_BEGIN_DECLS +gboolean mozilla_register_FtpProtocolHandler (void); -gboolean mozilla_register_components (void); -gboolean mozilla_register_FtpProtocolHandler (void); -gboolean mozilla_unregister_FtpProtocolHandler (void); -gboolean mozilla_register_MailtoProtocolHandler (void); +gboolean mozilla_unregister_FtpProtocolHandler (void); -G_END_DECLS +gboolean mozilla_register_MailtoProtocolHandler (void); -#endif // __MozRegisterComponents_h +#endif // MOZREGISTERCOMPONENTS_H diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp index 437e6edb7..6d03e08d4 100644 --- a/embed/mozilla/mozilla-embed-single.cpp +++ b/embed/mozilla/mozilla-embed-single.cpp @@ -37,7 +37,6 @@ #include <time.h> #include <libgnome/gnome-i18n.h> #include <string.h> -#include "nsBuildID.h" #include <nsICacheService.h> #include <nsCOMPtr.h> #include <nsIPrefService.h> @@ -45,7 +44,6 @@ #include <nsIServiceManager.h> #include <nsIIOService.h> #include <nsIProtocolProxyService.h> -#include <nsIJVMManager.h> #include <nsIAtom.h> #include <nsIFontList.h> #include <nsISupportsPrimitives.h> @@ -250,8 +248,6 @@ struct MozillaEmbedSinglePrivate GtkWidget *theme_window; }; -static NS_DEFINE_CID(kJVMManagerCID, NS_JVMMANAGER_CID); - static GObjectClass *parent_class = NULL; GType @@ -306,17 +302,23 @@ mozilla_embed_single_class_init (MozillaEmbedSingleClass *klass) shell_class->show_file_picker = impl_show_file_picker; } -static void +EphyEmbedSingle * +mozilla_embed_single_new (void) +{ + return EPHY_EMBED_SINGLE (g_object_new (MOZILLA_EMBED_SINGLE_TYPE, NULL)); +} + +static gboolean mozilla_set_default_prefs (MozillaEmbedSingle *mes) { nsCOMPtr<nsIPrefService> prefService; prefService = do_GetService (NS_PREFSERVICE_CONTRACTID); - g_return_if_fail (prefService != NULL); + if (prefService == NULL) return FALSE; nsCOMPtr<nsIPrefBranch> pref; prefService->GetBranch ("", getter_AddRefs(pref)); - g_return_if_fail (pref != NULL); + if (pref == NULL) return FALSE; /* Don't allow mozilla to raise window when setting focus (work around bugs) */ pref->SetBoolPref ("mozilla.widget.raise-on-setfocus", PR_FALSE); @@ -383,6 +385,8 @@ mozilla_set_default_prefs (MozillaEmbedSingle *mes) sub for embedding apps */ pref->SetCharPref ("general.useragent.vendor", "Epiphany"); pref->SetCharPref ("general.useragent.vendorSub", VERSION); + + return TRUE; } static char * @@ -531,13 +535,18 @@ mozilla_embed_single_init (MozillaEmbedSingle *mes) { mes->priv = g_new0 (MozillaEmbedSinglePrivate, 1); + mes->priv->theme_window = NULL; mes->priv->user_prefs = g_build_filename (ephy_dot_dir (), MOZILLA_PROFILE_DIR, MOZILLA_PROFILE_NAME, MOZILLA_PROFILE_FILE, NULL); +} +gboolean +mozilla_embed_single_init_services (MozillaEmbedSingle *single) +{ /* Pre initialization */ mozilla_init_home (); mozilla_init_profile (); @@ -545,24 +554,27 @@ mozilla_embed_single_init (MozillaEmbedSingle *mes) /* Fire up the best */ gtk_moz_embed_push_startup (); - mozilla_set_default_prefs (mes); + mozilla_init_single (single); + + if (!mozilla_set_default_prefs (single)) + { + return FALSE; + } /* FIXME: This should be removed when mozilla * bugs 207000 and 207001 are fixed. */ - mozilla_setup_colors (mes); + mozilla_setup_colors (single); START_PROFILER ("Mozilla prefs notifiers") - mozilla_notifiers_init (EPHY_EMBED_SINGLE (mes)); + mozilla_notifiers_init (EPHY_EMBED_SINGLE (single)); STOP_PROFILER ("Mozilla prefs notifiers") - mozilla_init_single (mes); - mozilla_register_components (); mozilla_register_external_protocols (); - /* FIXME alert if fails */ + return TRUE; } static void @@ -632,7 +644,10 @@ mozilla_embed_single_finalize (GObject *object) g_free (mes->priv->user_prefs); - gtk_widget_destroy (mes->priv->theme_window); + if (mes->priv->theme_window) + { + gtk_widget_destroy (mes->priv->theme_window); + } g_free (mes->priv); } diff --git a/embed/mozilla/mozilla-embed-single.h b/embed/mozilla/mozilla-embed-single.h index f46760d0c..02801daff 100644 --- a/embed/mozilla/mozilla-embed-single.h +++ b/embed/mozilla/mozilla-embed-single.h @@ -46,7 +46,11 @@ struct MozillaEmbedSingleClass EphyEmbedSingleClass parent_class; }; -GType mozilla_embed_single_get_type (void); +GType mozilla_embed_single_get_type (void); + +EphyEmbedSingle *mozilla_embed_single_new (void); + +gboolean mozilla_embed_single_init_services (MozillaEmbedSingle *single); G_END_DECLS |