Lagrange [release]

Added option to retain tabs at launch

=> 9beb506b6d66f8264702cb60e7927dee3567ba94

diff --git a/po/en.po b/po/en.po
index d1e7027c..d4584609 100644
--- a/po/en.po
+++ b/po/en.po
@@ -1533,6 +1533,9 @@ msgstr "Language:"
 msgid "prefs.time.24h"
 msgstr "24-Hour Time"
 
+msgid "prefs.retaintabs"
+msgstr "Restore tabs at launch:"
+
 msgid "prefs.uiscale"
 msgstr "UI scale factor:"
 
diff --git a/res/lang/cs.bin b/res/lang/cs.bin
index 4115ed6b..e58da8a7 100644
Binary files a/res/lang/cs.bin and b/res/lang/cs.bin differ
diff --git a/res/lang/de.bin b/res/lang/de.bin
index 094f7ba3..553d974e 100644
Binary files a/res/lang/de.bin and b/res/lang/de.bin differ
diff --git a/res/lang/en.bin b/res/lang/en.bin
index a4c77530..c3c1f998 100644
Binary files a/res/lang/en.bin and b/res/lang/en.bin differ
diff --git a/res/lang/eo.bin b/res/lang/eo.bin
index 9e587563..dd2a90eb 100644
Binary files a/res/lang/eo.bin and b/res/lang/eo.bin differ
diff --git a/res/lang/es.bin b/res/lang/es.bin
index fd46818a..36b100c9 100644
Binary files a/res/lang/es.bin and b/res/lang/es.bin differ
diff --git a/res/lang/es_MX.bin b/res/lang/es_MX.bin
index e680ca2d..80c9189f 100644
Binary files a/res/lang/es_MX.bin and b/res/lang/es_MX.bin differ
diff --git a/res/lang/fi.bin b/res/lang/fi.bin
index e67bcdc1..f447ed50 100644
Binary files a/res/lang/fi.bin and b/res/lang/fi.bin differ
diff --git a/res/lang/fr.bin b/res/lang/fr.bin
index 1caad665..5ecfa866 100644
Binary files a/res/lang/fr.bin and b/res/lang/fr.bin differ
diff --git a/res/lang/gl.bin b/res/lang/gl.bin
index 7d7c0ca2..f2eb2fc9 100644
Binary files a/res/lang/gl.bin and b/res/lang/gl.bin differ
diff --git a/res/lang/hu.bin b/res/lang/hu.bin
index 4efe5260..f2dfbef4 100644
Binary files a/res/lang/hu.bin and b/res/lang/hu.bin differ
diff --git a/res/lang/ia.bin b/res/lang/ia.bin
index 8dc6b799..148966d9 100644
Binary files a/res/lang/ia.bin and b/res/lang/ia.bin differ
diff --git a/res/lang/ie.bin b/res/lang/ie.bin
index 6c1df718..df285088 100644
Binary files a/res/lang/ie.bin and b/res/lang/ie.bin differ
diff --git a/res/lang/isv.bin b/res/lang/isv.bin
index 4f39ad7c..0b1d7763 100644
Binary files a/res/lang/isv.bin and b/res/lang/isv.bin differ
diff --git a/res/lang/it.bin b/res/lang/it.bin
index bf36c0b0..ecc878a6 100644
Binary files a/res/lang/it.bin and b/res/lang/it.bin differ
diff --git a/res/lang/nl.bin b/res/lang/nl.bin
index 0f037d28..679205f5 100644
Binary files a/res/lang/nl.bin and b/res/lang/nl.bin differ
diff --git a/res/lang/pl.bin b/res/lang/pl.bin
index 9d650947..e3275484 100644
Binary files a/res/lang/pl.bin and b/res/lang/pl.bin differ
diff --git a/res/lang/ru.bin b/res/lang/ru.bin
index 3c33f708..cf15a2d7 100644
Binary files a/res/lang/ru.bin and b/res/lang/ru.bin differ
diff --git a/res/lang/sk.bin b/res/lang/sk.bin
index 7b93bce9..5e67eea6 100644
Binary files a/res/lang/sk.bin and b/res/lang/sk.bin differ
diff --git a/res/lang/sr.bin b/res/lang/sr.bin
index 7631078f..022a2981 100644
Binary files a/res/lang/sr.bin and b/res/lang/sr.bin differ
diff --git a/res/lang/tok.bin b/res/lang/tok.bin
index 9f6c802c..70b23119 100644
Binary files a/res/lang/tok.bin and b/res/lang/tok.bin differ
diff --git a/res/lang/tr.bin b/res/lang/tr.bin
index 045217cd..d6772c46 100644
Binary files a/res/lang/tr.bin and b/res/lang/tr.bin differ
diff --git a/res/lang/uk.bin b/res/lang/uk.bin
index 6f3d4174..1594a006 100644
Binary files a/res/lang/uk.bin and b/res/lang/uk.bin differ
diff --git a/res/lang/zh_Hans.bin b/res/lang/zh_Hans.bin
index fddc78bf..5de58aaf 100644
Binary files a/res/lang/zh_Hans.bin and b/res/lang/zh_Hans.bin differ
diff --git a/res/lang/zh_Hant.bin b/res/lang/zh_Hant.bin
index 7d8839e7..00f42204 100644
Binary files a/res/lang/zh_Hant.bin and b/res/lang/zh_Hant.bin differ
diff --git a/src/app.c b/src/app.c
index 0e2ac0b5..22208938 100644
--- a/src/app.c
+++ b/src/app.c
@@ -279,25 +279,26 @@ static iString *serializePrefs_App_(const iApp *d) {
         const char * id;
         const iBool *value;
     } boolPrefs[] = {
-        { "prefs.time.24h", &d->prefs.time24h },
         { "prefs.animate", &d->prefs.uiAnimations },
-        { "prefs.font.smooth", &d->prefs.fontSmoothing },
-        { "prefs.mono.gemini", &d->prefs.monospaceGemini },
-        { "prefs.mono.gopher", &d->prefs.monospaceGopher },
-        { "prefs.boldlink.visited", &d->prefs.boldLinkVisited },
+        { "prefs.archive.openindex", &d->prefs.openArchiveIndexPages },
+        { "prefs.biglede", &d->prefs.bigFirstParagraph },
+        { "prefs.blink", &d->prefs.blinkingCursor },
         { "prefs.boldlink.dark", &d->prefs.boldLinkDark },
         { "prefs.boldlink.light", &d->prefs.boldLinkLight },
-        { "prefs.biglede", &d->prefs.bigFirstParagraph },
-        { "prefs.plaintext.wrap", &d->prefs.plainTextWrap },
-        { "prefs.sideicon", &d->prefs.sideIcon },
+        { "prefs.boldlink.visited", &d->prefs.boldLinkVisited },
+        { "prefs.bookmarks.addbottom", &d->prefs.addBookmarksToBottom },
         { "prefs.centershort", &d->prefs.centerShortDocs },
         { "prefs.collapsepreonload", &d->prefs.collapsePreOnLoad },
-        { "prefs.hoverlink", &d->prefs.hoverLink },
-        { "prefs.bookmarks.addbottom", &d->prefs.addBookmarksToBottom },
         { "prefs.dataurl.openimages", &d->prefs.openDataUrlImagesOnLoad },
-        { "prefs.archive.openindex", &d->prefs.openArchiveIndexPages },
+        { "prefs.font.smooth", &d->prefs.fontSmoothing },
         { "prefs.font.warnmissing", &d->prefs.warnAboutMissingGlyphs },
-        { "prefs.blink", &d->prefs.blinkingCursor },
+        { "prefs.hoverlink", &d->prefs.hoverLink },
+        { "prefs.mono.gemini", &d->prefs.monospaceGemini },
+        { "prefs.mono.gopher", &d->prefs.monospaceGopher },
+        { "prefs.plaintext.wrap", &d->prefs.plainTextWrap },
+        { "prefs.retaintabs", &d->prefs.retainTabs },
+        { "prefs.sideicon", &d->prefs.sideIcon },
+        { "prefs.time.24h", &d->prefs.time24h },
     };
     iForIndices(i, boolPrefs) {
         appendFormat_String(str, "%s.changed arg:%d\n", boolPrefs[i].id, *boolPrefs[i].value);
@@ -430,9 +431,10 @@ static void loadPrefs_App_(iApp *d) {
                 insert_StringSet(d->prefs.disabledFontPacks,
                                  collect_String(suffix_Command(cmd, "id")));
             }
-            else if (equal_Command(cmd, "font.set")) {
-                /* Handle this immediately so the first initialization of the fonts already
-                   has the right ones. */
+            else if (equal_Command(cmd, "font.set") ||
+                     equal_Command(cmd, "prefs.retaintabs.changed")) {
+                /* Fonts are set immediately so the first initialization already has 
+                   the right ones. */
                 handleCommand_App(cmd);
             }
 #if defined (iPlatformAndroidMobile)
@@ -641,17 +643,19 @@ static iBool loadState_App_(iApp *d) {
                     rootIndex = 0;
                 }
                 setCurrent_Root(win->base.roots[rootIndex]);
-                iDocumentWidget *doc;
-                if (isFirstTab[rootIndex]) {
-                    isFirstTab[rootIndex] = iFalse;
-                    /* There is one pre-created tab in each root. */
-                    doc = document_Root(get_Root());
-                }
-                else {
-                    doc = newTab_App(NULL, iFalse /* no switching */);
-                }
-                if (flags & current_DocumentStateFlag) {
-                    value_Array(currentTabs, numWins - 1, iCurrentTabs).currentTab[rootIndex] = doc;
+                iDocumentWidget *doc = NULL;
+                if (d->prefs.retainTabs) {
+                    if (isFirstTab[rootIndex]) {
+                        isFirstTab[rootIndex] = iFalse;
+                        /* There is one pre-created tab in each root. */
+                        doc = document_Root(get_Root());
+                    }
+                    else {
+                        doc = newTab_App(NULL, iFalse /* no switching */);
+                    }
+                    if (flags & current_DocumentStateFlag) {
+                        value_Array(currentTabs, numWins - 1, iCurrentTabs).currentTab[rootIndex] = doc;
+                    }
                 }
                 deserializeState_DocumentWidget(doc, stream_File(f));
                 doc = NULL;
@@ -1067,6 +1071,17 @@ static void init_App_(iApp *d, int argc, char **argv) {
     if (!loadState_App_(d)) {
         postCommand_Root(NULL, "open url:about:help");
     }
+    else if (!d->prefs.retainTabs) {
+        /* All roots will just show home. */
+        iForEach(PtrArray, w, &d->mainWindows) {
+            const iWindow *win = w.ptr;
+            iForIndices(ri, win->roots) {
+                if (win->roots[ri]) {
+                    postCommand_Root(win->roots[ri], "navigate.home");
+                }
+            }
+        }
+    }
     postCommand_App("~navbar.actions.changed");
     postCommand_App("~toolbar.actions.changed");
     postCommand_App("~window.unfreeze");
@@ -2597,6 +2612,10 @@ iBool handleCommand_App(const char *cmd) {
         postCommandf_App("window.fullscreen.changed arg:%d", !wasFull);
         return iTrue;
     }
+    else if (equal_Command(cmd, "prefs.retaintabs.changed")) {
+        d->prefs.retainTabs = arg_Command(cmd);
+        return iTrue;
+    }
     else if (equal_Command(cmd, "font.reset")) {
         resetFonts_App();
         return iTrue;
@@ -3323,6 +3342,7 @@ iBool handleCommand_App(const char *cmd) {
         /* TODO: Use a common table in Prefs to do this more conviently.
            Also see `serializePrefs_App_()`. */
         setToggle_Widget(findChild_Widget(dlg, "prefs.hoverlink"), d->prefs.hoverLink);
+        setToggle_Widget(findChild_Widget(dlg, "prefs.retaintabs"), d->prefs.retainTabs);
         setToggle_Widget(findChild_Widget(dlg, "prefs.smoothscroll"), d->prefs.smoothScrolling);
         setToggle_Widget(findChild_Widget(dlg, "prefs.imageloadscroll"), d->prefs.loadImageInsteadOfScrolling);
         setToggle_Widget(findChild_Widget(dlg, "prefs.hidetoolbarscroll"), d->prefs.hideToolbarOnScroll);
diff --git a/src/prefs.c b/src/prefs.c
index fa05eb70..495940b4 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -61,7 +61,8 @@ void init_Prefs(iPrefs *d) {
     d->pinSplit          = 1;
     d->time24h           = iTrue;
     d->returnKey         = default_ReturnKeyBehavior;
-    d->hoverLink         = iFalse;
+    d->retainTabs        = iTrue;
+    d->hoverLink         = iTrue;
     d->smoothScrolling   = iTrue;
     d->smoothScrollSpeed[keyboard_ScrollType] = 13;
     d->smoothScrollSpeed[mouse_ScrollType]    = 13;
diff --git a/src/prefs.h b/src/prefs.h
index fc4f00ef..67616747 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -72,6 +72,7 @@ enum iPrefsBool {
     time24h_PrefsBool,
     
     /* Behavior */
+    retainTabs_PrefsBool,
     hoverLink_PrefsBool,
     smoothScrolling_PrefsBool,
     loadImageInsteadOfScrolling_PrefsBool,
@@ -126,6 +127,7 @@ struct Impl_Prefs {
             iBool time24h;
             
             /* Behavior */
+            iBool retainTabs;
             iBool hoverLink;
             iBool smoothScrolling;
             iBool loadImageInsteadOfScrolling;
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 93b321f2..15b8f753 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -5884,9 +5884,17 @@ void serializeState_DocumentWidget(const iDocumentWidget *d, iStream *outs) {
 }
 
 void deserializeState_DocumentWidget(iDocumentWidget *d, iStream *ins) {
-    deserialize_PersistentDocumentState(&d->mod, ins);
-    parseUser_DocumentWidget_(d);
-    updateFromHistory_DocumentWidget_(d);
+    if (d) {
+        deserialize_PersistentDocumentState(&d->mod, ins);
+        parseUser_DocumentWidget_(d);
+        updateFromHistory_DocumentWidget_(d);
+    }
+    else {
+        /* Read and throw away the data. */
+        iPersistentDocumentState *dummy = new_PersistentDocumentState();
+        deserialize_PersistentDocumentState(dummy, ins);
+        delete_PersistentDocumentState(dummy);
+    }
 }
 
 void setUrlFlags_DocumentWidget(iDocumentWidget *d, const iString *url, int setUrlFlags) {
diff --git a/src/ui/util.c b/src/ui/util.c
index 7cbd0757..42064843 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -2650,9 +2650,7 @@ iWidget *makePreferences_Widget(void) {
         setUrlContent_InputWidget(searchUrl, iTrue);
         addDialogPadding_(headings, values);
         addDialogToggle_(headings, values, "${prefs.hoverlink}", "prefs.hoverlink");
-        addDialogToggle_(headings, values, "${prefs.dataurl.openimages}", "prefs.dataurl.openimages");
-        addDialogToggle_(headings, values, "${prefs.archive.openindex}", "prefs.archive.openindex");
-        addDialogToggle_(headings, values, "${prefs.bookmarks.addbottom}", "prefs.bookmarks.addbottom");
+        addDialogToggle_(headings, values, "${prefs.retaintabs}", "prefs.retaintabs");
         if (deviceType_App() != phone_AppDeviceType) {
             addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.pinsplit}")));
             iWidget *pinSplit = new_Widget();
@@ -2663,6 +2661,9 @@ iWidget *makePreferences_Widget(void) {
             }
             addChildFlags_Widget(values, iClob(pinSplit), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
         }
+        addDialogToggle_(headings, values, "${prefs.bookmarks.addbottom}", "prefs.bookmarks.addbottom");
+        addDialogToggle_(headings, values, "${prefs.archive.openindex}", "prefs.archive.openindex");
+        addDialogToggle_(headings, values, "${prefs.dataurl.openimages}", "prefs.dataurl.openimages");
         addDialogPadding_(headings, values);
         /* UI languages. */ {
             iArray *uiLangs = collectNew_Array(sizeof(iMenuItem));
Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/release/cdiff/9beb506b6d66f8264702cb60e7927dee3567ba94
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
30.183522 milliseconds
Gemini-to-HTML Time
0.622803 milliseconds

This content has been proxied by September (ba2dc).