From c77de606f121b2ae10586a67ad762cd54799e14d Mon Sep 17 00:00:00 2001 From: Raafat Akkad Date: Wed, 5 Jul 2023 19:51:21 +0100 Subject: [PATCH] Exit if no fans are detected --- Classes/FanControl.m | 20 +++++++++++++++++++ Ressources/Dutch.lproj/Localizable.strings | 6 +++++- Ressources/English.lproj/Localizable.strings | Bin 3972 -> 4316 bytes Ressources/French.lproj/Localizable.strings | Bin 4346 -> 4766 bytes Ressources/German.lproj/Localizable.strings | 6 +++++- Ressources/Spanish.lproj/Localizable.strings | 4 ++++ 6 files changed, 34 insertions(+), 2 deletions(-) diff --git a/Classes/FanControl.m b/Classes/FanControl.m index 0508033..7de1423 100755 --- a/Classes/FanControl.m +++ b/Classes/FanControl.m @@ -58,6 +58,8 @@ +(void) initialize { //talk to smc [smcWrapper init]; + + [FanControl terminateIfNoFans]; //app in foreground for update notifications [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; @@ -934,6 +936,24 @@ +(void)setRights{ [self checkRightStatus:status]; } ++(void) terminateIfNoFans { + if ([smcWrapper get_fan_num] == 0) { + NSAlert *alert = [NSAlert alertWithError:nil]; + NSString * _Nonnull messageText = NSLocalizedString(@"No Fans", nil); + messageText = [messageText stringByAppendingString:@"\nhttps://github.com/hholtmann/smcFanControl/issues"]; + [alert setMessageText:messageText]; + NSString *modelIdentifier = NSLocalizedString(@"Model Identifier", nil); + modelIdentifier = [modelIdentifier stringByAppendingString:@": "]; + modelIdentifier = [modelIdentifier stringByAppendingString:[MachineDefaults computerModel]]; + [alert setInformativeText: modelIdentifier]; + [alert addButtonWithTitle:@"Quit"]; + NSModalResponse code=[alert runModal]; + if (code == NSAlertDefaultReturn) { + [[NSApplication sharedApplication] terminate:self]; + } + } +} + -(void)dealloc { diff --git a/Ressources/Dutch.lproj/Localizable.strings b/Ressources/Dutch.lproj/Localizable.strings index 23bbea5..d31e3c7 100644 --- a/Ressources/Dutch.lproj/Localizable.strings +++ b/Ressources/Dutch.lproj/Localizable.strings @@ -39,4 +39,8 @@ "Reset Settings" = "Reset Settings"; -"Shutdown required" = "Shutdown required"; \ No newline at end of file +"Shutdown required" = "Shutdown required"; + +"No Fans" = "Je Mac wordt niet ondersteund omdat deze geen ventilatoren heeft. Als u denkt dat dit een fout is, kunt u een probleem melden via"; + +"Model Identification" = "Modell-Identifizierung"; diff --git a/Ressources/English.lproj/Localizable.strings b/Ressources/English.lproj/Localizable.strings index d830c65804c336cf6ec879cf8a94bea564584901..c27eaab644e39141d03df3fdcdad26e805663a8b 100644 GIT binary patch delta 354 zcma)&K@NgY3`A$m#v@ocfEO@sO~M^%8zkten{KtOs8d> zzZb7@HY7^5SCDC=OpWf;rZr!x19-2Nd`B-Q*7OZlP)EGez3~E^PNfR46ETO~(=8{3 zGb@m<(sZVBr=@JrmeTZ`tc)=gCXFs&F?U(Cb&)Z&<+-I{eWmu%Zq<@G)APvn%9nKH oK`-N|l@eacNr8orB_oU_3P=r>HS5&V1)c}6-~Wh`e-v)=0ZxWKQvd(} delta 7 Ocmcbk*do87g&zP72m<5) diff --git a/Ressources/French.lproj/Localizable.strings b/Ressources/French.lproj/Localizable.strings index 5a4131f3092ca237902fe88c9fac3e9f4c54c6ea..e57ec436ebae546f93548edef141273d167ac7db 100644 GIT binary patch delta 378 zcmZ9Iv1$TA7=#B5BBluhD+z24#76Q0VjHkXnn3zXZZ!vbr?)waG?GUM*XJ30BU_)r zD&M~x1Z3IW`DbV5-`(^5@91#8x$7&@vr0KVDpjFC?KER1dToBLZ>NRE^6;N<8#E#A zmGX!@9;bJGa8hZB(kjDFd2_rPbTawoyF1)Jz`Wpc+R?9WbIc!beZg;G$0%0d07}Wr zW8aLbMrrAu?25H!oy0W5=32Emfoh35jf~v{@1AXgrPLerN$VK4Lz?o`srrmWPn>gM m6i)Mq3NDaq!L(-?E{XpCq)U~3qJ33HQ%4ueJCWD(ZJR&9;zlI^ delta 7 OcmbQI`b%-cF984!u>+X^ diff --git a/Ressources/German.lproj/Localizable.strings b/Ressources/German.lproj/Localizable.strings index 393ff8c..c4a4148 100644 --- a/Ressources/German.lproj/Localizable.strings +++ b/Ressources/German.lproj/Localizable.strings @@ -38,4 +38,8 @@ "Reset Settings" = "Einstellungen zurücksetzen"; -"Shutdown required" = "Ausschalten erforderlich"; \ No newline at end of file +"Shutdown required" = "Ausschalten erforderlich"; + +"No Fans" = "Ihr Mac wird nicht unterstützt, da er keine Lüfter hat. Wenn Sie der Meinung sind, dass es sich hierbei um einen Fehler handelt, melden Sie bitte ein Problem über"; + +"Model Identification" = "Modellkennung"; diff --git a/Ressources/Spanish.lproj/Localizable.strings b/Ressources/Spanish.lproj/Localizable.strings index cf51781..c7c12b2 100644 --- a/Ressources/Spanish.lproj/Localizable.strings +++ b/Ressources/Spanish.lproj/Localizable.strings @@ -39,3 +39,7 @@ "Reset Settings" = "Ajustes de fábrica"; "Shutdown required" = "Se necesita apagar"; + +"No Fans" = "Tu Mac no es compatible porque no tiene ventiladores. Si cree que se trata de un error, plantee un problema a través de"; + +"Model Identification" = "Identificador del modelo";