feat: implement win.close action

merge-requests/8/head
Nefo Fortressia 2021-10-22 13:16:13 +07:00
parent 67a1f0057e
commit d38ad0627c
1 changed files with 15 additions and 4 deletions

View File

@ -9,8 +9,8 @@ pub trait MenubarImplementedEditor {
fn setup_menubar(
&self,
app: &super::EchidnaEditor,
window: gtk::ApplicationWindow,
builder: gtk::Builder,
window: &gtk::ApplicationWindow,
builder: &gtk::Builder,
);
}
@ -18,8 +18,8 @@ impl MenubarImplementedEditor for EchidnaEditor {
fn setup_menubar(
&self,
app: &super::EchidnaEditor,
window: gtk::ApplicationWindow,
builder: gtk::Builder,
window: &gtk::ApplicationWindow,
builder: &gtk::Builder,
) {
let menubuilder = gtk::Builder::from_string(include_str!("../../ui/menu.ui"));
let menubar: MenuModel = menubuilder
@ -75,6 +75,17 @@ impl MenubarImplementedEditor for EchidnaEditor {
about_dialog.set_visible(true);
});
let act_window_close = SimpleAction::new("close", None);
window.add_action(&act_window_close);
act_window_close.connect_activate(clone!(@weak window =>
move | _action, _variant | {
window.close();
}
));
let action_open_file: SimpleAction = SimpleAction::new("open-file", None);
window.add_action(&action_open_file);