Only show one empty speed dial shortcut at the end
And discard invalid groups automatically.
This commit is contained in:
parent
e0168e5a94
commit
1515b1e8d9
1 changed files with 14 additions and 15 deletions
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in a new issue