[totem/gnome-3-12] main: Don't allow adding duplicate items to recent
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/gnome-3-12] main: Don't allow adding duplicate items to recent
- Date: Mon, 18 Aug 2014 11:08:15 +0000 (UTC)
commit a71e8cc724299cec5a39cb3924c506b7ee185df8
Author: Bastien Nocera <hadess hadess net>
Date: Fri May 9 11:40:57 2014 +0200
main: Don't allow adding duplicate items to recent
https://bugzilla.gnome.org/show_bug.cgi?id=729775
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 0fd0d69..e105b24 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]