diff options
Diffstat (limited to 'src/ui/sidebarwidget.c')
-rw-r--r-- | src/ui/sidebarwidget.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 8fa36291..9cfc507a 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -264,10 +264,12 @@ static iBool isBookmarkFolded_SidebarWidget_(const iSidebarWidget *d, const iBoo | |||
264 | return iFalse; | 264 | return iFalse; |
265 | } | 265 | } |
266 | 266 | ||
267 | static void updateItems_SidebarWidget_(iSidebarWidget *d) { | 267 | static void updateItemsWithFlags_SidebarWidget_(iSidebarWidget *d, iBool keepActions) { |
268 | clear_ListWidget(d->list); | 268 | clear_ListWidget(d->list); |
269 | releaseChildren_Widget(d->blank); | 269 | releaseChildren_Widget(d->blank); |
270 | releaseChildren_Widget(d->actions); | 270 | if (!keepActions) { |
271 | releaseChildren_Widget(d->actions); | ||
272 | } | ||
271 | d->actions->rect.size.y = 0; | 273 | d->actions->rect.size.y = 0; |
272 | destroy_Widget(d->menu); | 274 | destroy_Widget(d->menu); |
273 | destroy_Widget(d->modeMenu); | 275 | destroy_Widget(d->modeMenu); |
@@ -348,7 +350,8 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
348 | break; | 350 | break; |
349 | } | 351 | } |
350 | } | 352 | } |
351 | /* Actions. */ { | 353 | /* Actions. */ |
354 | if (!keepActions) { | ||
352 | addActionButton_SidebarWidget_( | 355 | addActionButton_SidebarWidget_( |
353 | d, check_Icon " ${sidebar.action.feeds.markallread}", "feeds.markallread", expand_WidgetFlag | | 356 | d, check_Icon " ${sidebar.action.feeds.markallread}", "feeds.markallread", expand_WidgetFlag | |
354 | tight_WidgetFlag); | 357 | tight_WidgetFlag); |
@@ -362,6 +365,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
362 | iWidget *dropButton = addChild_Widget( | 365 | iWidget *dropButton = addChild_Widget( |
363 | d->actions, | 366 | d->actions, |
364 | iClob(makeMenuButton_LabelWidget(items[d->feedsMode].label, items, 2))); | 367 | iClob(makeMenuButton_LabelWidget(items[d->feedsMode].label, items, 2))); |
368 | setId_Widget(dropButton, "feeds.modebutton"); | ||
365 | checkIcon_LabelWidget((iLabelWidget *) dropButton); | 369 | checkIcon_LabelWidget((iLabelWidget *) dropButton); |
366 | setFixedSize_Widget( | 370 | setFixedSize_Widget( |
367 | dropButton, | 371 | dropButton, |
@@ -373,6 +377,10 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
373 | 13 * gap_UI), | 377 | 13 * gap_UI), |
374 | -1)); | 378 | -1)); |
375 | } | 379 | } |
380 | else { | ||
381 | updateDropdownSelection_LabelWidget(findChild_Widget(d->actions, "feeds.modebutton"), | ||
382 | format_CStr(" arg:%d", d->feedsMode)); | ||
383 | } | ||
376 | d->menu = makeMenu_Widget( | 384 | d->menu = makeMenu_Widget( |
377 | as_Widget(d), | 385 | as_Widget(d), |
378 | (iMenuItem[]){ { openTab_Icon " ${feeds.entry.newtab}", 0, 0, "feed.entry.opentab" }, | 386 | (iMenuItem[]){ { openTab_Icon " ${feeds.entry.newtab}", 0, 0, "feed.entry.opentab" }, |
@@ -644,6 +652,10 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
644 | updateMouseHover_ListWidget(d->list); | 652 | updateMouseHover_ListWidget(d->list); |
645 | } | 653 | } |
646 | 654 | ||
655 | static void updateItems_SidebarWidget_(iSidebarWidget *d) { | ||
656 | updateItemsWithFlags_SidebarWidget_(d, iFalse); | ||
657 | } | ||
658 | |||
647 | static size_t findItem_SidebarWidget_(const iSidebarWidget *d, int id) { | 659 | static size_t findItem_SidebarWidget_(const iSidebarWidget *d, int id) { |
648 | /* Note that this is O(n), so only meant for infrequent use. */ | 660 | /* Note that this is O(n), so only meant for infrequent use. */ |
649 | for (size_t i = 0; i < numItems_ListWidget(d->list); i++) { | 661 | for (size_t i = 0; i < numItems_ListWidget(d->list); i++) { |
@@ -1304,9 +1316,9 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
1304 | } | 1316 | } |
1305 | return iTrue; | 1317 | return iTrue; |
1306 | } | 1318 | } |
1307 | else if (isCommand_Widget(w, ev, "menu.closed")) { | 1319 | // else if (isCommand_Widget(w, ev, "menu.closed")) { |
1308 | // invalidateItem_ListWidget(d->list, d->contextIndex); | 1320 | // invalidateItem_ListWidget(d->list, d->contextIndex); |
1309 | } | 1321 | // } |
1310 | else if (isCommand_Widget(w, ev, "bookmark.open")) { | 1322 | else if (isCommand_Widget(w, ev, "bookmark.open")) { |
1311 | const iSidebarItem *item = d->contextItem; | 1323 | const iSidebarItem *item = d->contextItem; |
1312 | if (d->mode == bookmarks_SidebarMode && item) { | 1324 | if (d->mode == bookmarks_SidebarMode && item) { |
@@ -1462,7 +1474,7 @@ static iBool processEvent_SidebarWidget_(iSidebarWidget *d, const SDL_Event *ev) | |||
1462 | } | 1474 | } |
1463 | else if (equalWidget_Command(cmd, w, "feeds.mode")) { | 1475 | else if (equalWidget_Command(cmd, w, "feeds.mode")) { |
1464 | d->feedsMode = arg_Command(cmd); | 1476 | d->feedsMode = arg_Command(cmd); |
1465 | updateItems_SidebarWidget_(d); | 1477 | updateItemsWithFlags_SidebarWidget_(d, iTrue); |
1466 | return iTrue; | 1478 | return iTrue; |
1467 | } | 1479 | } |
1468 | else if (equal_Command(cmd, "feeds.markallread") && d->mode == feeds_SidebarMode) { | 1480 | else if (equal_Command(cmd, "feeds.markallread") && d->mode == feeds_SidebarMode) { |