[gvfs/wip/rishi/goa] Handle empty parents map
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/rishi/goa] Handle empty parents map
- Date: Mon, 7 Sep 2015 14:58:49 +0000 (UTC)
commit b01ab6c36bbf1f675a8ad9584b8ac72359910bf2
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Sep 7 16:58:26 2015 +0200
Handle empty parents map
daemon/gvfsbackendgoogle.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/daemon/gvfsbackendgoogle.c b/daemon/gvfsbackendgoogle.c
index 1a6006b..5a51ba6 100644
--- a/daemon/gvfsbackendgoogle.c
+++ b/daemon/gvfsbackendgoogle.c
@@ -293,7 +293,8 @@ get_content_type_from_entry (GDataEntry *entry)
/* ---------------------------------------------------------------------------------------------------- */
static gchar *
-get_parent_id (GDataEntry *entry)
+get_parent_id (GVfsBackendGoogle *self,
+ GDataEntry *entry)
{
GList *l;
GList *links = NULL;
@@ -325,6 +326,14 @@ get_parent_id (GDataEntry *entry)
}
}
+ if (ret_val == NULL)
+ {
+ const gchar *root_id;
+
+ root_id = gdata_entry_get_id (self->root);
+ ret_val = g_strdup (root_id);
+ }
+
g_list_free (links);
return ret_val;
}
@@ -348,7 +357,7 @@ get_entry_path (GVfsBackendGoogle *self, GDataEntry *entry)
path = g_string_new (base_id);
g_string_prepend_c (path, '/');
- id = get_parent_id (entry);
+ id = get_parent_id (self, entry);
root_id = gdata_entry_get_id (self->root);
while (id != NULL)
@@ -371,7 +380,7 @@ get_entry_path (GVfsBackendGoogle *self, GDataEntry *entry)
g_string_prepend_c (path, '/');
g_free (id);
- id = get_parent_id (parent_entry);
+ id = get_parent_id (self, parent_entry);
}
ret_val = g_strdup (path->str);
@@ -403,7 +412,7 @@ insert_entry_full (GVfsBackendGoogle *self,
g_hash_table_insert (self->entries, g_strdup (id), g_object_ref (entry));
- parent_id = get_parent_id (entry);
+ parent_id = get_parent_id (self, entry);
if (parent_id == NULL)
{
g_warning (" insert_entry: Unable to get parent ID for entry %s (title: %s)", id, title);
@@ -482,7 +491,7 @@ remove_entry (GVfsBackendGoogle *self,
g_hash_table_remove (self->entries, id);
- parent_id = get_parent_id (entry);
+ parent_id = get_parent_id (self, entry);
if (parent_id == NULL)
{
g_warning (" remove_entry: Unable to get parent ID for entry %s (title: %s)", id, title);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]