summaryrefslogtreecommitdiff
path: root/core/database.vala
diff options
context:
space:
mode:
authorChristian Dywan <christian@twotoasts.de>2018-09-15 18:00:24 +0200
committerGitHub <noreply@github.com>2018-09-15 18:00:24 +0200
commit3d4832ef4b9c68a6e76360a84d963daf7643e6dd (patch)
treef6ec6c0dcf168d49c31cd1d8dd0777afcf732066 /core/database.vala
parentb8b6200d9af273187d0a0b7859a00fd56cd8cf70 (diff)
downloadmidori-git-3d4832ef4b9c68a6e76360a84d963daf7643e6dd.tar.gz
Decouple database readonly behavior from App.incognito (#58)
Databases other than History may need to be writable even in a private browsing context, and more importantly there can be browsers in different modes at the same time. This also makes it possible to hide delete buttons and not rely on errors when trying to modify the database.
Diffstat (limited to 'core/database.vala')
-rw-r--r--core/database.vala7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/database.vala b/core/database.vala
index 925d01ee..3e3f03e4 100644
--- a/core/database.vala
+++ b/core/database.vala
@@ -204,6 +204,11 @@ namespace Midori {
} }
/*
+ * A read-only database will fail on insert, update and delete.
+ */
+ public bool readonly { get; protected set; default = false; }
+
+ /*
* A new database successfully opened for the first time.
* Old or additional data should be opened if this is true.
*/
@@ -254,7 +259,7 @@ namespace Midori {
bool exists = exists (real_path);
int flags = 0;
- if (App.incognito) {
+ if (readonly) {
flags |= Sqlite.OPEN_READONLY;
} else {
flags |= Sqlite.OPEN_CREATE;