mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
use modern (2018) pattern for modules
This commit is contained in:
parent
1627902b8f
commit
cdc3fe3388
28 changed files with 0 additions and 0 deletions
|
|
@ -1,71 +0,0 @@
|
|||
mod tab;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use tab::Tab;
|
||||
|
||||
use gtk::{glib::GString, prelude::BoxExt, Box, Orientation};
|
||||
|
||||
pub struct Main {
|
||||
tab: Arc<Tab>,
|
||||
widget: Box,
|
||||
}
|
||||
|
||||
impl Main {
|
||||
// Construct
|
||||
pub fn new() -> Self {
|
||||
// Init components
|
||||
let tab = Arc::new(Tab::new());
|
||||
|
||||
tab.activate(tab.clone());
|
||||
|
||||
// Append demo tab @TODO
|
||||
tab.append(Some(GString::from("gemini://geminiprotocol.net/")), true);
|
||||
|
||||
// Extras
|
||||
let widget = Box::builder().orientation(Orientation::Vertical).build();
|
||||
|
||||
widget.append(tab.widget());
|
||||
|
||||
// Init struct
|
||||
Self { tab, widget }
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn tab_append(&self, tab_page_navigation_request_text: Option<GString>) {
|
||||
self.tab.append(tab_page_navigation_request_text, true);
|
||||
}
|
||||
|
||||
pub fn tab_page_reload(&self) {
|
||||
self.tab.page_reload();
|
||||
}
|
||||
|
||||
pub fn tab_close(&self) {
|
||||
self.tab.close();
|
||||
}
|
||||
|
||||
pub fn tab_close_all(&self) {
|
||||
self.tab.close_all();
|
||||
}
|
||||
|
||||
pub fn tab_pin(&self) {
|
||||
self.tab.pin();
|
||||
}
|
||||
|
||||
pub fn update(&self) {
|
||||
self.tab.update();
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn tab_page_title(&self) -> Option<GString> {
|
||||
self.tab.page_title()
|
||||
}
|
||||
|
||||
pub fn tab_page_description(&self) -> Option<GString> {
|
||||
self.tab.page_description()
|
||||
}
|
||||
|
||||
pub fn widget(&self) -> &Box {
|
||||
&self.widget
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue