mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-09 07:09:51 +03:00
Harden settings side effects
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -217,15 +217,20 @@ class SettingsController:
|
||||
cls._setBinary('HideDockIcon', enabled)
|
||||
|
||||
@classmethod
|
||||
def setStartupOnBoot(cls, enabled: bool):
|
||||
"""Apply the platform startup registration preference."""
|
||||
def setStartupOnBoot(cls, enabled: bool) -> bool:
|
||||
"""Persist startup preference only after host registration succeeds."""
|
||||
if enabled:
|
||||
StartupOnBoot.on_()
|
||||
success = StartupOnBoot.on_()
|
||||
else:
|
||||
StartupOnBoot.off()
|
||||
success = StartupOnBoot.off()
|
||||
|
||||
if not success:
|
||||
return False
|
||||
|
||||
cls._setBinary('StartupOnBoot', enabled)
|
||||
|
||||
return True
|
||||
|
||||
@classmethod
|
||||
def setPowerSaveMode(cls, enabled: bool):
|
||||
"""Persist power-saving behavior for the next connection."""
|
||||
@@ -290,7 +295,7 @@ class SettingsController:
|
||||
cls._setBinary(METRICS_COLLECTION_SETTING, enabled)
|
||||
|
||||
try:
|
||||
AppMainWindow().trafficStatsManager.setCollectionEnabled(enabled)
|
||||
AppTrafficStatsManager().setCollectionEnabled(enabled)
|
||||
except (AttributeError, RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user