[epiphany] Initialize the favicon database from WebKit2GTK+ as soon as possible.



commit 922083024453e10d90cc9819bd0bc6896636e780
Author: Mario Sanchez Prada <msanchez gnome org>
Date:   Tue Dec 4 13:31:47 2012 +0100

    Initialize the favicon database from WebKit2GTK+ as soon as possible.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679370

 embed/ephy-embed-single.c |    2 +-
 src/ephy-shell.c          |   19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index 1e77c5a..0c36e50 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -417,7 +417,7 @@ ephy_embed_single_initialize (EphyEmbedSingle *single)
   char *filename;
   char *cookie_policy;
 
-  /* TODO: SoupCache, SSL, favicons */
+  /* TODO: SoupCache, SSL */
   web_context = webkit_web_context_get_default ();
 
   /* Store cookies in moz-compatible SQLite format */
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 86b5e0b..07075ec 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -612,6 +612,12 @@ ephy_shell_init (EphyShell *shell)
 {
   EphyShell **ptr = &ephy_shell;
 
+#ifdef HAVE_WEBKIT2
+  WebKitWebContext *web_context;
+  EphyEmbedShellMode mode;
+  char *favicon_db_path;
+#endif
+
   shell->priv = EPHY_SHELL_GET_PRIVATE (shell);
 
   /* globally accessible singleton */
@@ -621,9 +627,20 @@ ephy_shell_init (EphyShell *shell)
                              (gpointer *)ptr);
 
 #ifdef HAVE_WEBKIT2
-  g_signal_connect (webkit_web_context_get_default (), "download-started",
+  web_context = webkit_web_context_get_default ();
+  g_signal_connect (web_context, "download-started",
                     G_CALLBACK (download_started_cb),
                     shell);
+
+  /* Initialize the favicon cache as early as possible, or further
+     calls to webkit_web_context_get_favicon_database will fail. */
+  mode = ephy_embed_shell_get_mode (ephy_embed_shell_get_default ());
+  favicon_db_path = g_build_filename (mode == EPHY_EMBED_SHELL_MODE_PRIVATE ?
+                                      ephy_dot_dir () : g_get_user_cache_dir (),
+                                      g_get_prgname (), "icondatabase", NULL);
+
+  webkit_web_context_set_favicon_database_directory (web_context, favicon_db_path);
+  g_free (favicon_db_path);
 #endif
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]