summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-11-27 09:46:17 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-11-27 09:46:17 +0200
commite78b773a4c58c016025fa4e5f5d9ee6f5070fa4d (patch)
tree6af77b5a38afbfc9975a36c3ce30339ed5d27042 /src
parentde350bd1bfd51ee62a866b8f4a980b5cc4a9eeb9 (diff)
Subscribing via menu; cleanup after unsubscribe
Diffstat (limited to 'src')
-rw-r--r--src/app.c16
-rw-r--r--src/ui/sidebarwidget.c4
-rw-r--r--src/ui/window.c2
3 files changed, 21 insertions, 1 deletions
diff --git a/src/app.c b/src/app.c
index 92334d42..99e42fc2 100644
--- a/src/app.c
+++ b/src/app.c
@@ -1242,6 +1242,22 @@ iBool handleCommand_App(const char *cmd) {
1242 postCommand_App("focus.set id:bmed.title"); 1242 postCommand_App("focus.set id:bmed.title");
1243 return iTrue; 1243 return iTrue;
1244 } 1244 }
1245 else if (equal_Command(cmd, "bookmark.addtag")) {
1246 const iString *tag = string_Command(cmd, "tag");
1247 const iString *feedUrl = url_DocumentWidget(document_App());
1248 if (!isEmpty_String(feedUrl)) {
1249 uint32_t id = findUrl_Bookmarks(d->bookmarks, feedUrl);
1250 if (id) {
1251 addTag_Bookmark(get_Bookmarks(d->bookmarks, id), cstr_String(tag));
1252 }
1253 else {
1254 add_Bookmarks(d->bookmarks, feedUrl, bookmarkTitle_DocumentWidget(document_App()),
1255 tag, siteIcon_GmDocument(document_DocumentWidget(document_App())));
1256 }
1257 postCommand_App("bookmarks.changed");
1258 }
1259 return iTrue;
1260 }
1245 else if (equal_Command(cmd, "bookmarks.changed")) { 1261 else if (equal_Command(cmd, "bookmarks.changed")) {
1246 save_Bookmarks(d->bookmarks, dataDir_App_); 1262 save_Bookmarks(d->bookmarks, dataDir_App_);
1247 return iFalse; 1263 return iFalse;
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index d856f9f8..2edd28a9 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -668,6 +668,9 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
668 iBookmark *bm = get_Bookmarks(bookmarks_App(), item->id); 668 iBookmark *bm = get_Bookmarks(bookmarks_App(), item->id);
669 if (hasTag_Bookmark(bm, tag)) { 669 if (hasTag_Bookmark(bm, tag)) {
670 removeTag_Bookmark(bm, tag); 670 removeTag_Bookmark(bm, tag);
671 if (!iCmpStr(tag, "subscribed")) {
672 removeEntries_Feeds(item->id);
673 }
671 } 674 }
672 else { 675 else {
673 addTag_Bookmark(bm, tag); 676 addTag_Bookmark(bm, tag);
@@ -679,6 +682,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
679 else if (equal_Command(cmd, "bookmark.delete")) { 682 else if (equal_Command(cmd, "bookmark.delete")) {
680 const iSidebarItem *item = d->contextItem; 683 const iSidebarItem *item = d->contextItem;
681 if (d->mode == bookmarks_SidebarMode && item && remove_Bookmarks(bookmarks_App(), item->id)) { 684 if (d->mode == bookmarks_SidebarMode && item && remove_Bookmarks(bookmarks_App(), item->id)) {
685 removeEntries_Feeds(item->id);
682 postCommand_App("bookmarks.changed"); 686 postCommand_App("bookmarks.changed");
683 } 687 }
684 return iTrue; 688 return iTrue;
diff --git a/src/ui/window.c b/src/ui/window.c
index 637018a9..6e91d644 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -155,7 +155,7 @@ static const iMenuItem viewMenuItems_[] = {
155 { "Zoom Out", SDLK_MINUS, KMOD_PRIMARY, "zoom.delta arg:-10" }, 155 { "Zoom Out", SDLK_MINUS, KMOD_PRIMARY, "zoom.delta arg:-10" },
156 { "Reset Zoom", SDLK_0, KMOD_PRIMARY, "zoom.set arg:100" }, 156 { "Reset Zoom", SDLK_0, KMOD_PRIMARY, "zoom.set arg:100" },
157 { "---", 0, 0, NULL }, 157 { "---", 0, 0, NULL },
158 { "Wrap Preformatted", 0, 0, "forcewrap.toggle" } 158 { "Wrap Preformatted", 0, 0, "forcewrap.toggle" } /* TODO: remove this; should scroll preformatted */
159}; 159};
160 160
161static iMenuItem bookmarksMenuItems_[] = { 161static iMenuItem bookmarksMenuItems_[] = {