Skip to content

Commit

Permalink
shorten fn names
Browse files Browse the repository at this point in the history
  • Loading branch information
应元东 authored and 应元东 committed Nov 6, 2015
1 parent 6a1e095 commit 22f59c5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/cocoa_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl RetainRelease for id
}
}

pub fn ns_localized_string(key: &str) -> id
pub fn l10n_str(key: &str) -> id
{
unsafe
{
Expand Down Expand Up @@ -135,7 +135,7 @@ pub fn app_terminate()



pub fn show_notification_nsstring(title: id, msg: id, activated_fn: extern fn(&mut Object, Sel, id, id))
pub fn show_noti(title: id, msg: id, activated_fn: extern fn(&mut Object, Sel, id, id))
{
static REGISTER_DELEGATE: Once = ONCE_INIT;
REGISTER_DELEGATE.call_once(||
Expand Down
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn main()
unsafe{NSAutoreleasePool::new(nil)};

request_accessiblility();
begin_check_for_update(&nsstring_to_string(ns_localized_string("check_update_url")));
begin_check_for_update(&nsstring_to_string(l10n_str("check_update_url")));

let schems = load_audio_schemes();
let pref = Pref::load(&schems);
Expand All @@ -59,7 +59,7 @@ fn main()
tickeys.set_on_keydown(Some(handle_keydown)); //handle qaz123
tickeys.start();

show_notification_nsstring(ns_localized_string("Tickeys_Running"), ns_localized_string("press_qaz123"), noti_click_callback);
show_noti(l10n_str("Tickeys_Running"), l10n_str("press_qaz123"), noti_click_callback);

//relaunch on os wakeup from sleep
register_os_wake_noti();
Expand Down Expand Up @@ -144,9 +144,9 @@ fn request_accessiblility()

let alert:id = msg_send![class("NSAlert"), new];
alert.autorelease();
let _:id = msg_send![alert, setMessageText: ns_localized_string("ax_tip")];
let _:id = msg_send![alert, addButtonWithTitle: ns_localized_string("quit")];
let _:id = msg_send![alert, addButtonWithTitle: ns_localized_string("doneWithThis")];
let _:id = msg_send![alert, setMessageText: l10n_str("ax_tip")];
let _:id = msg_send![alert, addButtonWithTitle: l10n_str("quit")];
let _:id = msg_send![alert, addButtonWithTitle: l10n_str("doneWithThis")];

let btn:i32 = msg_send![alert, runModal];
println!("request_accessiblility alert: {}", btn);
Expand Down Expand Up @@ -239,10 +239,10 @@ fn begin_check_for_update(url: &str)
{
println!("New Version Available!");

let title = ns_localized_string("newVersion");
let title = l10n_str("newVersion");
let whats_new = unsafe{NSString::alloc(nil).init_str(&format!("{} -> {}: {}",CURRENT_VERSION, ver.Version, ver.WhatsNew)).autorelease()};

show_notification_nsstring(title, whats_new, noti_click_callback)
show_noti(title, whats_new, noti_click_callback)
});

let block = & *cblock.copy();
Expand Down
2 changes: 1 addition & 1 deletion src/settings_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ pub trait SettingsDelegate
{
let s = &schemes[i];

let _: id = msg_send![popup_audio_scheme, addItemWithTitle: ns_localized_string(&s.display_name)];
let _: id = msg_send![popup_audio_scheme, addItemWithTitle: l10n_str(&s.display_name)];
if *s.name == pref.audio_scheme
{
let _:id = msg_send![popup_audio_scheme, selectItemAtIndex:i];
Expand Down

0 comments on commit 22f59c5

Please sign in to comment.