[gnome-documents/wip/skydrive: 2/2] miner: Traverse the Skydrive hierarchy



commit 5bcfb25be907e4d610ad7874cc80c841d0439c87
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed May 23 17:29:21 2012 +0200

    miner: Traverse the Skydrive hierarchy
    
    Fixes: https://bugzilla.gnome.org/666535

 src/miner/gd-zpj-miner.c |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/src/miner/gd-zpj-miner.c b/src/miner/gd-zpj-miner.c
index 28f995f..e36c1e8 100644
--- a/src/miner/gd-zpj-miner.c
+++ b/src/miner/gd-zpj-miner.c
@@ -153,10 +153,56 @@ account_miner_job_cleanup_previous (AccountMinerJob *job,
   g_string_free (delete, TRUE);
 }
 
+static gboolean
+account_miner_job_process_entry (AccountMinerJob *job,
+                                 ZpjSkydriveEntry *entry,
+                                 GError **error)
+{
+}
+
+static void
+account_miner_job_traverse_folder (AccountMinerJob *job,
+                                   const gchar *folder_id,
+                                   GError **error)
+{
+  GList *entries, *l;
+
+  entries = zpj_skydrive_list_folder_id (job->service,
+                                         folder_id,
+                                         job->cancellable,
+                                         error);
+  if (entries == NULL)
+    return;
+
+  for (l = entries; l != NULL; l = l->next)
+    {
+      ZpjSkydriveEntry *entry = (ZpjSkydriveEntry *) l->data;
+      const gchar *id;
+
+      id = zpj_skydrive_entry_get_id (entry);
+
+      if (ZPJ_IS_SKYDRIVE_FOLDER (entry))
+        account_miner_job_traverse_folder (job, id, error);
+      else if (ZPJ_IS_SKYDRIVE_PHOTO (entry))
+        continue;
+
+      account_miner_job_process_entry (job, entry, error);
+
+      if (*error != NULL)
+        {
+          g_warning ("Unable to process entry %p: %s", l->data, (*error)->message);
+          g_clear_error (error);
+        }
+    }
+
+  g_list_free_full (entries, g_object_unref);
+}
+
 static void
 account_miner_job_query_zpj (AccountMinerJob *job,
                              GError **error)
 {
+  account_miner_job_traverse_folder (job, ZPJ_SKYDRIVE_FOLDER_SKYDRIVE, error);
 }
 
 



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