summaryrefslogtreecommitdiff
path: root/src/ui
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
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')
-rw-r--r--src/ui/sidebarwidget.c23
-rw-r--r--src/ui/util.c8
-rw-r--r--src/ui/window.c1
3 files changed, 26 insertions, 6 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) {
diff --git a/src/ui/util.c b/src/ui/util.c
index 9bd40e80..1118758b 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -376,7 +376,9 @@ iWidget *addAction_Widget(iWidget *parent, int key, int kmods, const char *comma
376static iBool isCommandIgnoredByMenus_(const char *cmd) { 376static iBool isCommandIgnoredByMenus_(const char *cmd) {
377 return equal_Command(cmd, "media.updated") || equal_Command(cmd, "media.player.update") || 377 return equal_Command(cmd, "media.updated") || equal_Command(cmd, "media.player.update") ||
378 startsWith_CStr(cmd, "feeds.update.") || 378 startsWith_CStr(cmd, "feeds.update.") ||
379 equal_Command(cmd, "document.request.updated") || equal_Command(cmd, "window.resized") || 379 equal_Command(cmd, "document.request.updated") ||
380 equal_Command(cmd, "bookmarks.request.finished") ||
381 equal_Command(cmd, "window.resized") ||
380 equal_Command(cmd, "window.reload.update") || 382 equal_Command(cmd, "window.reload.update") ||
381 (equal_Command(cmd, "mouse.clicked") && !arg_Command(cmd)); /* button released */ 383 (equal_Command(cmd, "mouse.clicked") && !arg_Command(cmd)); /* button released */
382} 384}
@@ -893,7 +895,9 @@ void updateValueInput_Widget(iWidget *d, const char *title, const char *prompt)
893 895
894static iBool messageHandler_(iWidget *msg, const char *cmd) { 896static iBool messageHandler_(iWidget *msg, const char *cmd) {
895 /* Almost any command dismisses the sheet. */ 897 /* Almost any command dismisses the sheet. */
896 if (!(equal_Command(cmd, "media.updated") || equal_Command(cmd, "media.player.update") || 898 if (!(equal_Command(cmd, "media.updated") ||
899 equal_Command(cmd, "media.player.update") ||
900 equal_Command(cmd, "bookmarks.request.finished") ||
897 equal_Command(cmd, "document.request.updated") || startsWith_CStr(cmd, "window."))) { 901 equal_Command(cmd, "document.request.updated") || startsWith_CStr(cmd, "window."))) {
898 destroy_Widget(msg); 902 destroy_Widget(msg);
899 } 903 }
diff --git a/src/ui/window.c b/src/ui/window.c
index 6ec4a4f1..bc0a622e 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -167,6 +167,7 @@ static iMenuItem bookmarksMenuItems_[] = {
167 { "List All", 0, 0, "open url:about:bookmarks" }, 167 { "List All", 0, 0, "open url:about:bookmarks" },
168 { "List by Tag", 0, 0, "open url:about:bookmarks?tags" }, 168 { "List by Tag", 0, 0, "open url:about:bookmarks?tags" },
169 { "List by Creation Time", 0, 0, "open url:about:bookmarks?created" }, 169 { "List by Creation Time", 0, 0, "open url:about:bookmarks?created" },
170 { "Refresh Remote Bookmarks", 0, 0, "bookmarks.reload.remote" },
170 { "---", 0, 0, NULL }, 171 { "---", 0, 0, NULL },
171 { "Subscribe to This Page...", subscribeToPage_KeyModifier, "feeds.subscribe" }, 172 { "Subscribe to This Page...", subscribeToPage_KeyModifier, "feeds.subscribe" },
172 { "---", 0, 0, NULL }, 173 { "---", 0, 0, NULL },