[bijiben] manager, trash: allows to retrieve an archived note



commit ad7f9d6db2b51e6cea3947724a85d6681197fb4f
Author: Pierre-Yves Luyten <py luyten fr>
Date:   Tue Dec 3 01:08:24 2013 +0100

    manager, trash: allows to retrieve an archived note
    
    get_item_at_path should return trashed note

 src/libbiji/biji-manager.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/libbiji/biji-manager.c b/src/libbiji/biji-manager.c
index 2ad4dfb..12d6dd7 100644
--- a/src/libbiji/biji-manager.c
+++ b/src/libbiji/biji-manager.c
@@ -628,17 +628,36 @@ biji_manager_load_archives          (BijiManager        *manager)
 }
 
 
+static void
+_delete_item (gpointer key,
+              gpointer value,
+              gpointer user_data)
+{
+  BijiItem *i;
+
+  i = BIJI_ITEM (value);
+  biji_item_delete (value);
+}
+
+
 
-void
 biji_manager_empty_bin              (BijiManager        *manager)
 {
+  g_hash_table_foreach (manager->priv->archives, _delete_item, NULL);
 }
 
 
 BijiItem *
 biji_manager_get_item_at_path (BijiManager *manager, const gchar *path)
 {
-  return g_hash_table_lookup (manager->priv->items, (gconstpointer) path);
+  BijiItem *retval;
+
+  retval = g_hash_table_lookup (manager->priv->items, (gconstpointer) path);
+
+  if (retval == NULL)
+    retval = g_hash_table_lookup (manager->priv->archives, (gconstpointer) path);
+
+  return retval;
 }
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]