draft close all tabs actions

This commit is contained in:
yggverse 2024-09-23 16:03:39 +03:00
parent 91ad71033a
commit 6801cc6a05
4 changed files with 34 additions and 1 deletions

View file

@ -13,6 +13,7 @@ impl Menu {
let model_tab_close = gio::Menu::new(); let model_tab_close = gio::Menu::new();
model_tab_close.append(Some("Current"), Some("win.tab_close")); model_tab_close.append(Some("Current"), Some("win.tab_close"));
model_tab_close.append(Some("All"), Some("win.tab_close_all"));
model_tab.append_submenu(Some("Close"), &model_tab_close); model_tab.append_submenu(Some("Close"), &model_tab_close);
let model = gio::Menu::new(); let model = gio::Menu::new();

View file

@ -29,6 +29,14 @@ impl Main {
self.tab.append(true); self.tab.append(true);
} }
pub fn tab_close(&self) {
self.tab.close();
}
pub fn tab_close_all(&self) {
self.tab.close();
}
pub fn tab_pin(&self) { pub fn tab_pin(&self) {
self.tab.pin(); self.tab.pin();
} }

View file

@ -25,8 +25,16 @@ impl Tab {
) )
} }
pub fn close(&self) {
todo!()
}
pub fn close_all(&self) {
todo!()
}
pub fn pin(&self) -> bool { pub fn pin(&self) -> bool {
false // @TODO todo!()
} }
// Getters // Getters

View file

@ -59,6 +59,22 @@ impl Browser {
} }
}) })
.build(), .build(),
ActionEntry::builder("tab_close")
.activate({
let main = main.clone();
move |_, _, _| {
main.tab_close();
}
})
.build(),
ActionEntry::builder("tab_close_all")
.activate({
let main = main.clone();
move |_, _, _| {
main.tab_close_all();
}
})
.build(),
ActionEntry::builder("tab_pin") ActionEntry::builder("tab_pin")
.activate({ .activate({
let main = main.clone(); let main = main.clone();