mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
draft profile database implementation, make members public, run initial dialog, rename field from active to is_active
This commit is contained in:
parent
b0ee52c3f4
commit
4d7b61ef59
4 changed files with 81 additions and 54 deletions
|
|
@ -3,24 +3,21 @@ mod database;
|
|||
mod history;
|
||||
mod identity;
|
||||
|
||||
use database::Database;
|
||||
|
||||
use gtk::glib::user_config_dir;
|
||||
use sqlite::{Connection, Transaction};
|
||||
use std::{
|
||||
fs::create_dir_all,
|
||||
path::{Path, PathBuf},
|
||||
rc::Rc,
|
||||
sync::RwLock,
|
||||
};
|
||||
use std::{fs::create_dir_all, path::PathBuf, rc::Rc, sync::RwLock};
|
||||
|
||||
const VENDOR: &str = "YGGverse";
|
||||
const APP_ID: &str = "Yoda";
|
||||
const BRANCH: &str = "master";
|
||||
|
||||
const DB_NAME: &str = "profile.sqlite3";
|
||||
const DB_NAME: &str = "database.sqlite3";
|
||||
|
||||
pub struct Profile {
|
||||
database: Rc<RwLock<Connection>>,
|
||||
config_path: PathBuf,
|
||||
pub database: Rc<Database>,
|
||||
pub config_path: PathBuf,
|
||||
}
|
||||
|
||||
impl Profile {
|
||||
|
|
@ -82,20 +79,10 @@ impl Profile {
|
|||
|
||||
// Result
|
||||
Self {
|
||||
database: connection,
|
||||
database: Rc::new(Database::new(connection)),
|
||||
config_path,
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
||||
pub fn database(&self) -> &Rc<RwLock<Connection>> {
|
||||
&self.database
|
||||
}
|
||||
|
||||
pub fn config_path(&self) -> &Path {
|
||||
self.config_path.as_path()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn migrate(tx: &Transaction) -> Result<(), String> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue