diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-11-26 09:31:24 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-11-26 09:31:24 +0200 |
commit | c389843f276875aa21dfb5d878994dfaefbe95f0 (patch) | |
tree | 05cef9f627513ca39269559b0c96c78fcf7dcfbe /src/ui/sidebarwidget.c | |
parent | b60d380ad6e83cd1b155b8057528f25bb1494a38 (diff) |
SidebarWidget: Update bookmark tag menu items
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r-- | src/ui/sidebarwidget.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index d6c74298..9946ac5a 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -214,7 +214,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
214 | { "Copy URL", 0, 0, "bookmark.copy" }, | 214 | { "Copy URL", 0, 0, "bookmark.copy" }, |
215 | { "---", 0, 0, NULL }, | 215 | { "---", 0, 0, NULL }, |
216 | { "Subscribe to Feed", 0, 0, "bookmark.tag tag:subscribed" }, | 216 | { "Subscribe to Feed", 0, 0, "bookmark.tag tag:subscribed" }, |
217 | { "Use as Homepage", 0, 0, "bookmark.tag tag:homepage" }, | 217 | { "", 0, 0, "bookmark.tag tag:homepage" }, |
218 | { "---", 0, 0, NULL }, | 218 | { "---", 0, 0, NULL }, |
219 | { uiTextCaution_ColorEscape "Delete Bookmark", 0, 0, "bookmark.delete" } }, | 219 | { uiTextCaution_ColorEscape "Delete Bookmark", 0, 0, "bookmark.delete" } }, |
220 | 7); | 220 | 7); |
@@ -844,7 +844,29 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
844 | if (constHoverItem_ListWidget(d->list) || isVisible_Widget(d->menu)) { | 844 | if (constHoverItem_ListWidget(d->list) || isVisible_Widget(d->menu)) { |
845 | d->menuItem = hoverItem_ListWidget(d->list); | 845 | d->menuItem = hoverItem_ListWidget(d->list); |
846 | /* Update menu items. */ | 846 | /* Update menu items. */ |
847 | if (d->mode == identities_SidebarMode) { | 847 | /* TODO: Some callback-based mechanism would be nice for updating menus right |
848 | before they open? */ | ||
849 | if (d->mode == bookmarks_SidebarMode && d->menuItem) { | ||
850 | const iBookmark *bm = get_Bookmarks(bookmarks_App(), d->menuItem->id); | ||
851 | if (bm) { | ||
852 | iLabelWidget *menuItem = findMenuItem_Widget(d->menu, | ||
853 | "bookmark.tag tag:homepage"); | ||
854 | if (menuItem) { | ||
855 | setTextCStr_LabelWidget(menuItem, | ||
856 | hasTag_Bookmark(bm, "homepage") | ||
857 | ? "Remove Homepage" | ||
858 | : "Use as Homepage"); | ||
859 | } | ||
860 | menuItem = findMenuItem_Widget(d->menu, "bookmark.tag tag:subscribed"); | ||
861 | if (menuItem) { | ||
862 | setTextCStr_LabelWidget(menuItem, | ||
863 | hasTag_Bookmark(bm, "subscribed") | ||
864 | ? "Unsubscribe from Feed" | ||
865 | : "Subscribe to Feed"); | ||
866 | } | ||
867 | } | ||
868 | } | ||
869 | else if (d->mode == identities_SidebarMode) { | ||
848 | const iGmIdentity *ident = constHoverIdentity_SidebarWidget_(d); | 870 | const iGmIdentity *ident = constHoverIdentity_SidebarWidget_(d); |
849 | const iString * docUrl = url_DocumentWidget(document_App()); | 871 | const iString * docUrl = url_DocumentWidget(document_App()); |
850 | iForEach(ObjectList, i, children_Widget(d->menu)) { | 872 | iForEach(ObjectList, i, children_Widget(d->menu)) { |