From 4a4b5956c9b12bbfb583da1794ef0184e760ac33 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Mon, 21 Aug 2017 17:16:25 +0200 Subject: Move settings from GSettings to own db --- libdino/src/service/database.vala | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'libdino/src/service/database.vala') diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala index 5a7eb46d..91a62cce 100644 --- a/libdino/src/service/database.vala +++ b/libdino/src/service/database.vala @@ -6,7 +6,7 @@ using Dino.Entities; namespace Dino { public class Database : Qlite.Database { - private const int VERSION = 4; + private const int VERSION = 5; public class AccountTable : Table { public Column id = new Column.Integer("id") { primary_key = true, auto_increment = true }; @@ -133,6 +133,17 @@ public class Database : Qlite.Database { } } + public class SettingsTable : Table { + public Column id = new Column.Integer("id") { primary_key = true, auto_increment = true }; + public Column key = new Column.Text("key") { unique = true, not_null = true }; + public Column value = new Column.Text("value"); + + internal SettingsTable(Database db) { + base(db, "settings"); + init({id, key, value}); + } + } + public AccountTable account { get; private set; } public JidTable jid { get; private set; } public MessageTable message { get; private set; } @@ -141,6 +152,7 @@ public class Database : Qlite.Database { public AvatarTable avatar { get; private set; } public EntityFeatureTable entity_feature { get; private set; } public RosterTable roster { get; private set; } + public SettingsTable settings { get; private set; } public Map jid_table_cache = new HashMap(); public Map jid_table_reverse = new HashMap(); @@ -156,7 +168,8 @@ public class Database : Qlite.Database { avatar = new AvatarTable(this); entity_feature = new EntityFeatureTable(this); roster = new RosterTable(this); - init({ account, jid, message, real_jid, conversation, avatar, entity_feature, roster }); + settings = new SettingsTable(this); + init({ account, jid, message, real_jid, conversation, avatar, entity_feature, roster, settings }); exec("PRAGMA synchronous=0"); } -- cgit v1.2.3-54-g00ecf