[gnome-photos/wip/favorites: 3/7] base-manager: Do not replace existing objects for a particular ID
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/favorites: 3/7] base-manager: Do not replace existing objects for a particular ID
- Date: Wed, 12 Dec 2012 05:46:15 +0000 (UTC)
commit 726967b0bff2264381448898943f356dffce5b16
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Dec 11 23:27:54 2012 +0530
base-manager: Do not replace existing objects for a particular ID
This will let us re-use the PhotosItemManager for the Favorites mode,
where we will look for items marked as favorite. Otherwise we would
end up emitting an extra "object-added" for an object that belongs to
both modes.
src/photos-base-manager.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-base-manager.c b/src/photos-base-manager.c
index b2e8396..bef3365 100644
--- a/src/photos-base-manager.c
+++ b/src/photos-base-manager.c
@@ -207,6 +207,10 @@ photos_base_manager_add_object (PhotosBaseManager *self, GObject *object)
gchar *id;
g_object_get (object, "id", &id, NULL);
+ old_object = photos_base_manager_get_object_by_id (self, id);
+ if (old_object != NULL)
+ goto out;
+
g_hash_table_insert (self->priv->objects, (gpointer) id, g_object_ref (object));
g_signal_emit (self, signals[OBJECT_ADDED], 0, object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]