forked from pieter/gitx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PBPrefsWindowController.m
62 lines (50 loc) · 1.86 KB
/
PBPrefsWindowController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// PBPrefsWindowController.m
// GitX
//
// Created by Christian Jacobsen on 02/10/2008.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "PBPrefsWindowController.h"
#import "PBGitRepository.h"
@implementation PBPrefsWindowController
# pragma mark DBPrefsWindowController overrides
- (void)setupToolbar
{
// GENERAL
[self addView:generalPrefsView label:@"General" image:[NSImage imageNamed:@"gitx"]];
// INTERGRATION
[self addView:integrationPrefsView label:@"Integration" image:[NSImage imageNamed:NSImageNameNetwork]];
// UPDATES
[self addView:updatesPrefsView label:@"Updates"];
}
#pragma mark -
#pragma mark Delegate methods
- (IBAction) checkGitValidity: sender
{
// FIXME: This does not work reliably, probably due to: http://www.cocoabuilder.com/archive/message/cocoa/2008/9/10/217850
//[badGitPathIcon setHidden:[PBGitRepository validateGit:[[NSValueTransformer valueTransformerForName:@"PBNSURLPathUserDefaultsTransfomer"] reverseTransformedValue:[gitPathController URL]]]];
}
- (IBAction) resetGitPath: sender
{
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"gitExecutable"];
}
- (void)pathCell:(NSPathCell *)pathCell willDisplayOpenPanel:(NSOpenPanel *)openPanel
{
[openPanel setCanChooseDirectories:NO];
[openPanel setCanChooseFiles:YES];
[openPanel setAllowsMultipleSelection:NO];
[openPanel setTreatsFilePackagesAsDirectories:YES];
[openPanel setAccessoryView:gitPathOpenAccessory];
//[[openPanel _navView] setShowsHiddenFiles:YES];
gitPathOpenPanel = openPanel;
}
#pragma mark -
#pragma mark Git Path open panel actions
- (IBAction) showHideAllFiles: sender
{
/* FIXME: This uses undocumented OpenPanel features to show hidden files! */
NSNumber *showHidden = [NSNumber numberWithBool:[sender state] == NSOnState];
[[gitPathOpenPanel valueForKey:@"_navView"] setValue:showHidden forKey:@"showsHiddenFiles"];
}
@end