mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
25 lines
653 B
Rust
25 lines
653 B
Rust
use super::WindowAction;
|
|
use gtk::{Align, Button, prelude::ButtonExt};
|
|
use std::rc::Rc;
|
|
|
|
pub trait Append {
|
|
fn append(window_action: &Rc<WindowAction>) -> Self;
|
|
}
|
|
|
|
impl Append for Button {
|
|
fn append(window_action: &Rc<WindowAction>) -> Self {
|
|
let button = Button::builder()
|
|
.icon_name("tab-new-symbolic")
|
|
.css_classes(["flat"])
|
|
.valign(Align::Center)
|
|
.tooltip_text("New tab")
|
|
.build();
|
|
|
|
button.connect_clicked({
|
|
let window_action = window_action.clone();
|
|
move |_| window_action.append.activate_default_once()
|
|
});
|
|
|
|
button
|
|
}
|
|
}
|