From 017d789f4faf0d962bf129f819a6a074cee52099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Guchens?= Date: Sat, 23 May 2009 23:59:22 +0200 Subject: [PATCH] Remove spaces from the speed dial JSON --- data/speeddial.json | 2 +- midori/midori-browser.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/data/speeddial.json b/data/speeddial.json index 0bb63f32..eeb62ab8 100644 --- a/data/speeddial.json +++ b/data/speeddial.json @@ -1 +1 @@ -'{"shortcuts": [ { "id": "s1", "href": "#", "title": "", "img": "" }, { "id": "s2", "href": "#", "title": "", "img": "" }, { "id": "s3", "href": "#", "title": "", "img": "" }, { "id": "s4", "href": "#", "title": "", "img": "" }, { "id": "s5", "href": "#", "title": "", "img": "" }, { "id": "s6", "href": "#", "title": "", "img": "" }, { "id": "s7", "href": "#", "title": "", "img": "" }, { "id": "s8", "href": "#", "title": "", "img": "" }, { "id": "s9", "href": "#", "title": "", "img": "" } ] }' +'{"shortcuts":[{"id":"s1","href":"#","title":"","img":""},{"id":"s2","href":"#","title":"","img":""},{"id":"s3","href":"#","title":"","img":""},{"id":"s4","href":"#","title":"","img":""},{"id":"s5","href":"#","title":"","img":""},{"id":"s6","href":"#","title":"","img":""},{"id":"s7","href":"#","title":"","img":""},{"id":"s8","href":"#","title":"","img":""},{"id":"s9","href":"#","title":"","img":""}]}' diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 6a4c38f8..e85ae554 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -932,7 +932,7 @@ midori_browser_speed_dial_get_next_free_slot (void) else g_file_get_contents (body_fname, &speed_dial_body, NULL, NULL); - regex = g_regex_new ("\"id\":[ \t]*\"(s[0-9])\"[ \t]*,[ \t]*\"href\":\"#\"", + regex = g_regex_new ("\"id\":\"(s[1-9])\",\"href\":\"#\"", G_REGEX_MULTILINE, 0, NULL); if (g_regex_match (regex, speed_dial_body, 0, &match_info)) @@ -1029,9 +1029,8 @@ midori_browser_add_speed_dial (MidoriBrowser* browser) encoded = g_base64_encode ((guchar *)file_content, sz); replace_from = g_strdup_printf ( - "\\{[ \t]*\"id\"[ \t]*:[ \t]*\"%s\"[ \t]*,[ \t]*\"href\"[ \t]*"\ - "[ \t]*:[ \t]*\"#\"[ \t]*,[ \t]*\"title\"[ \t]*:[ \t]*\"\"[ \t]*,"\ - "\"img\"[ \t]*:[ \t]*\"\"[ \t]*\\}", slot_id); + "\\{\"id\":\"%s\",\"href\":\"#\",\"title\":\"\",\"img\":\"\"\\}", + slot_id); replace_by = g_strdup_printf ( "{\"id\":\"%s\",\"href\":\"%s\",\"title\":\"%s\",\"img\":\"%s\"}", slot_id, uri, title, encoded);