connect events

This commit is contained in:
yggverse 2024-09-23 00:25:56 +03:00
parent ac5a878fdf
commit 4877e24020
2 changed files with 13 additions and 12 deletions

View File

@ -5,19 +5,11 @@ pub struct Tab {
}
impl Tab {
// Construct
pub fn new() -> Tab {
// Init widget
let widget = widget::Tab::new();
// Init events
/* @TODO
widget.connect_clicked(|this| {
this.activate_action("win.tab_append", None)
.expect("The action does not exist");
}); */
// Result
Self { widget }
Self {
widget: widget::Tab::new(),
}
}
// Getters

View File

@ -1,3 +1,5 @@
use gtk::prelude::{ButtonExt, WidgetExt};
pub struct Tab {
gtk: gtk::Button,
}
@ -5,11 +7,18 @@ pub struct Tab {
impl Tab {
// Construct
pub fn new() -> Tab {
// Init widget
let gtk = gtk::Button::builder()
.icon_name("tab-new-symbolic")
.tooltip_text("New tab")
.build();
// Init events
gtk.connect_clicked(|this| {
this.activate_action("win.tab_append", None)
.expect("The action does not exist");
});
Self { gtk }
}