create separated wrapper for pin action

This commit is contained in:
yggverse 2024-11-10 10:07:16 +02:00
parent e47c22ac92
commit 33b22ca30a
11 changed files with 152 additions and 54 deletions

View file

@ -33,7 +33,6 @@ impl Window {
action_page_history_back: SimpleAction,
action_page_history_forward: SimpleAction,
action_page_reload: SimpleAction,
action_page_pin: SimpleAction,
) -> Self {
// Init local actions
let action = Rc::new(Action::new());
@ -47,7 +46,6 @@ impl Window {
action_page_home.clone(),
action_page_history_back.clone(),
action_page_history_forward.clone(),
action_page_pin.clone(),
action_page_reload.clone(),
);
@ -61,7 +59,6 @@ impl Window {
action_page_history_back,
action_page_history_forward,
action_page_reload,
action_page_pin,
// Widgets
tab.gobject(),
);
@ -77,6 +74,11 @@ impl Window {
}
});
action.pin().connect_activate({
let tab = tab.clone();
move |page_position| tab.pin(page_position)
});
// Init struct
Self {
//header,
@ -113,10 +115,6 @@ impl Window {
self.tab.close_all();
}
pub fn tab_pin(&self, page_position: Option<i32>) {
self.tab.pin(page_position);
}
pub fn update(&self, tab_item_id: Option<GString>) {
self.tab.update(tab_item_id);
}