Split clearing of page icons from cache again

We need to re-visit this with an idea to preserve icons
from search engines or otherwise being in use.
This commit is contained in:
Christian Dywan 2012-03-08 22:18:16 +01:00
parent 7940a02ae8
commit 8b78ae5491

View file

@ -1795,29 +1795,32 @@ midori_clear_saved_logins_cb (void)
g_free (path); g_free (path);
} }
#if WEBKIT_CHECK_VERSION (1, 3, 11)
static void static void
midori_clear_web_cache_cb (void) midori_clear_web_cache_cb (void)
{
SoupSession* session = webkit_get_default_session ();
SoupSessionFeature* feature = soup_session_get_feature (session, SOUP_TYPE_CACHE);
gchar* cache = g_build_filename (g_get_user_cache_dir (), PACKAGE_NAME, "web", NULL);
soup_cache_clear (SOUP_CACHE (feature));
soup_cache_flush (SOUP_CACHE (feature));
sokoke_remove_path (cache, TRUE);
g_free (cache);
}
#endif
static void
midori_clear_page_icons_cb (void)
{ {
gchar* cache = g_build_filename (g_get_user_cache_dir (), gchar* cache = g_build_filename (g_get_user_cache_dir (),
PACKAGE_NAME, "icons", NULL); PACKAGE_NAME, "icons", NULL);
/* FIXME: Exclude search engine icons */
sokoke_remove_path (cache, TRUE); sokoke_remove_path (cache, TRUE);
g_free (cache); g_free (cache);
cache = g_build_filename (g_get_user_data_dir (), cache = g_build_filename (g_get_user_data_dir (),
"webkit", "icondatabase", NULL); "webkit", "icondatabase", NULL);
sokoke_remove_path (cache, TRUE); sokoke_remove_path (cache, TRUE);
g_free (cache); g_free (cache);
#if WEBKIT_CHECK_VERSION (1, 3, 11)
{
SoupSession* session = webkit_get_default_session ();
SoupSessionFeature* feature = soup_session_get_feature (session, SOUP_TYPE_CACHE);
cache = g_build_filename (g_get_user_cache_dir (), PACKAGE_NAME, "web", NULL);
soup_cache_clear (SOUP_CACHE (feature));
soup_cache_flush (SOUP_CACHE (feature));
sokoke_remove_path (cache, TRUE);
g_free (cache);
}
#endif
} }
static void static void
@ -2109,12 +2112,12 @@ main (int argc,
sokoke_register_privacy_item ("web-cookies", _("Cookies and Website data"), sokoke_register_privacy_item ("web-cookies", _("Cookies and Website data"),
G_CALLBACK (midori_clear_web_cookies_cb)); G_CALLBACK (midori_clear_web_cookies_cb));
#if WEBKIT_CHECK_VERSION (1, 3, 11) #if WEBKIT_CHECK_VERSION (1, 3, 11)
/* TODO: Preserve page icons of search engines and merge privacy items */
sokoke_register_privacy_item ("web-cache", _("Web Cache"), sokoke_register_privacy_item ("web-cache", _("Web Cache"),
G_CALLBACK (midori_clear_web_cache_cb)); G_CALLBACK (midori_clear_web_cache_cb));
#else
sokoke_register_privacy_item ("page-icons", _("Website icons"),
G_CALLBACK (midori_clear_web_cache_cb));
#endif #endif
sokoke_register_privacy_item ("page-icons", _("Website icons"),
G_CALLBACK (midori_clear_page_icons_cb));
/* Web Application or Private Browsing support */ /* Web Application or Private Browsing support */
if (webapp || private || run) if (webapp || private || run)