Blob Blame History Raw
From dd275eb432c8a7fbcd6b97a9a134a089eb92bc76 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@igalia.com>
Date: Fri, 6 Feb 2015 10:35:09 -0600
Subject: [PATCH] Fix the search provider

The search provider is crashing on start since
3806c195d631cc55f2cef64c4be6bc733745e730. EphyEmbedShell needs to create
a WebKitWebContext.

We could also try to inherit EphySearchProvider from EphyShell and then
run EphyEmbedShell as a GApplication, but that is really horrible
madness.

https://bugzilla.gnome.org/show_bug.cgi?id=741595
---
 embed/ephy-embed-shell.c        | 5 +++--
 embed/ephy-embed-shell.h        | 3 ++-
 src/Makefile.am                 | 2 ++
 src/ephy-search-provider-main.c | 4 ++++
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index e507372..09491f9 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -749,9 +749,10 @@ ephy_embed_shell_constructed (GObject *object)
   G_OBJECT_CLASS (ephy_embed_shell_parent_class)->constructed (object);
 
   embed_shell = EPHY_EMBED_SHELL (object);
-  /* Tests do not run the EmbedShell application instance, so make sure that
+  /* These do not run the EmbedShell application instance, so make sure that
      there is a web context and a user content manager for them. */
-  if (ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_TEST) {
+  if (ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_TEST ||
+      ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_SEARCH_PROVIDER) {
     ephy_embed_shell_create_web_context (embed_shell);
     embed_shell->priv->user_content = webkit_user_content_manager_new ();
   }
diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h
index e9734a2..ac695fe 100644
--- a/embed/ephy-embed-shell.h
+++ b/embed/ephy-embed-shell.h
@@ -48,7 +48,8 @@ typedef enum
   EPHY_EMBED_SHELL_MODE_PRIVATE,
   EPHY_EMBED_SHELL_MODE_INCOGNITO,
   EPHY_EMBED_SHELL_MODE_APPLICATION,
-  EPHY_EMBED_SHELL_MODE_TEST
+  EPHY_EMBED_SHELL_MODE_TEST,
+  EPHY_EMBED_SHELL_MODE_SEARCH_PROVIDER
 } EphyEmbedShellMode;
 
 #define EPHY_EMBED_SHELL_MODE_HAS_PRIVATE_PROFILE(mode) \
diff --git a/src/Makefile.am b/src/Makefile.am
index e5c8a0c..597fb8c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -183,6 +183,7 @@ epiphany_search_provider_SOURCES = \
 
 epiphany_search_provider_CPPFLAGS = \
 	-I$(top_builddir)/lib		\
+	-I$(top_srcdir)/embed		\
 	-I$(top_srcdir)/lib   		\
 	-I$(top_srcdir)/lib/history	\
 	-I$(top_srcdir)/src/bookmarks   \
@@ -200,6 +201,7 @@ epiphany_search_provider_LDADD = \
 	$(top_builddir)/lib/widgets/libephywidgets.la \
 	$(top_builddir)/lib/history/libephyhistory.la \
 	$(top_builddir)/lib/libephymisc.la \
+	$(top_builddir)/lib/egg/libegg.la \
 	$(DEPENDENCIES_LIBS) \
 	$(CODE_COVERAGE_LDFLAGS) \
 	$(LIBINTL)
diff --git a/src/ephy-search-provider-main.c b/src/ephy-search-provider-main.c
index 5c5905a..c77892e 100644
--- a/src/ephy-search-provider-main.c
+++ b/src/ephy-search-provider-main.c
@@ -20,7 +20,9 @@
 #include "config.h"
 
 #include "ephy-search-provider.h"
+#include "ephy-embed-shell.h"
 #include "ephy-file-helpers.h"
+#include "ephy-private.h"
 
 gint main (gint argc, gchar** argv)
 {
@@ -35,6 +37,8 @@ gint main (gint argc, gchar** argv)
     return 1;
   }
 
+  _ephy_shell_create_instance (EPHY_EMBED_SHELL_MODE_SEARCH_PROVIDER);
+
   search_provider = ephy_search_provider_new ();
   status = g_application_run (G_APPLICATION (search_provider), argc, argv);
   g_object_unref (search_provider);
-- 
2.1.0