diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-30 08:19:03 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-30 08:19:03 +0200 |
commit | 136933d10165d1991cc28621ea0e941904df02a9 (patch) | |
tree | f5bf855987da4b9bc306e0483bae838f4764cc1b /src/bookmarks.c | |
parent | d382445afe8fe7b8f8b6c7a3ec6cbecd0f9946b7 (diff) |
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.
Diffstat (limited to 'src/bookmarks.c')
-rw-r--r-- | src/bookmarks.c | 17 |
1 files changed, 17 insertions, 0 deletions
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) { | |||
216 | return bm != NULL; | 216 | return bm != NULL; |
217 | } | 217 | } |
218 | 218 | ||
219 | iBool updateBookmarkIcon_Bookmarks(iBookmarks *d, const iString *url, iChar icon) { | ||
220 | iBool changed = iFalse; | ||
221 | lock_Mutex(d->mtx); | ||
222 | const uint32_t id = findUrl_Bookmarks(d, url); | ||
223 | if (id) { | ||
224 | iBookmark *bm = get_Bookmarks(d, id); | ||
225 | if (!hasTag_Bookmark(bm, "remote")) { | ||
226 | if (icon != bm->icon) { | ||
227 | bm->icon = icon; | ||
228 | changed = iTrue; | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | unlock_Mutex(d->mtx); | ||
233 | return changed; | ||
234 | } | ||
235 | |||
219 | iBookmark *get_Bookmarks(iBookmarks *d, uint32_t id) { | 236 | iBookmark *get_Bookmarks(iBookmarks *d, uint32_t id) { |
220 | return (iBookmark *) value_Hash(&d->bookmarks, id); | 237 | return (iBookmark *) value_Hash(&d->bookmarks, id); |
221 | } | 238 | } |