From patchwork Tue Mar 12 12:48:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 15284 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0C97F23E10 for ; Tue, 12 Mar 2013 12:48:21 +0000 (UTC) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by fiordland.canonical.com (Postfix) with ESMTP id 981CFA18055 for ; Tue, 12 Mar 2013 12:48:20 +0000 (UTC) Received: by mail-ve0-f182.google.com with SMTP id ox1so3453344veb.41 for ; Tue, 12 Mar 2013 05:48:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=fMizE7uMSrVvfexVG58nP8sqAUVL9h8TSSsDb9Qp7I8=; b=iFEBNkP9WfZ0X9ILgs78IhJjLZIEriH4Is04twGw5Ys3Nfn5wkUw1TU0BtdnjDJ/zr 2GJ5E/1L7qqDktPhFy2mhszsfShTAW3IUO4wnIV9X/+GgY2tn9kO+z6DBSh3C7hwvkGn ly+f3kfBLsqh9Lo5jzOaWrL3UBBh9DpYEVAo1g6Pfozt87jIAUrAjAcqZ8ee2/jedsLl ICL3SVAsAXtBzdJnsGpf9+MSmJSvLn3ZxC9fBWkzCusPua/jw7esYE+r2qA8y1cjoJ7b +sW1snzmwNSCxIe9nQgAhJlTCBZ6GpPbMd+B1kGl/zhnCwriEuv/kqeeeUiHCZ8kkSdA 5YDA== X-Received: by 10.52.177.163 with SMTP id cr3mr5628191vdc.94.1363092500041; Tue, 12 Mar 2013 05:48:20 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp126131veb; Tue, 12 Mar 2013 05:48:19 -0700 (PDT) X-Received: by 10.180.85.97 with SMTP id g1mr19627721wiz.29.1363092498221; Tue, 12 Mar 2013 05:48:18 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id d42si34754309eep.18.2013.03.12.05.48.17 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 12 Mar 2013 05:48:18 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1UFOcq-0005Cn-Ah; Tue, 12 Mar 2013 12:48:16 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH 4/4] ui/cocoa.m: Avoid deprecated NSOpenPanel beginSheetForDirectory Date: Tue, 12 Mar 2013 12:48:16 +0000 Message-Id: <1363092496-19978-5-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1363092496-19978-1-git-send-email-peter.maydell@linaro.org> References: <1363092496-19978-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQmXkJ4+cL6CEFfIMjLOBBZFEBt24HOiiwhJiiuCfrCkwK9bZHHoJJgKGAUzr+Ser6Rdn9LX In MacOSX 10.6 and above the NSOpenPanel beginSheetForDirectory method is deprecated. Use the preferred replacements instead. We retain the original code for use on earlier MacOSX versions because the replacement methods don't exist before 10.6. Signed-off-by: Peter Maydell --- ui/cocoa.m | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index 2df481d..96f7880 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -35,6 +35,9 @@ #ifndef MAC_OS_X_VERSION_10_5 #define MAC_OS_X_VERSION_10_5 1050 #endif +#ifndef MAC_OS_X_VERSION_10_6 +#define MAC_OS_X_VERSION_10_6 1060 +#endif //#define DEBUG @@ -783,9 +786,20 @@ QemuCocoaView *cocoaView; NSOpenPanel *op = [[NSOpenPanel alloc] init]; [op setPrompt:@"Boot image"]; [op setMessage:@"Select the disk image you want to boot.\n\nHit the \"Cancel\" button to quit"]; - [op beginSheetForDirectory:nil file:nil types:[NSArray arrayWithObjects:@"img",@"iso",@"dmg",@"qcow",@"cow",@"cloop",@"vmdk",nil] + NSArray *filetypes = [NSArray arrayWithObjects:@"img", @"iso", @"dmg", + @"qcow", @"cow", @"cloop", @"vmdk", nil]; +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) + [op setAllowedFileTypes:filetypes]; + [op beginSheetModalForWindow:normalWindow + completionHandler:^(NSInteger returnCode) + { [self openPanelDidEnd:op + returnCode:returnCode contextInfo:NULL ]; } ]; +#else + // Compatibility code for pre-10.6, using deprecated method + [op beginSheetForDirectory:nil file:nil types:filetypes modalForWindow:normalWindow modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; +#endif } else { // or launch QEMU, with the global args [self startEmulationWithArgc:gArgc argv:(char **)gArgv];