katze_preferences_add_widget (preferences, button, "indented");
button = katze_property_proxy (settings, "maximum-cookie-age", "days");
katze_preferences_add_widget (preferences, button, "spanned");
+ #ifdef HAVE_LIBSOUP_2_29_91
+ button = katze_property_proxy (settings, "first-party-cookies-only", NULL);
+ katze_preferences_add_widget (preferences, button, "filled");
+ #endif
markup = g_strdup_printf ("<span size=\"smaller\">%s</span>",
_("Cookies store login data, saved games, "
midori_soup_session_set_proxy_uri (session, NULL);
}
+#ifdef HAVE_LIBSOUP_2_29_91
+static void
+soup_session_settings_notify_first_party_cb (MidoriWebSettings* settings,
+ GParamSpec* pspec,
+ SoupSession* session)
+{
+ void* jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
+ gboolean yes = katze_object_get_boolean (settings, "first-party-cookies-only");
+ g_object_set (jar, "accept-policy",
+ yes ? SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY
+ : SOUP_COOKIE_JAR_ACCEPT_ALWAYS, NULL);
+}
+#endif
+
static void
midori_soup_session_settings_accept_language_cb (SoupSession* session,
SoupMessage* msg,
G_CALLBACK (soup_session_settings_notify_http_proxy_cb), session);
g_signal_connect (settings, "notify::proxy-type",
G_CALLBACK (soup_session_settings_notify_http_proxy_cb), session);
+ #ifdef HAVE_LIBSOUP_2_29_91
+ if (g_object_class_find_property (G_OBJECT_GET_CLASS (settings),
+ "enable-file-access-from-file-uris")) /* WebKitGTK+ >= 1.1.21 */
+ g_signal_connect (settings, "notify::first-party-cookies-only",
+ G_CALLBACK (soup_session_settings_notify_first_party_cb), session);
+ #endif
g_signal_connect (session, "request-queued",
G_CALLBACK (midori_soup_session_settings_accept_language_cb), settings);
g_object_set (settings,
"preferred-languages", "en",
"enable-private-browsing", TRUE,
+ #ifdef HAVE_LIBSOUP_2_29_91
+ "first-party-cookies-only", TRUE,
+ #endif
"enable-html5-database", FALSE,
"enable-html5-local-storage", FALSE,
"enable-offline-web-application-cache", FALSE,
gboolean zoom_text_and_images : 1;
gboolean find_while_typing : 1;
gboolean kinetic_scrolling : 1;
- gboolean original_cookies_only : 1;
+ gboolean first_party_cookies_only : 1;
gboolean remember_last_visited_pages : 1;
MidoriProxy proxy_type : 2;
MidoriIdentity identify_as : 3;
PROP_FIND_WHILE_TYPING,
PROP_KINETIC_SCROLLING,
PROP_MAXIMUM_COOKIE_AGE,
+ PROP_FIRST_PARTY_COOKIES_ONLY,
PROP_MAXIMUM_HISTORY_AGE,
0, G_MAXINT, 30,
flags));
+ /**
+ * MidoriWebSettings:first-party-cookies-only:
+ *
+ * Whether only first party cookies should be accepted.
+ * WebKitGTK+ 1.1.21 is required for this to work.
+ *
+ * Since: 0.4.2
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_FIRST_PARTY_COOKIES_ONLY,
+ g_param_spec_boolean (
+ "first-party-cookies-only",
+ _("Only accept Cookies from sites you visit"),
+ _("Block cookies sent by third-party websites"),
+ #ifdef HAVE_LIBSOUP_2_29_91
+ TRUE,
+ g_object_class_find_property (gobject_class, /* WebKitGTK+ >= 1.1.21 */
+ "enable-file-access-from-file-uris") ? flags : G_PARAM_READABLE));
+ #else
+ FALSE,
+ G_PARAM_READABLE));
+ #endif
g_object_class_install_property (gobject_class,
PROP_MAXIMUM_HISTORY_AGE,
case PROP_MAXIMUM_COOKIE_AGE:
web_settings->maximum_cookie_age = g_value_get_int (value);
break;
+ case PROP_FIRST_PARTY_COOKIES_ONLY:
+ web_settings->first_party_cookies_only = g_value_get_boolean (value);
+ break;
case PROP_MAXIMUM_HISTORY_AGE:
web_settings->maximum_history_age = g_value_get_int (value);
case PROP_MAXIMUM_COOKIE_AGE:
g_value_set_int (value, web_settings->maximum_cookie_age);
break;
+ case PROP_FIRST_PARTY_COOKIES_ONLY:
+ g_value_set_boolean (value, web_settings->first_party_cookies_only);
+ break;
case PROP_MAXIMUM_HISTORY_AGE:
g_value_set_int (value, web_settings->maximum_history_age);