aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-embed-shell.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-01-18 23:53:54 +0800
committerChristian Persch <chpe@src.gnome.org>2006-01-18 23:53:54 +0800
commitbc05ca2fb4d1d031e5ba4f081666bfcbec875872 (patch)
treebce80060063e65e63366c4063267802dc35cde61 /embed/ephy-embed-shell.c
parent539426a9bd327676ad71b263e497ce19da1adde9 (diff)
downloadgsoc2013-epiphany-bc05ca2fb4d1d031e5ba4f081666bfcbec875872.tar
gsoc2013-epiphany-bc05ca2fb4d1d031e5ba4f081666bfcbec875872.tar.gz
gsoc2013-epiphany-bc05ca2fb4d1d031e5ba4f081666bfcbec875872.tar.bz2
gsoc2013-epiphany-bc05ca2fb4d1d031e5ba4f081666bfcbec875872.tar.lz
gsoc2013-epiphany-bc05ca2fb4d1d031e5ba4f081666bfcbec875872.tar.xz
gsoc2013-epiphany-bc05ca2fb4d1d031e5ba4f081666bfcbec875872.tar.zst
gsoc2013-epiphany-bc05ca2fb4d1d031e5ba4f081666bfcbec875872.zip
Decouple embed single instantiation and initialisation. Prevents
2006-01-18 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed-shell.c: (impl_get_embed_single): * embed/ephy-embed-single.c: (ephy_embed_single_init): * embed/ephy-embed-single.h: * embed/mozilla/mozilla-embed-single.cpp: Decouple embed single instantiation and initialisation. Prevents double-initialisation on startup. * embed/mozilla/EphyContentPolicy.cpp: * embed/mozilla/EphyContentPolicy.h: Remove embed single variable, it was unused.
Diffstat (limited to 'embed/ephy-embed-shell.c')
-rw-r--r--embed/ephy-embed-shell.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 9e50c59fc..32dd8e1bc 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -33,6 +33,9 @@
#include "ephy-debug.h"
#include "ephy-adblock-manager.h"
+#include <glib/gi18n.h>
+#include <gtk/gtkmessagedialog.h>
+
#define EPHY_EMBED_SHELL_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_SHELL, EphyEmbedShellPrivate))
struct _EphyEmbedShellPrivate
@@ -43,6 +46,7 @@ struct _EphyEmbedShellPrivate
EphyEmbedSingle *embed_single;
EphyEncodings *encodings;
EphyAdBlockManager *adblock_manager;
+ guint single_initialised : 1;
};
enum
@@ -201,12 +205,41 @@ ephy_embed_shell_get_downloader_view (EphyEmbedShell *shell)
static GObject *
impl_get_embed_single (EphyEmbedShell *shell)
{
+ EphyEmbedShellPrivate *priv;
+
g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), NULL);
- if (shell->priv->embed_single == NULL)
+ priv = shell->priv;
+
+ if (priv->embed_single != NULL &&
+ !priv->single_initialised)
+ {
+ g_warning ("ephy_embed_shell_get_embed_single called while the single is being initialised!\n");
+ return G_OBJECT (priv->embed_single);
+ }
+
+ if (priv->embed_single == NULL)
{
- shell->priv->embed_single = EPHY_EMBED_SINGLE
+ priv->embed_single = EPHY_EMBED_SINGLE
(ephy_embed_factory_new_object (EPHY_TYPE_EMBED_SINGLE));
+
+ if (!ephy_embed_single_init (priv->embed_single))
+ {
+ 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."));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ exit (0);
+ }
+
+ priv->single_initialised = TRUE;
}
return G_OBJECT (shell->priv->embed_single);