remember power save mode between restarts

This commit is contained in:
peter
2012-09-24 17:37:11 +04:00
parent a20763701b
commit 39b834b7e4
@@ -15,6 +15,7 @@
*/
package com.intellij.ide;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.util.messages.MessageBus;
import com.intellij.util.messages.Topic;
@@ -23,7 +24,8 @@ import com.intellij.util.messages.Topic;
* @author yole
*/
public class PowerSaveMode {
private boolean myEnabled = false;
private static final String POWER_SAVE_MODE = "power.save.mode";
private boolean myEnabled = PropertiesComponent.getInstance().getBoolean(POWER_SAVE_MODE, false);
private final MessageBus myBus;
public PowerSaveMode(MessageBus bus) {
@@ -39,6 +41,7 @@ public class PowerSaveMode {
if (instance.myEnabled != value) {
instance.myEnabled = value;
instance.myBus.syncPublisher(TOPIC).powerSaveStateChanged();
PropertiesComponent.getInstance().setValue(POWER_SAVE_MODE, String.valueOf(value));
}
}