From: Paweł Forysiuk Date: Sat, 8 Sep 2012 22:31:02 +0000 (+0200) Subject: Fix slot and dial name mixups when preparing/ saving X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad99fb1ebbd897bea53531de3fead8732902ace0;p=midori Fix slot and dial name mixups when preparing/ saving --- diff --git a/midori/midori-speeddial.vala b/midori/midori-speeddial.vala index 31a2cbc8..b532f36b 100644 --- a/midori/midori-speeddial.vala +++ b/midori/midori-speeddial.vala @@ -120,14 +120,14 @@ namespace Midori { while (slot <= slot_count) { string tile = "Dial %u".printf (slot); if (!keyfile.has_group (tile)) - return "s%u".printf (slot); + return "Dial %u".printf (slot); slot++; } - return "s%u".printf (slot_count + 1); + return "Dial %u".printf (slot_count + 1); } public void add (string uri, string title, Gdk.Pixbuf img) { - string id = "Dial " + get_next_free_slot (); + string id = get_next_free_slot (); add_with_id (id, uri, title, img); } @@ -260,7 +260,7 @@ namespace Midori { if (action == "add" || action == "rename" || action == "delete" || action == "swap") { - uint slot_id = parts[1].to_int () + 1; + uint slot_id = parts[1].next_char().to_int () ; string dial_id = "Dial %u".printf (slot_id); if (action == "delete") { @@ -279,7 +279,7 @@ namespace Midori { keyfile.set_string (dial_id, "title", title); } else if (action == "swap") { - uint slot2_id = parts[2].to_int () + 1; + uint slot2_id = parts[2].next_char().to_int (); string dial2_id = "Dial %u".printf (slot2_id); string uri = keyfile.get_string (dial_id, "uri"); diff --git a/tests/speeddial.vala b/tests/speeddial.vala index 8a5d7460..1da490da 100644 --- a/tests/speeddial.vala +++ b/tests/speeddial.vala @@ -40,8 +40,8 @@ static void speeddial_load () { FileUtils.remove (json); Katze.assert_str_equal (json, dial_data.keyfile.to_data (), dial_json.keyfile.to_data ()); - Katze.assert_str_equal (json, Midori.SpeedDial.get_next_free_slot_fk (dial_data.keyfile), "s2"); - Katze.assert_str_equal (json, Midori.SpeedDial.get_next_free_Slot_fk (dial_json), "s2"); + Katze.assert_str_equal (json, dial_data.get_next_free_slot (), "Dial 2"); + Katze.assert_str_equal (json, dial_json.get_next_free_slot (), "Dial 2"); } void main (string[] args) {