aboutsummaryrefslogtreecommitdiff
path: root/AppKit/GTMUILocalizer.m
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-07-28 18:15:21 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-07-28 18:15:21 +0000
commitb65c5509d204b37eb79af1307f04a048806def48 (patch)
tree64f7c1c4ee820e131d10e8d28ba90bf1d70ba58c /AppKit/GTMUILocalizer.m
parent874df1af538a60925df094b91a7993087cd49c8c (diff)
[Author: thomasvl]
Use CPP gates instead of runtime checks for NSViewController. R=dmaclach DELTA=18 (5 added, 5 deleted, 8 changed)
Diffstat (limited to 'AppKit/GTMUILocalizer.m')
-rw-r--r--AppKit/GTMUILocalizer.m26
1 files changed, 13 insertions, 13 deletions
diff --git a/AppKit/GTMUILocalizer.m b/AppKit/GTMUILocalizer.m
index 8f7d467..9b78b4f 100644
--- a/AppKit/GTMUILocalizer.m
+++ b/AppKit/GTMUILocalizer.m
@@ -47,15 +47,13 @@
- (NSBundle *)bundleForOwner:(id)owner {
NSBundle *newBundle = nil;
if (owner) {
- Class class = NSClassFromString(@"NSViewController");
- if ([owner isKindOfClass:class]) {
- newBundle = [owner performSelector:@selector(nibBundle)];
- } else {
- class = [NSWindowController class];
- if ([owner isKindOfClass:class]
- && ![owner isMemberOfClass:class]) {
- newBundle = [NSBundle bundleForClass:[owner class]];
- }
+ Class class = [NSWindowController class];
+ if ([owner isKindOfClass:class] && ![owner isMemberOfClass:class]) {
+ newBundle = [NSBundle bundleForClass:[owner class]];
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+ } else if ([owner isKindOfClass:[NSViewController class]]) {
+ newBundle = [(NSViewController *)owner nibBundle];
+#endif
}
if (!newBundle) {
newBundle = [NSBundle mainBundle];
@@ -81,12 +79,14 @@
- (void)localizeObject:(id)object recursively:(BOOL)recursive {
if (object) {
- if ([object isKindOfClass:NSClassFromString(@"NSViewController")]) {
- NSView *view = [object view];
- [self localizeView:view recursively:recursive];
- } else if ([object isKindOfClass:[NSWindowController class]]) {
+ if ([object isKindOfClass:[NSWindowController class]]) {
NSWindow *window = [object window];
[self localizeWindow:window recursively:recursive];
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+ } else if ([object isKindOfClass:[NSViewController class]]) {
+ NSView *view = [object view];
+ [self localizeView:view recursively:recursive];
+#endif
} else if ([object isKindOfClass:[NSMenu class]]) {
[self localizeMenu:(NSMenu *)object recursively:recursive];
} else if ([object isKindOfClass:[NSWindow class]]) {