mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
update label text on page reload
This commit is contained in:
parent
10374b1b08
commit
9e5ec86222
3 changed files with 13 additions and 8 deletions
|
|
@ -41,8 +41,8 @@ impl Label {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self) {
|
pub fn update(&self, title: &GString) {
|
||||||
// @TODO
|
self.title.update(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use gtk::{pango::EllipsizeMode, Label};
|
use gtk::{glib::GString, pango::EllipsizeMode, Label};
|
||||||
|
|
||||||
pub struct Title {
|
pub struct Title {
|
||||||
widget: Label,
|
widget: Label,
|
||||||
|
|
@ -17,6 +17,11 @@ impl Title {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
pub fn update(&self, title: &GString) {
|
||||||
|
self.widget.set_text(title);
|
||||||
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
pub fn widget(&self) -> &Label {
|
pub fn widget(&self) -> &Label {
|
||||||
&self.widget
|
&self.widget
|
||||||
|
|
|
||||||
|
|
@ -136,14 +136,14 @@ impl Tab {
|
||||||
// Get widget ID
|
// Get widget ID
|
||||||
let id = &widget.widget_name();
|
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
|
// Get page by widget ID
|
||||||
if let Some(page) = self.pages.borrow().get(id) {
|
if let Some(page) = self.pages.borrow().get(id) {
|
||||||
page.update();
|
page.update();
|
||||||
|
|
||||||
|
// Get label by widget ID
|
||||||
|
if let Some(label) = self.labels.borrow().get(id) {
|
||||||
|
label.update(&page.title());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue