mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
update label text on page reload
This commit is contained in:
parent
10374b1b08
commit
9e5ec86222
@ -41,8 +41,8 @@ impl Label {
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self) {
|
||||
// @TODO
|
||||
pub fn update(&self, title: &GString) {
|
||||
self.title.update(title);
|
||||
}
|
||||
|
||||
// Setters
|
||||
|
@ -1,4 +1,4 @@
|
||||
use gtk::{pango::EllipsizeMode, Label};
|
||||
use gtk::{glib::GString, pango::EllipsizeMode, Label};
|
||||
|
||||
pub struct Title {
|
||||
widget: Label,
|
||||
@ -17,6 +17,11 @@ impl Title {
|
||||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, title: &GString) {
|
||||
self.widget.set_text(title);
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn widget(&self) -> &Label {
|
||||
&self.widget
|
||||
|
@ -136,14 +136,14 @@ impl Tab {
|
||||
// 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();
|
||||
|
||||
// Get label by widget ID
|
||||
if let Some(label) = self.labels.borrow().get(id) {
|
||||
label.update(&page.title());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user