summaryrefslogtreecommitdiff
path: root/src/bookmarks.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bookmarks.c')
-rw-r--r--src/bookmarks.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/bookmarks.c b/src/bookmarks.c
index 35e16d9a..fe2ca47a 100644
--- a/src/bookmarks.c
+++ b/src/bookmarks.c
@@ -83,6 +83,10 @@ int cmpTitleAscending_Bookmark(const iBookmark **a, const iBookmark **b) {
83 return cmpStringCase_String(&(*a)->title, &(*b)->title); 83 return cmpStringCase_String(&(*a)->title, &(*b)->title);
84} 84}
85 85
86iBool filterInsideFolder_Bookmark(void *context, const iBookmark *bm) {
87 return hasParent_Bookmark(bm, id_Bookmark(context));
88}
89
86/*----------------------------------------------------------------------------------------------*/ 90/*----------------------------------------------------------------------------------------------*/
87 91
88static const char *oldFileName_Bookmarks_ = "bookmarks.txt"; 92static const char *oldFileName_Bookmarks_ = "bookmarks.txt";
@@ -345,16 +349,9 @@ iBool remove_Bookmarks(iBookmarks *d, uint32_t id) {
345 lock_Mutex(d->mtx); 349 lock_Mutex(d->mtx);
346 iBookmark *bm = (iBookmark *) remove_Hash(&d->bookmarks, id); 350 iBookmark *bm = (iBookmark *) remove_Hash(&d->bookmarks, id);
347 if (bm) { 351 if (bm) {
348 /* If this is a remote source, make sure all the remote bookmarks are 352 /* Remove all the contained bookmarks as well. */
349 removed as well. */ 353 iConstForEach(PtrArray, i, list_Bookmarks(d, NULL, filterInsideFolder_Bookmark, bm)) {
350 if (hasTag_Bookmark(bm, remoteSource_BookmarkTag)) { 354 delete_Bookmark((iBookmark *) remove_Hash(&d->bookmarks, id_Bookmark(i.ptr)));
351 iForEach(Hash, i, &d->bookmarks) {
352 iBookmark *j = (iBookmark *) i.value;
353 if (j->parentId == id_Bookmark(bm)) {
354 remove_HashIterator(&i);
355 delete_Bookmark(j);
356 }
357 }
358 } 355 }
359 delete_Bookmark(bm); 356 delete_Bookmark(bm);
360 } 357 }