aboutsummaryrefslogtreecommitdiffstats
path: root/Low Battery Yup/AppDelegate.m
diff options
context:
space:
mode:
Diffstat (limited to 'Low Battery Yup/AppDelegate.m')
-rw-r--r--Low Battery Yup/AppDelegate.m21
1 files changed, 21 insertions, 0 deletions
diff --git a/Low Battery Yup/AppDelegate.m b/Low Battery Yup/AppDelegate.m
index 1c77f41..365b1bf 100644
--- a/Low Battery Yup/AppDelegate.m
+++ b/Low Battery Yup/AppDelegate.m
@@ -11,14 +11,25 @@
@implementation AppDelegate
+- (id)init
+{
+ self = [super init];
+ if (self) {
+ _launchagent = [[LaunchAgentManager alloc] init];
+ }
+ return self;
+}
+
- (void)dealloc
{
+ [_launchagent release];
[super dealloc];
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[self initializeShortcutView];
+ [self performStartAtLogin:self];
}
- (void)initializeShortcutView
@@ -33,6 +44,16 @@
}
}
+- (IBAction)performStartAtLogin:(id)sender
+{
+ if ([_start_at_login state] == NSOnState) {
+ [_launchagent install];
+ }
+ else {
+ [_launchagent uninstall];
+ }
+}
+
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication
{
return YES;