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 { impl Tab {
// Construct
pub fn new() -> Tab { pub fn new() -> Tab {
// Init widget Self {
let widget = widget::Tab::new(); 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 }
} }
// Getters // Getters

View file

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