From fb1d931e2c327da8c2ae87c04c40e71aa982ad5f Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 28 Mar 2009 03:04:27 +0100 Subject: [PATCH] Load cookie jar in an idle callback This improves perceived startup time a lot. --- midori/main.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/midori/main.c b/midori/main.c index 9fe227c9..6512ca43 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1433,6 +1433,28 @@ midori_create_diagnostic_dialog (MidoriWebSettings* settings, return dialog; } +static gboolean +midori_load_cookie_jar (gpointer data) +{ + MidoriWebSettings* settings = MIDORI_WEB_SETTINGS (data); + SoupSession* webkit_session; + KatzeNet* net; + SoupSession* s_session; + SoupCookieJar* jar; + + 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); + + return FALSE; +} + static gboolean midori_load_extensions (gpointer data) { @@ -1645,10 +1667,6 @@ main (int argc, gchar* uri; KatzeItem* item; gchar* uri_ready; - KatzeNet* net; - SoupSession* webkit_session; - SoupSession* s_session; - SoupCookieJar* jar; #if HAVE_SQLITE sqlite3* db; gint max_history_age; @@ -1872,16 +1890,6 @@ main (int argc, } g_string_free (error_messages, TRUE); - 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; while (uris && uris[i]) @@ -1995,6 +2003,7 @@ main (int argc, g_signal_connect (app, "add-browser", G_CALLBACK (midori_app_add_browser_cb), NULL); + g_idle_add (midori_load_cookie_jar, settings); g_idle_add (midori_load_extensions, app); katze_item_set_parent (KATZE_ITEM (_session), app); g_idle_add (midori_load_session, _session); -- 2.39.5