Skip to content

Commit

Permalink
more lints
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Aug 30, 2023
1 parent 1bb0934 commit cc1cce0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions core/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2104,7 +2104,7 @@ impl<T: UserEvent> Runtime<T> for Wry<T> {
TrayContext {
tray: Rc::new(Mutex::new(Some(tray))),
listeners: Rc::new(RefCell::new(listeners)),
items: Arc::new(Mutex::new(items)),
items: Rc::new(RefCell::new(items)),
},
);

Expand Down Expand Up @@ -2655,7 +2655,7 @@ fn handle_user_message<T: UserEvent>(
TrayContext {
tray: Rc::new(Mutex::new(Some(tray))),
listeners: Rc::new(RefCell::new(listeners)),
items: Arc::new(Mutex::new(items)),
items: Rc::new(RefCell::new(items)),
},
);

Expand All @@ -2669,7 +2669,7 @@ fn handle_user_message<T: UserEvent>(
} else if let Some(tray_context) = trays.get(&tray_id) {
match tray_message {
TrayMessage::UpdateItem(menu_id, update) => {
let mut tray = tray_context.items.as_ref().lock().unwrap();
let mut tray = tray_context.items.as_ref().borrow_mut();
let item = tray.get_mut(&menu_id).expect("menu item not found");
match update {
MenuUpdate::SetEnabled(enabled) => item.set_enabled(enabled),
Expand All @@ -2685,7 +2685,7 @@ fn handle_user_message<T: UserEvent>(
if let Some(tray) = &mut *tray_context.tray.lock().unwrap() {
let mut items = HashMap::new();
tray.set_menu(&to_wry_context_menu(&mut items, menu));
*tray_context.items.lock().unwrap() = items;
*tray_context.items.borrow_mut() = items;
}
}
TrayMessage::UpdateIcon(icon) => {
Expand Down Expand Up @@ -2718,7 +2718,7 @@ fn handle_user_message<T: UserEvent>(
TrayMessage::Destroy(tx) => {
*tray_context.tray.lock().unwrap() = None;
tray_context.listeners.borrow_mut().clear();
tray_context.items.lock().unwrap().clear();
tray_context.items.borrow_mut().clear();
tx.send(Ok(())).unwrap();
}
}
Expand Down Expand Up @@ -2844,7 +2844,7 @@ fn handle_event_loop<T: UserEvent>(
let (mut listeners, mut tray_id) = (None, 0);
for (id, tray_context) in trays_iter {
let has_menu = {
let items = tray_context.items.lock().unwrap();
let items = tray_context.items.borrow();
items.contains_key(&menu_id.0)
};
if has_menu {
Expand Down
2 changes: 1 addition & 1 deletion core/tauri-runtime-wry/src/system_tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub type GlobalSystemTrayEventListeners = Arc<Mutex<Vec<Arc<GlobalSystemTrayEven

pub type SystemTrayEventHandler = Box<dyn Fn(&SystemTrayEvent) + Send>;
pub type SystemTrayEventListeners = Rc<RefCell<Vec<Rc<SystemTrayEventHandler>>>>;
pub type SystemTrayItems = Arc<Mutex<HashMap<u16, WryCustomMenuItem>>>;
pub type SystemTrayItems = Rc<RefCell<HashMap<u16, WryCustomMenuItem>>>;

#[derive(Clone, Default)]
pub struct TrayContext {
Expand Down

0 comments on commit cc1cce0

Please sign in to comment.