Commits

Peter Hosey  committed 3994e36

Display the hg revision in the Growl preference pane when it's an hg version.

  • Participants
  • Parent commits f2deb58
  • Branches default

Comments (0)

Files changed (2)

File Core/Resources/Info.plist

 	<string>GPAN</string>
 	<key>CFBundleVersion</key>
 	<string>GROWL_VERSION</string>
+	<key>GrowlHgRevision</key>
+	<string>HG_REVISION</string>
 	<key>NSMainNibFile</key>
 	<string>GrowlPref</string>
 	<key>NSPrefPaneIconFile</key>

File Core/Source/GrowlPreferencePane.m

 #pragma mark About Tab
 
 - (void) setupAboutTab {
+	NSString *versionString = [[self bundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
+	if (versionString) {
+		NSString *versionStringWithHgVersion = nil;
+		struct Version version;
+		if (parseVersionString(versionString, &version)) {
+			const char *hgRevisionUTF8 = [[[self bundle] objectForInfoDictionaryKey:@"GrowlHgRevision"] UTF8String];
+			if (hgRevisionUTF8) {
+				version.development = (u_int32_t)strtoul(hgRevisionUTF8, /*next*/ NULL, 10);
+
+				versionStringWithHgVersion = [NSMakeCollectable(createVersionDescription(version)) autorelease];
+			}
+		}
+		if (versionStringWithHgVersion)
+			versionString = versionStringWithHgVersion;
+	}
+
 	[aboutVersionString setStringValue:[NSString stringWithFormat:@"%@ %@", 
 										[[self bundle] objectForInfoDictionaryKey:@"CFBundleName"], 
-										[[self bundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]]];
+										versionString]];
 	[aboutBoxTextView readRTFDFromFile:[[self bundle] pathForResource:@"About" ofType:@"rtf"]];
 }