diff --git a/src/lib.rs b/src/lib.rs index a47fa6e..5d37593 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,13 +25,6 @@ impl Sysbar { } } -trait Barfly { - fn new(name: &str) -> Self; - fn add_item(&mut self, label: &str, cbs: Box ()>); - fn add_quit_item(&mut self, label: &str); - fn display(&mut self); -} - #[cfg(target_os = "macos")] type PlatformFly = mac_os::MacOsBarfly; diff --git a/src/mac_os/mod.rs b/src/mac_os/mod.rs index fa3e4cc..3851ebf 100644 --- a/src/mac_os/mod.rs +++ b/src/mac_os/mod.rs @@ -24,8 +24,6 @@ extern crate objc_foundation; pub use self::cocoa::foundation::{NSAutoreleasePool, NSString}; pub use self::objc_foundation::{INSObject, NSObject}; -use super::Barfly; - pub struct MacOsBarfly { name: String, menu: *mut objc::runtime::Object, @@ -38,8 +36,8 @@ impl Drop for MacOsBarfly { } } -impl Barfly for MacOsBarfly { - fn new(name: &str) -> Self { +impl MacOsBarfly { + pub fn new(name: &str) -> Self { unsafe { let pool = NSAutoreleasePool::new(nil); MacOsBarfly { @@ -50,7 +48,7 @@ impl Barfly for MacOsBarfly { } } - fn add_item(&mut self, label: &str, cbs: Box ()>) { + pub fn add_item(&mut self, label: &str, cbs: Box ()>) { unsafe { let cb_obj = Callback::from(cbs); @@ -70,7 +68,7 @@ impl Barfly for MacOsBarfly { } // TODO: allow user callback - fn add_quit_item(&mut self, label: &str) { + pub fn add_quit_item(&mut self, label: &str) { unsafe { let no_key = NSString::alloc(nil).init_str(""); let pref_item = NSString::alloc(nil).init_str(label); @@ -85,7 +83,7 @@ impl Barfly for MacOsBarfly { } } - fn display(&mut self) { + pub fn display(&mut self) { unsafe { let app = NSApp(); app.activateIgnoringOtherApps_(YES);