Disabled Install & Update buttons if Internet isn't available

This commit is contained in:
Joel Moniz
2014-08-16 00:36:23 +05:30
parent c4c1462882
commit d13038091b
2 changed files with 10 additions and 0 deletions

View File

@@ -44,6 +44,7 @@ public class ContributionListing {
Map<String, List<Contribution>> librariesByCategory;
ArrayList<Contribution> allContributions;
boolean hasDownloadedLatestList;
boolean hasListDownloadFailed;
ReentrantLock downloadingListingLock;
@@ -371,6 +372,8 @@ public class ContributionListing {
hasDownloadedLatestList = true;
setAdvertisedList(listingFile);
}
else
hasListDownloadFailed = true;
}
downloadingListingLock.unlock();
}
@@ -436,6 +439,11 @@ public class ContributionListing {
}
boolean hasListDownloadFailed() {
return hasListDownloadFailed;
}
// /**
// * @return a lowercase string with all non-alphabetic characters removed
// */

View File

@@ -761,8 +761,10 @@ class ContributionPanel extends JPanel {
if (contrib != null) {
updateButton.setVisible((contribListing.hasUpdates(contrib) && !contrib.isUpdateFlagged() && !contrib.isDeletionFlagged()) || isUpdateInProgress);
updateButton.setEnabled(!contribListing.hasListDownloadFailed());
}
installRemoveButton.setVisible(isSelected() || installRemoveButton.getText().equals(Language.text("contrib.remove")) || isUpdateInProgress);
installRemoveButton.setEnabled(installRemoveButton.getText().equals(Language.text("contrib.remove")) ||!contribListing.hasListDownloadFailed());
reorganizePaneComponents();
// for (JTextPane textPane : headerPaneSet) {