summaryrefslogtreecommitdiff
path: root/src/ui/sidebarwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-01 14:47:34 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-01 14:47:34 +0200
commitb18b380014222131572a186888e6aa035c9c06e1 (patch)
treed21e066681c67b094ddfa0c67e03b77c39f1780b /src/ui/sidebarwidget.c
parentd87edbfc4907b0985b107e1432f73104eb66d356 (diff)
Subscribing to new headings on a page
When "subscribed" and "headings" tags are used, the subscribed page is tracked for newly added headings (of any kind). This works for the weiph/pikkulogs out there.
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r--src/ui/sidebarwidget.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c
index 6bb6d7a1..5baa08f7 100644
--- a/src/ui/sidebarwidget.c
+++ b/src/ui/sidebarwidget.c
@@ -123,6 +123,9 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
123 iZap(on); 123 iZap(on);
124 iConstForEach(PtrArray, i, listEntries_Feeds()) { 124 iConstForEach(PtrArray, i, listEntries_Feeds()) {
125 const iFeedEntry *entry = i.ptr; 125 const iFeedEntry *entry = i.ptr;
126 if (isHidden_FeedEntry(entry)) {
127 continue; /* A hidden entry. */
128 }
126 /* For more items, one can always see "about:feeds". A large number of items 129 /* For more items, one can always see "about:feeds". A large number of items
127 is a bit difficult to navigate in the sidebar. */ 130 is a bit difficult to navigate in the sidebar. */
128 if (numItems_ListWidget(d->list) == 100) { 131 if (numItems_ListWidget(d->list) == 100) {
@@ -151,9 +154,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) {
151 if (equal_String(docUrl, &entry->url)) { 154 if (equal_String(docUrl, &entry->url)) {
152 item->listItem.isSelected = iTrue; /* currently being viewed */ 155 item->listItem.isSelected = iTrue; /* currently being viewed */
153 } 156 }
154 if (!containsUrl_Visited(visited_App(), &entry->url)) { 157 item->indent = isUnread_FeedEntry(entry);
155 item->indent = 1; /* unread */
156 }
157 set_String(&item->url, &entry->url); 158 set_String(&item->url, &entry->url);
158 set_String(&item->label, &entry->title); 159 set_String(&item->label, &entry->title);
159 const iBookmark *bm = get_Bookmarks(bookmarks_App(), entry->bookmarkId); 160 const iBookmark *bm = get_Bookmarks(bookmarks_App(), entry->bookmarkId);
@@ -498,7 +499,20 @@ static void itemClicked_SidebarWidget_(iSidebarWidget *d, const iSidebarItem *it
498 } 499 }
499 case feeds_SidebarMode: 500 case feeds_SidebarMode:
500 if (!isEmpty_String(&item->url)) { 501 if (!isEmpty_String(&item->url)) {
501 postCommandf_App("open url:%s", cstr_String(&item->url)); 502 const size_t fragPos = indexOf_String(&item->url, '#');
503 if (fragPos != iInvalidPos) {
504 iString *head = collect_String(
505 newRange_String((iRangecc){ constBegin_String(&item->url) + fragPos + 1,
506 constEnd_String(&item->url) }));
507 postCommandf_App(
508 "open gotourlheading:%s url:%s",
509 cstr_String(head),
510 cstr_Rangecc((iRangecc){ constBegin_String(&item->url),
511 constBegin_String(&item->url) + fragPos }));
512 }
513 else {
514 postCommandf_App("open url:%s", cstr_String(&item->url));
515 }
502 } 516 }
503 break; 517 break;
504 case bookmarks_SidebarMode: 518 case bookmarks_SidebarMode: