From 34e397e76a0903675b223f638989703009ac5646 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Thu, 17 Dec 2020 15:33:03 +0200 Subject: Bookmarks: Improved bookmark list page formatting --- src/bookmarks.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/bookmarks.c') diff --git a/src/bookmarks.c b/src/bookmarks.c index 6d7302c0..1a7bf31c 100644 --- a/src/bookmarks.c +++ b/src/bookmarks.c @@ -229,13 +229,16 @@ const iPtrArray *list_Bookmarks(const iBookmarks *d, iBookmarksCompareFunc cmp, const iString *bookmarkListPage_Bookmarks(const iBookmarks *d) { iString *str = collectNew_String(); - setCStr_String(str, "Here are all your bookmarks. " - "You can save this page to export them, or you can copy them to " - "the clipboard.\n"); lock_Mutex(d->mtx); + format_String(str, + "You have %d bookmark%s.\n\n" + "Save this page to export them, or you can copy them to " + "the clipboard.\n\n", + size_Hash(&d->bookmarks), + size_Hash(&d->bookmarks) != 1 ? "s" : ""); iConstForEach(PtrArray, i, list_Bookmarks(d, cmpTitleAscending_Bookmark_, NULL, NULL)) { const iBookmark *bm = i.ptr; - appendFormat_String(str, "\n=> %s %s\n", cstr_String(&bm->url), cstr_String(&bm->title)); + appendFormat_String(str, "=> %s %s\n", cstr_String(&bm->url), cstr_String(&bm->title)); iRangecc tag = iNullRange; while (nextSplit_Rangecc(range_String(&bm->tags), " ", &tag)) { if (!isEmpty_Range(&tag)) { @@ -247,14 +250,12 @@ const iString *bookmarkListPage_Bookmarks(const iBookmarks *d) { } unlock_Mutex(d->mtx); appendCStr_String(str, - "\nPAGE FORMAT: " - "Text lines and preformatted text are comments and should be ignored. " + "\nText lines and preformatted text are comments and should be ignored. " "Each link line represents a bookmark. " "Folder structure is defined by headings. " "All links before the first heading are root level bookmarks. " "Bullet lines following a link are used for tags; each tag gets its own " "bullet line. Quotes are reserved for additional information about a " "bookmark.\n"); - appendCStr_String(str, "\nLagrange v" LAGRANGE_APP_VERSION "\n"); return str; } -- cgit v1.2.3