mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
create permanent gemini client object for page
This commit is contained in:
parent
b76fd41deb
commit
a5633046e1
@ -1,3 +1,4 @@
|
|||||||
|
mod client;
|
||||||
mod content;
|
mod content;
|
||||||
mod database;
|
mod database;
|
||||||
mod error;
|
mod error;
|
||||||
@ -6,6 +7,7 @@ mod meta;
|
|||||||
mod navigation;
|
mod navigation;
|
||||||
mod widget;
|
mod widget;
|
||||||
|
|
||||||
|
use client::Client;
|
||||||
use content::Content;
|
use content::Content;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use input::Input;
|
use input::Input;
|
||||||
@ -39,10 +41,11 @@ pub struct Page {
|
|||||||
browser_action: Rc<BrowserAction>,
|
browser_action: Rc<BrowserAction>,
|
||||||
tab_action: Rc<TabAction>,
|
tab_action: Rc<TabAction>,
|
||||||
// Components
|
// Components
|
||||||
pub navigation: Rc<Navigation>,
|
pub client: Rc<Client>,
|
||||||
pub content: Rc<Content>,
|
pub content: Rc<Content>,
|
||||||
pub input: Rc<Input>,
|
pub input: Rc<Input>,
|
||||||
pub meta: Rc<Meta>,
|
pub meta: Rc<Meta>,
|
||||||
|
pub navigation: Rc<Navigation>,
|
||||||
pub widget: Rc<Widget>,
|
pub widget: Rc<Widget>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +85,7 @@ impl Page {
|
|||||||
browser_action: action.0,
|
browser_action: action.0,
|
||||||
tab_action: action.2,
|
tab_action: action.2,
|
||||||
// Components
|
// Components
|
||||||
|
client: Rc::new(Client::new()),
|
||||||
content,
|
content,
|
||||||
navigation,
|
navigation,
|
||||||
input,
|
input,
|
||||||
@ -413,9 +417,6 @@ impl Page {
|
|||||||
let input = self.input.clone();
|
let input = self.input.clone();
|
||||||
let meta = self.meta.clone();
|
let meta = self.meta.clone();
|
||||||
|
|
||||||
// Init socket
|
|
||||||
let client = gemini::Client::new();
|
|
||||||
|
|
||||||
// Return PEM string match request
|
// Return PEM string match request
|
||||||
let certificate = match self
|
let certificate = match self
|
||||||
.profile
|
.profile
|
||||||
@ -430,7 +431,7 @@ impl Page {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Listen for connection status updates
|
// Listen for connection status updates
|
||||||
client.socket.connect_event({
|
self.client.gemini.socket.connect_event({
|
||||||
let id = id.clone();
|
let id = id.clone();
|
||||||
let meta = meta.clone();
|
let meta = meta.clone();
|
||||||
let update = update.clone();
|
let update = update.clone();
|
||||||
@ -462,7 +463,7 @@ impl Page {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Create connection
|
// Create connection
|
||||||
client.request_async(
|
self.client.gemini.request_async(
|
||||||
uri.clone(),
|
uri.clone(),
|
||||||
None,
|
None,
|
||||||
Some(cancellable.clone()),
|
Some(cancellable.clone()),
|
||||||
|
14
src/app/browser/window/tab/item/page/client.rs
Normal file
14
src/app/browser/window/tab/item/page/client.rs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
pub struct Client {
|
||||||
|
pub gemini: gemini::Client,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Client {
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
/// Create new `Self`
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
gemini: gemini::Client::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user