summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-11-26 21:47:10 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-11-26 21:47:10 +0200
commite648ca3f621b1d612303218d97d395dada5503b2 (patch)
tree2284780691ff6fa4804b78c2a50c5b8c30b27ea5 /src/ui
parent91e8a9aa0e9ffc4fb76560944261dca2d6b22a51 (diff)
SidebarWidget: Open entries, feed index pages
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/sidebarwidget.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 3bd0f229..9477353b 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -148,6 +148,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
148 set_String(&item->label, &entry->title); 148 set_String(&item->label, &entry->title);
149 const iBookmark *bm = get_Bookmarks(bookmarks_App(), entry->bookmarkId); 149 const iBookmark *bm = get_Bookmarks(bookmarks_App(), entry->bookmarkId);
150 if (bm) { 150 if (bm) {
151 item->id = entry->bookmarkId;
151 item->icon = bm->icon; 152 item->icon = bm->icon;
152 append_String(&item->meta, &bm->title); 153 append_String(&item->meta, &bm->title);
153 } 154 }
@@ -693,6 +694,34 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev)
693 else if (equal_Command(cmd, "feeds.update.finished") && d->mode == feeds_SidebarMode) { 694 else if (equal_Command(cmd, "feeds.update.finished") && d->mode == feeds_SidebarMode) {
694 updateItems_SidebarWidget_(d); 695 updateItems_SidebarWidget_(d);
695 } 696 }
697 else if (startsWith_CStr(cmd, "feed.entry.") && d->mode == feeds_SidebarMode) {
698 const iSidebarItem *item = d->menuItem;
699 if (item) {
700 if (equal_Command(cmd, "feed.entry.opentab")) {
701 postCommandf_App("open newtab:1 url:%s", cstr_String(&item->url));
702 return iTrue;
703 }
704 if (equal_Command(cmd, "feed.entry.toggleread")) {
705 iVisited *vis = visited_App();
706 const iTime visit = urlVisitTime_Visited(vis, &item->url);
707 if (isValid_Time(&visit)) {
708 removeUrl_Visited(vis, &item->url);
709 }
710 else {
711 visitUrl_Visited(vis, &item->url, transient_VisitedUrlFlag);
712 }
713 postCommand_App("visited.changed");
714 return iTrue;
715 }
716 const iBookmark *feedBookmark = get_Bookmarks(bookmarks_App(), item->id);
717 if (feedBookmark) {
718 if (equal_Command(cmd, "feed.entry.openfeed")) {
719 postCommandf_App("open url:%s", cstr_String(&feedBookmark->url));
720 return iTrue;
721 }
722 }
723 }
724 }
696 else if (equal_Command(cmd, "bookmarks.changed") && d->mode == bookmarks_SidebarMode) { 725 else if (equal_Command(cmd, "bookmarks.changed") && d->mode == bookmarks_SidebarMode) {
697 updateItems_SidebarWidget_(d); 726 updateItems_SidebarWidget_(d);
698 } 727 }