Fixes #82
This commit is contained in:
parent
a1f2711ceb
commit
589ff8c789
|
@ -69,7 +69,7 @@ pub(crate) static APP_PTR: &str = "rstAppPtr";
|
||||||
|
|
||||||
/// A handler to make some boilerplate less annoying.
|
/// A handler to make some boilerplate less annoying.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn shared_application<T, F: Fn(id) -> T>(handler: F) -> T {
|
pub(crate) fn shared_application<T, F: Fn(id) -> T>(handler: F) -> T {
|
||||||
let app: id = unsafe { msg_send![register_app_class(), sharedApplication] };
|
let app: id = unsafe { msg_send![register_app_class(), sharedApplication] };
|
||||||
handler(app)
|
handler(app)
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ impl<T> App<T> {
|
||||||
pub fn run(&self) {
|
pub fn run(&self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
//let current_app: id = msg_send![class!(NSRunningApplication), currentApplication];
|
//let current_app: id = msg_send![class!(NSRunningApplication), currentApplication];
|
||||||
let shared_app: id = msg_send![class!(RSTApplication), sharedApplication];
|
let shared_app: id = msg_send![register_app_class(), sharedApplication];
|
||||||
let _: () = msg_send![shared_app, run];
|
let _: () = msg_send![shared_app, run];
|
||||||
self.pool.drain();
|
self.pool.drain();
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,8 +165,12 @@ impl MenuItem {
|
||||||
// supported by MenuItem yet.
|
// supported by MenuItem yet.
|
||||||
Self::Services => {
|
Self::Services => {
|
||||||
let item = make_menu_item("Services", None, None, None);
|
let item = make_menu_item("Services", None, None, None);
|
||||||
let app: id = msg_send![class!(RSTApplication), sharedApplication];
|
|
||||||
let services: id = msg_send![app, servicesMenu];
|
let services = crate::appkit::app::shared_application(|app| {
|
||||||
|
let services: id = msg_send![app, servicesMenu];
|
||||||
|
services
|
||||||
|
});
|
||||||
|
|
||||||
let _: () = msg_send![&*item, setSubmenu: services];
|
let _: () = msg_send![&*item, setSubmenu: services];
|
||||||
item
|
item
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue