mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
enshort setup menu state match
This commit is contained in:
parent
86fba1dc69
commit
ddead4e870
1 changed files with 4 additions and 7 deletions
|
|
@ -83,13 +83,10 @@ impl Tab {
|
|||
widget.gobject().connect_setup_menu({
|
||||
let window_action = window_action.clone();
|
||||
move |tab_view, tab_page| {
|
||||
// Set state
|
||||
let state = match tab_page {
|
||||
// Context menu opened
|
||||
Some(this) => Some(tab_view.page_position(this)),
|
||||
// Context menu closed (reset state to defaults)
|
||||
None => None,
|
||||
};
|
||||
// Set new state for page selected on menu open
|
||||
// * this action return default state (`None`) on menu close
|
||||
let state = tab_page.map(|this| tab_view.page_position(this));
|
||||
|
||||
// Update actions with new state value
|
||||
window_action.close_all().change_state(state);
|
||||
window_action.close().change_state(state);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue