]> spindle.queued.net Git - midori/commitdiff
Prevent duplicate entries by looking for trailing slashes
authorDale Whittaker <dayul@users.sf.net>
Tue, 27 Jan 2009 17:56:21 +0000 (18:56 +0100)
committerChristian Dywan <christian@twotoasts.de>
Tue, 27 Jan 2009 17:56:21 +0000 (18:56 +0100)
midori/midori-locationaction.c

index 6c966b48941037fbcd92343e272b919c7d787756..bdcfce06cb4ea72c1b874306152d51175d6d87a9 100644 (file)
@@ -592,17 +592,28 @@ midori_location_action_iter_lookup (MidoriLocationAction* location_action,
                                     GtkTreeIter*          iter)
 {
     gchar* path;
+    gchar* new_uri;
+    gboolean found;
 
-    if ((path = g_hash_table_lookup (location_action->items, uri)))
-    {
-        if (gtk_tree_model_get_iter_from_string (location_action->model,
-                                                 iter, path))
-            return TRUE;
+    found = FALSE;
+    new_uri = NULL;
 
-        g_hash_table_remove (location_action->items, uri);
+    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 (!(found = gtk_tree_model_get_iter_from_string (location_action->model,
+                                                           iter, path)))
+        {
+            g_hash_table_remove (location_action->items,
+                                 new_uri ? new_uri : uri);
+        }
     }
+    g_free (new_uri);
 
-    return FALSE;
+    return found;
 }
 
 /**