From patchwork Mon Mar 25 22:31:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 15638 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 CB33023E39 for ; Mon, 25 Mar 2013 22:31:43 +0000 (UTC) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by fiordland.canonical.com (Postfix) with ESMTP id 80603A195EC for ; Mon, 25 Mar 2013 22:31:43 +0000 (UTC) Received: by mail-vc0-f177.google.com with SMTP id ia10so5062787vcb.8 for ; Mon, 25 Mar 2013 15:31:43 -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=zjXkg8ZqLFlSdTV5EEmeSXP/f4ger8220pFWtju9cB4=; b=kXjl6EOP5n+TcOkguEEyOevktfRcMuqL0hA62VA3up+wQr9mrcecAsPShrl5PcDo1X N21Ya18ZYHBvLzUqJZrAa6rm7whUuwembsOmRsNgFQtsxegeNIc1NBzIFdkVf93QS/SW ZYWdNwV4jaE0vXPxWjKJiPcMd11/e0O3K5mAAvkyEUEArK/jOSJrtQVVr+xnf0a7MG8E uF0bH0PQKK9pyEH65EgBRQZw2l7ACc9tq1wfXDP6c+9TUpad/QSrAB0QXKbEAoXd+YyX Ck/0IYCaKALkOywbfYBN+n8UQG6QXzZrfLdhLpaHadfJYNL2+m6fIQSklUgPyHrq0DAu SqZg== X-Received: by 10.58.224.101 with SMTP id rb5mr18114256vec.17.1364250703051; Mon, 25 Mar 2013 15:31:43 -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.59.4.204 with SMTP id cg12csp45849ved; Mon, 25 Mar 2013 15:31:42 -0700 (PDT) X-Received: by 10.66.234.101 with SMTP id ud5mr20474841pac.40.1364250699127; Mon, 25 Mar 2013 15:31:39 -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 lq8si15462350pab.258.2013.03.25.15.31.37 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 25 Mar 2013 15:31:38 -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 1UKFvT-00024c-2s; Mon, 25 Mar 2013 22:31:35 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [PATCH v2 4/4] ui/cocoa.m: Avoid deprecated NSOpenPanel beginSheetForDirectory Date: Mon, 25 Mar 2013 22:31:34 +0000 Message-Id: <1364250694-7939-5-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1364250694-7939-1-git-send-email-peter.maydell@linaro.org> References: <1364250694-7939-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQk7rfgDypJRzvCcLmsp0g5tVq0Qm8tu4uyPPD5EfsHDoepC2ThVKbIXgMpbEQfFtoUmLgyB 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 36181d9..79fd41b 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];