diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-17 15:33:03 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-17 15:33:03 +0200 |
commit | 34e397e76a0903675b223f638989703009ac5646 (patch) | |
tree | 868d9d152b91a3341dd77bdac744ea14eed4c4ef /src | |
parent | d8a95f267f4f1865a58cbed15e6b45349e9d2c09 (diff) |
Bookmarks: Improved bookmark list page formatting
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks.c | 15 |
1 files changed, 8 insertions, 7 deletions
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, | |||
229 | 229 | ||
230 | const iString *bookmarkListPage_Bookmarks(const iBookmarks *d) { | 230 | const iString *bookmarkListPage_Bookmarks(const iBookmarks *d) { |
231 | iString *str = collectNew_String(); | 231 | iString *str = collectNew_String(); |
232 | setCStr_String(str, "Here are all your bookmarks. " | ||
233 | "You can save this page to export them, or you can copy them to " | ||
234 | "the clipboard.\n"); | ||
235 | lock_Mutex(d->mtx); | 232 | lock_Mutex(d->mtx); |
233 | format_String(str, | ||
234 | "You have %d bookmark%s.\n\n" | ||
235 | "Save this page to export them, or you can copy them to " | ||
236 | "the clipboard.\n\n", | ||
237 | size_Hash(&d->bookmarks), | ||
238 | size_Hash(&d->bookmarks) != 1 ? "s" : ""); | ||
236 | iConstForEach(PtrArray, i, list_Bookmarks(d, cmpTitleAscending_Bookmark_, NULL, NULL)) { | 239 | iConstForEach(PtrArray, i, list_Bookmarks(d, cmpTitleAscending_Bookmark_, NULL, NULL)) { |
237 | const iBookmark *bm = i.ptr; | 240 | const iBookmark *bm = i.ptr; |
238 | appendFormat_String(str, "\n=> %s %s\n", cstr_String(&bm->url), cstr_String(&bm->title)); | 241 | appendFormat_String(str, "=> %s %s\n", cstr_String(&bm->url), cstr_String(&bm->title)); |
239 | iRangecc tag = iNullRange; | 242 | iRangecc tag = iNullRange; |
240 | while (nextSplit_Rangecc(range_String(&bm->tags), " ", &tag)) { | 243 | while (nextSplit_Rangecc(range_String(&bm->tags), " ", &tag)) { |
241 | if (!isEmpty_Range(&tag)) { | 244 | if (!isEmpty_Range(&tag)) { |
@@ -247,14 +250,12 @@ const iString *bookmarkListPage_Bookmarks(const iBookmarks *d) { | |||
247 | } | 250 | } |
248 | unlock_Mutex(d->mtx); | 251 | unlock_Mutex(d->mtx); |
249 | appendCStr_String(str, | 252 | appendCStr_String(str, |
250 | "\nPAGE FORMAT: " | 253 | "\nText lines and preformatted text are comments and should be ignored. " |
251 | "Text lines and preformatted text are comments and should be ignored. " | ||
252 | "Each link line represents a bookmark. " | 254 | "Each link line represents a bookmark. " |
253 | "Folder structure is defined by headings. " | 255 | "Folder structure is defined by headings. " |
254 | "All links before the first heading are root level bookmarks. " | 256 | "All links before the first heading are root level bookmarks. " |
255 | "Bullet lines following a link are used for tags; each tag gets its own " | 257 | "Bullet lines following a link are used for tags; each tag gets its own " |
256 | "bullet line. Quotes are reserved for additional information about a " | 258 | "bullet line. Quotes are reserved for additional information about a " |
257 | "bookmark.\n"); | 259 | "bookmark.\n"); |
258 | appendCStr_String(str, "\nLagrange v" LAGRANGE_APP_VERSION "\n"); | ||
259 | return str; | 260 | return str; |
260 | } | 261 | } |