static void katze_http_cookies_jar_changed_cb (SoupCookieJar* jar, SoupCookie* old_cookie, SoupCookie* new_cookie, KatzeHttpCookies* http_cookies) { GObject* settings; guint accept_cookies; if (old_cookie) soup_cookie_set_max_age (old_cookie, 0); if (new_cookie) { settings = g_object_get_data (G_OBJECT (jar), "midori-settings"); accept_cookies = katze_object_get_enum (settings, "accept-cookies"); if (accept_cookies == 2 /* MIDORI_ACCEPT_COOKIES_NONE */) { soup_cookie_set_max_age (new_cookie, 0); } else if (accept_cookies == 1 /* MIDORI_ACCEPT_COOKIES_SESSION */ && new_cookie->expires) { soup_cookie_set_max_age (new_cookie, -1); } else if (new_cookie->expires) { gint age = katze_object_get_int (settings, "maximum-cookie-age"); if (age > 0) { SoupDate* max_date = soup_date_new_from_now ( age * SOUP_COOKIE_MAX_AGE_ONE_DAY); if (soup_date_to_time_t (new_cookie->expires) > soup_date_to_time_t (max_date)) soup_cookie_set_expires (new_cookie, max_date); } else { /* An age of 0 to SoupCookie means already-expired A user choosing 0 days probably expects 1 hour. */ soup_cookie_set_max_age (new_cookie, SOUP_COOKIE_MAX_AGE_ONE_HOUR); } } } if (g_getenv ("MIDORI_COOKIES_DEBUG") != NULL) http_cookies->counter++; if (!http_cookies->timeout && (old_cookie || new_cookie->expires)) http_cookies->timeout = g_timeout_add_seconds (5, (GSourceFunc)katze_http_cookies_update_jar, http_cookies); }
void midori_normal_app_on_quit (MidoriApp* app) { MidoriWebSettings* settings = katze_object_get_object (app, "settings"); MidoriBookmarksDb* bookmarks = katze_object_get_object (app, "bookmarks"); KatzeArray* history = katze_object_get_object (app, "history"); g_object_notify (G_OBJECT (settings), "load-on-startup"); midori_bookmarks_db_on_quit (bookmarks); midori_history_on_quit (history, settings); midori_private_data_on_quit (settings); MidoriStartup load_on_startup = katze_object_get_int (settings, "load-on-startup"); if (load_on_startup < MIDORI_STARTUP_LAST_OPEN_PAGES) { gchar* config_file = midori_paths_get_config_filename_for_writing ("session.xbel"); g_unlink (config_file); } }