aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2011-01-03 12:49:49 +0000
committerBibiko <bibiko@eva.mpg.de>2011-01-03 12:49:49 +0000
commitc668c662b616ec378f6ff8315055b46acbc923cc (patch)
tree8c0a7a860bd81e9ede9a66120965a9cb5b3409c9 /Source
parent8a2cdc1581e018984a7bd5c34d510c7c32eef3f1 (diff)
downloadsequelpro-c668c662b616ec378f6ff8315055b46acbc923cc.tar.gz
sequelpro-c668c662b616ec378f6ff8315055b46acbc923cc.tar.bz2
sequelpro-c668c662b616ec378f6ff8315055b46acbc923cc.zip
• changed the way to check for available update of Default Bundles
- perform a check only if the revision number is greater as the last recorded one, in other words if an updated version of Sequel Pro was installed and runs for the very first time
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppController.m22
-rw-r--r--Source/SPConstants.h1
-rw-r--r--Source/SPConstants.m1
-rw-r--r--Source/SPPreferencesUpgrade.m7
4 files changed, 14 insertions, 17 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 25a181fa..ec853140 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -1353,19 +1353,17 @@
BOOL processDefaultBundles = NO;
NSFileManager *fm = [NSFileManager defaultManager];
-
+
NSArray *deletedDefaultBundles;
- NSMutableArray *updatedDefaultBundles = [NSMutableArray array];
+
if([[NSUserDefaults standardUserDefaults] objectForKey:SPBundleDeletedDefaultBundlesKey]) {
deletedDefaultBundles = [[[NSUserDefaults standardUserDefaults] objectForKey:SPBundleDeletedDefaultBundlesKey] retain];
} else {
deletedDefaultBundles = [[NSArray array] retain];
}
- if([[NSUserDefaults standardUserDefaults] objectForKey:SPBundleUpdatedDefaultBundlesKey]) {
- [updatedDefaultBundles setArray:[[NSUserDefaults standardUserDefaults] objectForKey:SPBundleUpdatedDefaultBundlesKey]];
- }
NSMutableString *infoAboutUpdatedDefaultBundles = [NSMutableString string];
+ BOOL doBundleUpdate = ([[NSUserDefaults standardUserDefaults] objectForKey:@"doBundleUpdate"]) ? YES : NO;
for(NSString* bundlePath in bundlePaths) {
if([bundlePath length]) {
@@ -1420,8 +1418,8 @@
// If default Bundle is already install check for possible update,
// if so duplicate the modified one by appending (user) and updated it
if([installedBundleUUIDs objectForKey:[cmdData objectForKey:SPBundleFileUUIDKey]]) {
- if([updatedDefaultBundles containsObject:[cmdData objectForKey:SPBundleFileUUIDKey]]) {
-
+ if(doBundleUpdate) {
+NSLog(@"do update");
NSString *oldPath = [NSString stringWithFormat:@"%@/%@/%@", [bundlePaths objectAtIndex:0], bundle, SPBundleFileName];
NSError *readError = nil;
NSString *convError = nil;
@@ -1496,9 +1494,6 @@
}
- // Remove item from update list which will be updated in the Prefs
- [updatedDefaultBundles removeObject:[cmdData objectForKey:SPBundleFileUUIDKey]];
-
}
if (cmdData) [cmdData release];
@@ -1624,9 +1619,10 @@
}
[deletedDefaultBundles release];
-
- // Synchronize updated Bundles
- [[NSUserDefaults standardUserDefaults] setObject:updatedDefaultBundles forKey:SPBundleUpdatedDefaultBundlesKey];
+ if(doBundleUpdate) {
+ [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"doBundleUpdate"];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+ }
// Inform user about default Bundle updates which were modified by the user and re-run Reload Bundles
if([infoAboutUpdatedDefaultBundles length]) {
diff --git a/Source/SPConstants.h b/Source/SPConstants.h
index f95f6286..d3171802 100644
--- a/Source/SPConstants.h
+++ b/Source/SPConstants.h
@@ -376,7 +376,6 @@ extern NSString *SPLastImportIntoNewTableEncoding;
extern NSString *SPLastImportIntoNewTableType;
extern NSString *SPGlobalValueHistory;
extern NSString *SPBundleDeletedDefaultBundlesKey;
-extern NSString *SPBundleUpdatedDefaultBundlesKey;
// URLs
extern NSString *SPDonationsURL;
diff --git a/Source/SPConstants.m b/Source/SPConstants.m
index ae803424..52d2ccca 100644
--- a/Source/SPConstants.m
+++ b/Source/SPConstants.m
@@ -187,7 +187,6 @@ NSString *SPLastImportIntoNewTableEncoding = @"LastImportIntoNewTableEncod
NSString *SPLastImportIntoNewTableType = @"LastImportIntoNewTableType";
NSString *SPGlobalValueHistory = @"GlobalValueHistory";
NSString *SPBundleDeletedDefaultBundlesKey = @"deletedDefaultBundles";
-NSString *SPBundleUpdatedDefaultBundlesKey = @"updatedDefaultBundles";
// URLs
NSString *SPDonationsURL = @"http://www.sequelpro.com/donate.html";
diff --git a/Source/SPPreferencesUpgrade.m b/Source/SPPreferencesUpgrade.m
index 7b1c31cf..350ef7e8 100644
--- a/Source/SPPreferencesUpgrade.m
+++ b/Source/SPPreferencesUpgrade.m
@@ -45,7 +45,7 @@ void SPApplyRevisionChanges(void)
// Get the current revision
if ([prefs objectForKey:@"lastUsedVersion"]) recordedVersionNumber = [[prefs objectForKey:@"lastUsedVersion"] integerValue];
if ([prefs objectForKey:SPLastUsedVersion]) recordedVersionNumber = [[prefs objectForKey:SPLastUsedVersion] integerValue];
-
+
// Skip processing if the current version matches or is less than recorded version
if (currentVersionNumber <= recordedVersionNumber) return;
@@ -54,7 +54,10 @@ void SPApplyRevisionChanges(void)
[prefs setObject:[NSNumber numberWithInteger:currentVersionNumber] forKey:SPLastUsedVersion];
return;
}
-
+
+ // Inform SPAppController to check installed default Bundles for available updates
+ [prefs setObject:[NSNumber numberWithBool:YES] forKey:@"doBundleUpdate"];
+
// For versions prior to r336 (0.9.4), where column widths have been saved, walk through them and remove
// any table widths set to 15 or less (fix for mangled columns caused by Issue #140)
if (recordedVersionNumber < 336 && [prefs objectForKey:SPTableColumnWidths] != nil) {