summaryrefslogtreecommitdiff
path: root/src/gmdocument.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-23 11:46:18 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-23 11:46:18 +0200
commit64b9cea544ecb2c0ae95afae5e84543ac6117f62 (patch)
treedbe2f0e2a462a14449c3053fdc30ccaf701782e7 /src/gmdocument.c
parent5d8bfceb00d5d6b358b358b76c5828344c179e5d (diff)
Improved handling of bookmark icons
The effect of a bookmark icon is restricted to URLs that begin with the bookmarked URL. TODO: Bookmark icon of an URL should affect the whole domain, but this should take into consideration user subdirectories ("~name" or "/users/name"). IssueID #140
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r--src/gmdocument.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 3298fecc..ff088ef7 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -720,6 +720,13 @@ static void setDerivedThemeColors_(enum iGmDocumentTheme theme) {
720 } 720 }
721} 721}
722 722
723static void updateIconBasedOnUrl_GmDocument_(iGmDocument *d) {
724 const iChar userIcon = siteIcon_Bookmarks(bookmarks_App(), &d->url);
725 if (userIcon) {
726 d->siteIcon = userIcon;
727 }
728}
729
723void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { 730void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
724 const iPrefs * prefs = prefs_App(); 731 const iPrefs * prefs = prefs_App();
725 enum iGmDocumentTheme theme = 732 enum iGmDocumentTheme theme =
@@ -1092,10 +1099,7 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
1092 if (equal_CStr(cstr_Block(seed), "gemini.circumlunar.space")) { 1099 if (equal_CStr(cstr_Block(seed), "gemini.circumlunar.space")) {
1093 d->siteIcon = 0x264a; /* gemini symbol */ 1100 d->siteIcon = 0x264a; /* gemini symbol */
1094 } 1101 }
1095 const iChar userIcon = siteIcon_Bookmarks(bookmarks_App(), urlHost_String(&d->url)); 1102 updateIconBasedOnUrl_GmDocument_(d);
1096 if (userIcon) {
1097 d->siteIcon = userIcon;
1098 }
1099 } 1103 }
1100#if 0 1104#if 0
1101 for (int i = tmFirst_ColorId; i < max_ColorId; ++i) { 1105 for (int i = tmFirst_ColorId; i < max_ColorId; ++i) {
@@ -1197,6 +1201,7 @@ void setUrl_GmDocument(iGmDocument *d, const iString *url) {
1197 iUrl parts; 1201 iUrl parts;
1198 init_Url(&parts, url); 1202 init_Url(&parts, url);
1199 setRange_String(&d->localHost, parts.host); 1203 setRange_String(&d->localHost, parts.host);
1204 updateIconBasedOnUrl_GmDocument_(d);
1200} 1205}
1201 1206
1202void setSource_GmDocument(iGmDocument *d, const iString *source, int width) { 1207void setSource_GmDocument(iGmDocument *d, const iString *source, int width) {