mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
implement base button sensitivity update
This commit is contained in:
parent
58d5c96f26
commit
98f88c5464
@ -65,7 +65,7 @@ impl Navigation {
|
|||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self) {
|
pub fn update(&self) {
|
||||||
self.base.update();
|
self.base.update(self.request.uri());
|
||||||
self.history.update();
|
self.history.update();
|
||||||
self.reload.update(!self.request.is_empty());
|
self.reload.update(!self.request.is_empty());
|
||||||
self.request.update();
|
self.request.update();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use gtk::Button;
|
use gtk::{glib::Uri, prelude::WidgetExt, Button};
|
||||||
|
|
||||||
pub struct Base {
|
pub struct Base {
|
||||||
widget: Button,
|
widget: Button,
|
||||||
@ -18,8 +18,11 @@ impl Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self) {
|
pub fn update(&self, uri: Option<Uri>) {
|
||||||
// @TODO
|
self.widget.set_sensitive(match uri {
|
||||||
|
Some(uri) => "/" != uri.path(),
|
||||||
|
None => false,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use gtk::{
|
use gtk::{
|
||||||
glib::GString,
|
glib::{GString, Uri, UriFlags},
|
||||||
prelude::{EditableExt, EntryExt, WidgetExt},
|
prelude::{EditableExt, EntryExt, WidgetExt},
|
||||||
Entry,
|
Entry,
|
||||||
};
|
};
|
||||||
@ -66,4 +66,11 @@ impl Request {
|
|||||||
pub fn text(&self) -> GString {
|
pub fn text(&self) -> GString {
|
||||||
self.widget.text()
|
self.widget.text()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn uri(&self) -> Option<Uri> {
|
||||||
|
match Uri::parse(&self.widget.text(), UriFlags::NONE) {
|
||||||
|
Ok(uri) => Some(uri),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user