From bb92b5667eb43d39a162b86f0b779d06e36eca52 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Thu, 3 Aug 2023 21:48:55 +0300 Subject: [PATCH] refactor: change submenu set_as functions --- .changes/macos-window-menu.md | 5 +++++ src/items/submenu.rs | 8 ++++---- src/platform_impl/macos/mod.rs | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changes/macos-window-menu.md diff --git a/.changes/macos-window-menu.md b/.changes/macos-window-menu.md new file mode 100644 index 0000000..4c463ad --- /dev/null +++ b/.changes/macos-window-menu.md @@ -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` diff --git a/src/items/submenu.rs b/src/items/submenu.rs index 209994d..ba60c5e 100644 --- a/src/items/submenu.rs +++ b/src/items/submenu.rs @@ -126,8 +126,8 @@ impl Submenu { /// This will cause macOS to automatically add window-switching items and /// certain other items to the menu. #[cfg(target_os = "macos")] - pub fn set_windows_menu_for_nsapp(&self) { - self.0.borrow_mut().set_windows_menu_for_nsapp() + pub fn set_as_windows_menu_for_nsapp(&self) { + self.0.borrow_mut().set_as_windows_menu_for_nsapp() } /// 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 /// which has a title matching the localized word "Help". #[cfg(target_os = "macos")] - pub fn set_help_menu_for_nsapp(&self) { - self.0.borrow_mut().set_help_menu_for_nsapp() + pub fn set_as_help_menu_for_nsapp(&self) { + self.0.borrow_mut().set_as_help_menu_for_nsapp() } } diff --git a/src/platform_impl/macos/mod.rs b/src/platform_impl/macos/mod.rs index fac7348..c0df7c6 100644 --- a/src/platform_impl/macos/mod.rs +++ b/src/platform_impl/macos/mod.rs @@ -541,11 +541,11 @@ impl MenuChild { 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) } } - 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] } }