};
// Default mode for menu bar items: blue highlight when selected
- msg_send![bar.status_bar_item, setHighlightMode:YES];
+ let _: () = msg_send![bar.status_bar_item, setHighlightMode:YES];
// Set title. Only displayed if image fails to load.
let title = NSString::alloc(nil).init_str("connectr");
NSButton::setTitle_(bar.status_bar_item, title);
- let _ = msg_send![title, release];
+ let _: () = msg_send![title, release];
// Look for icon in OS X bundle if there is one, otherwise current dir.
// See docs/icons.md for explanation of icon files.
let img = NSString::alloc(nil).init_str(&img_path);
let icon = NSImage::alloc(nil).initWithContentsOfFile_(img);
#[cfg(feature = "mac_white_icon")]
- let _ = msg_send![icon, setTemplate: YES]; // enable to make icon white
+ let _: () = msg_send![icon, setTemplate: YES]; // enable to make icon white
bar.status_bar_item.button().setImage_(icon);
- let _ = msg_send![img, release];
- let _ = msg_send![icon, release];
+ let _: () = msg_send![img, release];
+ let _: () = msg_send![icon, release];
// Add the same image again as an alternate image. I'm not sure how the
// blending is performed, but it behaves differently and better if an
// much in 'dark mode' when selected, and is too light in 'light mode'.
let img = NSString::alloc(nil).init_str(&img_path);
let icon = NSImage::alloc(nil).initWithContentsOfFile_(img);
- let _ = msg_send![bar.status_bar_item.button(), setAlternateImage: icon];
- let _ = msg_send![img, release];
- let _ = msg_send![icon, release];
+ let _: () = msg_send![bar.status_bar_item.button(), setAlternateImage: icon];
+ let _: () = msg_send![img, release];
+ let _: () = msg_send![icon, release];
bar.status_bar_item.setMenu_(bar.menu_bar);
bar.object.cb_fn = Some(Box::new(
let old_menu = self.menu_bar;
self.menu_bar = NSMenu::new(nil);
self.status_bar_item.setMenu_(self.menu_bar);
- let _ = msg_send![old_menu, removeAllItems];
- let _ = msg_send![old_menu, release];
+ let _: () = msg_send![old_menu, removeAllItems];
+ let _: () = msg_send![old_menu, release];
}
}
fn set_tooltip(&mut self, text: &str) {
unsafe {
let img = NSString::alloc(nil).init_str(text);
- let _ = msg_send![self.status_bar_item.button(), setToolTip: img];
- let _ = msg_send![img, release];
+ let _: () = msg_send![self.status_bar_item.button(), setToolTip: img];
+ let _: () = msg_send![img, release];
}
}
fn add_label(&mut self, label: &str) {
let quit_key = NSString::alloc(nil).init_str("");
let app_menu_item = NSMenuItem::alloc(nil)
.initWithTitle_action_keyEquivalent_(txt, self.object.selector(), quit_key);
- let _ = msg_send![txt, release];
- let _ = msg_send![quit_key, release];
+ let _: () = msg_send![txt, release];
+ let _: () = msg_send![quit_key, release];
self.menu_bar.addItem_(app_menu_item);
- let _ = msg_send![app_menu_item, release];
+ let _: () = msg_send![app_menu_item, release];
}
}
fn add_quit(&mut self, label: &str) {
let quit_key = NSString::alloc(nil).init_str("");
let app_menu_item = NSMenuItem::alloc(nil)
.initWithTitle_action_keyEquivalent_(txt, sel!(terminate:), quit_key);
- let _ = msg_send![txt, release];
- let _ = msg_send![quit_key, release];
+ let _: () = msg_send![txt, release];
+ let _: () = msg_send![quit_key, release];
self.menu_bar.addItem_(app_menu_item);
- let _ = msg_send![app_menu_item, release];
+ let _: () = msg_send![app_menu_item, release];
}
}
fn add_separator(&mut self) {
let quit_key = NSString::alloc(nil).init_str("");
let app_menu_item = NSMenuItem::alloc(nil)
.initWithTitle_action_keyEquivalent_(txt, self.object.selector(), quit_key);
- let _ = msg_send![txt, release];
- let _ = msg_send![quit_key, release];
+ let _: () = msg_send![txt, release];
+ let _: () = msg_send![quit_key, release];
self.object.add_callback(app_menu_item, callback);
let objc = self.object.take_objc();
let _: () = msg_send![app_menu_item, setTarget: objc];
}
let item: *mut Object = app_menu_item;
self.menu_bar.addItem_(app_menu_item);
- let _ = msg_send![app_menu_item, release];
+ let _: () = msg_send![app_menu_item, release];
item
}
}
unsafe {
let ns_label = NSString::alloc(nil).init_str(label);
let _: () = msg_send![item, setTitle: ns_label];
- let _ = msg_send![ns_label, release];
+ let _: () = msg_send![ns_label, release];
}
}
fn sel_item(&mut self, sender: u64) {
// let button = NSString::alloc(nil).init_str("ok");
// let cls = Class::get("NSAlert").unwrap();
// let alert: *mut Object = msg_send![cls, alloc];
-// let _ = msg_send![alert, init];
-// let _ = msg_send![alert, setMessageText: ns_text];
-// let _ = msg_send![alert, addButtonWithTitle: button];
-// let _ = msg_send![alert, runModal];
-// let _ = msg_send![ns_text, release];
-// let _ = msg_send![button, release];
-// let _ = msg_send![alert, release];
+// let _: () = msg_send![alert, init];
+// let _: () = msg_send![alert, setMessageText: ns_text];
+// let _: () = msg_send![alert, addButtonWithTitle: button];
+// let _: () = msg_send![alert, runModal];
+// let _: () = msg_send![ns_text, release];
+// let _: () = msg_send![button, release];
+// let _: () = msg_send![alert, release];
// }
//}
});
unsafe {
let ptr: u64 = &*rust as *const RustWrapperClass as u64;
- let _ = msg_send![rust.objc, setRustData: ptr];
+ let _:() = msg_send![rust.objc, setRustData: ptr];
}
return rust
}