summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.c6
-rw-r--r--src/bookmarks.c21
-rw-r--r--src/prefs.c1
-rw-r--r--src/prefs.h1
-rw-r--r--src/ui/util.c1
5 files changed, 26 insertions, 4 deletions
diff --git a/src/app.c b/src/app.c
index cb5479e8..a7925def 100644
--- a/src/app.c
+++ b/src/app.c
@@ -243,6 +243,7 @@ static iString *serializePrefs_App_(const iApp *d) {
243 appendFormat_String(str, "prefs.centershort.changed arg:%d\n", d->prefs.centerShortDocs); 243 appendFormat_String(str, "prefs.centershort.changed arg:%d\n", d->prefs.centerShortDocs);
244 appendFormat_String(str, "prefs.collapsepreonload.changed arg:%d\n", d->prefs.collapsePreOnLoad); 244 appendFormat_String(str, "prefs.collapsepreonload.changed arg:%d\n", d->prefs.collapsePreOnLoad);
245 appendFormat_String(str, "prefs.hoverlink.changed arg:%d\n", d->prefs.hoverLink); 245 appendFormat_String(str, "prefs.hoverlink.changed arg:%d\n", d->prefs.hoverLink);
246 appendFormat_String(str, "prefs.bookmarks.addbottom arg:%d\n", d->prefs.addBookmarksToBottom);
246 appendFormat_String(str, "prefs.archive.openindex.changed arg:%d\n", d->prefs.openArchiveIndexPages); 247 appendFormat_String(str, "prefs.archive.openindex.changed arg:%d\n", d->prefs.openArchiveIndexPages);
247 appendFormat_String(str, "quoteicon.set arg:%d\n", d->prefs.quoteIcon ? 1 : 0); 248 appendFormat_String(str, "quoteicon.set arg:%d\n", d->prefs.quoteIcon ? 1 : 0);
248 appendFormat_String(str, "theme.set arg:%d auto:1\n", d->prefs.theme); 249 appendFormat_String(str, "theme.set arg:%d auto:1\n", d->prefs.theme);
@@ -2413,6 +2414,10 @@ iBool handleCommand_App(const char *cmd) {
2413 d->prefs.openArchiveIndexPages = arg_Command(cmd) != 0; 2414 d->prefs.openArchiveIndexPages = arg_Command(cmd) != 0;
2414 return iTrue; 2415 return iTrue;
2415 } 2416 }
2417 else if (equal_Command(cmd, "prefs.bookmarks.addbottom.changed")) {
2418 d->prefs.addBookmarksToBottom = arg_Command(cmd) != 0;
2419 return iTrue;
2420 }
2416 else if (equal_Command(cmd, "prefs.animate.changed")) { 2421 else if (equal_Command(cmd, "prefs.animate.changed")) {
2417 d->prefs.uiAnimations = arg_Command(cmd) != 0; 2422 d->prefs.uiAnimations = arg_Command(cmd) != 0;
2418 return iTrue; 2423 return iTrue;
@@ -2710,6 +2715,7 @@ iBool handleCommand_App(const char *cmd) {
2710 setToggle_Widget(findChild_Widget(dlg, "prefs.smoothscroll"), d->prefs.smoothScrolling); 2715 setToggle_Widget(findChild_Widget(dlg, "prefs.smoothscroll"), d->prefs.smoothScrolling);
2711 setToggle_Widget(findChild_Widget(dlg, "prefs.imageloadscroll"), d->prefs.loadImageInsteadOfScrolling); 2716 setToggle_Widget(findChild_Widget(dlg, "prefs.imageloadscroll"), d->prefs.loadImageInsteadOfScrolling);
2712 setToggle_Widget(findChild_Widget(dlg, "prefs.hidetoolbarscroll"), d->prefs.hideToolbarOnScroll); 2717 setToggle_Widget(findChild_Widget(dlg, "prefs.hidetoolbarscroll"), d->prefs.hideToolbarOnScroll);
2718 setToggle_Widget(findChild_Widget(dlg, "prefs.bookmarks.addbottom"), d->prefs.addBookmarksToBottom);
2713 setToggle_Widget(findChild_Widget(dlg, "prefs.archive.openindex"), d->prefs.openArchiveIndexPages); 2719 setToggle_Widget(findChild_Widget(dlg, "prefs.archive.openindex"), d->prefs.openArchiveIndexPages);
2714 setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme); 2720 setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme);
2715 setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame); 2721 setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame);
diff --git a/src/bookmarks.c b/src/bookmarks.c
index 67c6a25f..1a260f3a 100644
--- a/src/bookmarks.c
+++ b/src/bookmarks.c
@@ -327,11 +327,18 @@ void save_Bookmarks(const iBookmarks *d, const char *dirPath) {
327 unlock_Mutex(d->mtx); 327 unlock_Mutex(d->mtx);
328} 328}
329 329
330static int maxOrder_Bookmarks_(const iBookmarks *d) { 330static iRangei orderRange_Bookmarks_(const iBookmarks *d) {
331 int ord = 0; 331 iRangei ord = { 0, 0 };
332 iConstForEach(Hash, i, &d->bookmarks) { 332 iConstForEach(Hash, i, &d->bookmarks) {
333 const iBookmark *bm = (const iBookmark *) i.value; 333 const iBookmark *bm = (const iBookmark *) i.value;
334 ord = iMax(ord, bm->order); 334 if (isEmpty_Range(&ord)) {
335 ord.start = bm->order;
336 ord.end = bm->order + 1;
337 }
338 else {
339 ord.start = iMin(ord.start, bm->order);
340 ord.end = iMax(ord.end, bm->order + 1);
341 }
335 } 342 }
336 return ord; 343 return ord;
337} 344}
@@ -349,7 +356,13 @@ uint32_t add_Bookmarks(iBookmarks *d, const iString *url, const iString *title,
349 } 356 }
350 bm->icon = icon; 357 bm->icon = icon;
351 initCurrent_Time(&bm->when); 358 initCurrent_Time(&bm->when);
352 bm->order = maxOrder_Bookmarks_(d) + 1; /* Last in lists. */ 359 const iRangei ord = orderRange_Bookmarks_(d);
360 if (prefs_App()->addBookmarksToBottom) {
361 bm->order = ord.end; /* Last in lists. */
362 }
363 else {
364 bm->order = ord.start - 1; /* First in lists. */
365 }
353 insert_Bookmarks_(d, bm); 366 insert_Bookmarks_(d, bm);
354 unlock_Mutex(d->mtx); 367 unlock_Mutex(d->mtx);
355 return id_Bookmark(bm); 368 return id_Bookmark(bm);
diff --git a/src/prefs.c b/src/prefs.c
index f7179ad7..65560264 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -51,6 +51,7 @@ void init_Prefs(iPrefs *d) {
51 d->loadImageInsteadOfScrolling = iFalse; 51 d->loadImageInsteadOfScrolling = iFalse;
52 d->collapsePreOnLoad = iFalse; 52 d->collapsePreOnLoad = iFalse;
53 d->openArchiveIndexPages = iTrue; 53 d->openArchiveIndexPages = iTrue;
54 d->addBookmarksToBottom = iTrue;
54 d->decodeUserVisibleURLs = iTrue; 55 d->decodeUserVisibleURLs = iTrue;
55 d->maxCacheSize = 10; 56 d->maxCacheSize = 10;
56 d->maxMemorySize = 200; 57 d->maxMemorySize = 200;
diff --git a/src/prefs.h b/src/prefs.h
index 3431305d..dc233cdc 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -81,6 +81,7 @@ struct Impl_Prefs {
81 iBool loadImageInsteadOfScrolling; 81 iBool loadImageInsteadOfScrolling;
82 iBool collapsePreOnLoad; 82 iBool collapsePreOnLoad;
83 iBool openArchiveIndexPages; 83 iBool openArchiveIndexPages;
84 iBool addBookmarksToBottom;
84 /* Network */ 85 /* Network */
85 iBool decodeUserVisibleURLs; 86 iBool decodeUserVisibleURLs;
86 int maxCacheSize; /* MB */ 87 int maxCacheSize; /* MB */
diff --git a/src/ui/util.c b/src/ui/util.c
index ab799a36..3240b416 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -2381,6 +2381,7 @@ iWidget *makePreferences_Widget(void) {
2381 setUrlContent_InputWidget(searchUrl, iTrue); 2381 setUrlContent_InputWidget(searchUrl, iTrue);
2382 addDialogPadding_(headings, values); 2382 addDialogPadding_(headings, values);
2383 addDialogToggle_(headings, values, "${prefs.hoverlink}", "prefs.hoverlink"); 2383 addDialogToggle_(headings, values, "${prefs.hoverlink}", "prefs.hoverlink");
2384 addDialogToggle_(headings, values, "${prefs.bookmarks.addbottom}", "prefs.bookmarks.addbottom");
2384 addDialogToggle_(headings, values, "${prefs.archive.openindex}", "prefs.archive.openindex"); 2385 addDialogToggle_(headings, values, "${prefs.archive.openindex}", "prefs.archive.openindex");
2385 if (deviceType_App() != phone_AppDeviceType) { 2386 if (deviceType_App() != phone_AppDeviceType) {
2386 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.pinsplit}"))); 2387 addChild_Widget(headings, iClob(makeHeading_Widget("${prefs.pinsplit}")));