fix(status-area): update existing menu if a duplicate is registered
This commit is contained in:
parent
bfdf378a43
commit
3a39874291
1 changed files with 9 additions and 0 deletions
|
|
@ -108,6 +108,15 @@ impl cosmic::Application for App {
|
|||
}
|
||||
status_notifier_watcher::Event::Registered(name) => {
|
||||
let (state, cmd) = status_menu::State::new(name);
|
||||
if let Some((id, m)) = self
|
||||
.menus
|
||||
.iter_mut()
|
||||
.find(|(_, prev_state)| prev_state.name() == state.name())
|
||||
{
|
||||
*m = state;
|
||||
let id = *id;
|
||||
return cmd.map(move |msg| app::message::app(Msg::StatusMenu((id, msg))));
|
||||
}
|
||||
let id = self.next_menu_id();
|
||||
self.menus.insert(id, state);
|
||||
Command::batch([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue