summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-11-24 19:37:03 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-11-24 19:37:03 +0200
commitf25fd86e8ea0c1f25165f27c61563052f98b93c6 (patch)
tree75cfb8fae1315225ba126d241ee6b8da31d4db4d
parentecb69789e3fb5e3a55e898b4ce9829d414be59ca (diff)
Toolbar button for toggling sidebar
-rw-r--r--res/about/version.gmi1
-rw-r--r--src/ui/root.c32
2 files changed, 15 insertions, 18 deletions
diff --git a/res/about/version.gmi b/res/about/version.gmi
index 36e23492..d89700af 100644
--- a/res/about/version.gmi
+++ b/res/about/version.gmi
@@ -9,6 +9,7 @@
9# 1.9 9# 1.9
10 10
11New features: 11New features:
12* Added a toolbar button for toggling the left sidebar.
12* Choose parent folder when creating or editing a bookmark. 13* Choose parent folder when creating or editing a bookmark.
13* Support for ANSI background color escapes (disabled by default). 14* Support for ANSI background color escapes (disabled by default).
14* UI language for Turkish. 15* UI language for Turkish.
diff --git a/src/ui/root.c b/src/ui/root.c
index 5bfae857..d98701b8 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -142,11 +142,11 @@ static const iMenuItem identityButtonMenuItems_[] = {
142 { add_Icon " ${menu.identity.new}", newIdentity_KeyShortcut, "ident.new" }, 142 { add_Icon " ${menu.identity.new}", newIdentity_KeyShortcut, "ident.new" },
143 { "${menu.identity.import}", SDLK_i, KMOD_PRIMARY | KMOD_SHIFT, "ident.import" }, 143 { "${menu.identity.import}", SDLK_i, KMOD_PRIMARY | KMOD_SHIFT, "ident.import" },
144 { "---" }, 144 { "---" },
145 { person_Icon " ${menu.show.identities}", '4', KMOD_PRIMARY, "sidebar.mode arg:3 show:1" }, 145 { person_Icon " ${menu.show.identities}", '4', KMOD_PRIMARY, "sidebar.mode arg:3 toggle:1" },
146# else 146# else
147 { add_Icon " ${menu.identity.new}", 0, 0, "ident.new" }, 147 { add_Icon " ${menu.identity.new}", 0, 0, "ident.new" },
148 { "---" }, 148 { "---" },
149 { person_Icon " ${menu.show.identities}", 0, 0, "sidebar.mode arg:3 show:1" }, 149 { person_Icon " ${menu.show.identities}", 0, 0, "sidebar.mode arg:3 toggle:1" },
150# endif 150# endif
151}; 151};
152#endif 152#endif
@@ -626,6 +626,7 @@ static void updateNavBarSize_(iWidget *navBar) {
626 /* Button sizing. */ 626 /* Button sizing. */
627 if (isNarrow ^ ((flags_Widget(navBar) & tight_WidgetFlag) != 0)) { 627 if (isNarrow ^ ((flags_Widget(navBar) & tight_WidgetFlag) != 0)) {
628 setFlags_Widget(navBar, tight_WidgetFlag, isNarrow); 628 setFlags_Widget(navBar, tight_WidgetFlag, isNarrow);
629 showCollapsed_Widget(findChild_Widget(navBar, "navbar.sidebar"), !isNarrow);
629 iObjectList *lists[] = { 630 iObjectList *lists[] = {
630 children_Widget(navBar), 631 children_Widget(navBar),
631 children_Widget(findChild_Widget(navBar, "url")), 632 children_Widget(findChild_Widget(navBar, "url")),
@@ -1103,19 +1104,13 @@ void createUserInterface_Root(iRoot *d) {
1103 iWidget *navBack; 1104 iWidget *navBack;
1104 setId_Widget(navBack = addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(backArrow_Icon, 0, 0, "navigate.back")), collapse_WidgetFlag), "navbar.back"); 1105 setId_Widget(navBack = addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(backArrow_Icon, 0, 0, "navigate.back")), collapse_WidgetFlag), "navbar.back");
1105 setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(forwardArrow_Icon, 0, 0, "navigate.forward")), collapse_WidgetFlag), "navbar.forward"); 1106 setId_Widget(addChildFlags_Widget(navBar, iClob(newIcon_LabelWidget(forwardArrow_Icon, 0, 0, "navigate.forward")), collapse_WidgetFlag), "navbar.forward");
1106 /* Mobile devices have a button for easier access to the left sidebar. */ 1107 /* Button for toggling the left sidebar. */
1107 if (deviceType_App() != desktop_AppDeviceType) { 1108 setId_Widget(addChildFlags_Widget(
1108 setId_Widget(addChildFlags_Widget( 1109 navBar,
1109 navBar, 1110 iClob(newIcon_LabelWidget(leftHalf_Icon, 0, 0, "sidebar.toggle")),
1110 iClob(newIcon_LabelWidget(leftHalf_Icon, 0, 0, "sidebar.toggle")), 1111 collapse_WidgetFlag),
1111 collapse_WidgetFlag), 1112 "navbar.sidebar");
1112 "navbar.sidebar");
1113 }
1114 addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag); 1113 addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag);
1115 iLabelWidget *idMenu = makeMenuButton_LabelWidget(
1116 "\U0001f464", identityButtonMenuItems_, iElemCount(identityButtonMenuItems_));
1117 setAlignVisually_LabelWidget(idMenu, iTrue);
1118 setId_Widget(addChildFlags_Widget(navBar, iClob(idMenu), collapse_WidgetFlag), "navbar.ident");
1119 iInputWidget *url; 1114 iInputWidget *url;
1120 /* URL input field. */ { 1115 /* URL input field. */ {
1121 url = new_InputWidget(0); 1116 url = new_InputWidget(0);
@@ -1257,10 +1252,11 @@ void createUserInterface_Root(iRoot *d) {
1257 arrange_Widget(urlButtons); 1252 arrange_Widget(urlButtons);
1258 setId_Widget(addChild_Widget(rightEmbed, iClob(makePadding_Widget(0))), "url.embedpad"); 1253 setId_Widget(addChild_Widget(rightEmbed, iClob(makePadding_Widget(0))), "url.embedpad");
1259 } 1254 }
1260 if (deviceType_App() != desktop_AppDeviceType) { 1255 /* The active identity menu. */ {
1261 /* On mobile, the Identities button is on the right side of the URL bar. */ 1256 iLabelWidget *idMenu = makeMenuButton_LabelWidget(
1262 iWidget *ident = removeChild_Widget(navBar, findChild_Widget(navBar, "navbar.ident")); 1257 "\U0001f464", identityButtonMenuItems_, iElemCount(identityButtonMenuItems_));
1263 addChild_Widget(navBar, iClob(ident)); 1258 setAlignVisually_LabelWidget(idMenu, iTrue);
1259 setId_Widget(addChildFlags_Widget(navBar, iClob(idMenu), collapse_WidgetFlag), "navbar.ident");
1264 } 1260 }
1265 addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag); 1261 addChildFlags_Widget(navBar, iClob(new_Widget()), expand_WidgetFlag);
1266 setId_Widget(addChildFlags_Widget(navBar, 1262 setId_Widget(addChildFlags_Widget(navBar,