Use data manager name everywhere

This commit is contained in:
Reinout Meliesie 2025-02-05 00:03:26 +01:00
parent 7610b291a4
commit 11dca1fab2
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
6 changed files with 15 additions and 13 deletions

View file

@ -12,10 +12,10 @@ use crate :: error :: { * , ZoodexError :: * } ;
pub struct Collection { sqlite_client : Client }
pub struct DataManager { sqlite_client : Client }
impl Collection {
pub async fn new () -> Result <Collection> {
impl DataManager {
pub async fn new () -> Result <Self> {
let sqlite_client = ClientBuilder :: new ()
. path ("zoodex.sqlite")
. flags ( OpenFlags :: SQLITE_OPEN_READ_WRITE | OpenFlags :: SQLITE_OPEN_NO_MUTEX )
@ -24,7 +24,7 @@ impl Collection {
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| {
let films = sqlite_connection
. prepare ( "

View file

@ -1,5 +1,5 @@
mod error ;
mod persistence ;
mod data_manager ;
mod ui ;
mod utility ;
@ -13,7 +13,7 @@ use {
} ,
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 {
async_unit_result_context (
async {
let collection = Collection :: new () . await ? ;
let collection_overview = collection . get_overview () . await ;
ui . render_collection_overview (collection_overview) ;
let data_manager = DataManager :: new () . await ? ;
let collection = data_manager . get_collection_overview () . await ;
ui . render_collection_overview (collection) ;
Ok (())
} ,
|error| {

View file

@ -1,7 +1,8 @@
use {
gtk4 :: {
* ,
Align :: * , Orientation :: * ,
Align :: * ,
Orientation :: * ,
gdk :: * ,
pango :: { * , Weight :: * } ,
prelude :: * ,

View file

@ -6,7 +6,8 @@ use {
} ;
use crate :: ui :: {
component :: * , utility :: * ,
component :: * ,
utility :: * ,
collatable_container :: { * , collation_menu :: sort_button :: * } ,
} ;

View file

@ -4,7 +4,7 @@ mod collation_menu ;
use gtk4 :: { * , Orientation :: * , prelude :: * } ;
use crate :: {
persistence :: * ,
data_manager :: * ,
ui :: {
component :: * , utility :: * ,
collatable_container :: { collated_grid :: * , collation_menu :: * } ,

View file

@ -10,7 +10,7 @@ use {
} ;
use crate :: {
persistence :: * ,
data_manager :: * ,
ui :: {
application_header_bar :: * ,
collatable_container :: * ,