mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
use shared Subject struct for Page and TabPage
This commit is contained in:
parent
065bd8bfad
commit
5570b6fa85
4 changed files with 121 additions and 105 deletions
|
|
@ -1,5 +1,6 @@
|
|||
mod driver;
|
||||
mod feature;
|
||||
mod subject;
|
||||
|
||||
use super::Page;
|
||||
use adw::TabPage;
|
||||
|
|
@ -11,11 +12,13 @@ use gtk::{
|
|||
prelude::CancellableExt,
|
||||
};
|
||||
use std::{cell::Cell, rc::Rc};
|
||||
use subject::Subject;
|
||||
|
||||
/// Multi-protocol client API for tab `Item`
|
||||
pub struct Client {
|
||||
cancellable: Cell<Cancellable>,
|
||||
driver: Rc<Driver>,
|
||||
subject: Rc<Subject>,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
|
|
@ -23,9 +26,14 @@ impl Client {
|
|||
|
||||
/// Create new `Self`
|
||||
pub fn init(page: &Rc<Page>, tab_page: &TabPage) -> Self {
|
||||
let subject = Rc::new(Subject {
|
||||
page: page.clone(),
|
||||
tab_page: tab_page.clone(),
|
||||
});
|
||||
Self {
|
||||
cancellable: Cell::new(Cancellable::new()),
|
||||
driver: Rc::new(Driver::build(page, tab_page)),
|
||||
driver: Rc::new(Driver::build(&subject)),
|
||||
subject,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue