Merge cookies, other data and caches in Clear Private Data
This commit is contained in:
parent
a2ebb7e671
commit
569b8e4779
1 changed files with 37 additions and 57 deletions
|
@ -1720,19 +1720,6 @@ midori_setup_inactivity_reset (MidoriBrowser* browser,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
midori_clear_page_icons_cb (void)
|
|
||||||
{
|
|
||||||
gchar* cache = g_build_filename (g_get_user_cache_dir (),
|
|
||||||
PACKAGE_NAME, "icons", NULL);
|
|
||||||
sokoke_remove_path (cache, TRUE);
|
|
||||||
g_free (cache);
|
|
||||||
cache = g_build_filename (g_get_user_data_dir (),
|
|
||||||
"webkit", "icondatabase", NULL);
|
|
||||||
sokoke_remove_path (cache, TRUE);
|
|
||||||
g_free (cache);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_clear_web_cookies_cb (void)
|
midori_clear_web_cookies_cb (void)
|
||||||
{
|
{
|
||||||
|
@ -1740,12 +1727,11 @@ midori_clear_web_cookies_cb (void)
|
||||||
SoupSessionFeature* jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
|
SoupSessionFeature* jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
|
||||||
GSList* cookies = soup_cookie_jar_all_cookies (SOUP_COOKIE_JAR (jar));
|
GSList* cookies = soup_cookie_jar_all_cookies (SOUP_COOKIE_JAR (jar));
|
||||||
SoupSessionFeature* feature;
|
SoupSessionFeature* feature;
|
||||||
|
gchar* cache;
|
||||||
|
|
||||||
|
/* HTTP Cookies/ Web Cookies */
|
||||||
for (; cookies != NULL; cookies = g_slist_next (cookies))
|
for (; cookies != NULL; cookies = g_slist_next (cookies))
|
||||||
{
|
soup_cookie_jar_delete_cookie ((SoupCookieJar*)jar, cookies->data);
|
||||||
SoupCookie* cookie = cookies->data;
|
|
||||||
soup_cookie_jar_delete_cookie ((SoupCookieJar*)jar, cookie);
|
|
||||||
}
|
|
||||||
soup_cookies_free (cookies);
|
soup_cookies_free (cookies);
|
||||||
/* Removing KatzeHttpCookies makes it save outstanding changes */
|
/* Removing KatzeHttpCookies makes it save outstanding changes */
|
||||||
if ((feature = soup_session_get_feature (session, KATZE_TYPE_HTTP_COOKIES)))
|
if ((feature = soup_session_get_feature (session, KATZE_TYPE_HTTP_COOKIES)))
|
||||||
|
@ -1755,19 +1741,25 @@ midori_clear_web_cookies_cb (void)
|
||||||
soup_session_add_feature (session, feature);
|
soup_session_add_feature (session, feature);
|
||||||
g_object_unref (feature);
|
g_object_unref (feature);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/* Local shared objects/ Flash cookies */
|
||||||
#ifdef GDK_WINDOWING_X11
|
#ifdef GDK_WINDOWING_X11
|
||||||
static void
|
cache = g_build_filename (g_get_home_dir (), ".macromedia", "Flash_Player", NULL);
|
||||||
midori_clear_flash_cookies_cb (void)
|
|
||||||
{
|
|
||||||
gchar* cache = g_build_filename (g_get_home_dir (), ".macromedia",
|
|
||||||
"Flash_Player", NULL);
|
|
||||||
sokoke_remove_path (cache, TRUE);
|
sokoke_remove_path (cache, TRUE);
|
||||||
g_free (cache);
|
g_free (cache);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* HTML5 databases */
|
||||||
|
webkit_remove_all_web_databases ();
|
||||||
|
|
||||||
|
/* HTML5 offline application caches */
|
||||||
|
#if WEBKIT_CHECK_VERSION (1, 3, 13)
|
||||||
|
/* Changing the size implies clearing the cache */
|
||||||
|
webkit_application_cache_set_maximum_size (
|
||||||
|
webkit_application_cache_get_maximum_size () - 1);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_clear_saved_logins_cb (void)
|
midori_clear_saved_logins_cb (void)
|
||||||
{
|
{
|
||||||
|
@ -1786,34 +1778,29 @@ midori_clear_saved_logins_cb (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_clear_html5_databases_cb (void)
|
midori_clear_web_cache_cb (void)
|
||||||
{
|
{
|
||||||
webkit_remove_all_web_databases ();
|
gchar* cache = g_build_filename (g_get_user_cache_dir (),
|
||||||
}
|
PACKAGE_NAME, "icons", NULL);
|
||||||
|
sokoke_remove_path (cache, TRUE);
|
||||||
|
g_free (cache);
|
||||||
|
cache = g_build_filename (g_get_user_data_dir (),
|
||||||
|
"webkit", "icondatabase", NULL);
|
||||||
|
sokoke_remove_path (cache, TRUE);
|
||||||
|
g_free (cache);
|
||||||
|
|
||||||
#if WEBKIT_CHECK_VERSION (1, 3, 11)
|
#if WEBKIT_CHECK_VERSION (1, 3, 11)
|
||||||
static void
|
|
||||||
midori_clear_web_cache_cb (void)
|
|
||||||
{
|
{
|
||||||
SoupSession* session = webkit_get_default_session ();
|
SoupSession* session = webkit_get_default_session ();
|
||||||
SoupSessionFeature* feature = soup_session_get_feature (session, SOUP_TYPE_CACHE);
|
SoupSessionFeature* feature = soup_session_get_feature (session, SOUP_TYPE_CACHE);
|
||||||
gchar* path = g_build_filename (g_get_user_cache_dir (), PACKAGE_NAME, "web", NULL);
|
cache = g_build_filename (g_get_user_cache_dir (), PACKAGE_NAME, "web", NULL);
|
||||||
soup_cache_clear (SOUP_CACHE (feature));
|
soup_cache_clear (SOUP_CACHE (feature));
|
||||||
soup_cache_flush (SOUP_CACHE (feature));
|
soup_cache_flush (SOUP_CACHE (feature));
|
||||||
sokoke_remove_path (path, TRUE);
|
sokoke_remove_path (cache, TRUE);
|
||||||
g_free (path);
|
g_free (cache);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WEBKIT_CHECK_VERSION (1, 3, 13)
|
|
||||||
static void
|
|
||||||
midori_clear_offline_appcache_cb (void)
|
|
||||||
{
|
|
||||||
/* Changing the size implies clearing the cache */
|
|
||||||
unsigned long long maximum = webkit_application_cache_get_maximum_size ();
|
|
||||||
webkit_application_cache_set_maximum_size (maximum - 1);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
midori_log_to_file (const gchar* log_domain,
|
midori_log_to_file (const gchar* log_domain,
|
||||||
|
@ -2098,24 +2085,17 @@ main (int argc,
|
||||||
g_log_set_default_handler (midori_log_to_file, (gpointer)logfile);
|
g_log_set_default_handler (midori_log_to_file, (gpointer)logfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
sokoke_register_privacy_item ("page-icons", _("Website icons"),
|
|
||||||
G_CALLBACK (midori_clear_page_icons_cb));
|
|
||||||
/* i18n: Logins and passwords in websites and web forms */
|
/* i18n: Logins and passwords in websites and web forms */
|
||||||
sokoke_register_privacy_item ("formhistory", _("Saved logins and _passwords"),
|
sokoke_register_privacy_item ("formhistory", _("Saved logins and _passwords"),
|
||||||
G_CALLBACK (midori_clear_saved_logins_cb));
|
G_CALLBACK (midori_clear_saved_logins_cb));
|
||||||
sokoke_register_privacy_item ("web-cookies", _("Cookies"),
|
sokoke_register_privacy_item ("web-cookies", _("Cookies and Website data"),
|
||||||
G_CALLBACK (midori_clear_web_cookies_cb));
|
G_CALLBACK (midori_clear_web_cookies_cb));
|
||||||
#ifdef GDK_WINDOWING_X11
|
|
||||||
sokoke_register_privacy_item ("flash-cookies", _("'Flash' Cookies"),
|
|
||||||
G_CALLBACK (midori_clear_flash_cookies_cb));
|
|
||||||
#endif
|
|
||||||
sokoke_register_privacy_item ("html5-databases", _("HTML5 _Databases"),
|
|
||||||
G_CALLBACK (midori_clear_html5_databases_cb));
|
|
||||||
#if WEBKIT_CHECK_VERSION (1, 3, 11)
|
#if WEBKIT_CHECK_VERSION (1, 3, 11)
|
||||||
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));
|
||||||
sokoke_register_privacy_item ("offline-appcache", _("Offline Application Cache"),
|
#else
|
||||||
G_CALLBACK (midori_clear_offline_appcache_cb));
|
sokoke_register_privacy_item ("page-icons", _("Website icons"),
|
||||||
|
G_CALLBACK (midori_clear_web_cache_cb));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Web Application or Private Browsing support */
|
/* Web Application or Private Browsing support */
|
||||||
|
|
Loading…
Reference in a new issue