From patchwork Mon Apr 22 20:29:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 16327 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f197.google.com (mail-gg0-f197.google.com [209.85.161.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EA22223919 for ; Mon, 22 Apr 2013 20:30:47 +0000 (UTC) Received: by mail-gg0-f197.google.com with SMTP id k5sf10652291ggn.4 for ; Mon, 22 Apr 2013 13:30:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=wH19cQd4ypjVdc6wWdqFPWV/rYqRBYcRdw1dyjJKDUI=; b=BFXME6ZXtbrDcWm+Eq0XpmOfDMTusD8QiExDH3n9a5ZJ9w74SqpGmh6GQhnmhlMHN+ 5JMPU1uKlwBCVAv5s5PYqQ6nfB3UcFQgeclayXiWrszT523nHt/ImQ2HlYH2CxZBguNw WyY3mpe3WdirVG3zRmoD0gFhQLZEknmbf+6qQfXN6k+A34RLqC+sVmnvOI1zRZKFXVSn LAy7Qk01a2TQYmZkBLa7tVvdpfL9Vx+3k1YXNJA33H8AgyX9nrCFI50Ir6QjtM+uCCzz u+34UBjmjsubPdRuh5VuKXAtjo6eB+1zDfSvNVueyOljhd/zXLHivqBA4r7iD4BYQh52 eQ+w== X-Received: by 10.224.178.205 with SMTP id bn13mr20835925qab.3.1366662600711; Mon, 22 Apr 2013 13:30:00 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.127.137 with SMTP id ng9ls9744qeb.42.gmail; Mon, 22 Apr 2013 13:30:00 -0700 (PDT) X-Received: by 10.220.103.209 with SMTP id l17mr158453vco.39.1366662600574; Mon, 22 Apr 2013 13:30:00 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id ec8si16811938vdb.59.2013.04.22.13.30.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Apr 2013 13:30:00 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id lf10so525062vcb.20 for ; Mon, 22 Apr 2013 13:30:00 -0700 (PDT) X-Received: by 10.220.189.9 with SMTP id dc9mr6943974vcb.8.1366662600447; Mon, 22 Apr 2013 13:30:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp93405veb; Mon, 22 Apr 2013 13:29:59 -0700 (PDT) X-Received: by 10.205.115.11 with SMTP id fc11mr1290642bkc.72.1366662594428; Mon, 22 Apr 2013 13:29:54 -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 dd4si9589527bkc.99.2013.04.22.13.29.53 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 22 Apr 2013 13:29:54 -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; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1UUNMz-0004ly-CM; Mon, 22 Apr 2013 21:29:49 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori Subject: [PATCH v3 4/4] ui/cocoa.m: Avoid deprecated NSOpenPanel beginSheetForDirectory Date: Mon, 22 Apr 2013 21:29:49 +0100 Message-Id: <1366662589-18315-5-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1366662589-18315-1-git-send-email-peter.maydell@linaro.org> References: <1366662589-18315-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQlVd5pogZ3dI46FF7faPklPF4+FFMJuLc85v6sIBSA3YjjM5Loy2LOQuaCEXgSsjMhRDaPN X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 9ff688d..cee93be 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 @@ -771,9 +774,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];