summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-06-09 00:41:02 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-06-09 12:06:19 +0200
commitd8cc59e18d6bf90c91e5d9cf1f9c36587f4ab26c (patch)
treef004320e757660cbefb02559ea7a902575c84e1c
parente89a2293ebb3331dca46f5edf0108231b1007402 (diff)
Add new_tab_page option
Adds support to load a custom page when a new tab is opened. The current behavior is set as the default, load a blank page. The location bar is only selected when the new tab page is the blank page, otherwise the page loaded gets the focus. Co-authored-by: Alex <a1ex@dismail.de> Fixes: https://github.com/dillo-browser/dillo/issues/124
-rw-r--r--ChangeLog5
-rw-r--r--dillorc5
-rw-r--r--doc/user_help.in.html10
-rw-r--r--src/prefs.c3
-rw-r--r--src/prefs.h1
-rw-r--r--src/prefsparser.cc1
-rw-r--r--src/uicmd.cc5
-rw-r--r--src/url.c5
8 files changed, 33 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6c988621..e32e67ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,11 @@ Here we list changes that are relatively significant and/or visible to the
user. For a history of changes in full detail, see our Git repository
at https://github.com/dillo-browser/dillo
+dillo-3.2.0 [Not released yet]
+
++- Add new_tab_page option to open a custom new tab page.
+ Patches: Alex, Rodrigo Arias Mallo
+
dillo-3.1.1 [Jun 8, 2024]
+- Disable TLSv1.3 in Mbed TLS 3.6.0 until it is supported.
diff --git a/dillorc b/dillorc
index 362b9bb9..72f6862e 100644
--- a/dillorc
+++ b/dillorc
@@ -157,6 +157,11 @@
# home="file:/home/jcid/HomePage/Home.html"
#home="https://dillo-browser.github.io/"
+# Set the new tab page.
+# new_tab_page="dpi:/bm/"
+# new_tab_page="https://example.com/"
+#new_tab_page="about:blank"
+
# Set the URLs used by the web search dialog.
# "%s" is replaced with the search keywords separated by '+'.
# Format: search_url="[prefix ][<label> ]<url>"
diff --git a/doc/user_help.in.html b/doc/user_help.in.html
index d1d92fb5..66480681 100644
--- a/doc/user_help.in.html
+++ b/doc/user_help.in.html
@@ -318,7 +318,8 @@ DuckDuckGo for the keywords "dillo browser".
<p>
Dillo can open different web pages into tabs. To open a link in a new tab click
the middle button instead of the left button. The same applies to buttons to
-submit a form.
+submit a form. A new tab can also be opened from the <code>File</code> menu or
+using the shortcut <code>Ctrl+T</code>.
<p>
By default the new tab will be automatically focused. If you want to change
this behaviour, adjust the following options in the
@@ -337,6 +338,13 @@ label. The middle button can be used instead by setting the option:
<pre>
right_click_closes_tab=NO
</pre>
+<p>
+Use the <code>new_tab_page</code> option to control which page is loaded in a
+newly opened tab, by default is an empty page. To open the
+bookmarks page set the following line in <a href="#dillorc">dillorc</a>:
+<pre>
+new_tab_page="dpi:/bm/"
+</pre>
<h3 id="bookmarks">Bookmarks</h3>
<p>
diff --git a/src/prefs.c b/src/prefs.c
index 8d25ef18..e7f735ed 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -14,6 +14,7 @@
#define PREFS_START_PAGE "about:splash"
#define PREFS_HOME "https://dillo-browser.github.io/"
+#define PREFS_NEW_TAB_PAGE "about:blank"
#define PREFS_FONT_SERIF "DejaVu Serif"
#define PREFS_FONT_SANS_SERIF "DejaVu Sans"
#define PREFS_FONT_CURSIVE "DejaVu Sans"
@@ -110,6 +111,7 @@ void a_Prefs_init(void)
prefs.show_ui_tooltip = TRUE;
prefs.small_icons = FALSE;
prefs.start_page = a_Url_new(PREFS_START_PAGE, NULL);
+ prefs.new_tab_page = a_Url_new(PREFS_NEW_TAB_PAGE, NULL);
prefs.theme = dStrdup(PREFS_THEME);
prefs.ui_button_highlight_color = -1;
prefs.ui_fg_color = -1;
@@ -155,5 +157,6 @@ void a_Prefs_freeall(void)
dFree(dList_nth_data(prefs.search_urls, i));
dList_free(prefs.search_urls);
a_Url_free(prefs.start_page);
+ a_Url_free(prefs.new_tab_page);
dFree(prefs.theme);
}
diff --git a/src/prefs.h b/src/prefs.h
index b234176f..97bdecf7 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -48,6 +48,7 @@ typedef struct {
char *no_proxy;
DilloUrl *start_page;
DilloUrl *home;
+ DilloUrl *new_tab_page;
bool_t allow_white_bg;
int32_t white_bg_replacement;
int32_t bg_color;
diff --git a/src/prefsparser.cc b/src/prefsparser.cc
index 40460e52..8755890c 100644
--- a/src/prefsparser.cc
+++ b/src/prefsparser.cc
@@ -171,6 +171,7 @@ void PrefsParser::parse(FILE *fp)
{ "fullwindow_start", &prefs.fullwindow_start, PREFS_BOOL, 0 },
{ "geometry", NULL, PREFS_GEOMETRY, 0 },
{ "home", &prefs.home, PREFS_URL, 0 },
+ { "new_tab_page", &prefs.new_tab_page, PREFS_URL, 0 },
{ "http_language", &prefs.http_language, PREFS_STRING, 0 },
{ "http_max_conns", &prefs.http_max_conns, PREFS_INT32, 0 },
{ "http_persistent_conns", &prefs.http_persistent_conns, PREFS_BOOL, 0 },
diff --git a/src/uicmd.cc b/src/uicmd.cc
index 88bc9b7d..d7822e47 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -770,6 +770,11 @@ void a_UIcmd_open_url(BrowserWindow *bw, const DilloUrl *url)
static void UIcmd_open_url_nbw(BrowserWindow *new_bw, const DilloUrl *url)
{
+ if (!url && prefs.new_tab_page) {
+ if (strcmp(URL_STR(prefs.new_tab_page), "about:blank") != 0)
+ url = prefs.new_tab_page;
+ }
+
/* When opening a new BrowserWindow (tab or real window) we focus
* Location if we don't yet have an URL, main otherwise.
*/
diff --git a/src/url.c b/src/url.c
index 686a3b90..181d4f36 100644
--- a/src/url.c
+++ b/src/url.c
@@ -2,6 +2,7 @@
* File: url.c
*
* Copyright (C) 2001-2009 Jorge Arellano Cid <jcid@dillo.org>
+ * Copyright (C) 2024 Rodrigo Arias Mallo <rodarima@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -374,7 +375,9 @@ DilloUrl* a_Url_new(const char *url_str, const char *base_url)
Dstr *SolvedUrl;
int i, n_ic, n_ic_spc;
- dReturn_val_if_fail (url_str != NULL, NULL);
+ /* NULL or empty URL is not valid */
+ if (!url_str || url_str[0] == '\0')
+ return NULL;
/* Count illegal characters (0x00-0x1F, 0x7F-0xFF and space) */
n_ic = n_ic_spc = 0;