diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-11-27 09:27:05 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-11-27 09:27:05 +0200 |
commit | dded8a306546e7575ce591f4d19531910c958e86 (patch) | |
tree | f9f13bbbec11fb153ee0d1318ffbce2cb42cbb50 /src | |
parent | f1e28849822fb9acc6a63e175443e9bd1fd11c04 (diff) |
SidebarWidget: Adding bookmarks, edit feeds
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/sidebarwidget.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 38ffd02d..d856f9f8 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -708,18 +708,32 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
708 | postCommand_App("visited.changed"); | 708 | postCommand_App("visited.changed"); |
709 | return iTrue; | 709 | return iTrue; |
710 | } | 710 | } |
711 | if (equal_Command(cmd, "feed.entry.bookmark")) { | ||
712 | makeBookmarkCreation_Widget(&item->url, &item->label, item->icon); | ||
713 | postCommand_App("focus.set id:bmed.title"); | ||
714 | return iTrue; | ||
715 | } | ||
711 | iBookmark *feedBookmark = get_Bookmarks(bookmarks_App(), item->id); | 716 | iBookmark *feedBookmark = get_Bookmarks(bookmarks_App(), item->id); |
712 | if (feedBookmark) { | 717 | if (feedBookmark) { |
713 | if (equal_Command(cmd, "feed.entry.openfeed")) { | 718 | if (equal_Command(cmd, "feed.entry.openfeed")) { |
714 | postCommandf_App("open url:%s", cstr_String(&feedBookmark->url)); | 719 | postCommandf_App("open url:%s", cstr_String(&feedBookmark->url)); |
715 | return iTrue; | 720 | return iTrue; |
716 | } | 721 | } |
722 | if (equal_Command(cmd, "feed.entry.edit")) { | ||
723 | setFlags_Widget(w, disabled_WidgetFlag, iTrue); | ||
724 | iWidget *dlg = makeBookmarkEditor_Widget(); | ||
725 | setText_InputWidget(findChild_Widget(dlg, "bmed.title"), &feedBookmark->title); | ||
726 | setText_InputWidget(findChild_Widget(dlg, "bmed.url"), &feedBookmark->url); | ||
727 | setText_InputWidget(findChild_Widget(dlg, "bmed.tags"), &feedBookmark->tags); | ||
728 | setCommandHandler_Widget(dlg, handleBookmarkEditorCommands_SidebarWidget_); | ||
729 | setFocus_Widget(findChild_Widget(dlg, "bmed.title")); | ||
730 | return iTrue; | ||
731 | } | ||
717 | if (equal_Command(cmd, "feed.entry.unsubscribe")) { | 732 | if (equal_Command(cmd, "feed.entry.unsubscribe")) { |
718 | if (arg_Command(cmd)) { | 733 | if (arg_Command(cmd)) { |
719 | removeTag_Bookmark(feedBookmark, "subscribed"); | 734 | removeTag_Bookmark(feedBookmark, "subscribed"); |
720 | removeEntries_Feeds(id_Bookmark(feedBookmark)); | 735 | removeEntries_Feeds(id_Bookmark(feedBookmark)); |
721 | updateItems_SidebarWidget_(d); | 736 | updateItems_SidebarWidget_(d); |
722 | return iTrue; | ||
723 | } | 737 | } |
724 | else { | 738 | else { |
725 | makeQuestion_Widget( | 739 | makeQuestion_Widget( |
@@ -731,11 +745,13 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
731 | (const char *[]){ "cancel", "feed.entry.unsubscribe arg:1" }, | 745 | (const char *[]){ "cancel", "feed.entry.unsubscribe arg:1" }, |
732 | 2); | 746 | 2); |
733 | } | 747 | } |
748 | return iTrue; | ||
734 | } | 749 | } |
735 | } | 750 | } |
736 | } | 751 | } |
737 | } | 752 | } |
738 | else if (equal_Command(cmd, "bookmarks.changed") && d->mode == bookmarks_SidebarMode) { | 753 | else if (equal_Command(cmd, "bookmarks.changed") && (d->mode == bookmarks_SidebarMode || |
754 | d->mode == feeds_SidebarMode)) { | ||
739 | updateItems_SidebarWidget_(d); | 755 | updateItems_SidebarWidget_(d); |
740 | } | 756 | } |
741 | else if (equal_Command(cmd, "idents.changed") && d->mode == identities_SidebarMode) { | 757 | else if (equal_Command(cmd, "idents.changed") && d->mode == identities_SidebarMode) { |