Lagrange [release]
Don't have duplicate New Tab buttons
[1mdiff --git a/res/about/version.gmi b/res/about/version.gmi[m
[1mindex df532ab3..5dad2c58 100644[m
[1m--- a/res/about/version.gmi[m
[1m+++ b/res/about/version.gmi[m
[36m@@ -8,6 +8,7 @@[m
[m
## 1.10.3[m
* Added a man page.[m
[32m+[m[32m* Hide the [+] on the row of tab buttons if the navbar has a New Tab button.[m
* "/index.gmi" is considered equal to "/" when navigating to parent directory.[m
* Gopher: Fixed navigating to root, e.g., when clicking on the page top banner. Set item type to 1 to show a gophermap and not the plain source.[m
* Titan: When navigating to parent/root, switch URL scheme to "gemini". This action occurs on a Titan response page, so initiating a new upload with the parent/root URL is probably not appropriate.[m
[1mdiff --git a/src/app.c b/src/app.c[m
[1mindex a137dc23..9f35d727 100644[m
[1m--- a/src/app.c[m
[1m+++ b/src/app.c[m
[36m@@ -2086,7 +2086,6 @@[m [miDocumentWidget *document_Command(const char *cmd) {[m
}[m
[m
iDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf, iBool switchToNew) {[m
[31m- //iApp *d = &app_;[m
iWidget *tabs = findWidget_Root("doctabs");[m
setFlags_Widget(tabs, hidden_WidgetFlag, iFalse);[m
iWidget *newTabButton = findChild_Widget(tabs, "newtab");[m
[36m@@ -2102,6 +2101,7 @@[m [miDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf, iBool switchToNe[m
iRelease(doc); /* now owned by the tabs */[m
addTabCloseButton_Widget(tabs, as_Widget(doc), "tabs.close");[m
addChild_Widget(findChild_Widget(tabs, "tabs.buttons"), iClob(newTabButton));[m
[32m+[m[32m showOrHideNewTabButton_Root(tabs->root);[m
if (switchToNew) {[m
postCommandf_App("tabs.switch page:%p", doc);[m
}[m
[36m@@ -2852,6 +2852,7 @@[m [miBool handleCommand_App(const char *cmd) {[m
return iTrue;[m
}[m
iDocumentWidget *doc = document_Command(cmd);[m
[32m+[m[32m iAssert(doc);[m
iDocumentWidget *origin = doc;[m
if (hasLabel_Command(cmd, "origin")) {[m
iDocumentWidget *cmdOrig = findWidget_App(cstr_Command(cmd, "origin"));[m
[1mdiff --git a/src/ui/root.c b/src/ui/root.c[m
[1mindex 776a9a35..6e187313 100644[m
[1m--- a/src/ui/root.c[m
[1m+++ b/src/ui/root.c[m
[36m@@ -703,6 +703,20 @@[m [mvoid updateToolbarColors_Root(iRoot *d) {[m
#endif[m
}[m
[m
[32m+[m[32mvoid showOrHideNewTabButton_Root(iRoot *d) {[m
[32m+[m[32m iWidget *tabs = findChild_Widget(d->widget, "doctabs");[m
[32m+[m[32m iWidget *newTabButton = findChild_Widget(tabs, "newtab");[m
[32m+[m[32m iBool hide = iFalse;[m
[32m+[m[32m iForIndices(i, prefs_App()->navbarActions) {[m
[32m+[m[32m if (prefs_App()->navbarActions[i] == newTab_ToolbarAction) {[m
[32m+[m[32m hide = iTrue;[m
[32m+[m[32m break;[m
[32m+[m[32m }[m
[32m+[m[32m }[m
[32m+[m[32m setFlags_Widget(newTabButton, hidden_WidgetFlag, hide);[m
[32m+[m[32m arrange_Widget(findChild_Widget(tabs, "tabs.buttons"));[m
[32m+[m[32m}[m
[32m+[m
void notifyVisualOffsetChange_Root(iRoot *d) {[m
if (d && (d->didAnimateVisualOffsets || d->didChangeArrangement)) {[m
iNotifyAudience(d, visualOffsetsChanged, RootVisualOffsetsChanged);[m
[36m@@ -848,6 +862,7 @@[m [mstatic void updateNavBarActions_(iWidget *navBar) {[m
}[m
iEndCollect();[m
}[m
[32m+[m[32m showOrHideNewTabButton_Root(navBar->root);[m
}[m
[m
static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) {[m
[36m@@ -1526,7 +1541,7 @@[m [mvoid createUserInterface_Root(iRoot *d) {[m
}[m
setId_Widget([m
addChildFlags_Widget(buttons, iClob(newIcon_LabelWidget(add_Icon, 0, 0, "tabs.new")),[m
[31m- moveToParentRightEdge_WidgetFlag),[m
[32m+[m[32m moveToParentRightEdge_WidgetFlag | collapse_WidgetFlag),[m
"newtab");[m
}[m
/* Sidebars. */ {[m
[1mdiff --git a/src/ui/root.h b/src/ui/root.h[m
[1mindex 7e831be3..a81ebdf7 100644[m
[1m--- a/src/ui/root.h[m
[1m+++ b/src/ui/root.h[m
[36m@@ -43,6 +43,8 @@[m [mvoid updatePadding_Root (iRoot *); /* TODO: is part of m[m
void dismissPortraitPhoneSidebars_Root (iRoot *);[m
void showToolbar_Root (iRoot *, iBool show);[m
void updateToolbarColors_Root (iRoot *);[m
[32m+[m[32mvoid showOrHideNewTabButton_Root (iRoot *);[m
[32m+[m
void notifyVisualOffsetChange_Root (iRoot *);[m
[m
iInt2 size_Root (const iRoot *);[m