mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
init update action
This commit is contained in:
parent
68a97fdc88
commit
ae3cc7a7d5
14 changed files with 91 additions and 27 deletions
|
|
@ -12,7 +12,7 @@ pub struct Main {
|
|||
|
||||
impl Main {
|
||||
// Construct
|
||||
pub fn new() -> Main {
|
||||
pub fn new() -> Arc<Main> {
|
||||
// Init components
|
||||
let tab = Tab::new();
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ impl Main {
|
|||
widget.append(tab.widget());
|
||||
|
||||
// Init struct
|
||||
Self { tab, widget }
|
||||
Arc::new(Self { tab, widget })
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
|
@ -42,6 +42,10 @@ impl Main {
|
|||
self.tab.pin();
|
||||
}
|
||||
|
||||
pub fn update(&self) {
|
||||
self.tab.update();
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn widget(&self) -> &Box {
|
||||
&self.widget
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ impl Label {
|
|||
Self { pin, title, widget }
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self) {
|
||||
// @TODO
|
||||
}
|
||||
|
||||
// Setters
|
||||
pub fn pin(&self, is_pinned: bool) {
|
||||
self.pin.widget().set_visible(is_pinned);
|
||||
|
|
|
|||
|
|
@ -120,6 +120,27 @@ impl Tab {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn update(&self) {
|
||||
// Get current page
|
||||
if let Some(page_number) = self.widget.current_page() {
|
||||
// Get default widget to extract it name as the ID for childs
|
||||
if let Some(widget) = self.widget.nth_page(Some(page_number)) {
|
||||
// Get widget ID
|
||||
let id = &widget.widget_name();
|
||||
|
||||
// Get label by widget ID
|
||||
if let Some(label) = self.labels.borrow().get(id) {
|
||||
label.update();
|
||||
}
|
||||
|
||||
// Get page by widget ID
|
||||
if let Some(page) = self.pages.borrow().get(id) {
|
||||
page.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn widget(&self) -> &Notebook {
|
||||
self.widget.as_ref()
|
||||
|
|
|
|||
|
|
@ -1,17 +1,23 @@
|
|||
mod content;
|
||||
mod navigation;
|
||||
|
||||
use content::Content;
|
||||
use navigation::Navigation;
|
||||
|
||||
use gtk::{glib::GString, prelude::BoxExt, Box, Orientation};
|
||||
|
||||
pub struct Page {
|
||||
widget: Box,
|
||||
navigation: Navigation,
|
||||
content: Content,
|
||||
}
|
||||
|
||||
impl Page {
|
||||
// Construct
|
||||
pub fn new(name: GString) -> Page {
|
||||
// Init components
|
||||
let navigation = navigation::Navigation::new();
|
||||
let content = content::Content::new();
|
||||
let content = Content::new();
|
||||
let navigation = Navigation::new();
|
||||
|
||||
// Init widget
|
||||
let widget = Box::builder()
|
||||
|
|
@ -23,7 +29,17 @@ impl Page {
|
|||
widget.append(content.widget());
|
||||
|
||||
// Result
|
||||
Self { widget }
|
||||
Self {
|
||||
widget,
|
||||
content,
|
||||
navigation,
|
||||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self) {
|
||||
self.navigation.update();
|
||||
// @TODO self.content.update();
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ impl Base {
|
|||
|
||||
// Actions
|
||||
pub fn update(&self) {
|
||||
todo!()
|
||||
// @TODO
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ impl Bookmark {
|
|||
|
||||
// Actions
|
||||
pub fn update(&self) {
|
||||
todo!()
|
||||
// @TODO
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ impl Back {
|
|||
|
||||
// Actions
|
||||
pub fn update(&self) {
|
||||
todo!()
|
||||
// @TODO
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ impl Forward {
|
|||
|
||||
// Actions
|
||||
pub fn update(&self) {
|
||||
todo!()
|
||||
// @TODO
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ impl Navigation {
|
|||
widget.append(request.widget());
|
||||
widget.append(bookmark.widget());
|
||||
|
||||
// Connect events
|
||||
// request.widget().connect_changed({ |_, _, _| {} });
|
||||
|
||||
// Result
|
||||
Self {
|
||||
widget,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ impl Reload {
|
|||
|
||||
// Actions
|
||||
pub fn update(&self) {
|
||||
todo!()
|
||||
// @TODO
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ impl Request {
|
|||
|
||||
// Actions
|
||||
pub fn update(&self) {
|
||||
todo!()
|
||||
// @TODO
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue