Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removes dependency to NSBundle

  • Loading branch information...
commit 641000b05c8c24cdb12d9eee28fa0fb2e47d46b3 1 parent 04d1a25
@HBehrens authored
Showing with 13 additions and 22 deletions.
  1. +1 −3 StartAtLoginController.h
  2. +12 −19 StartAtLoginController.m
View
4 StartAtLoginController.h
@@ -31,9 +31,7 @@
@property (assign, nonatomic, readwrite) BOOL startAtLogin;
@property (assign, nonatomic, readwrite) BOOL enabled;
@property (copy, nonatomic, readwrite) NSString *identifier;
-@property (copy, nonatomic, readwrite) NSURL *url;
-- (id)initWithBundle:(NSBundle*)bndl;
-- (void)setBundle:(NSBundle*)bndl;
+-(id)initWithIdentifier:(NSString*)identifier;
@end
View
31 StartAtLoginController.m
@@ -26,12 +26,10 @@
@implementation StartAtLoginController
@synthesize identifier = _identifier;
-@synthesize url = _url;
#if !__has_feature(objc_arc)
- (void)dealloc {
self.identifier = nil;
- self.url = nil;
[super dealloc];
}
#endif
@@ -50,26 +48,21 @@ + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)theKey {
return automatic;
}
--(id)initWithBundle:(NSBundle*)bndl
-{
- self = [super init];
- if (self) {
- _enabled = NO;
- [self setBundle:bndl];
-
- // this method call initializes _enabled to the correct value as a side effect.
- [self startAtLogin];
-#if !defined(NDEBUG)
- NSLog(@"Launcher '%@' %@ configured to start at login",
- self.identifier, (_enabled ? @"is" : @"is not"));
-#endif
+-(id)initWithIdentifier:(NSString*)identifier {
+ self = [self init];
+ if(self) {
+ self.identifier = identifier;
}
return self;
}
-- (void)setBundle:(NSBundle*)bndl {
- self.identifier = [bndl bundleIdentifier];
- self.url = [bndl bundleURL];
+-(void)setIdentifier:(NSString *)identifier {
+ _identifier = identifier;
+ [self startAtLogin];
+#if !defined(NDEBUG)
+ NSLog(@"Launcher '%@' %@ configured to start at login",
+ self.identifier, (_enabled ? @"is" : @"is not"));
+#endif
}
- (BOOL)startAtLogin {
@@ -101,7 +94,7 @@ - (BOOL)startAtLogin {
}
- (void)setStartAtLogin:(BOOL)flag {
- if (!_identifier||!_url)
+ if (!_identifier)
return;
[self willChangeValueForKey:@"startAtLogin"];
Please sign in to comment.
Something went wrong with that request. Please try again.