refactor: change submenu set_as functions

This commit is contained in:
Amr Bashir 2023-08-03 21:48:55 +03:00
parent 48472232fe
commit bb92b5667e
No known key found for this signature in database
GPG key ID: BBD7A47A2003FF33
3 changed files with 11 additions and 6 deletions

View file

@ -0,0 +1,5 @@
---
"muda": "minor"
---
On macOS, changed `Submenu::set_windows_menu_for_nsapp` and `Submenu::set_help_menu_for_nsapp` to `Submenu::set_as_windows_menu_for_nsapp` and `Submenu::set_as_help_menu_for_nsapp`

View file

@ -126,8 +126,8 @@ impl Submenu {
/// This will cause macOS to automatically add window-switching items and /// This will cause macOS to automatically add window-switching items and
/// certain other items to the menu. /// certain other items to the menu.
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
pub fn set_windows_menu_for_nsapp(&self) { pub fn set_as_windows_menu_for_nsapp(&self) {
self.0.borrow_mut().set_windows_menu_for_nsapp() self.0.borrow_mut().set_as_windows_menu_for_nsapp()
} }
/// Set this submenu as the Help menu for the application on macOS. /// Set this submenu as the Help menu for the application on macOS.
@ -137,8 +137,8 @@ impl Submenu {
/// If no menu is set as the Help menu, macOS will automatically use any menu /// If no menu is set as the Help menu, macOS will automatically use any menu
/// which has a title matching the localized word "Help". /// which has a title matching the localized word "Help".
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
pub fn set_help_menu_for_nsapp(&self) { pub fn set_as_help_menu_for_nsapp(&self) {
self.0.borrow_mut().set_help_menu_for_nsapp() self.0.borrow_mut().set_as_help_menu_for_nsapp()
} }
} }

View file

@ -541,11 +541,11 @@ impl MenuChild {
show_context_menu(self.ns_menu.1, view, position) show_context_menu(self.ns_menu.1, view, position)
} }
pub fn set_windows_menu_for_nsapp(&self) { pub fn set_as_windows_menu_for_nsapp(&self) {
unsafe { NSApp().setWindowsMenu_(self.ns_menu.1) } unsafe { NSApp().setWindowsMenu_(self.ns_menu.1) }
} }
pub fn set_help_menu_for_nsapp(&self) { pub fn set_as_help_menu_for_nsapp(&self) {
unsafe { msg_send![NSApp(), setHelpMenu: self.ns_menu.1] } unsafe { msg_send![NSApp(), setHelpMenu: self.ns_menu.1] }
} }