From aeef4e4ee3dad8ad36cfd17752da9e0b3c89b32a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Forysiuk?= Date: Sun, 7 Aug 2011 00:46:06 +0200 Subject: [PATCH] Use static variable to store speeddial markup. While it does not make anything faster, it causess way less I/O. --- midori/midori-view.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/midori/midori-view.c b/midori/midori-view.c index c589cd57..17041268 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -198,6 +198,8 @@ enum { static guint signals[LAST_SIGNAL]; +static gchar* speeddial_markup = NULL; + static void midori_view_finalize (GObject* object); @@ -3744,15 +3746,12 @@ prepare_speed_dial_html (MidoriView* view) cols * (thumb_size + 60), thumb_size < 160 ? "hidden" : "visible"); - if (!katze_object_get_boolean (view->settings, "enable-scripts")) - { - g_string_append (markup, - ""); - } + g_string_append (markup, + ""); while (slot <= rows * cols) { @@ -3863,9 +3862,11 @@ midori_view_set_uri (MidoriView* view, katze_assign (view->uri, g_strdup ("")); katze_item_set_uri (view->item, ""); - data = prepare_speed_dial_html (view); + if (speeddial_markup == NULL); + speeddial_markup = prepare_speed_dial_html (view); + midori_view_load_alternate_string (view, - data, "res:/", "about:blank", NULL); + speeddial_markup, "res:/", "about:blank", NULL); #ifdef G_ENABLE_DEBUG if (g_getenv ("MIDORI_STARTTIME") != NULL) @@ -3874,7 +3875,6 @@ midori_view_set_uri (MidoriView* view, g_timer_destroy (timer); } #endif - g_free (data); } /* This is not prefectly elegant, but creating special pages inline is the simplest solution. */ @@ -5513,6 +5513,7 @@ midori_view_speed_dial_save (MidoriView* view, config_file = g_build_filename (sokoke_set_config_dir (NULL), "speeddial", NULL); sokoke_key_file_save_to_file (key_file, config_file, NULL); + katze_assign (speeddial_markup, prepare_speed_dial_html (view)); i = 0; while ((tab = midori_browser_get_nth_tab (browser, i++)))