mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
enshort setup menu state match
This commit is contained in:
parent
86fba1dc69
commit
ddead4e870
@ -83,13 +83,10 @@ impl Tab {
|
|||||||
widget.gobject().connect_setup_menu({
|
widget.gobject().connect_setup_menu({
|
||||||
let window_action = window_action.clone();
|
let window_action = window_action.clone();
|
||||||
move |tab_view, tab_page| {
|
move |tab_view, tab_page| {
|
||||||
// Set state
|
// Set new state for page selected on menu open
|
||||||
let state = match tab_page {
|
// * this action return default state (`None`) on menu close
|
||||||
// Context menu opened
|
let state = tab_page.map(|this| tab_view.page_position(this));
|
||||||
Some(this) => Some(tab_view.page_position(this)),
|
|
||||||
// Context menu closed (reset state to defaults)
|
|
||||||
None => None,
|
|
||||||
};
|
|
||||||
// Update actions with new state value
|
// Update actions with new state value
|
||||||
window_action.close_all().change_state(state);
|
window_action.close_all().change_state(state);
|
||||||
window_action.close().change_state(state);
|
window_action.close().change_state(state);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user