Browse Source

draft close all tabs actions

master
yggverse 2 months ago
parent
commit
6801cc6a05
  1. 1
      src/browser/header/tray/menu/model.rs
  2. 8
      src/browser/main/mod.rs
  3. 10
      src/browser/main/tab/mod.rs
  4. 16
      src/browser/mod.rs

1
src/browser/header/tray/menu/model.rs

@ -13,6 +13,7 @@ impl Menu { @@ -13,6 +13,7 @@ impl Menu {
let model_tab_close = gio::Menu::new();
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);
let model = gio::Menu::new();

8
src/browser/main/mod.rs

@ -29,6 +29,14 @@ impl Main { @@ -29,6 +29,14 @@ impl Main {
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) {
self.tab.pin();
}

10
src/browser/main/tab/mod.rs

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

16
src/browser/mod.rs

@ -59,6 +59,22 @@ impl Browser { @@ -59,6 +59,22 @@ impl Browser {
}
})
.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")
.activate({
let main = main.clone();

Loading…
Cancel
Save