mirror of https://github.com/BOINC/boinc.git
Mac: More thorough error checking and recovery
svn path=/trunk/boinc/; revision=23043
This commit is contained in:
parent
07982df97a
commit
754b7e6f4e
|
@ -273,7 +273,7 @@ David 25 Jan 2011
|
|||
edit_email_action.php
|
||||
|
||||
Charlie 27 Jan 2011
|
||||
Mac: update Mac_SA_Insecure.sh script to not require BOIN Client in
|
||||
Mac: update Mac_SA_Insecure.sh script to not require BOINC Client in
|
||||
BOINC Data folder.
|
||||
|
||||
mac_build/
|
||||
|
@ -805,3 +805,10 @@ David 15 Feb 2011
|
|||
|
||||
py/Boinc/
|
||||
tools.py
|
||||
|
||||
Charlie 16 Feb 2011
|
||||
Mac: More thorough error checking and recovery in code which localizes
|
||||
items in Mac's BOINC menu.
|
||||
|
||||
mac/
|
||||
Mac_GUI.cpp
|
||||
|
|
|
@ -74,7 +74,8 @@ Boolean Mac_Authorize()
|
|||
void MacLocalizeBOINCMenu() {
|
||||
MenuRef BOINCMenu;
|
||||
MenuItemIndex itemIndex;
|
||||
wxString originalText;
|
||||
wxString originalText = wxEmptyString;
|
||||
char originalCharStr[1024];
|
||||
CFStringRef localizedText;
|
||||
CFStringRef menuItemString;
|
||||
OSStatus err;
|
||||
|
@ -82,46 +83,88 @@ void MacLocalizeBOINCMenu() {
|
|||
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
|
||||
wxASSERT(pSkinAdvanced);
|
||||
|
||||
GetIndMenuItemWithCommandID(NULL, kHICommandAbout, 1, &BOINCMenu, &itemIndex);
|
||||
originalText.Printf(_("About %s"), pSkinAdvanced->GetApplicationShortName().c_str());
|
||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
|
||||
GetIndMenuItemWithCommandID(NULL, kHICommandPreferences, 1, &BOINCMenu, &itemIndex);
|
||||
originalText = _("Preferences…");
|
||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
|
||||
const wxChar *shortName = pSkinAdvanced->GetApplicationShortName().c_str();
|
||||
if (!shortName) return; // Should never happen
|
||||
|
||||
err = GetIndMenuItemWithCommandID(NULL, kHICommandAbout, 1, &BOINCMenu, &itemIndex);
|
||||
if (!err) {
|
||||
originalText.Printf(_("About %s"), shortName);
|
||||
strlcpy(originalCharStr, originalText.utf8_str(), sizeof(originalCharStr));
|
||||
if (originalCharStr[0]) {
|
||||
localizedText = CFStringCreateWithCString(NULL, originalCharStr, kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
}
|
||||
}
|
||||
|
||||
originalText.Clear();
|
||||
err = GetIndMenuItemWithCommandID(NULL, kHICommandPreferences, 1, &BOINCMenu, &itemIndex);
|
||||
if (!err) {
|
||||
originalText = _("Preferences…");
|
||||
strlcpy(originalCharStr, originalText.utf8_str(), sizeof(originalCharStr));
|
||||
if (originalCharStr[0]) {
|
||||
localizedText = CFStringCreateWithCString(NULL, originalCharStr, kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
}
|
||||
}
|
||||
|
||||
originalText.Clear();
|
||||
originalText = _("Services");
|
||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
||||
count = CountMenuItems(BOINCMenu);
|
||||
for (itemIndex=1; itemIndex<=count; ++itemIndex) {
|
||||
err = CopyMenuItemTextAsCFString(BOINCMenu, itemIndex, &menuItemString);
|
||||
if (err == noErr) {
|
||||
if (CFStringCompare(menuItemString, CFSTR("Services"), 0) == kCFCompareEqualTo) {
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
break;
|
||||
strlcpy(originalCharStr, originalText.utf8_str(), sizeof(originalCharStr));
|
||||
if (originalCharStr[0]) {
|
||||
localizedText = CFStringCreateWithCString(NULL, originalCharStr, kCFStringEncodingUTF8);
|
||||
count = CountMenuItems(BOINCMenu);
|
||||
for (itemIndex=1; itemIndex<=count; ++itemIndex) {
|
||||
err = CopyMenuItemTextAsCFString(BOINCMenu, itemIndex, &menuItemString);
|
||||
if (err == noErr) {
|
||||
if (CFStringCompare(menuItemString, CFSTR("Services"), 0) == kCFCompareEqualTo) {
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
originalText.Clear();
|
||||
err = GetIndMenuItemWithCommandID(NULL, kHICommandHide, 1, &BOINCMenu, &itemIndex);
|
||||
if (!err) {
|
||||
originalText.Printf(_("Hide %s"), shortName);
|
||||
strlcpy(originalCharStr, originalText.utf8_str(), sizeof(originalCharStr));
|
||||
if (originalCharStr[0]) {
|
||||
localizedText = CFStringCreateWithCString(NULL, originalCharStr, kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
}
|
||||
}
|
||||
|
||||
GetIndMenuItemWithCommandID(NULL, kHICommandHide, 1, &BOINCMenu, &itemIndex);
|
||||
originalText.Printf(_("Hide %s"), pSkinAdvanced->GetApplicationShortName().c_str());
|
||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
|
||||
GetIndMenuItemWithCommandID(NULL, kHICommandHideOthers, 1, &BOINCMenu, &itemIndex);
|
||||
originalText = _("Hide Others");
|
||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
|
||||
GetIndMenuItemWithCommandID(NULL, kHICommandShowAll, 1, &BOINCMenu, &itemIndex);
|
||||
originalText = _("Show All");
|
||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
|
||||
GetIndMenuItemWithCommandID(NULL, kHICommandQuit, 1, &BOINCMenu, &itemIndex);
|
||||
originalText.Printf(_("Quit %s"), pSkinAdvanced->GetApplicationShortName().c_str());
|
||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
originalText.Clear();
|
||||
err = GetIndMenuItemWithCommandID(NULL, kHICommandHideOthers, 1, &BOINCMenu, &itemIndex);
|
||||
if (!err) {
|
||||
originalText = _("Hide Others");
|
||||
strlcpy(originalCharStr, originalText.utf8_str(), sizeof(originalCharStr));
|
||||
if (originalCharStr[0]) {
|
||||
localizedText = CFStringCreateWithCString(NULL, originalCharStr, kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
}
|
||||
}
|
||||
|
||||
originalText.Clear();
|
||||
err = GetIndMenuItemWithCommandID(NULL, kHICommandShowAll, 1, &BOINCMenu, &itemIndex);
|
||||
if (!err) {
|
||||
originalText = _("Show All");
|
||||
strlcpy(originalCharStr, originalText.utf8_str(), sizeof(originalCharStr));
|
||||
if (originalCharStr[0]) {
|
||||
localizedText = CFStringCreateWithCString(NULL, originalCharStr, kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
}
|
||||
}
|
||||
|
||||
originalText.Clear();
|
||||
err = GetIndMenuItemWithCommandID(NULL, kHICommandQuit, 1, &BOINCMenu, &itemIndex);
|
||||
if (!err) {
|
||||
originalText.Printf(_("Quit %s"), shortName);
|
||||
strlcpy(originalCharStr, originalText.utf8_str(), sizeof(originalCharStr));
|
||||
if (originalCharStr[0]) {
|
||||
localizedText = CFStringCreateWithCString(NULL, originalCharStr, kCFStringEncodingUTF8);
|
||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue