mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
draft header update on page reload
This commit is contained in:
parent
8977adab77
commit
ca74a29ffa
6 changed files with 72 additions and 10 deletions
|
|
@ -2,7 +2,7 @@ mod tab;
|
|||
|
||||
use tab::Tab;
|
||||
|
||||
use gtk::{prelude::BoxExt, Box, Orientation};
|
||||
use gtk::{glib::GString, prelude::BoxExt, Box, Orientation};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Main {
|
||||
|
|
@ -51,6 +51,14 @@ impl Main {
|
|||
}
|
||||
|
||||
// Getters
|
||||
pub fn tab_page_title(&self) -> GString {
|
||||
self.tab.page_title()
|
||||
}
|
||||
|
||||
pub fn tab_page_description(&self) -> GString {
|
||||
self.tab.page_description()
|
||||
}
|
||||
|
||||
pub fn widget(&self) -> &Box {
|
||||
&self.widget
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,6 +155,40 @@ impl Tab {
|
|||
}
|
||||
|
||||
// Getters
|
||||
pub fn page_title(&self) -> GString {
|
||||
// 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 page by widget ID
|
||||
if let Some(page) = self.pages.borrow().get(id) {
|
||||
return page.title();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GString::new() // @TODO
|
||||
}
|
||||
|
||||
pub fn page_description(&self) -> GString {
|
||||
// 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 page by widget ID
|
||||
if let Some(page) = self.pages.borrow().get(id) {
|
||||
return page.description();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GString::new() // @TODO
|
||||
}
|
||||
|
||||
pub fn widget(&self) -> &Notebook {
|
||||
self.widget.as_ref()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue