diff options
-rw-r--r-- | src/bookmarks.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bookmarks.c b/src/bookmarks.c index fe2ca47a..67c6a25f 100644 --- a/src/bookmarks.c +++ b/src/bookmarks.c | |||
@@ -327,6 +327,15 @@ void save_Bookmarks(const iBookmarks *d, const char *dirPath) { | |||
327 | unlock_Mutex(d->mtx); | 327 | unlock_Mutex(d->mtx); |
328 | } | 328 | } |
329 | 329 | ||
330 | static int maxOrder_Bookmarks_(const iBookmarks *d) { | ||
331 | int ord = 0; | ||
332 | iConstForEach(Hash, i, &d->bookmarks) { | ||
333 | const iBookmark *bm = (const iBookmark *) i.value; | ||
334 | ord = iMax(ord, bm->order); | ||
335 | } | ||
336 | return ord; | ||
337 | } | ||
338 | |||
330 | uint32_t add_Bookmarks(iBookmarks *d, const iString *url, const iString *title, const iString *tags, | 339 | uint32_t add_Bookmarks(iBookmarks *d, const iString *url, const iString *title, const iString *tags, |
331 | iChar icon) { | 340 | iChar icon) { |
332 | lock_Mutex(d->mtx); | 341 | lock_Mutex(d->mtx); |
@@ -340,6 +349,7 @@ uint32_t add_Bookmarks(iBookmarks *d, const iString *url, const iString *title, | |||
340 | } | 349 | } |
341 | bm->icon = icon; | 350 | bm->icon = icon; |
342 | initCurrent_Time(&bm->when); | 351 | initCurrent_Time(&bm->when); |
352 | bm->order = maxOrder_Bookmarks_(d) + 1; /* Last in lists. */ | ||
343 | insert_Bookmarks_(d, bm); | 353 | insert_Bookmarks_(d, bm); |
344 | unlock_Mutex(d->mtx); | 354 | unlock_Mutex(d->mtx); |
345 | return id_Bookmark(bm); | 355 | return id_Bookmark(bm); |