From 443eb6e7e82ea7c42e430f16007b454c761be52d Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 19 Dec 2020 13:03:38 +0200 Subject: SidebarWidget: Disable menu items for remote bookmarks --- src/ui/sidebarwidget.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 3b7e7d4b..4c7435c5 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c @@ -1069,6 +1069,25 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) } } if (hoverItem_ListWidget(d->list) || isVisible_Widget(d->menu)) { + /* Update the menu before opening. */ + if (d->mode == bookmarks_SidebarMode && !isVisible_Widget(d->menu)) { + /* Remote bookmarks have limitations. */ + const iSidebarItem *hoverItem = hoverItem_ListWidget(d->list); + iAssert(hoverItem); + const iBookmark * bm = get_Bookmarks(bookmarks_App(), hoverItem->id); + const iBool isRemote = hasTag_Bookmark(bm, "remote"); + static const char *localOnlyCmds[] = { "bookmark.edit", + "bookmark.delete", + "bookmark.tag tag:subscribed", + "bookmark.tag tag:homepage", + "bookmark.tag tag:remotesource", + "bookmark.tag tag:subscribed" }; + iForIndices(i, localOnlyCmds) { + setFlags_Widget(as_Widget(findMenuItem_Widget(d->menu, localOnlyCmds[i])), + disabled_WidgetFlag, + isRemote); + } + } processContextMenuEvent_Widget(d->menu, ev, {}); } return processEvent_Widget(w, ev); -- cgit v1.2.3