GNOME Bugzilla – Bug 589067
[GDataDocumentsEntry] Get path function doesn't work.
Last modified: 2009-07-20 18:22:38 UTC
Please describe the problem: The gdata_documents_entry_get_path doesn't work at all. Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Created attachment 138770 [details] [review] Change the way gdata_document_entry_get_path works and gdata_document I deleted the GDataDocumentsEntry::path property because it doesn't have sense anymore. I tested it and look fine now.
Created attachment 138834 [details] [review] New patch so the path is /folderID1/folderID2/.../DocumentID instead of /folderID1/folderID2/
Some notes: * You should have used a GString in get_path instead of a series of g_strconcat()s. GString reallocates memory, rather than allocating new memory then freeing the old stuff, which can be more efficient. It also simplifies the code. :-) * When adding entries to a GList in a loop, it's always better to prepend them all, then reverse the list at the end. g_list_append is an O(n) operation, while g_list_prepend is O(1). g_list_reverse is an O(n) operation, so you have an order-of-magnitude improvement in execution time. commit a1824d8706439c882f3e6fcb6496120fd4300e78 Author: Philip Withnall <philip@tecnocode.co.uk> Date: Mon Jul 20 19:18:16 2009 +0100 [documents] Fixed gdata_documents_entry_get_path function Necessarily also fixed gdata_entry_look_up_links, and added test cases for it. Based on patches by Thibault Saunier <saunierthibault@gmail.com>. Closes: bgo#589067 gdata/atom/gdata-link.c | 4 +- gdata/gdata-entry.c | 16 ++--- gdata/gdata.symbols | 1 + gdata/services/documents/gdata-documents-entry.c | 71 ++++++++++++---------- gdata/services/documents/gdata-documents-entry.h | 2 +- gdata/tests/general.c | 33 ++++++++++- 6 files changed, 84 insertions(+), 43 deletions(-)