rename base to home

This commit is contained in:
yggverse 2024-11-01 03:14:11 +02:00
parent 313122e5c3
commit 532ed65ed8
12 changed files with 61 additions and 67 deletions

View file

@ -0,0 +1,43 @@
use gtk::{
gio::SimpleAction,
prelude::{ActionExt, ButtonExt, WidgetExt},
Button,
};
use std::sync::Arc;
pub struct Widget {
gobject: Button,
}
impl Widget {
// Construct
pub fn new_arc(action_page_home: SimpleAction) -> Arc<Self> {
// Init gobject
let gobject = Button::builder()
.icon_name("go-home-symbolic")
.tooltip_text("Home")
.sensitive(false)
.build();
// Init events
gobject.connect_clicked({
let action_page_home = action_page_home.clone();
move |_| {
action_page_home.activate(None);
}
});
// Return activated struct
Arc::new(Self { gobject })
}
// Actions
pub fn update(&self, is_sensitive: bool) {
self.gobject.set_sensitive(is_sensitive);
}
// Getters
pub fn gobject(&self) -> &Button {
&self.gobject
}
}