diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-11-23 12:19:30 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-11-23 12:19:30 +0200 |
commit | 785e057d7170243bf822912e4d669dab2bbe21de (patch) | |
tree | c643126ec44e6e08716540fad4916413ef6b6164 /src | |
parent | 54f142bb093765e19fcee30cc5ffe9c63b67abd6 (diff) |
SidebarWidget: Redesigned Feeds action toolbar
The action toolbar now has a button for marking all as read, and keyboard shortcuts for switching between Unread and All modes.
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/labelwidget.c | 2 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 24 | ||||
-rw-r--r-- | src/ui/util.c | 4 |
3 files changed, 22 insertions, 8 deletions
diff --git a/src/ui/labelwidget.c b/src/ui/labelwidget.c index daca05d1..46bdc890 100644 --- a/src/ui/labelwidget.c +++ b/src/ui/labelwidget.c | |||
@@ -421,7 +421,7 @@ static void draw_LabelWidget_(const iLabelWidget *d) { | |||
421 | else { | 421 | else { |
422 | drawCenteredOutline_Text( | 422 | drawCenteredOutline_Text( |
423 | d->font, | 423 | d->font, |
424 | adjusted_Rect(bounds, add_I2(zero_I2(), init_I2(iconPad, 0)), neg_I2(zero_I2())), | 424 | adjusted_Rect(bounds, init_I2(iconPad * 1.5f, 0), init_I2(-iconPad, 0)), |
425 | d->flags.alignVisual, | 425 | d->flags.alignVisual, |
426 | d->flags.drawAsOutline ? fg : none_ColorId, | 426 | d->flags.drawAsOutline ? fg : none_ColorId, |
427 | d->flags.drawAsOutline ? d->widget.bgColor : fg, | 427 | d->flags.drawAsOutline ? d->widget.bgColor : fg, |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 5d627dda..581a7bb2 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -346,10 +346,24 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
346 | } | 346 | } |
347 | } | 347 | } |
348 | /* Actions. */ { | 348 | /* Actions. */ { |
349 | addActionButton_SidebarWidget_(d, "${sidebar.action.feeds.showall}", "feeds.mode arg:0", | 349 | addActionButton_SidebarWidget_( |
350 | d->feedsMode == all_FeedsMode ? selected_WidgetFlag : 0); | 350 | d, check_Icon " ${feeds.markallread}", "feeds.markallread", expand_WidgetFlag); |
351 | addActionButton_SidebarWidget_(d, "${sidebar.action.feeds.showunread}", "feeds.mode arg:1", | 351 | addChild_Widget(d->actions, iClob(new_LabelWidget("${sidebar.action.show}", NULL))); |
352 | d->feedsMode == unread_FeedsMode ? selected_WidgetFlag : 0); | 352 | const iMenuItem items[] = { |
353 | { "${sidebar.action.feeds.showall}", SDLK_u, KMOD_SHIFT, "feeds.mode arg:0" }, | ||
354 | { "${sidebar.action.feeds.showunread}", SDLK_u, 0, "feeds.mode arg:1" }, | ||
355 | }; | ||
356 | iWidget *dropButton = addChild_Widget( | ||
357 | d->actions, | ||
358 | iClob(makeMenuButton_LabelWidget(items[d->feedsMode].label, items, 2))); | ||
359 | setFixedSize_Widget( | ||
360 | dropButton, | ||
361 | init_I2(measure_Text( | ||
362 | default_FontId, | ||
363 | translateCStr_Lang(items[findWidestLabel_MenuItem(items, 2)].label)) | ||
364 | .advance.x + | ||
365 | 6 * gap_UI, | ||
366 | -1)); | ||
353 | } | 367 | } |
354 | d->menu = makeMenu_Widget( | 368 | d->menu = makeMenu_Widget( |
355 | as_Widget(d), | 369 | as_Widget(d), |
@@ -995,7 +1009,7 @@ iBool handleBookmarkEditorCommands_SidebarWidget_(iWidget *editor, const char *c | |||
995 | setBookmarkEditorFolder_Widget(editor, arg_Command(cmd)); | 1009 | setBookmarkEditorFolder_Widget(editor, arg_Command(cmd)); |
996 | return iTrue; | 1010 | return iTrue; |
997 | } | 1011 | } |
998 | if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) { | 1012 | if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "bmed.cancel")) { |
999 | iAssert(startsWith_String(id_Widget(editor), "bmed.")); | 1013 | iAssert(startsWith_String(id_Widget(editor), "bmed.")); |
1000 | iSidebarWidget *d = findWidget_App(cstr_String(id_Widget(editor)) + 5); /* bmed.sidebar */ | 1014 | iSidebarWidget *d = findWidget_App(cstr_String(id_Widget(editor)) + 5); /* bmed.sidebar */ |
1001 | if (equal_Command(cmd, "bmed.accept")) { | 1015 | if (equal_Command(cmd, "bmed.accept")) { |
diff --git a/src/ui/util.c b/src/ui/util.c index ba6a2538..e718631d 100644 --- a/src/ui/util.c +++ b/src/ui/util.c | |||
@@ -2811,7 +2811,7 @@ static const iArray *makeBookmarkFolderItems_(void) { | |||
2811 | 2811 | ||
2812 | iWidget *makeBookmarkEditor_Widget(void) { | 2812 | iWidget *makeBookmarkEditor_Widget(void) { |
2813 | const iMenuItem actions[] = { | 2813 | const iMenuItem actions[] = { |
2814 | { "${cancel}" }, | 2814 | { "${cancel}", 0, 0, "bmed.cancel" }, |
2815 | { uiTextCaution_ColorEscape "${dlg.bookmark.save}", SDLK_RETURN, KMOD_PRIMARY, "bmed.accept" } | 2815 | { uiTextCaution_ColorEscape "${dlg.bookmark.save}", SDLK_RETURN, KMOD_PRIMARY, "bmed.accept" } |
2816 | }; | 2816 | }; |
2817 | if (isUsingPanelLayout_Mobile()) { | 2817 | if (isUsingPanelLayout_Mobile()) { |
@@ -2891,7 +2891,7 @@ static iBool handleBookmarkCreationCommands_SidebarWidget_(iWidget *editor, cons | |||
2891 | setBookmarkEditorFolder_Widget(editor, arg_Command(cmd)); | 2891 | setBookmarkEditorFolder_Widget(editor, arg_Command(cmd)); |
2892 | return iTrue; | 2892 | return iTrue; |
2893 | } | 2893 | } |
2894 | if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "cancel")) { | 2894 | if (equal_Command(cmd, "bmed.accept") || equal_Command(cmd, "bmed.cancel")) { |
2895 | if (equal_Command(cmd, "bmed.accept")) { | 2895 | if (equal_Command(cmd, "bmed.accept")) { |
2896 | const iString *title = text_InputWidget(findChild_Widget(editor, "bmed.title")); | 2896 | const iString *title = text_InputWidget(findChild_Widget(editor, "bmed.title")); |
2897 | const iString *url = text_InputWidget(findChild_Widget(editor, "bmed.url")); | 2897 | const iString *url = text_InputWidget(findChild_Widget(editor, "bmed.url")); |