Display the hg revision in the Growl preference pane when it's an hg version.
authorPeter Hosey <hg@boredzo.org>
Thu Oct 15 21:29:35 2009 -0700 (2009-10-15)
changeset 45333994e363a689
parent 4532 f2deb58c350d
child 4534 81dc4c264dc1
Display the hg revision in the Growl preference pane when it's an hg version.
Core/Resources/Info.plist
Core/Source/GrowlPreferencePane.m
     1.1 --- a/Core/Resources/Info.plist	Thu Oct 15 20:47:42 2009 -0700
     1.2 +++ b/Core/Resources/Info.plist	Thu Oct 15 21:29:35 2009 -0700
     1.3 @@ -20,6 +20,8 @@
     1.4  	<string>GPAN</string>
     1.5  	<key>CFBundleVersion</key>
     1.6  	<string>GROWL_VERSION</string>
     1.7 +	<key>GrowlHgRevision</key>
     1.8 +	<string>HG_REVISION</string>
     1.9  	<key>NSMainNibFile</key>
    1.10  	<string>GrowlPref</string>
    1.11  	<key>NSPrefPaneIconFile</key>
     2.1 --- a/Core/Source/GrowlPreferencePane.m	Thu Oct 15 20:47:42 2009 -0700
     2.2 +++ b/Core/Source/GrowlPreferencePane.m	Thu Oct 15 21:29:35 2009 -0700
     2.3 @@ -864,9 +864,25 @@
     2.4  #pragma mark About Tab
     2.5  
     2.6  - (void) setupAboutTab {
     2.7 +	NSString *versionString = [[self bundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
     2.8 +	if (versionString) {
     2.9 +		NSString *versionStringWithHgVersion = nil;
    2.10 +		struct Version version;
    2.11 +		if (parseVersionString(versionString, &version)) {
    2.12 +			const char *hgRevisionUTF8 = [[[self bundle] objectForInfoDictionaryKey:@"GrowlHgRevision"] UTF8String];
    2.13 +			if (hgRevisionUTF8) {
    2.14 +				version.development = (u_int32_t)strtoul(hgRevisionUTF8, /*next*/ NULL, 10);
    2.15 +
    2.16 +				versionStringWithHgVersion = [NSMakeCollectable(createVersionDescription(version)) autorelease];
    2.17 +			}
    2.18 +		}
    2.19 +		if (versionStringWithHgVersion)
    2.20 +			versionString = versionStringWithHgVersion;
    2.21 +	}
    2.22 +
    2.23  	[aboutVersionString setStringValue:[NSString stringWithFormat:@"%@ %@", 
    2.24  										[[self bundle] objectForInfoDictionaryKey:@"CFBundleName"], 
    2.25 -										[[self bundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]]];
    2.26 +										versionString]];
    2.27  	[aboutBoxTextView readRTFDFromFile:[[self bundle] pathForResource:@"About" ofType:@"rtf"]];
    2.28  }
    2.29