diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-07-04 22:15:49 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-07-04 22:15:49 +0800 |
commit | 0774d40cedbde3a4c8751d02e237f7b3b0e25572 (patch) | |
tree | d551ee3ee49b76db5ab2b1369bdcece3f1ee0a0e | |
parent | 53e29e3ec1e3d6f72118873a221cdf2bc621091b (diff) | |
download | gsoc2013-epiphany-0774d40cedbde3a4c8751d02e237f7b3b0e25572.tar gsoc2013-epiphany-0774d40cedbde3a4c8751d02e237f7b3b0e25572.tar.gz gsoc2013-epiphany-0774d40cedbde3a4c8751d02e237f7b3b0e25572.tar.bz2 gsoc2013-epiphany-0774d40cedbde3a4c8751d02e237f7b3b0e25572.tar.lz gsoc2013-epiphany-0774d40cedbde3a4c8751d02e237f7b3b0e25572.tar.xz gsoc2013-epiphany-0774d40cedbde3a4c8751d02e237f7b3b0e25572.tar.zst gsoc2013-epiphany-0774d40cedbde3a4c8751d02e237f7b3b0e25572.zip |
Remove use of acconfig.h.
2003-07-04 Marco Pesenti Gritti <marco@it.gnome.org>
* configure.in:
Remove use of acconfig.h.
* embed/ephy-embed-shell.c: (ephy_embed_shell_get_embed_single):
* embed/ephy-embed-single.c:
* embed/ephy-embed-single.h:
* embed/mozilla/ContentHandler.cpp:
* embed/mozilla/EphyWrapper.cpp:
* embed/mozilla/Makefile.am:
* embed/mozilla/MozRegisterComponents.cpp:
* embed/mozilla/MozRegisterComponents.h:
* embed/mozilla/mozilla-embed-single.cpp:
* embed/mozilla/mozilla-embed-single.h:
* src/bookmarks/ephy-bookmarks-import.c: (bookmark_add),
(xbel_parse_folder), (ephy_bookmarks_import_mozilla):
* src/ephy-shell.c: (ephy_shell_init):
Show an alert when mozilla cant start instead of crashing.
Do not import bookmarks dups.
Cleanup some mozilla code headers inclusion.
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | configure.in | 24 | ||||
-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 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-import.c | 47 | ||||
-rw-r--r-- | src/ephy-shell.c | 30 |
14 files changed, 174 insertions, 152 deletions
@@ -1,3 +1,27 @@ +2003-07-04 Marco Pesenti Gritti <marco@it.gnome.org> + + * configure.in: + + Remove use of acconfig.h. + + * embed/ephy-embed-shell.c: (ephy_embed_shell_get_embed_single): + * embed/ephy-embed-single.c: + * embed/ephy-embed-single.h: + * embed/mozilla/ContentHandler.cpp: + * embed/mozilla/EphyWrapper.cpp: + * embed/mozilla/Makefile.am: + * embed/mozilla/MozRegisterComponents.cpp: + * embed/mozilla/MozRegisterComponents.h: + * embed/mozilla/mozilla-embed-single.cpp: + * embed/mozilla/mozilla-embed-single.h: + * src/bookmarks/ephy-bookmarks-import.c: (bookmark_add), + (xbel_parse_folder), (ephy_bookmarks_import_mozilla): + * src/ephy-shell.c: (ephy_shell_init): + + Show an alert when mozilla cant start instead of crashing. + Do not import bookmarks dups. + Cleanup some mozilla code headers inclusion. + 2003-07-03 Jeremy Katz <katzj@redhat.com> * lib/ephy-node.c (callback): Must use va_copy when assigning diff --git a/configure.in b/configure.in index 572f8cfc1..36f8f8fa8 100644 --- a/configure.in +++ b/configure.in @@ -54,31 +54,12 @@ if test "x$enable_nautilus_view" = "xauto"; then fi fi if test "x$enable_nautilus_view" = "xyes"; then - AC_DEFINE(ENABLE_NAUTILUS_VIEW) + AC_DEFINE(ENABLE_NAUTILUS_VIEW, 1, [Define if the nautilus view has to be built]) nautilusview_pkgs=libnautilus fi AC_MSG_RESULT($enable_nautilus_view) AM_CONDITIONAL(ENABLE_NAUTILUS_VIEW, test "x$enable_nautilus_view" = "xyes") -dnl See if nautilus is installed in other prefix than epiphany so that we can load -dnl nautilus throbbers even then. -dnl Maybe FIXME: make this check not require libnautilus.pc -dnl -nautilus_prefix=`pkg-config --variable=prefix libnautilus 2> /dev/null` -if test "x${nautilus_prefix}" != "x"; then - if test "x${prefix}" = "xNONE"; then - epiphany_prefix="${ac_default_prefix}" - else - epiphany_prefix="${prefix}" - fi - - dnl We already search for nautilus throbbers in epiphany prefix, don't add the - dnl same directory or we'd show the throbbers twice. - if test "x${nautilus_prefix}" != "x${epiphany_prefix}"; then - AC_DEFINE_UNQUOTED(NAUTILUS_PREFIX, "${nautilus_prefix}") - fi -fi - PKG_CHECK_MODULES(EPIPHANY_DEPENDENCY, gtk+-2.0 libxml-2.0 libgnomeui-2.0 libglade-2.0 bonobo-activation-2.0 libbonoboui-2.0 >= $LIBBONOBOUI_REQUIRED ORBit-2.0 libglade-2.0 gnome-vfs-2.0 gnome-vfs-module-2.0 gconf-2.0 $nautilusview_pkgs) AC_SUBST(EPIPHANY_DEPENDENCY_CFLAGS) AC_SUBST(EPIPHANY_DEPENDENCY_LIBS) @@ -93,7 +74,6 @@ BONOBO_ACTIVATION_IDL="`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`" AC_SUBST(BONOBO_ACTIVATION_IDL) PKG_CHECK_MODULES(MOZILLA_COMPONENT, mozilla-gtkmozembed) -dnl AC_DEFINE(ENABLE_MOZILLA_EMBED) AC_SUBST(MOZILLA_COMPONENT_CFLAGS) AC_SUBST(MOZILLA_COMPONENT_LIBS) @@ -200,7 +180,7 @@ dnl Add the languages which your application supports here. ALL_LINGUAS="am ar be ca cs da de el en_GB es fr hu ja ko li nl mk ms no pl pt pt_BR ru sr sr@Latn sv tr vi zh_TW" GETTEXT_PACKAGE=epiphany AC_SUBST(GETTEXT_PACKAGE) -AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE") +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package]) AM_GLIB_GNU_GETTEXT dnl uninstalled share dir to search data 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 diff --git a/src/bookmarks/ephy-bookmarks-import.c b/src/bookmarks/ephy-bookmarks-import.c index 884b856ee..8a50fc62c 100644 --- a/src/bookmarks/ephy-bookmarks-import.c +++ b/src/bookmarks/ephy-bookmarks-import.c @@ -43,22 +43,29 @@ typedef struct _XbelInfo char *smarturl; } XbelInfo; -static EphyNode * -set_folder (EphyBookmarks *bookmarks, - EphyNode *bookmark, - const char *name) +static void +bookmark_add (EphyBookmarks *bookmarks, + const char *title, + const char *address, + const char *topic_name) { EphyNode *topic; + EphyNode *bmk; - topic = ephy_bookmarks_find_keyword (bookmarks, name, FALSE); - if (topic == NULL) - { - topic = ephy_bookmarks_add_keyword (bookmarks, name); - } + if (ephy_bookmarks_find_bookmark (bookmarks, address)) return; - ephy_bookmarks_set_keyword (bookmarks, topic, bookmark); + bmk = ephy_bookmarks_add (bookmarks, title, address); - return topic; + if (topic_name) + { + topic = ephy_bookmarks_find_keyword (bookmarks, topic_name, FALSE); + if (topic == NULL) + { + topic = ephy_bookmarks_add_keyword (bookmarks, topic_name); + } + + ephy_bookmarks_set_keyword (bookmarks, topic, bmk); + } } gboolean @@ -144,7 +151,6 @@ xbel_parse_folder (EphyBookmarks *bookmarks, { XbelInfo *xbel; xmlChar *url; - EphyNode *bmk; xbel = g_new0 (XbelInfo, 1); xbel->title = NULL; @@ -156,14 +162,7 @@ xbel_parse_folder (EphyBookmarks *bookmarks, child->children, xbel); - /* FIXME need to import also smart bookmark */ - bmk = ephy_bookmarks_add (bookmarks, - xbel->title, - url); - if (keyword) - { - set_folder (bookmarks, bmk, keyword); - } + bookmark_add (bookmarks, xbel->title, url, keyword); xmlFree (url); @@ -393,7 +392,6 @@ ephy_bookmarks_import_mozilla (EphyBookmarks *bookmarks, gchar *parsedname; GString *url = g_string_new (NULL); char *current_folder = NULL; - EphyNode *bmk; if (!(bf = fopen (filename, "r"))) { g_warning ("Failed to open file: %s\n", filename); @@ -411,10 +409,9 @@ ephy_bookmarks_import_mozilla (EphyBookmarks *bookmarks, break; case NS_SITE: parsedname = ns_parse_bookmark_item (name); - bmk = ephy_bookmarks_add (bookmarks, - parsedname, - url->str); - set_folder (bookmarks, bmk, current_folder); + + bookmark_add (bookmarks, parsedname, + url->str, current_folder); break; default: break; diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 926527193..0d9fac6f3 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -170,13 +170,31 @@ ephy_shell_init (EphyShell *gs) /* This ensures mozilla is fired up */ single = ephy_embed_shell_get_embed_single (EPHY_EMBED_SHELL (gs)); + if (single != NULL) + { + g_signal_connect (G_OBJECT (single), + "new_window_orphan", + G_CALLBACK(ephy_shell_new_window_cb), + NULL); - g_signal_connect (G_OBJECT (single), - "new_window_orphan", - G_CALLBACK(ephy_shell_new_window_cb), - NULL); - - ephy_init_services (gs); + ephy_init_services (gs); + } + else + { + GtkWidget *dialog; + + dialog = gtk_message_dialog_new + (NULL, + GTK_DIALOG_MODAL, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Epiphany can't be used now. " + "Mozilla initialization failed. Check your " + "MOZILLA_FIVE_HOME environmental variable.")); + gtk_dialog_run (GTK_DIALOG (dialog)); + + exit (0); + } } static void |