[bijiben: 8/11] noteBook: do not replace existing collections
- From: Pierre-Yves Luyten <pyluyten src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bijiben: 8/11] noteBook: do not replace existing collections
- Date: Sun, 28 Apr 2013 23:14:57 +0000 (UTC)
commit 9cb72eae1aae98c2974f7a3880c5fd05fdf6569d
Author: Pierre-Yves Luyten <py luyten fr>
Date: Mon Apr 29 00:04:53 2013 +0200
noteBook: do not replace existing collections
Only create really new ones
src/libbiji/biji-note-book.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/libbiji/biji-note-book.c b/src/libbiji/biji-note-book.c
index a754cb6..edf7319 100644
--- a/src/libbiji/biji-note-book.c
+++ b/src/libbiji/biji-note-book.c
@@ -205,18 +205,20 @@ _biji_note_book_add_one_note (BijiNoteBook *book, BijiNoteObj *note)
/* Check for new collections */
collections = biji_note_obj_get_collections (note);
+
for (l = collections ; l != NULL; l = l->next)
{
BijiCollection *collection;
- /* If the collection already existed,
- * previous is finalized (GHashTable)
- * We could also check before creating it */
+ collection = g_hash_table_lookup (book->priv->items, l->data);
- collection = biji_collection_new ((gchar*) l->data);
- g_hash_table_insert (book->priv->items,
- biji_item_get_uuid (BIJI_ITEM (collection)),
- collection);
+ if (!collection)
+ {
+ collection = biji_collection_new ((gchar*) l->data);
+ g_hash_table_insert (book->priv->items,
+ biji_item_get_uuid (BIJI_ITEM (collection)),
+ collection);
+ }
}
/* Notify */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]