#include <unistd.h>
#endif
+#if !WEBKIT_CHECK_VERSION (1, 3, 11)
+
#define MAXLENGTH 1024 * 1024
static gchar*
{
sokoke_remove_path (web_cache_get_cache_dir (), TRUE);
}
+#endif
MidoriExtension*
extension_init (void)
{
+ #if WEBKIT_CHECK_VERSION (1, 3, 11)
+ return NULL;
+ #else
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Web Cache"),
"description", _("Cache HTTP communication on disk"),
G_CALLBACK (web_cache_clear_cache_cb));
return extension;
+ #endif
}
#include <webkit/webkit.h>
#include <sqlite3.h>
+#if WEBKIT_CHECK_VERSION (1, 3, 11)
+ #define LIBSOUP_USE_UNSTABLE_REQUEST_API
+ #include <libsoup/soup-cache.h>
+#endif
+
#if ENABLE_NLS
#include <libintl.h>
#include <locale.h>
soup_session_add_feature (session, feature);
g_object_unref (feature);
+ #if WEBKIT_CHECK_VERSION (1, 3, 11)
+ config_file = g_build_filename (g_get_user_cache_dir (),
+ PACKAGE_NAME, "web", NULL);
+ feature = SOUP_SESSION_FEATURE (soup_cache_new (config_file, 0));
+ g_free (config_file);
+ soup_session_add_feature (session, feature);
+ soup_cache_set_max_size (SOUP_CACHE (feature),
+ katze_object_get_int (settings, "maximum-cache-size") * 1024 * 1024);
+ soup_cache_load (SOUP_CACHE (feature));
+ #endif
+
return FALSE;
}
if (!extension)
{
+ /* No extension, no error: not available, not shown */
+ if (g_module_error () == NULL)
+ continue;
+
extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", filename,
"description", g_module_error (),
webkit_remove_all_web_databases ();
}
#endif
+
+#if WEBKIT_CHECK_VERSION (1, 3, 11)
+static void
+midori_clear_web_cache_cb (void)
+{
+ SoupSession* session = webkit_get_default_session ();
+ SoupSessionFeature* feature = soup_session_get_feature (session, SOUP_TYPE_CACHE);
+ gchar* path = 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 (path, TRUE);
+ g_free (path);
+}
+#endif
+
#if WEBKIT_CHECK_VERSION (1, 3, 13)
static void
midori_clear_offline_appcache_cb (void)
sokoke_register_privacy_item ("html5-databases", _("HTML5 _Databases"),
G_CALLBACK (midori_clear_html5_databases_cb));
#endif
+ #if WEBKIT_CHECK_VERSION (1, 3, 11)
+ sokoke_register_privacy_item ("web-cache", _("Web Cache"),
+ G_CALLBACK (midori_clear_web_cache_cb));
+ #endif
#if WEBKIT_CHECK_VERSION (1, 3, 13)
sokoke_register_privacy_item ("offline-appcache", _("Offline Application Cache"),
G_CALLBACK (midori_clear_offline_appcache_cb));
INDENTED_ADD (button);
button = katze_property_proxy (settings, "open-tabs-in-the-background", NULL);
SPANNED_ADD (button);
+
+ /* Page "Applications" */
#if !HAVE_HILDON
+ PAGE_NEW (GTK_STOCK_CONVERT, _("Applications"));
+ FRAME_NEW (_("External applications"));
label = katze_property_label (settings, "text-editor");
INDENTED_ADD (label);
entry = katze_property_proxy (settings, "text-editor", "application-text/plain");
SPANNED_ADD (entry);
+ label = katze_property_label (settings, "news-aggregator");
+ INDENTED_ADD (label);
+ entry = katze_property_proxy (settings, "news-aggregator", "application-News");
+ SPANNED_ADD (entry);
#endif
/* Page "Network" */
G_CALLBACK (midori_preferences_notify_proxy_type_cb), entry);
midori_preferences_notify_proxy_type_cb (settings, NULL, entry);
#endif
+ #if WEBKIT_CHECK_VERSION (1, 3, 11)
+ label = katze_property_label (settings, "maximum-cache-size");
+ INDENTED_ADD (label);
+ button = katze_property_proxy (settings, "maximum-cache-size", NULL);
+ SPANNED_ADD (button);
+ label = gtk_label_new (_("MB"));
+ SPANNED_ADD (label);
+ #endif
label = katze_property_label (settings, "identify-as");
INDENTED_ADD (label);
button = katze_property_proxy (settings, "identify-as", "custom-user-agent");
SPANNED_ADD (button);
- #if !HAVE_HILDON
- label = katze_property_label (settings, "news-aggregator");
- INDENTED_ADD (label);
- entry = katze_property_proxy (settings, "news-aggregator", "application-News");
- SPANNED_ADD (entry);
- #endif
}
GtkWidget* thumb_view;
KatzeArray* news_feeds;
- gchar* news_aggregator;
gboolean middle_click_opens_selection;
gboolean open_tabs_in_the_background;
gboolean close_buttons_on_tabs;
view->scrollh = view->scrollv = -2;
view->back_forward_set = FALSE;
- view->news_aggregator = NULL;
view->web_view = NULL;
/* Adjustments are not created initially, but overwritten later */
view->scrolled_window = katze_scrolled_new (NULL, NULL);
katze_object_assign (view->settings, NULL);
katze_object_assign (view->item, NULL);
- katze_assign (view->news_aggregator, NULL);
-
G_OBJECT_CLASS (midori_view_parent_class)->finalize (object);
}
g_object_set (view->web_view, "settings", settings, NULL);
- g_free (view->news_aggregator);
-
g_object_get (view->settings,
- "news-aggregator", &view->news_aggregator,
"zoom-text-and-images", &zoom_text_and_images,
"kinetic-scrolling", &kinetic_scrolling,
"close-buttons-on-tabs", &view->close_buttons_on_tabs,
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (view->settings), name, &value);
- if (name == g_intern_string ("news-aggregator"))
- katze_assign (view->news_aggregator, g_value_dup_string (&value));
- else if (name == g_intern_string ("zoom-text-and-images"))
+ if (name == g_intern_string ("zoom-text-and-images"))
{
if (view->web_view)
g_object_set (view->web_view, "full-content-zoom",
gchar* news_aggregator;
gchar* location_entry_search;
gchar* http_proxy;
+ #if WEBKIT_CHECK_VERSION (1, 3, 11)
+ gint maximum_cache_size;
+ #endif
gchar* http_accept_language;
gchar* ident_string;
PROP_PROXY_TYPE,
PROP_HTTP_PROXY,
+ PROP_MAXIMUM_CACHE_SIZE,
PROP_IDENTIFY_AS,
PROP_USER_AGENT,
PROP_PREFERRED_LANGUAGES,
NULL,
flags));
+ #if WEBKIT_CHECK_VERSION (1, 3, 11)
+ /**
+ * MidoriWebSettings:maximum-cache-size:
+ *
+ * The maximum size of cached pages on disk.
+ *
+ * Since: 0.3.4
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_MAXIMUM_CACHE_SIZE,
+ g_param_spec_int (
+ "maximum-cache-size",
+ _("Web Cache"),
+ _("The maximum size of cached pages on disk"),
+ 0, G_MAXINT, 100,
+ flags));
+ #endif
+
/**
* MidoriWebSettings:identify-as:
*
case PROP_HTTP_PROXY:
katze_assign (web_settings->http_proxy, g_value_dup_string (value));
break;
+ #if WEBKIT_CHECK_VERSION (1, 3, 11)
+ case PROP_MAXIMUM_CACHE_SIZE:
+ web_settings->maximum_cache_size = g_value_get_int (value);
+ break;
+ #endif
case PROP_IDENTIFY_AS:
web_settings->identify_as = g_value_get_enum (value);
if (web_settings->identify_as != MIDORI_IDENT_CUSTOM)
case PROP_HTTP_PROXY:
g_value_set_string (value, web_settings->http_proxy);
break;
+ #if WEBKIT_CHECK_VERSION (1, 3, 11)
+ case PROP_MAXIMUM_CACHE_SIZE:
+ g_value_set_int (value, web_settings->maximum_cache_size);
+ break;
+ #endif
case PROP_IDENTIFY_AS:
g_value_set_enum (value, web_settings->identify_as);
break;