FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

disable contrib update checks if pref disables updates · orgicus/processing@0a6bd75 · GitHub

Repository navigation

Commit 0a6bd75

Browse files
committed
disable contrib update checks if pref disables updates
1 parent 9c52602 commit 0a6bd75

3 files changed

Lines changed: 39 additions & 19 deletions

File tree

‎app/src/processing/app/Base.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,7 @@ public Base(String[] args) throws Exception {
450450
}
451451

452452
// check for updates
453-
if (Preferences.getBoolean("update.check")) { //$NON-NLS-1$
454-
new UpdateCheck(this);
455-
}
453+
new UpdateCheck(this);
456454
}
457455

458456

‎app/src/processing/app/UpdateCheck.java‎

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
Part of the Processing project - http://processing.org
55
6-
Copyright (c) 2005-12 Ben Fry and Casey Reas
6+
Copyright (c) 2005-15 Ben Fry and Casey Reas
77
88
This program is free software; you can redistribute it and/or modify
99
it under the terms of the GNU General Public License as published by
@@ -43,9 +43,12 @@
4343
* to check for updates. Also included is the operating system and
4444
* its version and the version of Java being used to run Processing.
4545
* <P>
46-
* The ID number also helps provide us a general idea of how many
47-
* people are using Processing, which helps us when writing grant
48-
* proposals and that kind of thing so that we can keep Processing free.
46+
* Aside from the privacy invasion of knowing that an anonymous Processing
47+
* user opened the software at one time during a 24-hour period somewhere
48+
* in the world, we use the ID number to give us a general idea of how many
49+
* people are using Processing, which helps us when writing grant proposals
50+
* and that kind of thing so that we can keep Processing free. The numbers
51+
* are also sometimes used in ugly charts when Ben and Casey present.
4952
*/
5053
public class UpdateCheck {
5154
private final Base base;
@@ -55,22 +58,27 @@ public class UpdateCheck {
5558

5659
static private final long ONE_DAY = 24 * 60 * 60 * 1000;
5760

61+
static boolean allowed;
62+
5863

5964
public UpdateCheck(Base base) {
6065
this.base = base;
61-
new Thread(new Runnable() {
62-
public void run() {
63-
try {
64-
Thread.sleep(20 * 1000); // give the PDE time to get rolling
65-
updateCheck();
66-
67-
} catch (Exception e) {
68-
// This can safely be ignored, too many situations where no net
69-
// connection is available that behave in strange ways.
70-
// Covers likely IOException, InterruptedException, and any others.
66+
67+
if (isAllowed()) {
68+
new Thread(new Runnable() {
69+
public void run() {
70+
try {
71+
Thread.sleep(5 * 1000); // give the PDE time to get rolling
72+
updateCheck();
73+
74+
} catch (Exception e) {
75+
// This can safely be ignored, too many situations where no net
76+
// connection is available that behave in strange ways.
77+
// Covers likely IOException, InterruptedException, and any others.
78+
}
7179
}
72-
}
73-
}, "Update Checker").start();
80+
}, "Update Checker").start();
81+
}
7482
}
7583

7684

@@ -186,4 +194,10 @@ protected int readInt(String filename) throws IOException {
186194
BufferedReader reader = new BufferedReader(isr);
187195
return Integer.parseInt(reader.readLine());
188196
}
197+
198+
199+
static public boolean isAllowed() {
200+
// Disable update checks for the paranoid
201+
return Preferences.getBoolean("update.check");
202+
}
189203
}

‎app/src/processing/app/contrib/ContributionManagerDialog.java‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,14 @@ protected void updateContributionListing() {
471471

472472

473473
protected void downloadAndUpdateContributionListing(Base base) {
474+
if (!UpdateCheck.isAllowed()) {
475+
// A dialog box seems to in-your-face, but not saying anything seems
476+
// problematic. This isn't a great option but it'll do for beta 1.
477+
System.out.println("Cannot update contributions because " +
478+
"updates are disabled in preferences.");
479+
return; // update checking phones home! IT! PHONES! HOME!
480+
}
481+
474482
retryConnectingButton.setEnabled(false);
475483
status.setMessage(Language.text("contrib.status.downloading_list"));
476484
contribListing.downloadAvailableList(base, new ContribProgressBar(progressBar) {

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL