From 136933d10165d1991cc28621ea0e941904df02a9 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 30 Dec 2020 08:19:03 +0200 Subject: Update bookmark icons when opening pages If bookmarks are imported or added manually, they won't have the correct site icons. Whenever a page is loaded the bookmark icon is now updated. --- src/bookmarks.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/bookmarks.c') diff --git a/src/bookmarks.c b/src/bookmarks.c index e54c6239..7cf7f5a1 100644 --- a/src/bookmarks.c +++ b/src/bookmarks.c @@ -216,6 +216,23 @@ iBool remove_Bookmarks(iBookmarks *d, uint32_t id) { return bm != NULL; } +iBool updateBookmarkIcon_Bookmarks(iBookmarks *d, const iString *url, iChar icon) { + iBool changed = iFalse; + lock_Mutex(d->mtx); + const uint32_t id = findUrl_Bookmarks(d, url); + if (id) { + iBookmark *bm = get_Bookmarks(d, id); + if (!hasTag_Bookmark(bm, "remote")) { + if (icon != bm->icon) { + bm->icon = icon; + changed = iTrue; + } + } + } + unlock_Mutex(d->mtx); + return changed; +} + iBookmark *get_Bookmarks(iBookmarks *d, uint32_t id) { return (iBookmark *) value_Hash(&d->bookmarks, id); } -- cgit v1.2.3