mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
init separated db component
This commit is contained in:
parent
599b03e551
commit
2a7d7c5c46
2 changed files with 20 additions and 3 deletions
11
src/browser/database.rs
Normal file
11
src/browser/database.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
pub struct Database {
|
||||||
|
pub connection: Arc<sqlite::Connection>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Database {
|
||||||
|
fn init(&self) {}
|
||||||
|
fn save(&self) {}
|
||||||
|
fn restore(&self) {}
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
mod database;
|
||||||
mod header;
|
mod header;
|
||||||
mod main;
|
mod main;
|
||||||
|
|
||||||
|
|
@ -10,13 +11,18 @@ use gtk::{
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Browser {
|
pub struct Browser {
|
||||||
db: Arc<sqlite::Connection>,
|
database: database::Database,
|
||||||
pub widget: Arc<gtk::ApplicationWindow>,
|
pub widget: Arc<gtk::ApplicationWindow>,
|
||||||
pub header: Arc<header::Header>,
|
pub header: Arc<header::Header>,
|
||||||
pub main: Arc<main::Main>,
|
pub main: Arc<main::Main>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(app: &Application, db: Arc<sqlite::Connection>, width: i32, height: i32) -> Browser {
|
pub fn new(
|
||||||
|
app: &Application,
|
||||||
|
connection: Arc<sqlite::Connection>,
|
||||||
|
width: i32,
|
||||||
|
height: i32,
|
||||||
|
) -> Browser {
|
||||||
// Init components
|
// Init components
|
||||||
let header = Arc::new(header::new());
|
let header = Arc::new(header::new());
|
||||||
let main = Arc::new(main::new());
|
let main = Arc::new(main::new());
|
||||||
|
|
@ -58,7 +64,7 @@ pub fn new(app: &Application, db: Arc<sqlite::Connection>, width: i32, height: i
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
Browser {
|
Browser {
|
||||||
db,
|
database: database::Database { connection },
|
||||||
widget,
|
widget,
|
||||||
header,
|
header,
|
||||||
main,
|
main,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue