adium 5458:1505802b48b2: Fix #16375

commits at adium.im commits at adium.im
Thu May 2 19:59:21 UTC 2013


details:	http://hg.adium.im/adium/rev/1505802b48b2
revision:	5458:1505802b48b2
branch:		adium-1.6
author:		Frank Dowsett <wixardy at adium.im>
date:		Thu May 02 13:19:58 2013 -0400

Fix #16375
Subject: adium 5459:7d2bcdcb7d19: Make the Xtra enable/disable relaunch alert more clear and add a "Relaunch Now" button. Fixes #15490

details:	http://hg.adium.im/adium/rev/7d2bcdcb7d19
revision:	5459:7d2bcdcb7d19
branch:		adium-1.6
author:		Frank Dowsett <wixardy at adium.im>
date:		Thu May 02 15:57:26 2013 -0400

Make the Xtra enable/disable relaunch alert more clear and add a "Relaunch Now" button. Fixes #15490

diffs (69 lines):

diff -r 6e13799a9c9b -r 7d2bcdcb7d19 Frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/MacOS/finish_installation
Binary file Frameworks/Sparkle.framework/Versions/A/Resources/finish_installation.app/Contents/MacOS/finish_installation has changed
diff -r 6e13799a9c9b -r 7d2bcdcb7d19 Source/AIPreferenceWindowController.m
--- a/Source/AIPreferenceWindowController.m	Thu May 02 12:39:48 2013 +0200
+++ b/Source/AIPreferenceWindowController.m	Thu May 02 15:57:26 2013 -0400
@@ -535,6 +535,7 @@
 	//Create the entries in the suggestions window
 	CGFloat y = frame.size.height - SUGGESTION_ENTRY_HEIGHT;
 	for (NSDictionary *dict in entries) {
+		//This is not a leak, these are released at the start of this method
 		AIHighlightingTextField *item = [[AIHighlightingTextField alloc] initWithFrame:NSMakeRect(0, y, frame.size.width, SUGGESTION_ENTRY_HEIGHT)];
 		
 		[item setString:[dict objectForKey:@"title"]
@@ -547,8 +548,6 @@
 		[_trackingAreas addObject:tA];
 		
 		y -= SUGGESTION_ENTRY_HEIGHT;
-		
-		[item release];
 	}
 	
 	[suggestionsWindow setFrame:frame display:NO];
diff -r 6e13799a9c9b -r 7d2bcdcb7d19 Source/AIXtrasManager.m
--- a/Source/AIXtrasManager.m	Thu May 02 12:39:48 2013 +0200
+++ b/Source/AIXtrasManager.m	Thu May 02 15:57:26 2013 -0400
@@ -25,6 +25,7 @@
 #import <AIUtilities/AIImageAdditions.h>
 #import <AIUtilities/AIToolbarUtilities.h>
 #import <Adium/AICorePluginLoader.h>
+#import <Sparkle/Sparkle.h>
 
 #define ADIUM_XTRAS_PAGE		AILocalizedString(@"http://xtras.adium.im/","Adium xtras page. Localized only if a translated version exists.")
 #define XTRAS_LAST_CATEGORY_KEY @"Xtras Last Category"
@@ -381,18 +382,31 @@
 	
 	NSAlert * warning = [NSAlert alertWithMessageText:AILocalizedString(@"You will need to restart Adium", nil)
 										defaultButton:AILocalizedString(@"OK", nil)
-									  alternateButton:nil
+									  alternateButton:AILocalizedString(@"Restart Adium now", nil)
 										  otherButton:nil
-							informativeTextWithFormat:AILocalizedString(@"Enabling or disabling Xtras requires a restart of Adium.", nil)];
+							informativeTextWithFormat:AILocalizedString(@"The changes will be made after a restart of Adium.", nil)];
 	[warning beginSheetModalForWindow:self.view.window
-						modalDelegate:nil
-					   didEndSelector:nil
+						modalDelegate:self
+					   didEndSelector:@selector(relaunchAlertDidEnd:returnCode:contextInfo:)
 						  contextInfo:nil];
 	
 	//Reload the plugins to reflect the recent changes
 	[self xtrasChanged:nil];
 }
 
+- (void)relaunchAlertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
+{
+	if (returnCode == NSAlertAlternateReturn) {
+		NSString *launcherSource = [[NSBundle bundleForClass:[SUUpdater class]]  pathForResource:@"finish_installation" ofType:@"app"];
+		NSString *relaunchToolPath = [launcherSource stringByAppendingPathComponent:@"Contents/MacOS/finish_installation"];
+		NSString *processID = [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]];
+		NSString *appPath = [[NSBundle mainBundle] bundlePath];
+		
+		[NSTask launchedTaskWithLaunchPath:relaunchToolPath arguments:[NSArray arrayWithObjects:appPath, appPath, processID, nil]];
+		[NSApp terminate:self];
+	}
+}
+
 + (BOOL)createXtraBundleAtPath:(NSString *)path
 {
 	NSString *contentsPath  = [path stringByAppendingPathComponent:@"Contents"];




More information about the commits mailing list