-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppDelegate.m
81 lines (61 loc) · 2.36 KB
/
AppDelegate.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#import "AppDelegate.h"
#import "LogManager.h"
@interface AppDelegate () <NSApplicationDelegate>
@property (nonatomic, assign, readwrite) IBOutlet NSPanel * panel;
@property (retain) IBOutlet NSTextField *zfsStatus;
@end
@implementation AppDelegate
@synthesize zfsStatus;
- (void)awakeFromNib
{
NSLog(@"Checking ZFS");
zfsStatus.stringValue = @"Checking ZFS";
[NSTimer scheduledTimerWithTimeInterval:5.0f
target:self selector:@selector(updateStatus:) userInfo:nil repeats:YES];
}
- (void)updateStatus:(NSTimer *)timer
{
NSString *pathToFile = @"/Users/.zfsloadcheck";
BOOL isDir = NO;
BOOL isFile = [[NSFileManager defaultManager] fileExistsAtPath:pathToFile isDirectory:&isDir];
if(isFile)
{
NSLog(@"ZFS Mounted");
zfsStatus.stringValue = @"ZFS Mounted";
}
else
{
NSLog(@"ZFS NOT Mounted");
zfsStatus.stringValue = @"ZFS Not Mounted!";
}
}
- (void)applicationDidFinishLaunching:(NSNotification *)note
{
#pragma unused(note)
[[LogManager sharedManager] logWithFormat:@"Did finish launching begin"];
assert(self.panel != nil);
// We have to call -[NSWindow setCanBecomeVisibleWithoutLogin:] to let the
// system know that we're not accidentally trying to display a window
// pre-login.
[self.panel setCanBecomeVisibleWithoutLogin:YES];
// Our application is a UI element which never activates, so we want our
// panel to show regardless.
[self.panel setHidesOnDeactivate:NO];
// Due to a problem with the relationship between the UI frameworks and the
// window server <rdar://problem/5136400>, -[NSWindow orderFront:] is not
// sufficient to show the window. We have to use -[NSWindow orderFrontRegardless].
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"ForceOrderFront"]) {
[[LogManager sharedManager] logWithFormat:@"Showing window with extreme prejudice"];
[self.panel orderFrontRegardless];
} else {
[[LogManager sharedManager] logWithFormat:@"Showing window normally"];
[self.panel orderFront:self];
}
[[LogManager sharedManager] logWithFormat:@"Did finish launching end"];
}
- (void)applicationWillTerminate:(NSNotification *)note
{
#pragma unused(note)
[[LogManager sharedManager] logWithFormat:@"Will terminate"];
}
@end