SoupCookie* new_cookie,
gchar* filename)
{
- GObject* app;
GObject* settings;
guint accept_cookies;
{
FILE *out;
- /* FIXME: This is really a hack */
- app = g_type_get_qdata (SOUP_TYPE_SESSION,
- g_quark_from_static_string ("midori-app"));
- settings = katze_object_get_object (G_OBJECT (app), "settings");
+ 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 */)
{
}
static void
-katze_http_cookies_session_request_queued_cb (SoupSession* session,
- SoupMessage* msg,
- SoupSessionFeature* feature)
+katze_http_cookies_attach (SoupSessionFeature* feature,
+ SoupSession* session)
{
- const gchar* filename;
SoupSessionFeature* cookie_jar;
-
- filename = g_object_get_data (G_OBJECT (feature), "filename");
- if (!filename)
- return;
+ gchar* filename;
cookie_jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR);
- if (!cookie_jar)
- return;
-
- g_type_set_qdata (SOUP_TYPE_COOKIE_JAR,
- g_quark_from_static_string ("midori-has-jar"), (void*)1);
+ g_return_if_fail (cookie_jar != NULL);
+ filename = g_object_get_data (G_OBJECT (feature), "filename");
+ g_return_if_fail (filename != NULL);
cookie_jar_load (SOUP_COOKIE_JAR (cookie_jar), filename);
g_signal_connect_data (cookie_jar, "changed",
G_CALLBACK (cookie_jar_changed_cb), g_strdup (filename),
(GClosureNotify)g_free, 0);
- g_signal_handlers_disconnect_by_func (session,
- katze_http_cookies_session_request_queued_cb, feature);
-}
-static void
-katze_http_cookies_attach (SoupSessionFeature* feature,
- SoupSession* session)
-{
- g_signal_connect (session, "request-queued",
- G_CALLBACK (katze_http_cookies_session_request_queued_cb), feature);
}
static void
katze_http_cookies_detach (SoupSessionFeature* feature,
SoupSession* session)
{
- g_signal_handlers_disconnect_by_func (session,
- katze_http_cookies_session_request_queued_cb, feature);
+ /* Nothing to do. */
}
static void
static void
midori_soup_session_prepare (SoupSession* session,
+ SoupCookieJar* cookie_jar,
MidoriWebSettings* settings)
{
SoupSessionFeature* feature;
config_file = build_config_filename ("cookies.txt");
g_object_set_data_full (G_OBJECT (feature), "filename",
config_file, (GDestroyNotify)g_free);
+ soup_session_add_feature (session, SOUP_SESSION_FEATURE (cookie_jar));
soup_session_add_feature (session, feature);
}
KatzeItem* item;
gchar* uri_ready;
KatzeNet* net;
+ SoupSession* webkit_session;
SoupSession* s_session;
SoupCookieJar* jar;
#if HAVE_SQLITE
}
g_string_free (error_messages, TRUE);
- if (1)
- {
- SoupSession* webkit_session = webkit_get_default_session ();
-
- net = katze_net_new ();
- s_session = katze_net_get_session (net);
- g_type_set_qdata (SOUP_TYPE_SESSION,
- g_quark_from_static_string ("midori-app"), app);
- jar = soup_cookie_jar_new ();
- soup_session_add_feature (s_session, SOUP_SESSION_FEATURE (jar));
- soup_session_add_feature (webkit_session, SOUP_SESSION_FEATURE (jar));
- g_object_unref (jar);
- midori_soup_session_prepare (s_session, settings);
- midori_soup_session_prepare (webkit_session, settings);
- g_object_unref (net);
- }
+ webkit_session = webkit_get_default_session ();
+ net = katze_net_new ();
+ s_session = katze_net_get_session (net);
+ jar = soup_cookie_jar_new ();
+ g_object_set_data (G_OBJECT (jar), "midori-settings", settings);
+ midori_soup_session_prepare (s_session, jar, settings);
+ midori_soup_session_prepare (webkit_session, jar, settings);
+ g_object_unref (jar);
+ g_object_unref (net);
/* Open as many tabs as we have uris, seperated by pipes */
i = 0;