summaryrefslogtreecommitdiff
path: root/src/ui/sidebarwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-19 13:03:38 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-19 13:03:38 +0200
commit443eb6e7e82ea7c42e430f16007b454c761be52d (patch)
tree408e6860856ed0a1c198ab1bceec4e46fe0453c1 /src/ui/sidebarwidget.c
parenta736f4e00d57a54f4ec1f061d8b1e284207c50b1 (diff)
SidebarWidget: Disable menu items for remote bookmarks
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r--src/ui/sidebarwidget.c19
1 files changed, 19 insertions, 0 deletions
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)
1069 } 1069 }
1070 } 1070 }
1071 if (hoverItem_ListWidget(d->list) || isVisible_Widget(d->menu)) { 1071 if (hoverItem_ListWidget(d->list) || isVisible_Widget(d->menu)) {
1072 /* Update the menu before opening. */
1073 if (d->mode == bookmarks_SidebarMode && !isVisible_Widget(d->menu)) {
1074 /* Remote bookmarks have limitations. */
1075 const iSidebarItem *hoverItem = hoverItem_ListWidget(d->list);
1076 iAssert(hoverItem);
1077 const iBookmark * bm = get_Bookmarks(bookmarks_App(), hoverItem->id);
1078 const iBool isRemote = hasTag_Bookmark(bm, "remote");
1079 static const char *localOnlyCmds[] = { "bookmark.edit",
1080 "bookmark.delete",
1081 "bookmark.tag tag:subscribed",
1082 "bookmark.tag tag:homepage",
1083 "bookmark.tag tag:remotesource",
1084 "bookmark.tag tag:subscribed" };
1085 iForIndices(i, localOnlyCmds) {
1086 setFlags_Widget(as_Widget(findMenuItem_Widget(d->menu, localOnlyCmds[i])),
1087 disabled_WidgetFlag,
1088 isRemote);
1089 }
1090 }
1072 processContextMenuEvent_Widget(d->menu, ev, {}); 1091 processContextMenuEvent_Widget(d->menu, ev, {});
1073 } 1092 }
1074 return processEvent_Widget(w, ev); 1093 return processEvent_Widget(w, ev);