From a71e8cc724299cec5a39cb3924c506b7ee185df8 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 9 May 2014 11:40:57 +0200 Subject: main: Don't allow adding duplicate items to recent https://bugzilla.gnome.org/show_bug.cgi?id=729775 --- src/totem-grilo.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/totem-grilo.c b/src/totem-grilo.c index 0fd0d690d..e105b2438 100644 --- a/src/totem-grilo.c +++ b/src/totem-grilo.c @@ -2559,6 +2559,7 @@ totem_grilo_add_item_to_recent (TotemGrilo *self, { GrlMedia *media; GFile *file; + FindMediaData data; g_return_val_if_fail (TOTEM_IS_GRILO (self), FALSE); @@ -2600,6 +2601,19 @@ totem_grilo_add_item_to_recent (TotemGrilo *self, if (!media) return FALSE; + data.found = FALSE; + data.key = GRL_METADATA_KEY_URL; + data.media = media; + data.iter = NULL; + gtk_tree_model_foreach (self->priv->recent_model, (GtkTreeModelForeachFunc) find_media_cb, &data); + + if (data.found) { + g_debug ("URI '%s' is already present in the bookmarks, not adding duplicate", uri); + gtk_tree_iter_free (data.iter); + g_object_unref (media); + return FALSE; + } + /* This should be quick, just adding the item to the DB */ grl_source_store_sync (self->priv->bookmarks_src, NULL, -- cgit v1.2.1