if (private)
{
+ g_object_set (settings,
#if WEBKIT_CHECK_VERSION (1, 1, 2)
- g_object_set (settings, "enable-private-browsing", TRUE, NULL);
+ "enable-private-browsing", TRUE,
#endif
/* Arguably DNS prefetching is or isn't a privacy concern. For the
* lack of more fine-grained control we'll go the safe route. */
- #if WEBKIT_CHECK_VERSION (1, 3, 13)
- g_object_set (settings, "enable-dns-prefetching", FALSE, NULL);
- #endif
- g_object_set (settings, "strip-referer", TRUE, NULL);
+ "enable-dns-prefetching", FALSE,
+ "strip-referer", TRUE, NULL);
midori_browser_set_action_visible (browser, "Tools", FALSE);
midori_browser_set_action_visible (browser, "ClearPrivateData", FALSE);
}
if (item)
{
tooltip = g_strdup (katze_item_get_uri (item));
- sokoke_prefetch_uri (tooltip, NULL, NULL);
+ sokoke_prefetch_uri (midori_browser_get_settings (browser),
+ tooltip, NULL, NULL);
}
}
_midori_browser_set_statusbar_text (browser, tooltip);
const gchar* link_uri,
MidoriView* view)
{
- #if !(WEBKIT_CHECK_VERSION (2, 18, 0) && defined (HAVE_LIBSOUP_2_29_3))
- sokoke_prefetch_uri (link_uri, NULL, NULL);
+ #if !(WEBKIT_CHECK_VERSION (1, 3, 1) && defined (HAVE_LIBSOUP_2_29_3))
+ sokoke_prefetch_uri (view->settings, link_uri, NULL, NULL);
#endif
katze_assign (view->link_uri, g_strdup (link_uri));
gint clear_private_data;
gchar* clear_data;
+ #if !WEBKIT_CHECK_VERSION (1, 3, 13)
+ gboolean enable_dns_prefetching;
+ #endif
gboolean strip_referer;
};
PROP_CLEAR_PRIVATE_DATA,
PROP_CLEAR_DATA,
+ PROP_ENABLE_DNS_PREFETCHING,
PROP_STRIP_REFERER
};
_("The data selected for deletion"),
NULL,
flags));
+ #if !WEBKIT_CHECK_VERSION (1, 3, 13)
+ /**
+ * MidoriWebSettings:enable-dns-prefetching:
+ *
+ * Whether to resolve host names in advance.
+ *
+ * Since: 0.3.4
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_ENABLE_DNS_PREFETCHING,
+ g_param_spec_boolean (
+ "enable-dns-prefetching",
+ "Whether to resolve host names in advance",
+ "Whether host names on a website or in bookmarks should be prefetched",
+ TRUE,
+ flags));
+ #endif
+
/**
* MidoriWebSettings:strip-referer:
*
case PROP_CLEAR_DATA:
katze_assign (web_settings->clear_data, g_value_dup_string (value));
break;
+ #if !WEBKIT_CHECK_VERSION (1, 3, 13)
+ case PROP_ENABLE_DNS_PREFETCHING:
+ web_settings->enable_dns_prefetching = g_value_get_boolean (value);
+ break;
+ #endif
case PROP_STRIP_REFERER:
web_settings->strip_referer = g_value_get_boolean (value);
break;
case PROP_CLEAR_DATA:
g_value_set_string (value, web_settings->clear_data);
break;
+ #if !WEBKIT_CHECK_VERSION (1, 3, 13)
+ case PROP_ENABLE_DNS_PREFETCHING:
+ g_value_set_boolean (value, web_settings->enable_dns_prefetching);
+ break;
+ #endif
case PROP_STRIP_REFERER:
g_value_set_boolean (value, web_settings->strip_referer);
break;
gint host_resolved = 0;
uri = g_strconcat ("http://", hostname, NULL);
- if (sokoke_prefetch_uri (uri, sokoke_resolve_hostname_cb,
+ if (sokoke_prefetch_uri (NULL, uri, sokoke_resolve_hostname_cb,
&host_resolved))
{
GTimer* timer = g_timer_new ();
/**
* sokoke_prefetch_uri:
+ * @settings: a #MidoriWebSettings instance, or %NULL
* @uri: an URI string
*
* Attempts to prefetch the specified URI, that is
* Return value: %TRUE on success
**/
gboolean
-sokoke_prefetch_uri (const char* uri,
+sokoke_prefetch_uri (MidoriWebSettings* settings,
+ const char* uri,
SoupAddressCallback callback,
gpointer user_data)
{
if (!uri)
return FALSE;
+
+ if (settings && !katze_object_get_boolean (settings, "enable-dns-prefetching"))
+ return FALSE;
+
s_uri = soup_uri_new (uri);
if (!s_uri || !s_uri->host)
return FALSE;
#define MIDORI_MOD_BACKGROUND(state) (state & GDK_SHIFT_MASK)
#define MIDORI_MOD_SCROLL(state) (state & GDK_CONTROL_MASK)
-#include <katze/katze.h>
-
-#include <webkit/webkit.h>
#include <JavaScriptCore/JavaScript.h>
+#include <midori/midori-websettings.h>
#if !GLIB_CHECK_VERSION (2, 14, 0)
#define G_PARAM_STATIC_STRINGS \
GtkFileChooserAction action);
gboolean
-sokoke_prefetch_uri (const char* uri,
+sokoke_prefetch_uri (MidoriWebSettings* settings,
+ const char* uri,
SoupAddressCallback callback,
gpointer user_data);