mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
rename wrapper mod to window
This commit is contained in:
parent
992ecfc0f6
commit
d5101a6465
26 changed files with 8 additions and 8 deletions
49
src/app/browser/window/tab/page/navigation/reload.rs
Normal file
49
src/app/browser/window/tab/page/navigation/reload.rs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
use gtk::{
|
||||
gio::SimpleAction,
|
||||
prelude::{ActionExt, ButtonExt, WidgetExt},
|
||||
Button,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub struct Reload {
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>,
|
||||
widget: Button,
|
||||
}
|
||||
|
||||
impl Reload {
|
||||
// Construct
|
||||
pub fn new(action_tab_page_navigation_reload: Arc<SimpleAction>) -> Self {
|
||||
// Init widget
|
||||
let widget = Button::builder()
|
||||
.icon_name("view-refresh-symbolic")
|
||||
.tooltip_text("Reload")
|
||||
.sensitive(false)
|
||||
.build();
|
||||
|
||||
// Init events
|
||||
widget.connect_clicked({
|
||||
let action_tab_page_navigation_reload = action_tab_page_navigation_reload.clone();
|
||||
move |_| {
|
||||
action_tab_page_navigation_reload.activate(None);
|
||||
}
|
||||
});
|
||||
|
||||
// Return activated struct
|
||||
Self {
|
||||
action_tab_page_navigation_reload,
|
||||
widget,
|
||||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
pub fn update(&self, is_enabled: bool) {
|
||||
self.action_tab_page_navigation_reload
|
||||
.set_enabled(is_enabled);
|
||||
self.widget.set_sensitive(is_enabled);
|
||||
}
|
||||
|
||||
// Getters
|
||||
pub fn widget(&self) -> &Button {
|
||||
&self.widget
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue