create parental app mod

This commit is contained in:
yggverse 2024-10-02 02:14:00 +03:00
parent 2461f2a0fb
commit b2aa3af46a
37 changed files with 176 additions and 111 deletions

View file

@ -0,0 +1,30 @@
use gtk::{gio::SimpleAction, prelude::ActionExt, prelude::ButtonExt, Button};
use std::sync::Arc;
pub struct Tab {
pub widget: Button,
}
impl Tab {
// Construct
pub fn new(action_tab_append: Arc<SimpleAction>) -> Self {
// Init widget
let widget = Button::builder()
.icon_name("tab-new-symbolic")
.tooltip_text("New tab")
.build();
// Init events
widget.connect_clicked(move |_| {
action_tab_append.activate(None);
});
// Return activated struct
Self { widget }
}
// Getters
pub fn widget(&self) -> &Button {
&self.widget
}
}