2
0

Add mp.update.check property to disable update checking.

This commit is contained in:
Maarten Billemont 2014-08-31 22:14:12 -04:00
parent 1e8a832cba
commit a8bb434ded
4 changed files with 36 additions and 11 deletions

View File

@ -6,7 +6,7 @@
</layout> </layout>
</appender> </appender>
<logger name="com.lyndir" level="${log.level:-INFO}" /> <logger name="com.lyndir" level="${mp.log.level:-INFO}" />
<root level="INFO"> <root level="INFO">
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />

View File

@ -0,0 +1,20 @@
package com.lyndir.masterpassword;
import com.lyndir.lhunath.opal.system.util.ConversionUtils;
/**
* @author lhunath, 2014-08-31
*/
public class Config {
private static final Config instance = new Config();
public static Config get() {
return instance;
}
public boolean checkForUpdates() {
return ConversionUtils.toBoolean( System.getProperty( "mp.update.check" ) ).or( true );
}
}

View File

@ -48,6 +48,20 @@ public class GUI implements UnlockFrame.SignInCallback {
public static void main(final String[] args) public static void main(final String[] args)
throws IOException { throws IOException {
if (Config.get().checkForUpdates())
checkUpdate();
GUI gui;
try {
gui = TypeUtils.newInstance( AppleGUI.class );
}
catch (NoClassDefFoundError e) {
gui = new GUI();
}
gui.open();
}
private static void checkUpdate() {
try { try {
Enumeration<URL> manifestURLs = Thread.currentThread().getContextClassLoader().getResources( JarFile.MANIFEST_NAME ); Enumeration<URL> manifestURLs = Thread.currentThread().getContextClassLoader().getResources( JarFile.MANIFEST_NAME );
while (manifestURLs.hasMoreElements()) { while (manifestURLs.hasMoreElements()) {
@ -74,15 +88,6 @@ public class GUI implements UnlockFrame.SignInCallback {
catch (IOException e) { catch (IOException e) {
logger.wrn( e, "Couldn't check for version update." ); logger.wrn( e, "Couldn't check for version update." );
} }
GUI gui;
try {
gui = TypeUtils.newInstance( AppleGUI.class );
}
catch (NoClassDefFoundError e) {
gui = new GUI();
}
gui.open();
} }
void open() { void open() {

View File

@ -6,7 +6,7 @@
</layout> </layout>
</appender> </appender>
<logger name="com.lyndir" level="${log.level:-INFO}" /> <logger name="com.lyndir" level="${mp.log.level:-INFO}" />
<root level="INFO"> <root level="INFO">
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />