From 94efa431a6f13f421f651c82ede8117b594885f0 Mon Sep 17 00:00:00 2001 From: German Laullon Date: Thu, 19 May 2011 00:01:49 +0200 Subject: [PATCH] conditionalize usage of 10.6-only protocols David Catmull (Uncommon) Uncommon/gitx@e5b603f188760d341ca5c578ee9a42ebcc46ba4b Conflicts: DBPrefsWindowController.h PBGitHistoryController.h PBGitSidebarController.h PBGitWindowController.h --- DBPrefsWindowController.h | 2 +- GitX_Prefix.pch | 13 +++++++++++++ PBGitHistoryController.h | 2 +- PBGitSidebarController.h | 2 +- PBGitWindowController.h | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/DBPrefsWindowController.h b/DBPrefsWindowController.h index 63b7855..63a80d0 100644 --- a/DBPrefsWindowController.h +++ b/DBPrefsWindowController.h @@ -42,7 +42,7 @@ #import -@interface DBPrefsWindowController : NSWindowController /**/{ +@interface DBPrefsWindowController : NSWindowController PROTOCOL_10_6(NSAnimationDelegate,NSToolbarDelegate){ NSMutableArray *toolbarIdentifiers; NSMutableDictionary *toolbarViews; NSMutableDictionary *toolbarItems; diff --git a/GitX_Prefix.pch b/GitX_Prefix.pch index f1ce03e..0af9ac2 100644 --- a/GitX_Prefix.pch +++ b/GitX_Prefix.pch @@ -17,3 +17,16 @@ #ifndef ALog #define ALog(...) DLog(__VA_ARGS__) #endif + +// In 10.6, some NSObject categories (like NSWindowDelegate) were changed to +// protocols. Thus to avoid warnings we need to add protocol specifiers, but +// only when compiling for 10.6+. +#ifndef MAC_OS_X_VERSION_10_6 +#define MAC_OS_X_VERSION_10_6 1060 +#endif + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#define PROTOCOL_10_6(...) <__VA_ARGS__> +#else +#define PROTOCOL_10_6(...) +#endif diff --git a/PBGitHistoryController.h b/PBGitHistoryController.h index f9cf468..a09bc64 100644 --- a/PBGitHistoryController.h +++ b/PBGitHistoryController.h @@ -22,7 +22,7 @@ @class PBHistorySearchController; -@interface PBGitHistoryController : PBViewController /**/{ +@interface PBGitHistoryController : PBViewController PROTOCOL_10_6(NSOutlineViewDelegate){ IBOutlet PBRefController *refController; IBOutlet NSSearchField *searchField; IBOutlet NSArrayController* commitController; diff --git a/PBGitSidebarController.h b/PBGitSidebarController.h index 623c816..64fd606 100644 --- a/PBGitSidebarController.h +++ b/PBGitSidebarController.h @@ -13,7 +13,7 @@ @class PBGitHistoryController; @class PBGitCommitController; -@interface PBGitSidebarController : PBViewController /**/{ +@interface PBGitSidebarController : PBViewController PROTOCOL_10_6(NSOutlineViewDelegate, NSMenuDelegate){ IBOutlet NSWindow *window; IBOutlet NSOutlineView *sourceView; IBOutlet NSView *sourceListControlsView; diff --git a/PBGitWindowController.h b/PBGitWindowController.h index c844bf6..a3bb3cb 100644 --- a/PBGitWindowController.h +++ b/PBGitWindowController.h @@ -14,7 +14,7 @@ @class PBViewController, PBGitSidebarController, PBGitCommitController; -@interface PBGitWindowController : NSWindowController /**/{ +@interface PBGitWindowController : NSWindowController PROTOCOL_10_6(NSWindowDelegate){ __weak PBGitRepository* repository; PBViewController *contentController;