Code changes needed to add the wcg brand for the mac manager,screen saver,installer

This commit is contained in:
Jonathan Armstrong 2018-05-23 10:10:02 -05:00
parent 85625c7512
commit c98ee539e5
11 changed files with 67 additions and 7 deletions

View File

@ -1839,7 +1839,7 @@ void CAdvancedFrame::OnConnect(CFrameEvent& WXUNUSED(event)) {
fscanf(f, "BrandId=%ld\n", &iBrandID);
fclose(f);
}
if ((iBrandID > 0) && (iBrandID < 4))
if ((iBrandID > 0) && (iBrandID < 5))
#endif
{
// If successful, hide the main window if we showed it

View File

@ -154,6 +154,12 @@ bool CBOINCGUIApp::OnInit() {
SetAppName(wxT("BOINC Manager"));
SetVendorName(wxT("Space Sciences Laboratory, U.C. Berkeley"));
#ifdef __WXMAC__
char displayName[MAXPATHLEN];
getDisplayNameForThisApp(displayName, sizeof(displayName));
SetAppDisplayName(wxString(displayName)); // {ass the display name to wxWidgets
#endif
// Initialize the configuration storage module
m_pConfig = new wxConfig(GetAppName());
@ -273,7 +279,6 @@ bool CBOINCGUIApp::OnInit() {
m_pConfig->Read(wxT("Skin"), &strDesiredSkinName, m_pSkinManager->GetDefaultSkinName());
m_pSkinManager->ReloadSkin(strDesiredSkinName);
#ifdef SANDBOX
// Make sure owners, groups and permissions are correct for the current setting of g_use_sandbox
//

View File

@ -223,6 +223,7 @@ public:
//
bool WasFileModifiedBeforeSystemBoot(char * filePath);
void HideThisApp(void);
void getDisplayNameForThisApp(char* pathBuf, size_t bufSize);
#if !wxCHECK_VERSION(3,0,1)
// This should be fixed after wxCocoa 3.0.0:

View File

@ -137,6 +137,19 @@ void CBOINCGUIApp::ShowApplication(bool bShow) {
}
///
/// Gets the display name for this app
void CBOINCGUIApp::getDisplayNameForThisApp(char* pathBuf, size_t bufSize) {
// Get the app's main bundle
NSBundle *main = [NSBundle mainBundle];
NSString *thePath = main.localizedInfoDictionary[(NSString *)kCFBundleNameKey];
if (thePath == nil) {
thePath = [NSProcessInfo processInfo].processName;
}
strlcpy(pathBuf, [thePath UTF8String], bufSize);
}
// NSTitledWindowMask is deprecated in OS 10.12 and is replaced by
// NSWindowStyleMaskTitled, which is not defined before OS 10.12
#ifndef NSWindowStyleMaskTitled

View File

@ -126,13 +126,15 @@ int SetBOINCAppOwnersGroupsAndPermissions(char *path) {
Boolean isDirectory;
OSStatus err = noErr;
#define NUMBRANDS 3
#define NUMBRANDS 5
char *saverName[NUMBRANDS];
saverName[0] = "BOINCSaver";
saverName[1] = "GridRepublic";
saverName[2] = "Progress Thru Processors";
saverName[3] = "Charity Engine";
saverName[4] = "World Community Grid";
if (geteuid() != 0) {
ShowSecurityError("SetBOINCAppOwnersGroupsAndPermissions must be called as root");

View File

@ -817,7 +817,7 @@ void CSimpleFrame::OnConnect(CFrameEvent& WXUNUSED(event)) {
fscanf(f, "BrandId=%ld\n", &iBrandID);
fclose(f);
}
if ((iBrandID > 0) && (iBrandID < 4))
if ((iBrandID > 0) && (iBrandID < 5))
#endif
{
// If successful, hide the main window if we showed it

View File

@ -410,6 +410,9 @@ OSStatus CScreensaver::initBOINCApp() {
case 3:
m_BrandText = "Charity Engine Desktop";
break;
case 4:
m_BrandText = "World Community Grid";
break;
default:
m_BrandText = "BOINC";
break;

View File

@ -83,6 +83,7 @@ CC_STATUS cc_status;
#define GRIDREPUBLIC_BRAND_ID 1
#define PROGRESSTHRUPROCESSORS_BRAND_ID 2
#define CHARITYENGINE_BRAND_ID 3
#define WORLDCOMMUNITYGRID_BRAND_ID 4
char* brand_name = "BOINC";
char* logo_file = "boinc_logo_black.jpg";
@ -535,6 +536,9 @@ int main(int argc, char** argv) {
} else if (brandId == CHARITYENGINE_BRAND_ID) {
brand_name = "Charity Engine";
logo_file = "CE_ss_logo.jpg";
} else if (brandId == WORLDCOMMUNITYGRID_BRAND_ID) {
brand_name = "World Community Grid";
logo_file = "wcg_ss_logo.jpg";
}
}
#endif

View File

@ -40,7 +40,7 @@ long GetBrandID(void);
static int parse_posic_spawn_command_line(char* p, char** argv);
int callPosixSpawn(const char *cmd);
#define NUMBRANDS 4
#define NUMBRANDS 5
static char *appName[NUMBRANDS];
static char *appPath[NUMBRANDS];
static char *brandName[NUMBRANDS];
@ -77,6 +77,9 @@ int main(int argc, char *argv[])
appName[3] = "Charity Engine Desktop";
appPath[3] = "/Applications/Charity Engine Desktop.app";
brandName[3] = "Charity Engine";
appName[4] = "World Community Grid";
appPath[4] = "/Applications/World Community Grid.app";
brandName[4] = "World Community Grid";
brandID = GetBrandID();

View File

@ -143,7 +143,7 @@ void notused() {
}
/* END TEMPORARY ITEMS TO ALLOW TRANSLATORS TO START WORK */
#define NUMBRANDS 4
#define NUMBRANDS 5
#define MAX_LANGUAGES_TO_TRY 5
static char * Catalog_Name = (char *)"BOINC-Setup";
@ -222,6 +222,13 @@ int main(int argc, char *argv[])
receiptName[3] = "/Library/Receipts/Charity Engine Installer.pkg";
skinName[3] = "Charity Engine";
appName[4] = "World Community Grid";
appPath[4] = "/Applications/World Community Grid.app";
brandName[4] = "World Community Grid";
saverName[4] = "World Community Grid";
receiptName[4] = "/Library/Receipts/World Community Grid Installer.pkg";
skinName[4] = "World Community Grid";
printf("\nStarting PostInstall app %s\n\n", argv[1]);
fflush(stdout);
// getlogin() gives unreliable results under OS 10.6.2, so use environment

View File

@ -391,6 +391,12 @@ static OSStatus DoUninstall(void) {
sleep(2);
}
BOINCManagerPID = getPidIfRunning("edu.berkeley.boinc");
if (BOINCManagerPID) {
kill(BOINCManagerPID, SIGTERM);
}
sleep(2);
// Core Client may still be running if it was started without Manager
coreClientPID = FindProcessPID("boinc", 0);
if (coreClientPID)
@ -478,17 +484,22 @@ static OSStatus DoUninstall(void) {
callPosixSpawn ("rm -rf \"/Applications/Charity Engine Desktop.app\"");
callPosixSpawn ("rm -rf \"/Library/Screen Savers/Charity Engine.saver\"");
callPosixSpawn ("rm -rf \"/Applications/World Community Grid.app\"");
callPosixSpawn ("rm -rf \"/Library/Screen Savers/World Community Grid.saver\"");
// Delete any receipt from an older installer (which had
// a wrapper application around the installer package.)
callPosixSpawn ("rm -rf /Library/Receipts/GridRepublic.pkg");
callPosixSpawn ("rm -rf /Library/Receipts/Progress\\ Thru\\ Processors.pkg");
callPosixSpawn ("rm -rf /Library/Receipts/Charity\\ Engine.pkg");
callPosixSpawn ("rm -rf /Library/Receipts/World\\ Community\\ Grid.pkg");
callPosixSpawn ("rm -rf /Library/Receipts/BOINC.pkg");
// Delete any receipt from a newer installer (a bare package.)
callPosixSpawn ("rm -rf /Library/Receipts/GridRepublic\\ Installer.pkg");
callPosixSpawn ("rm -rf /Library/Receipts/Progress\\ Thru\\ Processors\\ Installer.pkg");
callPosixSpawn ("rm -rf /Library/Receipts/Charity\\ Engine\\ Installer.pkg");
callPosixSpawn ("rm -rf /Library/Receipts/World\\ Community\\ Grid\\ Installer.pkg");
callPosixSpawn ("rm -rf /Library/Receipts/BOINC\\ Installer.pkg");
// Phase 5: Set BOINC Data owner and group to logged in user
@ -805,6 +816,7 @@ static OSStatus CleanupAllVisibleUsers(void)
DeleteLoginItemOSAScript(pw->pw_name, "GridRepublic Desktop");
DeleteLoginItemOSAScript(pw->pw_name, "Progress Thru Processors Desktop");
DeleteLoginItemOSAScript(pw->pw_name, "Charity Engine Desktop");
DeleteLoginItemOSAScript(pw->pw_name, "World Community Grid");
#if TESTING
} else {
@ -848,6 +860,11 @@ static OSStatus CleanupAllVisibleUsers(void)
changeSaver = true;
break;
}
if (strstr(s, "World Community Grid")) {
changeSaver = true;
break;
}
}
pclose(f);
}
@ -866,6 +883,9 @@ static OSStatus CleanupAllVisibleUsers(void)
if (strstr(s, "Charity Engine")) {
changeSaver = true;
}
if (strstr(s, "World Community Grid")) {
changeSaver = true;
}
}
}
@ -953,6 +973,8 @@ static void DeleteLoginItemFromPListFile(void)
success = DeleteLoginItemNameAtIndexFromPlistFile(counter-1);
if (strstr(theName, "CHARITY ENGINE DESKTOP"))
success = DeleteLoginItemNameAtIndexFromPlistFile(counter-1);
if (strstr(theName, "World Community Grid"))
success = DeleteLoginItemNameAtIndexFromPlistFile(counter-1);
}
}
#endif // MANIPULATE_LOGINITEM_PLIST_FILE