Prevent duplicate entries by looking for trailing slashes

This commit is contained in:
Dale Whittaker 2009-01-27 18:56:21 +01:00 committed by Christian Dywan
parent 181aa10b9d
commit 3c75e9eb20

View file

@ -592,17 +592,28 @@ midori_location_action_iter_lookup (MidoriLocationAction* location_action,
GtkTreeIter* iter) GtkTreeIter* iter)
{ {
gchar* path; gchar* path;
gchar* new_uri;
gboolean found;
if ((path = g_hash_table_lookup (location_action->items, uri))) found = FALSE;
new_uri = NULL;
if (!g_str_has_suffix (uri, "/"))
new_uri = g_strconcat (uri, "/", NULL);
if ((path = g_hash_table_lookup (location_action->items,
new_uri ? new_uri : uri)))
{ {
if (gtk_tree_model_get_iter_from_string (location_action->model, if (!(found = gtk_tree_model_get_iter_from_string (location_action->model,
iter, path)) iter, path)))
return TRUE; {
g_hash_table_remove (location_action->items,
g_hash_table_remove (location_action->items, uri); new_uri ? new_uri : uri);
}
} }
g_free (new_uri);
return FALSE; return found;
} }
/** /**