Skip to content
This repository has been archived by the owner on Feb 27, 2020. It is now read-only.

Commit

Permalink
Merge pull request #24 from jimbojsb/gh-24
Browse files Browse the repository at this point in the history
Status is wrong after rescan
  • Loading branch information
jimbojsb committed Mar 8, 2014
2 parents 366cd22 + d85f599 commit ef34427
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
6 changes: 4 additions & 2 deletions LaunchRocket/LaunchRocket-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.6b1</string>
<string>0.6b2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.6b1</string>
<string>0.6b2</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSMainNibFile</key>
Expand All @@ -34,6 +34,8 @@
<string>Fonts</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>PreferenceFileVersion</key>
<string>2</string>
<key>NSPrincipalClass</key>
<string>LaunchRocket</string>
</dict>
Expand Down
3 changes: 3 additions & 0 deletions LaunchRocket/LaunchRocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ - (void)mainViewDidLoad
self.launchRocketLabel.font = [OpenSansFont getFontWithSize:16];
self.versionNumber.font = [OpenSansFont getFontWithSize:13];
[sm renderList];

[self.versionNumber setStringValue: [NSString stringWithFormat:@"Version %@", [[[self bundle] infoDictionary] valueForKey:@"CFBundleVersion"]]];

}

- (void)didUnselect {
Expand Down
3 changes: 3 additions & 0 deletions LaunchRocket/ServiceController.m
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ -(void) handleSudoClick:(id)sender {
self.service.useSudo = NO;
}
[self.serviceManager saveService:self.service];
[self isStarted];
[self updateStartStopStatus];
[self updateStatusIndicator];
}

-(void) handleRunAtLoginClick:(id)sender {
Expand Down
12 changes: 8 additions & 4 deletions LaunchRocket/ServiceManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ -(void) createPreferencesFile {
if (![fm fileExistsAtPath:self.preferencesFile]) {
NSLog(@"Creating preferences file");
NSMutableDictionary *prefs = [[NSMutableDictionary alloc] init];
NSString *version =[[[self bundle] infoDictionary] valueForKey:@"CFBundleVersion"];
NSString *version =[[[self bundle] infoDictionary] valueForKey:@"PreferenceFileVersion"];
[prefs setObject:version forKey:@"version"];
[prefs setObject:[[NSDictionary alloc] init] forKey:@"services"];
[prefs writeToFile:self.preferencesFile atomically:YES];
Expand All @@ -58,7 +58,7 @@ -(void) loadPreferences {

if ([fm fileExistsAtPath:self.preferencesFile]) {
NSMutableDictionary *prefs = [NSMutableDictionary dictionaryWithContentsOfFile:self.preferencesFile];
NSString *version = [[[self bundle] infoDictionary] valueForKey:@"CFBundleVersion"];
NSString *version = [[[self bundle] infoDictionary] valueForKey:@"PreferenceFileVersion"];
if (![version isEqualToString:[prefs objectForKey:@"version"]]) {
[fm removeItemAtPath:self.preferencesFile error:nil];
NSLog(@"Killing preferences file, versions did not match");
Expand Down Expand Up @@ -206,7 +206,6 @@ -(IBAction) handleAddPlistClick:(id)sender {
}

-(void) addService:(NSString *)plistFile {
NSLog(@"%@%@", @"Adding services", plistFile);
NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
NSArray *pathComponents = [plistFile componentsSeparatedByString:@"/"];
NSArray *filenameComponents = [[pathComponents lastObject] componentsSeparatedByString:@"."];
Expand All @@ -215,7 +214,12 @@ -(void) addService:(NSString *)plistFile {
[dict setObject:plistFile forKey:@"plist"];
[dict setObject:serviceName forKey:@"name"];

[[self.preferences objectForKey:@"services"] setObject:dict forKey:identifier];
if ([[self.preferences objectForKey:@"services"] objectForKey:identifier] == nil) {
NSLog(@"Adding %@", plistFile);
[[self.preferences objectForKey:@"services"] setObject:dict forKey:identifier];
} else {
NSLog(@"%@ already exists -- preserving", plistFile);
}
[self writePreferences];
}

Expand Down
2 changes: 1 addition & 1 deletion LaunchRocket/en.lproj/LaunchRocket.xib
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" id="139">
<rect key="frame" x="17" y="174" width="104" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="Version 0.6b1" id="140">
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="center" title="Version ###" id="140">
<font key="font" metaFont="system" size="10"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
Expand Down

0 comments on commit ef34427

Please sign in to comment.