summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2022-01-01 10:04:06 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2022-01-01 10:04:06 +0200
commit5d247c7fafddcb46d83572af788a04f835d48d42 (patch)
tree54205ac18a8c47cb50ef2d3ed7a42077512abfca
parent6b3d31a3043d99890355c42dd3248411fd571347 (diff)
Mobile: User-configurable phone toolbar buttons
Actions for the first two mobile portrait phone toolbar buttons can be chosen in Settings.
-rw-r--r--po/en.po12
-rw-r--r--res/lang/cs.binbin31683 -> 31806 bytes
-rw-r--r--res/lang/de.binbin30690 -> 30813 bytes
-rw-r--r--res/lang/en.binbin26766 -> 26889 bytes
-rw-r--r--res/lang/eo.binbin25730 -> 25853 bytes
-rw-r--r--res/lang/es.binbin30514 -> 30637 bytes
-rw-r--r--res/lang/es_MX.binbin27836 -> 27959 bytes
-rw-r--r--res/lang/fi.binbin30347 -> 30470 bytes
-rw-r--r--res/lang/fr.binbin31494 -> 31617 bytes
-rw-r--r--res/lang/gl.binbin29699 -> 29822 bytes
-rw-r--r--res/lang/hu.binbin31519 -> 31642 bytes
-rw-r--r--res/lang/ia.binbin28836 -> 28959 bytes
-rw-r--r--res/lang/ie.binbin29434 -> 29557 bytes
-rw-r--r--res/lang/isv.binbin25487 -> 25610 bytes
-rw-r--r--res/lang/pl.binbin30122 -> 30245 bytes
-rw-r--r--res/lang/ru.binbin44882 -> 45005 bytes
-rw-r--r--res/lang/sk.binbin25823 -> 25946 bytes
-rw-r--r--res/lang/sr.binbin44308 -> 44431 bytes
-rw-r--r--res/lang/tok.binbin27556 -> 27679 bytes
-rw-r--r--res/lang/tr.binbin29740 -> 29863 bytes
-rw-r--r--res/lang/uk.binbin44227 -> 44350 bytes
-rw-r--r--res/lang/zh_Hans.binbin25731 -> 25854 bytes
-rw-r--r--res/lang/zh_Hant.binbin25939 -> 26062 bytes
-rw-r--r--src/app.c22
-rw-r--r--src/defs.h17
-rw-r--r--src/prefs.c2
-rw-r--r--src/prefs.h1
-rw-r--r--src/ui/mobile.c16
-rw-r--r--src/ui/mobile.h11
-rw-r--r--src/ui/root.c83
-rw-r--r--src/ui/util.c13
31 files changed, 130 insertions, 47 deletions
diff --git a/po/en.po b/po/en.po
index a4b83dcc..cf9643a0 100644
--- a/po/en.po
+++ b/po/en.po
@@ -344,6 +344,9 @@ msgstr "Go to Parent"
344msgid "menu.root" 344msgid "menu.root"
345msgstr "Go to Root" 345msgstr "Go to Root"
346 346
347msgid "menu.home"
348msgstr "Go Home"
349
347msgid "menu.reload" 350msgid "menu.reload"
348msgstr "Reload Page" 351msgstr "Reload Page"
349 352
@@ -1419,6 +1422,15 @@ msgstr "Load image on scroll:"
1419msgid "prefs.hidetoolbarscroll" 1422msgid "prefs.hidetoolbarscroll"
1420msgstr "Hide toolbar on scroll:" 1423msgstr "Hide toolbar on scroll:"
1421 1424
1425msgid "heading.prefs.toolbaractions"
1426msgstr "Toolbar Actions"
1427
1428msgid "prefs.toolbaraction1"
1429msgstr "Button 1"
1430
1431msgid "prefs.toolbaraction2"
1432msgstr "Button 2"
1433
1422msgid "prefs.ostheme" 1434msgid "prefs.ostheme"
1423msgstr "Use system theme:" 1435msgstr "Use system theme:"
1424 1436
diff --git a/res/lang/cs.bin b/res/lang/cs.bin
index bc34d7e8..9069f4b0 100644
--- a/res/lang/cs.bin
+++ b/res/lang/cs.bin
Binary files differ
diff --git a/res/lang/de.bin b/res/lang/de.bin
index 5fb9eb03..62893c64 100644
--- a/res/lang/de.bin
+++ b/res/lang/de.bin
Binary files differ
diff --git a/res/lang/en.bin b/res/lang/en.bin
index 114fa684..12cde1d0 100644
--- a/res/lang/en.bin
+++ b/res/lang/en.bin
Binary files differ
diff --git a/res/lang/eo.bin b/res/lang/eo.bin
index 3d16450c..be6c9cef 100644
--- a/res/lang/eo.bin
+++ b/res/lang/eo.bin
Binary files differ
diff --git a/res/lang/es.bin b/res/lang/es.bin
index fe6bdbb5..feb0b8ea 100644
--- a/res/lang/es.bin
+++ b/res/lang/es.bin
Binary files differ
diff --git a/res/lang/es_MX.bin b/res/lang/es_MX.bin
index c96da0b0..26188c5b 100644
--- a/res/lang/es_MX.bin
+++ b/res/lang/es_MX.bin
Binary files differ
diff --git a/res/lang/fi.bin b/res/lang/fi.bin
index d06dfc9c..86efb862 100644
--- a/res/lang/fi.bin
+++ b/res/lang/fi.bin
Binary files differ
diff --git a/res/lang/fr.bin b/res/lang/fr.bin
index 4cda45d8..e6977fd9 100644
--- a/res/lang/fr.bin
+++ b/res/lang/fr.bin
Binary files differ
diff --git a/res/lang/gl.bin b/res/lang/gl.bin
index 7ffb40ec..f282366d 100644
--- a/res/lang/gl.bin
+++ b/res/lang/gl.bin
Binary files differ
diff --git a/res/lang/hu.bin b/res/lang/hu.bin
index e698c7ac..3ca7ee30 100644
--- a/res/lang/hu.bin
+++ b/res/lang/hu.bin
Binary files differ
diff --git a/res/lang/ia.bin b/res/lang/ia.bin
index f951f0c5..29faea06 100644
--- a/res/lang/ia.bin
+++ b/res/lang/ia.bin
Binary files differ
diff --git a/res/lang/ie.bin b/res/lang/ie.bin
index c4671e06..9c8bc9bd 100644
--- a/res/lang/ie.bin
+++ b/res/lang/ie.bin
Binary files differ
diff --git a/res/lang/isv.bin b/res/lang/isv.bin
index 2788dc3f..4414fdb3 100644
--- a/res/lang/isv.bin
+++ b/res/lang/isv.bin
Binary files differ
diff --git a/res/lang/pl.bin b/res/lang/pl.bin
index 29260245..aae2b705 100644
--- a/res/lang/pl.bin
+++ b/res/lang/pl.bin
Binary files differ
diff --git a/res/lang/ru.bin b/res/lang/ru.bin
index 712d8a01..1166b064 100644
--- a/res/lang/ru.bin
+++ b/res/lang/ru.bin
Binary files differ
diff --git a/res/lang/sk.bin b/res/lang/sk.bin
index 79b1208f..b43f885c 100644
--- a/res/lang/sk.bin
+++ b/res/lang/sk.bin
Binary files differ
diff --git a/res/lang/sr.bin b/res/lang/sr.bin
index 79e76d20..eec114aa 100644
--- a/res/lang/sr.bin
+++ b/res/lang/sr.bin
Binary files differ
diff --git a/res/lang/tok.bin b/res/lang/tok.bin
index 31f9536e..0202545c 100644
--- a/res/lang/tok.bin
+++ b/res/lang/tok.bin
Binary files differ
diff --git a/res/lang/tr.bin b/res/lang/tr.bin
index 758dba68..95bdffdc 100644
--- a/res/lang/tr.bin
+++ b/res/lang/tr.bin
Binary files differ
diff --git a/res/lang/uk.bin b/res/lang/uk.bin
index 6aedfe5f..e222a609 100644
--- a/res/lang/uk.bin
+++ b/res/lang/uk.bin
Binary files differ
diff --git a/res/lang/zh_Hans.bin b/res/lang/zh_Hans.bin
index 036ecca3..648016a8 100644
--- a/res/lang/zh_Hans.bin
+++ b/res/lang/zh_Hans.bin
Binary files differ
diff --git a/res/lang/zh_Hant.bin b/res/lang/zh_Hant.bin
index d2aa482d..daa31717 100644
--- a/res/lang/zh_Hant.bin
+++ b/res/lang/zh_Hant.bin
Binary files differ
diff --git a/src/app.c b/src/app.c
index 58eecf51..1e66c6cf 100644
--- a/src/app.c
+++ b/src/app.c
@@ -248,6 +248,10 @@ static iString *serializePrefs_App_(const iApp *d) {
248 appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth); 248 appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth);
249 appendFormat_String(str, "linespacing.set arg:%f\n", d->prefs.lineSpacing); 249 appendFormat_String(str, "linespacing.set arg:%f\n", d->prefs.lineSpacing);
250 appendFormat_String(str, "returnkey.set arg:%d\n", d->prefs.returnKey); 250 appendFormat_String(str, "returnkey.set arg:%d\n", d->prefs.returnKey);
251#if defined (iPlatformMobile)
252 appendFormat_String(str, "toolbar.action.set arg:%d button:0\n", d->prefs.toolbarActions[0]);
253 appendFormat_String(str, "toolbar.action.set arg:%d button:1\n", d->prefs.toolbarActions[1]);
254#endif
251 iConstForEach(StringSet, fp, d->prefs.disabledFontPacks) { 255 iConstForEach(StringSet, fp, d->prefs.disabledFontPacks) {
252 appendFormat_String(str, "fontpack.disable id:%s\n", cstr_String(fp.value)); 256 appendFormat_String(str, "fontpack.disable id:%s\n", cstr_String(fp.value));
253 } 257 }
@@ -1870,6 +1874,12 @@ static void updatePrefsPinSplitButtons_(iWidget *d, int value) {
1870 } 1874 }
1871} 1875}
1872 1876
1877static void updatePrefsToolBarActionButton_(iWidget *prefs, int buttonIndex, int action) {
1878 updateDropdownSelection_LabelWidget(
1879 findChild_Widget(prefs, format_CStr("prefs.toolbaraction%d", buttonIndex + 1)),
1880 format_CStr(" arg:%d button:%d", action, buttonIndex));
1881}
1882
1873static void updateScrollSpeedButtons_(iWidget *d, enum iScrollType type, const int value) { 1883static void updateScrollSpeedButtons_(iWidget *d, enum iScrollType type, const int value) {
1874 const char *typeStr = (type == mouse_ScrollType ? "mouse" : "keyboard"); 1884 const char *typeStr = (type == mouse_ScrollType ? "mouse" : "keyboard");
1875 for (int i = 0; i <= 40; i++) { 1885 for (int i = 0; i <= 40; i++) {
@@ -1960,6 +1970,10 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) {
1960 format_CStr("returnkey.set arg:%d", arg_Command(cmd))); 1970 format_CStr("returnkey.set arg:%d", arg_Command(cmd)));
1961 return iFalse; 1971 return iFalse;
1962 } 1972 }
1973 else if (equal_Command(cmd, "toolbar.action.set")) {
1974 updatePrefsToolBarActionButton_(d, argLabel_Command(cmd, "button"), arg_Command(cmd));
1975 return iFalse;
1976 }
1963 else if (equal_Command(cmd, "pinsplit.set")) { 1977 else if (equal_Command(cmd, "pinsplit.set")) {
1964 updatePrefsPinSplitButtons_(d, arg_Command(cmd)); 1978 updatePrefsPinSplitButtons_(d, arg_Command(cmd));
1965 return iFalse; 1979 return iFalse;
@@ -2268,6 +2282,12 @@ iBool handleCommand_App(const char *cmd) {
2268 } 2282 }
2269 return iTrue; 2283 return iTrue;
2270 } 2284 }
2285 else if (equal_Command(cmd, "toolbar.action.set")) {
2286 d->prefs.toolbarActions[iClamp(argLabel_Command(cmd, "button"), 0, 1)] =
2287 iClamp(arg_Command(cmd), 0, max_ToolbarAction - 1);
2288 postCommand_App("~toolbar.actions.changed");
2289 return iTrue;
2290 }
2271 else if (equal_Command(cmd, "translation.languages")) { 2291 else if (equal_Command(cmd, "translation.languages")) {
2272 d->prefs.langFrom = argLabel_Command(cmd, "from"); 2292 d->prefs.langFrom = argLabel_Command(cmd, "from");
2273 d->prefs.langTo = argLabel_Command(cmd, "to"); 2293 d->prefs.langTo = argLabel_Command(cmd, "to");
@@ -3006,6 +3026,8 @@ iBool handleCommand_App(const char *cmd) {
3006 updateDropdownSelection_LabelWidget( 3026 updateDropdownSelection_LabelWidget(
3007 findChild_Widget(dlg, "prefs.returnkey"), 3027 findChild_Widget(dlg, "prefs.returnkey"),
3008 format_CStr("returnkey.set arg:%d", d->prefs.returnKey)); 3028 format_CStr("returnkey.set arg:%d", d->prefs.returnKey));
3029 updatePrefsToolBarActionButton_(dlg, 0, d->prefs.toolbarActions[0]);
3030 updatePrefsToolBarActionButton_(dlg, 1, d->prefs.toolbarActions[1]);
3009 setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); 3031 setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize);
3010 setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"), 3032 setText_InputWidget(findChild_Widget(dlg, "prefs.uiscale"),
3011 collectNewFormat_String("%g", uiScale_Window(as_Window(d->window)))); 3033 collectNewFormat_String("%g", uiScale_Window(as_Window(d->window))));
diff --git a/src/defs.h b/src/defs.h
index 9a466674..25c0ceeb 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -66,6 +66,23 @@ enum iReturnKeyFlag {
66 accept_ReturnKeyFlag = 4, /* shift */ 66 accept_ReturnKeyFlag = 4, /* shift */
67}; 67};
68 68
69enum iToolbarAction {
70 back_ToolbarAction = 0,
71 forward_ToolbarAction = 1,
72 home_ToolbarAction = 2,
73 parent_ToolbarAction = 3,
74 reload_ToolbarAction = 4,
75 newTab_ToolbarAction = 5,
76 closeTab_ToolbarAction = 6,
77 addBookmark_ToolbarAction = 7,
78 translate_ToolbarAction = 8,
79 upload_ToolbarAction = 9,
80 editPage_ToolbarAction = 10,
81 findText_ToolbarAction = 11,
82 settings_ToolbarAction = 12,
83 max_ToolbarAction
84};
85
69/* Return key behavior is not handled via normal bindings because only certain combinations 86/* Return key behavior is not handled via normal bindings because only certain combinations
70 are valid. */ 87 are valid. */
71enum iReturnKeyBehavior { 88enum iReturnKeyBehavior {
diff --git a/src/prefs.c b/src/prefs.c
index 6b0164b6..426b7212 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -44,6 +44,8 @@ void init_Prefs(iPrefs *d) {
44 d->uiAnimations = iTrue; 44 d->uiAnimations = iTrue;
45 d->uiScale = 1.0f; /* default set elsewhere */ 45 d->uiScale = 1.0f; /* default set elsewhere */
46 d->zoomPercent = 100; 46 d->zoomPercent = 100;
47 d->toolbarActions[0] = back_ToolbarAction;
48 d->toolbarActions[1] = forward_ToolbarAction;
47 d->sideIcon = iTrue; 49 d->sideIcon = iTrue;
48 d->hideToolbarOnScroll = iTrue; 50 d->hideToolbarOnScroll = iTrue;
49 d->blinkingCursor = iTrue; 51 d->blinkingCursor = iTrue;
diff --git a/src/prefs.h b/src/prefs.h
index 6c79a3e1..43f7fc0e 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -159,6 +159,7 @@ struct Impl_Prefs {
159 enum iColorAccent accent; 159 enum iColorAccent accent;
160 /* Window and User Interface */ 160 /* Window and User Interface */
161 float uiScale; 161 float uiScale;
162 enum iToolbarAction toolbarActions[2];
162 /* Document presentation */ 163 /* Document presentation */
163 int zoomPercent; 164 int zoomPercent;
164 /* Behavior */ 165 /* Behavior */
diff --git a/src/ui/mobile.c b/src/ui/mobile.c
index 08d8dba2..e34cad3a 100644
--- a/src/ui/mobile.c
+++ b/src/ui/mobile.c
@@ -37,6 +37,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
37# include "ios.h" 37# include "ios.h"
38#endif 38#endif
39 39
40const iToolbarActionSpec toolbarActions_Mobile[max_ToolbarAction] = {
41 { backArrow_Icon, "${menu.back}", "navigate.back" },
42 { forwardArrow_Icon, "${menu.forward}", "navigate.forward" },
43 { home_Icon, "${menu.home}", "navigate.home" },
44 { upArrow_Icon, "${menu.parent}", "navigate.parent" },
45 { reload_Icon, "${menu.reload}", "navigate.reload" },
46 { openTab_Icon, "${menu.newtab}", "tabs.new" },
47 { close_Icon, "${menu.closetab}", "tabs.close" },
48 { bookmark_Icon, "${menu.page.bookmark}", "bookmark.add" },
49 { globe_Icon, "${menu.page.translate}", "document.translate" },
50 { upload_Icon, "${menu.page.upload}", "document.upload" },
51 { edit_Icon, "${menu.page.upload.edit}", "document.upload copy:1" },
52 { magnifyingGlass_Icon, "${menu.find}", "focus.set id:find.input" },
53 { gear_Icon, "${menu.settings}", "preferences" },
54};
55
40iBool isUsingPanelLayout_Mobile(void) { 56iBool isUsingPanelLayout_Mobile(void) {
41 return deviceType_App() != desktop_AppDeviceType; 57 return deviceType_App() != desktop_AppDeviceType;
42} 58}
diff --git a/src/ui/mobile.h b/src/ui/mobile.h
index 54f55fd2..c19623f9 100644
--- a/src/ui/mobile.h
+++ b/src/ui/mobile.h
@@ -22,8 +22,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#pragma once 23#pragma once
24 24
25#include "defs.h"
25#include <the_Foundation/rect.h> 26#include <the_Foundation/rect.h>
26 27
28iDeclareType(ToolbarActionSpec)
29
30struct Impl_ToolbarActionSpec {
31 const char *icon;
32 const char *label;
33 const char *command;
34};
35
36const iToolbarActionSpec toolbarActions_Mobile[max_ToolbarAction];
37
27iDeclareType(Widget) 38iDeclareType(Widget)
28iDeclareType(MenuItem) 39iDeclareType(MenuItem)
29 40
diff --git a/src/ui/root.c b/src/ui/root.c
index bc2bc0fb..31176115 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -592,14 +592,21 @@ static void updateNavBarIdentity_(iWidget *navBar) {
592 592
593static void updateNavDirButtons_(iWidget *navBar) { 593static void updateNavDirButtons_(iWidget *navBar) {
594 const iHistory *history = history_DocumentWidget(document_App()); 594 const iHistory *history = history_DocumentWidget(document_App());
595 const iBool atOldest = atOldest_History(history); 595 iBool atOldest = atOldest_History(history);
596 const iBool atNewest = atNewest_History(history); 596 iBool atNewest = atNewest_History(history);
597 setFlags_Widget(findChild_Widget(navBar, "navbar.back"), disabled_WidgetFlag, atOldest); 597 setFlags_Widget(findChild_Widget(navBar, "navbar.back"), disabled_WidgetFlag, atOldest);
598 setFlags_Widget(findChild_Widget(navBar, "navbar.forward"), disabled_WidgetFlag, atNewest); 598 setFlags_Widget(findChild_Widget(navBar, "navbar.forward"), disabled_WidgetFlag, atNewest);
599 iWidget *toolBar = findWidget_App("toolbar"); 599 iWidget *toolBar = findWidget_App("toolbar");
600 if (toolBar) { 600 if (toolBar) {
601 iLabelWidget *back = findChild_Widget(toolBar, "toolbar.back"); 601 /* Reset the state. */
602 iLabelWidget *fwd = findChild_Widget(toolBar, "toolbar.forward"); 602 for (int i = 0; i < 2; i++) {
603 const char *id = (i == 0 ? "toolbar.action1" : "toolbar.action2");
604 setFlags_Widget(findChild_Widget(toolBar, id), disabled_WidgetFlag, iFalse);
605 setOutline_LabelWidget(findChild_Widget(toolBar, id), iFalse);
606 }
607 /* Disable certain actions. */
608 iLabelWidget *back = findMenuItem_Widget(toolBar, "navigate.back");
609 iLabelWidget *fwd = findMenuItem_Widget(toolBar, "navigate.forward");
603 setFlags_Widget(as_Widget(back), disabled_WidgetFlag, atOldest); 610 setFlags_Widget(as_Widget(back), disabled_WidgetFlag, atOldest);
604 setOutline_LabelWidget(back, atOldest); 611 setOutline_LabelWidget(back, atOldest);
605 setFlags_Widget(as_Widget(fwd), disabled_WidgetFlag, atNewest); 612 setFlags_Widget(as_Widget(fwd), disabled_WidgetFlag, atNewest);
@@ -1062,14 +1069,23 @@ static iBool handleSearchBarCommands_(iWidget *searchBar, const char *cmd) {
1062} 1069}
1063 1070
1064#if defined (iPlatformMobile) 1071#if defined (iPlatformMobile)
1065static void dismissSidebar_(iWidget *sidebar, const char *toolButtonId) { 1072
1066 if (isVisible_Widget(sidebar)) { 1073static void updateToolBarActions_(iWidget *toolBar) {
1067 postCommandf_App("%s.toggle", cstr_String(id_Widget(sidebar))); 1074 const iPrefs *prefs = prefs_App();
1068// if (toolButtonId) { 1075 for (int i = 0; i < 2; i++) {
1069 // setFlags_Widget(findWidget_App(toolButtonId), noBackground_WidgetFlag, iTrue); 1076 int action = prefs->toolbarActions[i]
1070// } 1077 ? prefs->toolbarActions[i]
1071 setVisualOffset_Widget(sidebar, height_Widget(sidebar), 250, easeIn_AnimFlag); 1078 : (i == 0 ? back_ToolbarAction : forward_ToolbarAction);
1079 iLabelWidget *button =
1080 findChild_Widget(toolBar, i == 0 ? "toolbar.action1" : "toolbar.action2");
1081 if (button) {
1082 setFlags_Widget(as_Widget(button), disabled_WidgetFlag, iFalse);
1083 setOutline_LabelWidget(button, iFalse);
1084 updateTextCStr_LabelWidget(button, toolbarActions_Mobile[action].icon);
1085 setCommand_LabelWidget(button, collectNewCStr_String(toolbarActions_Mobile[action].command));
1086 }
1072 } 1087 }
1088 refresh_Widget(toolBar);
1073} 1089}
1074 1090
1075static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) { 1091static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) {
@@ -1081,13 +1097,6 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) {
1081 return iTrue; 1097 return iTrue;
1082 } 1098 }
1083 else if (equal_Command(cmd, "toolbar.showview")) { 1099 else if (equal_Command(cmd, "toolbar.showview")) {
1084 /* TODO: Clean this up. */
1085// iWidget *sidebar = findWidget_App("sidebar");
1086// iWidget *sidebar2 = findWidget_App("sidebar2");
1087// dismissSidebar_(sidebar2, "toolbar.ident");
1088// const iBool isVisible = isVisible_Widget(sidebar);
1089 /* If a sidebar hasn't been shown yet, it's height is zero. */
1090// const int viewHeight = size_Root(get_Root()).y;
1091 if (arg_Command(cmd) >= 0) { 1100 if (arg_Command(cmd) >= 0) {
1092 postCommandf_App("sidebar.mode arg:%d show:1", arg_Command(cmd)); 1101 postCommandf_App("sidebar.mode arg:%d show:1", arg_Command(cmd));
1093 } 1102 }
@@ -1102,29 +1111,6 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) {
1102 postCommandf_App("sidebar.toggle"); 1111 postCommandf_App("sidebar.toggle");
1103 } 1112 }
1104 postCommand_App("preferences idents:1"); 1113 postCommand_App("preferences idents:1");
1105#if 0
1106 /* TODO: Clean this up. */
1107 iWidget *sidebar2 = findWidget_App("sidebar2");
1108 //dismissSidebar_(sidebar, "toolbar.view");
1109 if (isVisible_Widget(sidebar)) {
1110 postCommandf_App("sidebar.toggle");
1111 }
1112 const iBool isVisible = isVisible_Widget(sidebar2);
1113 // setFlags_Widget(findChild_Widget(toolBar, "toolbar.ident"), noBackground_WidgetFlag,
1114 // isVisible);
1115 /* If a sidebar hasn't been shown yet, it's height is zero. */
1116 const int viewHeight = size_Root(get_Root()).y;
1117 if (isVisible) {
1118 dismissSidebar_(sidebar2, NULL);
1119 }
1120 else {
1121 postCommand_App("sidebar2.mode arg:3 show:1");
1122 int offset = height_Widget(sidebar2);
1123 if (offset == 0) offset = size_Root(get_Root()).y;
1124 setVisualOffset_Widget(sidebar2, offset, 0, 0);
1125 setVisualOffset_Widget(sidebar2, 0, 400, easeOut_AnimFlag | softer_AnimFlag);
1126 }
1127#endif
1128 return iTrue; 1114 return iTrue;
1129 } 1115 }
1130 else if (equal_Command(cmd, "sidebar.mode.changed")) { 1116 else if (equal_Command(cmd, "sidebar.mode.changed")) {
@@ -1132,8 +1118,13 @@ static iBool handleToolBarCommands_(iWidget *toolBar, const char *cmd) {
1132 updateTextCStr_LabelWidget(viewTool, icon_SidebarMode(arg_Command(cmd))); 1118 updateTextCStr_LabelWidget(viewTool, icon_SidebarMode(arg_Command(cmd)));
1133 return iFalse; 1119 return iFalse;
1134 } 1120 }
1121 else if (equal_Command(cmd, "toolbar.actions.changed")) {
1122 updateToolBarActions_(toolBar);
1123 return iFalse;
1124 }
1135 return iFalse; 1125 return iFalse;
1136} 1126}
1127
1137#endif /* defined (iPlatformMobile) */ 1128#endif /* defined (iPlatformMobile) */
1138 1129
1139static iLabelWidget *newLargeIcon_LabelWidget(const char *text, const char *cmd) { 1130static iLabelWidget *newLargeIcon_LabelWidget(const char *text, const char *cmd) {
@@ -1552,14 +1543,14 @@ void createUserInterface_Root(iRoot *d) {
1552 "toolbar.close"); 1543 "toolbar.close");
1553#else 1544#else
1554 setId_Widget(addChildFlags_Widget(toolBar, 1545 setId_Widget(addChildFlags_Widget(toolBar,
1555 iClob(newLargeIcon_LabelWidget(backArrow_Icon, "navigate.back")), 1546 iClob(newLargeIcon_LabelWidget("", "...")),
1556 frameless_WidgetFlag), 1547 frameless_WidgetFlag),
1557 "toolbar.back"); 1548 "toolbar.action1");
1558#endif 1549#endif
1559 setId_Widget(addChildFlags_Widget(toolBar, 1550 setId_Widget(addChildFlags_Widget(toolBar,
1560 iClob(newLargeIcon_LabelWidget(forwardArrow_Icon, "navigate.forward")), 1551 iClob(newLargeIcon_LabelWidget("", "...")),
1561 frameless_WidgetFlag), 1552 frameless_WidgetFlag),
1562 "toolbar.forward"); 1553 "toolbar.action2");
1563 iWidget *identButton; 1554 iWidget *identButton;
1564 setId_Widget(identButton = addChildFlags_Widget( 1555 setId_Widget(identButton = addChildFlags_Widget(
1565 toolBar, 1556 toolBar,
@@ -1589,10 +1580,10 @@ void createUserInterface_Root(iRoot *d) {
1589 setId_Widget(as_Widget(menuButton), "toolbar.navmenu"); 1580 setId_Widget(as_Widget(menuButton), "toolbar.navmenu");
1590 addChildFlags_Widget(toolBar, iClob(menuButton), frameless_WidgetFlag); 1581 addChildFlags_Widget(toolBar, iClob(menuButton), frameless_WidgetFlag);
1591 iForEach(ObjectList, i, children_Widget(toolBar)) { 1582 iForEach(ObjectList, i, children_Widget(toolBar)) {
1592 iLabelWidget *btn = i.object;
1593 setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue); 1583 setFlags_Widget(i.object, noBackground_WidgetFlag, iTrue);
1594 } 1584 }
1595 updateToolbarColors_Root(d); 1585 updateToolbarColors_Root(d);
1586 updateToolBarActions_(toolBar);
1596 const iMenuItem items[] = { 1587 const iMenuItem items[] = {
1597 { book_Icon " ${sidebar.bookmarks}", 0, 0, "toolbar.showview arg:0" }, 1588 { book_Icon " ${sidebar.bookmarks}", 0, 0, "toolbar.showview arg:0" },
1598 { star_Icon " ${sidebar.feeds}", 0, 0, "toolbar.showview arg:1" }, 1589 { star_Icon " ${sidebar.feeds}", 0, 0, "toolbar.showview arg:1" },
diff --git a/src/ui/util.c b/src/ui/util.c
index ab7e9ebf..6add5c89 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -2383,6 +2383,15 @@ iWidget *makePreferences_Widget(void) {
2383 format_CStr("returnkey.set arg:%d", acceptWithPrimaryMod_ReturnKeyBehavior) }, 2383 format_CStr("returnkey.set arg:%d", acceptWithPrimaryMod_ReturnKeyBehavior) },
2384 { NULL } 2384 { NULL }
2385 }; 2385 };
2386 iMenuItem toolbarActionItems[2][max_ToolbarAction + 1];
2387 iZap(toolbarActionItems);
2388 for (int j = 0; j < 2; j++) {
2389 for (int i = 0; i < max_ToolbarAction; i++) {
2390 toolbarActionItems[j][i].label = toolbarActions_Mobile[i].label;
2391 toolbarActionItems[j][i].command =
2392 format_CStr("toolbar.action.set arg:%d button:%d", i, j);
2393 }
2394 }
2386 iMenuItem docThemes[2][max_GmDocumentTheme + 1]; 2395 iMenuItem docThemes[2][max_GmDocumentTheme + 1];
2387 for (int i = 0; i < 2; ++i) { 2396 for (int i = 0; i < 2; ++i) {
2388 const iBool isDark = (i == 0); 2397 const iBool isDark = (i == 0);
@@ -2476,8 +2485,10 @@ iWidget *makePreferences_Widget(void) {
2476 { "title id:heading.prefs.interface" }, 2485 { "title id:heading.prefs.interface" },
2477 { "dropdown device:0 id:prefs.returnkey", 0, 0, (const void *) returnKeyBehaviors }, 2486 { "dropdown device:0 id:prefs.returnkey", 0, 0, (const void *) returnKeyBehaviors },
2478 { "padding device:1" }, 2487 { "padding device:1" },
2479 //{ "toggle id:prefs.hoverlink" },
2480 { "toggle device:2 id:prefs.hidetoolbarscroll" }, 2488 { "toggle device:2 id:prefs.hidetoolbarscroll" },
2489 { "heading device:2 id:heading.prefs.toolbaractions" },
2490 { "dropdown device:2 id:prefs.toolbaraction1", 0, 0, (const void *) toolbarActionItems[0] },
2491 { "dropdown device:2 id:prefs.toolbaraction2", 0, 0, (const void *) toolbarActionItems[1] },
2481 { "heading id:heading.prefs.sizing" }, 2492 { "heading id:heading.prefs.sizing" },
2482 { "input id:prefs.uiscale maxlen:8" }, 2493 { "input id:prefs.uiscale maxlen:8" },
2483 { NULL } 2494 { NULL }