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
|
edit_email_action.php
|
||||||
|
|
||||||
Charlie 27 Jan 2011
|
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.
|
BOINC Data folder.
|
||||||
|
|
||||||
mac_build/
|
mac_build/
|
||||||
|
@ -805,3 +805,10 @@ David 15 Feb 2011
|
||||||
|
|
||||||
py/Boinc/
|
py/Boinc/
|
||||||
tools.py
|
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() {
|
void MacLocalizeBOINCMenu() {
|
||||||
MenuRef BOINCMenu;
|
MenuRef BOINCMenu;
|
||||||
MenuItemIndex itemIndex;
|
MenuItemIndex itemIndex;
|
||||||
wxString originalText;
|
wxString originalText = wxEmptyString;
|
||||||
|
char originalCharStr[1024];
|
||||||
CFStringRef localizedText;
|
CFStringRef localizedText;
|
||||||
CFStringRef menuItemString;
|
CFStringRef menuItemString;
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
@ -82,46 +83,88 @@ void MacLocalizeBOINCMenu() {
|
||||||
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
|
CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
|
||||||
wxASSERT(pSkinAdvanced);
|
wxASSERT(pSkinAdvanced);
|
||||||
|
|
||||||
GetIndMenuItemWithCommandID(NULL, kHICommandAbout, 1, &BOINCMenu, &itemIndex);
|
const wxChar *shortName = pSkinAdvanced->GetApplicationShortName().c_str();
|
||||||
originalText.Printf(_("About %s"), pSkinAdvanced->GetApplicationShortName().c_str());
|
if (!shortName) return; // Should never happen
|
||||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
|
||||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
err = GetIndMenuItemWithCommandID(NULL, kHICommandAbout, 1, &BOINCMenu, &itemIndex);
|
||||||
|
if (!err) {
|
||||||
GetIndMenuItemWithCommandID(NULL, kHICommandPreferences, 1, &BOINCMenu, &itemIndex);
|
originalText.Printf(_("About %s"), shortName);
|
||||||
originalText = _("Preferences…");
|
strlcpy(originalCharStr, originalText.utf8_str(), sizeof(originalCharStr));
|
||||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
if (originalCharStr[0]) {
|
||||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
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");
|
originalText = _("Services");
|
||||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
strlcpy(originalCharStr, originalText.utf8_str(), sizeof(originalCharStr));
|
||||||
count = CountMenuItems(BOINCMenu);
|
if (originalCharStr[0]) {
|
||||||
for (itemIndex=1; itemIndex<=count; ++itemIndex) {
|
localizedText = CFStringCreateWithCString(NULL, originalCharStr, kCFStringEncodingUTF8);
|
||||||
err = CopyMenuItemTextAsCFString(BOINCMenu, itemIndex, &menuItemString);
|
count = CountMenuItems(BOINCMenu);
|
||||||
if (err == noErr) {
|
for (itemIndex=1; itemIndex<=count; ++itemIndex) {
|
||||||
if (CFStringCompare(menuItemString, CFSTR("Services"), 0) == kCFCompareEqualTo) {
|
err = CopyMenuItemTextAsCFString(BOINCMenu, itemIndex, &menuItemString);
|
||||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
if (err == noErr) {
|
||||||
break;
|
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.Clear();
|
||||||
originalText.Printf(_("Hide %s"), pSkinAdvanced->GetApplicationShortName().c_str());
|
err = GetIndMenuItemWithCommandID(NULL, kHICommandHideOthers, 1, &BOINCMenu, &itemIndex);
|
||||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
if (!err) {
|
||||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
originalText = _("Hide Others");
|
||||||
|
strlcpy(originalCharStr, originalText.utf8_str(), sizeof(originalCharStr));
|
||||||
GetIndMenuItemWithCommandID(NULL, kHICommandHideOthers, 1, &BOINCMenu, &itemIndex);
|
if (originalCharStr[0]) {
|
||||||
originalText = _("Hide Others");
|
localizedText = CFStringCreateWithCString(NULL, originalCharStr, kCFStringEncodingUTF8);
|
||||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
||||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
}
|
||||||
|
}
|
||||||
GetIndMenuItemWithCommandID(NULL, kHICommandShowAll, 1, &BOINCMenu, &itemIndex);
|
|
||||||
originalText = _("Show All");
|
originalText.Clear();
|
||||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
err = GetIndMenuItemWithCommandID(NULL, kHICommandShowAll, 1, &BOINCMenu, &itemIndex);
|
||||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
if (!err) {
|
||||||
|
originalText = _("Show All");
|
||||||
GetIndMenuItemWithCommandID(NULL, kHICommandQuit, 1, &BOINCMenu, &itemIndex);
|
strlcpy(originalCharStr, originalText.utf8_str(), sizeof(originalCharStr));
|
||||||
originalText.Printf(_("Quit %s"), pSkinAdvanced->GetApplicationShortName().c_str());
|
if (originalCharStr[0]) {
|
||||||
localizedText = CFStringCreateWithCString(NULL, originalText.char_str(), kCFStringEncodingUTF8);
|
localizedText = CFStringCreateWithCString(NULL, originalCharStr, kCFStringEncodingUTF8);
|
||||||
SetMenuItemTextWithCFString(BOINCMenu, itemIndex, localizedText);
|
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