Use data manager name everywhere
This commit is contained in:
parent
7610b291a4
commit
11dca1fab2
6 changed files with 15 additions and 13 deletions
|
@ -12,10 +12,10 @@ use crate :: error :: { * , ZoodexError :: * } ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pub struct Collection { sqlite_client : Client }
|
pub struct DataManager { sqlite_client : Client }
|
||||||
|
|
||||||
impl Collection {
|
impl DataManager {
|
||||||
pub async fn new () -> Result <Collection> {
|
pub async fn new () -> Result <Self> {
|
||||||
let sqlite_client = ClientBuilder :: new ()
|
let sqlite_client = ClientBuilder :: new ()
|
||||||
. path ("zoodex.sqlite")
|
. path ("zoodex.sqlite")
|
||||||
. flags ( OpenFlags :: SQLITE_OPEN_READ_WRITE | OpenFlags :: SQLITE_OPEN_NO_MUTEX )
|
. flags ( OpenFlags :: SQLITE_OPEN_READ_WRITE | OpenFlags :: SQLITE_OPEN_NO_MUTEX )
|
||||||
|
@ -24,7 +24,7 @@ impl Collection {
|
||||||
Ok ( Self { sqlite_client } )
|
Ok ( Self { sqlite_client } )
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_overview ( & self ) -> CollectionOverview {
|
pub async fn get_collection_overview ( & self ) -> CollectionOverview {
|
||||||
self . sqlite_client . conn ( |sqlite_connection| {
|
self . sqlite_client . conn ( |sqlite_connection| {
|
||||||
let films = sqlite_connection
|
let films = sqlite_connection
|
||||||
. prepare ( "
|
. prepare ( "
|
10
src/main.rs
10
src/main.rs
|
@ -1,5 +1,5 @@
|
||||||
mod error ;
|
mod error ;
|
||||||
mod persistence ;
|
mod data_manager ;
|
||||||
mod ui ;
|
mod ui ;
|
||||||
mod utility ;
|
mod utility ;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ use {
|
||||||
} ,
|
} ,
|
||||||
libadwaita :: { * , prelude :: * } } ;
|
libadwaita :: { * , prelude :: * } } ;
|
||||||
|
|
||||||
use crate :: { error :: { * , ZoodexError :: * } , persistence :: * , ui :: * } ;
|
use crate :: { data_manager :: * , error :: { * , ZoodexError :: * } , ui :: * } ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ fn show_window ( app : & Application ) {
|
||||||
spawn_future_local ( async move {
|
spawn_future_local ( async move {
|
||||||
async_unit_result_context (
|
async_unit_result_context (
|
||||||
async {
|
async {
|
||||||
let collection = Collection :: new () . await ? ;
|
let data_manager = DataManager :: new () . await ? ;
|
||||||
let collection_overview = collection . get_overview () . await ;
|
let collection = data_manager . get_collection_overview () . await ;
|
||||||
ui . render_collection_overview (collection_overview) ;
|
ui . render_collection_overview (collection) ;
|
||||||
Ok (())
|
Ok (())
|
||||||
} ,
|
} ,
|
||||||
|error| {
|
|error| {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use {
|
use {
|
||||||
gtk4 :: {
|
gtk4 :: {
|
||||||
* ,
|
* ,
|
||||||
Align :: * , Orientation :: * ,
|
Align :: * ,
|
||||||
|
Orientation :: * ,
|
||||||
gdk :: * ,
|
gdk :: * ,
|
||||||
pango :: { * , Weight :: * } ,
|
pango :: { * , Weight :: * } ,
|
||||||
prelude :: * ,
|
prelude :: * ,
|
||||||
|
|
|
@ -6,7 +6,8 @@ use {
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
use crate :: ui :: {
|
use crate :: ui :: {
|
||||||
component :: * , utility :: * ,
|
component :: * ,
|
||||||
|
utility :: * ,
|
||||||
collatable_container :: { * , collation_menu :: sort_button :: * } ,
|
collatable_container :: { * , collation_menu :: sort_button :: * } ,
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ mod collation_menu ;
|
||||||
use gtk4 :: { * , Orientation :: * , prelude :: * } ;
|
use gtk4 :: { * , Orientation :: * , prelude :: * } ;
|
||||||
|
|
||||||
use crate :: {
|
use crate :: {
|
||||||
persistence :: * ,
|
data_manager :: * ,
|
||||||
ui :: {
|
ui :: {
|
||||||
component :: * , utility :: * ,
|
component :: * , utility :: * ,
|
||||||
collatable_container :: { collated_grid :: * , collation_menu :: * } ,
|
collatable_container :: { collated_grid :: * , collation_menu :: * } ,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use {
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
use crate :: {
|
use crate :: {
|
||||||
persistence :: * ,
|
data_manager :: * ,
|
||||||
ui :: {
|
ui :: {
|
||||||
application_header_bar :: * ,
|
application_header_bar :: * ,
|
||||||
collatable_container :: * ,
|
collatable_container :: * ,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue