summaryrefslogtreecommitdiff
path: root/src/ui/sidebarwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-19 10:26:23 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-19 10:26:23 +0200
commit3bde9d383a107760ee56ebc7f780154bfd3f3de7 (patch)
tree4703b0625c68a30be76251c5349659f3c9d14a21 /src/ui/sidebarwidget.c
parent6e54b0b5449e607417b2bd5b68ac4292277bad4b (diff)
Remote bookmark sources
Bookmarks tagged "remotesource" are fetched and all links are treated as remote bookmarks. Remote bookmarks are not saved locally.
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r--src/ui/sidebarwidget.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index c2672646..3b7e7d4b 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -199,6 +199,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
199 case bookmarks_SidebarMode: { 199 case bookmarks_SidebarMode: {
200 iRegExp *homeTag = iClob(new_RegExp("\\bhomepage\\b", caseSensitive_RegExpOption)); 200 iRegExp *homeTag = iClob(new_RegExp("\\bhomepage\\b", caseSensitive_RegExpOption));
201 iRegExp *subTag = iClob(new_RegExp("\\bsubscribed\\b", caseSensitive_RegExpOption)); 201 iRegExp *subTag = iClob(new_RegExp("\\bsubscribed\\b", caseSensitive_RegExpOption));
202 iRegExp *remoteSourceTag = iClob(new_RegExp("\\bremotesource\\b", caseSensitive_RegExpOption));
202 iConstForEach(PtrArray, i, list_Bookmarks(bookmarks_App(), cmpTitle_Bookmark_, NULL, NULL)) { 203 iConstForEach(PtrArray, i, list_Bookmarks(bookmarks_App(), cmpTitle_Bookmark_, NULL, NULL)) {
203 const iBookmark *bm = i.ptr; 204 const iBookmark *bm = i.ptr;
204 iSidebarItem *item = new_SidebarItem(); 205 iSidebarItem *item = new_SidebarItem();
@@ -216,6 +217,10 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
216 if (matchString_RegExp(homeTag, &bm->tags, &m)) { 217 if (matchString_RegExp(homeTag, &bm->tags, &m)) {
217 appendChar_String(&item->meta, 0x1f3e0); 218 appendChar_String(&item->meta, 0x1f3e0);
218 } 219 }
220 init_RegExpMatch(&m);
221 if (matchString_RegExp(remoteSourceTag, &bm->tags, &m)) {
222 appendChar_String(&item->meta, 0x2601);
223 }
219 } 224 }
220 addItem_ListWidget(d->list, item); 225 addItem_ListWidget(d->list, item);
221 iRelease(item); 226 iRelease(item);
@@ -228,11 +233,14 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
228 { "Edit Bookmark...", 0, 0, "bookmark.edit" }, 233 { "Edit Bookmark...", 0, 0, "bookmark.edit" },
229 { "Copy URL", 0, 0, "bookmark.copy" }, 234 { "Copy URL", 0, 0, "bookmark.copy" },
230 { "---", 0, 0, NULL }, 235 { "---", 0, 0, NULL },
231 { "Subscribe to Feed", 0, 0, "bookmark.tag tag:subscribed" }, 236 { "?", 0, 0, "bookmark.tag tag:subscribed" },
232 { "", 0, 0, "bookmark.tag tag:homepage" }, 237 { "?", 0, 0, "bookmark.tag tag:homepage" },
238 { "?", 0, 0, "bookmark.tag tag:remotesource" },
239 { "---", 0, 0, NULL },
240 { uiTextCaution_ColorEscape "Delete Bookmark", 0, 0, "bookmark.delete" },
233 { "---", 0, 0, NULL }, 241 { "---", 0, 0, NULL },
234 { uiTextCaution_ColorEscape "Delete Bookmark", 0, 0, "bookmark.delete" } }, 242 { "Refresh Remote Bookmarks", 0, 0, "bookmarks.reload.remote" } },
235 10); 243 13);
236 break; 244 break;
237 } 245 }
238 case history_SidebarMode: { 246 case history_SidebarMode: {
@@ -1006,6 +1014,13 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
1006 ? "Unsubscribe from Feed" 1014 ? "Unsubscribe from Feed"
1007 : "Subscribe to Feed"); 1015 : "Subscribe to Feed");
1008 } 1016 }
1017 menuItem = findMenuItem_Widget(d->menu, "bookmark.tag tag:remotesource");
1018 if (menuItem) {
1019 setTextCStr_LabelWidget(menuItem,
1020 hasTag_Bookmark(bm, "remotesource")
1021 ? "Remove Bookmark Source"
1022 : "Use as Bookmark Source");
1023 }
1009 } 1024 }
1010 } 1025 }
1011 else if (d->mode == feeds_SidebarMode && d->contextItem) { 1026 else if (d->mode == feeds_SidebarMode && d->contextItem) {