[Xfce4-commits] <midori:master> Only show one empty speed dial shortcut at the end

Christian Dywan noreply at xfce.org
Fri Nov 18 22:36:01 CET 2011


Updating branch refs/heads/master
         to 1515b1e8d9aec2d74f1694476735ce5e6fbc8a46 (commit)
       from e0168e5a94b612909ef0218010411fbf2413bff6 (commit)

commit 1515b1e8d9aec2d74f1694476735ce5e6fbc8a46
Author: Christian Dywan <christian at twotoasts.de>
Date:   Fri Nov 18 22:17:39 2011 +0100

    Only show one empty speed dial shortcut at the end
    
    And discard invalid groups automatically.

 midori/midori-view.c |   29 ++++++++++++++---------------
 1 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/midori/midori-view.c b/midori/midori-view.c
index 35c4af7..43bf765 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -3736,14 +3736,12 @@ prepare_speed_dial_html (MidoriView* view,
         g_string_append_printf (markup,
             "<style>.cross { left: -14px }</style>");
 
-    while (slot <= slot_count)
+    for (i = 0; groups[i]; i++)
     {
-        gchar* dial_entry = g_strdup_printf ("Dial %d", slot);
-        gchar* uri = g_key_file_get_string (key_file, dial_entry, "uri", NULL);
-
-        if (uri && *uri && *uri != '#')
+        gchar* uri = g_key_file_get_string (key_file, groups[i], "uri", NULL);
+        if (uri && strstr (uri, "://"))
         {
-            gchar* title = g_key_file_get_string (key_file, dial_entry, "title", NULL);
+            gchar* title = g_key_file_get_string (key_file, groups[i], "title", NULL);
             gchar* thumb_file = sokoke_build_thumbnail_path (uri);
             gchar* encoded;
 
@@ -3759,10 +3757,11 @@ prepare_speed_dial_html (MidoriView* view,
             {
                 encoded = g_strdup ("");
                 if (load_missing)
-                    midori_view_speed_dial_get_thumb (view, dial_entry, uri);
+                    midori_view_speed_dial_get_thumb (view, groups[i], uri);
             }
             g_free (thumb_file);
 
+            slot = atoi (groups[i] + strlen ("Dial "));
             g_string_append_printf (markup,
                 "<div class=\"shortcut\" id=\"s%d\"><div class=\"preview\">"
                 "<a class=\"cross\" href=\"#\" onclick='clearShortcut(\"s%d\");'></a>"
@@ -3774,18 +3773,18 @@ prepare_speed_dial_html (MidoriView* view,
             g_free (encoded);
         }
         else
-        {
-            g_string_append_printf (markup,
-                "<div class=\"shortcut\" id=\"s%d\"><div class=\"preview new\">"
-                "<a class=\"add\" href=\"#\" onclick='return getAction(\"s%d\");'></a>"
-                "</div><div class=\"title\">%s</div></div>\n",
-                slot, slot, _("Click to add a shortcut"));
-        }
+            g_key_file_remove_group (key_file, groups[i], NULL);
 
         slot++;
-        g_free (dial_entry);
         g_free (uri);
     }
+    g_strfreev (groups);
+
+    g_string_append_printf (markup,
+        "<div class=\"shortcut\" id=\"s%d\"><div class=\"preview new\">"
+        "<a class=\"add\" href=\"#\" onclick='return getAction(\"s%d\");'></a>"
+        "</div><div class=\"title\">%s</div></div>\n",
+        slot, slot, _("Click to add a shortcut"));
     g_string_append_printf (markup,
             "</div>\n</body>\n</html>\n");
 


More information about the Xfce4-commits mailing list