diff options
author | Bastien Nocera <hadess@hadess.net> | 2014-05-09 11:40:57 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2014-08-18 12:53:57 +0200 |
commit | a71e8cc724299cec5a39cb3924c506b7ee185df8 (patch) | |
tree | 85f19de31be48e50bbbd117c3360d8124bc8ac6a | |
parent | 72bc2886692cf025a4bf1d63f7c47ce3f00b34a5 (diff) | |
download | totem-a71e8cc724299cec5a39cb3924c506b7ee185df8.tar.gz |
main: Don't allow adding duplicate items to recent
https://bugzilla.gnome.org/show_bug.cgi?id=729775
-rw-r--r-- | src/totem-grilo.c | 14 |
1 files changed, 14 insertions, 0 deletions
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, |