Skip to content

Commit

Permalink
(minor) Screw it, I’m tired of trying to conform.
Browse files Browse the repository at this point in the history
  • Loading branch information
ELLIOTTCABLE committed Jun 9, 2010
1 parent dce061c commit 2b0a6cb
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 34 deletions.
16 changes: 8 additions & 8 deletions Preference Pane/YRSolcounterPref.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
#import <PreferencePanes/PreferencePanes.h>


@interface YRSolcounterPref : NSPreferencePane
{
IBOutlet NSButton *extraEnabled;
@interface YRSolcounterPref: NSPreferencePane {
IBOutlet //»
NSButton *extraEnabled;
}

- (void) mainViewDidLoad;
- (IBAction) toggleExtra:(id)sender;
-(void) mainViewDidLoad;
-(IBAction) toggleExtra: (id)sender;

- (void)loadExtra:(NSString *)extraPath;
- (void)removeExtra:(NSString *)extraPath;
- (BOOL)isExtraLoaded:(NSString *)extraPath;
-(void) loadExtra: (NSString*)extraPath;
-(void) removeExtra: (NSString*)extraPath;
-(BOOL) isExtraLoaded: (NSString*)extraPath;

@end
37 changes: 16 additions & 21 deletions Preference Pane/YRSolcounterPref.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,36 +24,33 @@

@implementation YRSolcounterPref

- (void) mainViewDidLoad
{
-(void) mainViewDidLoad {
NSString *extraPath = [[self bundle] pathForResource: @"Solcounter"
ofType: @"menu"
inDirectory: @""];

if ([self isExtraLoaded:extraPath])
[extraEnabled setState:NSOnState];
if ([self isExtraLoaded: extraPath])
[extraEnabled setState: NSOnState];
}

- (IBAction)toggleExtra:(id)sender
{
-(IBAction) toggleExtra: (id)sender {
NSString *extraPath = [[self bundle] pathForResource: @"Solcounter"
ofType: @"menu"
inDirectory: @""];

if (([sender state] == NSOnState) && ![self isExtraLoaded:extraPath]) {
[self loadExtra:extraPath];
if (![self isExtraLoaded:extraPath])
[sender setState:NSOffState];
if (([sender state] == NSOnState) && ![self isExtraLoaded: extraPath]) {
[self loadExtra: extraPath];
if (![self isExtraLoaded: extraPath])
[sender setState: NSOffState];
} else //»
if (([sender state] == NSOffState) && [self isExtraLoaded:extraPath]) {
[self removeExtra:extraPath];
if ([self isExtraLoaded:extraPath])
[sender setState:NSOnState];
if (([sender state] == NSOffState) && [self isExtraLoaded: extraPath]) {
[self removeExtra: extraPath];
if ([self isExtraLoaded: extraPath])
[sender setState: NSOnState];
}
}

- (void)loadExtra:(NSString *)extraPath
{ int sleepCount;
-(void) loadExtra: (NSString*)extraPath { int sleepCount;
NSURL *extraURL = [NSURL fileURLWithPath: extraPath];
CMEAddExtra((CFURLRef)extraURL, 0);

Expand All @@ -67,7 +64,7 @@ - (void)loadExtra:(NSString *)extraPath
inDirectory: @""];

if (extraPath != crackerPath && ![self isExtraLoaded: extraPath])
[self loadExtra:crackerPath];
[self loadExtra: crackerPath];

CMEAddExtra((CFURLRef)extraURL, 0);

Expand All @@ -77,17 +74,15 @@ - (void)loadExtra:(NSString *)extraPath
usleep(sleepCount += 250000); }
}

- (void)removeExtra:(NSString *)extraPath
{ OpaqueMenuExtra *extra;
-(void) removeExtra: (NSString*)extraPath { OpaqueMenuExtra *extra;
NSString *extraID = [[NSBundle bundleWithPath: extraPath]
objectForInfoDictionaryKey: @"CFBundleIdentifier"];

if ((CMEGetExtra((CFStringRef)extraID, &extra) == 0) && extra)
CMERemoveExtra(extra);
}

- (BOOL)isExtraLoaded:(NSString *)extraPath
{ OpaqueMenuExtra *extra;
-(BOOL) isExtraLoaded: (NSString*)extraPath { OpaqueMenuExtra *extra;
NSString *extraID = [[NSBundle bundleWithPath: extraPath]
objectForInfoDictionaryKey: @"CFBundleIdentifier"];

Expand Down
2 changes: 1 addition & 1 deletion YRSolcounter.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@class YRSolcounterView;


@interface YRSolcounter : NSMenuExtra {
@interface YRSolcounter: NSMenuExtra {
IBOutlet //»
NSTextField *textField;
BundleUserDefaults *defaults;
Expand Down
7 changes: 3 additions & 4 deletions YRSolcounter.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

@implementation YRSolcounter

- (id)initWithBundle:(NSBundle *)bundle
{
-(id) initWithBundle: (NSBundle*)bundle {
if ( (self = [super initWithBundle: bundle]) == nil ) return nil;

[(defaults = [[BundleUserDefaults alloc]
Expand All @@ -35,7 +34,7 @@ - (id)initWithBundle:(NSBundle *)bundle
return self;
}

- (void)handleTimer:(NSTimer *)_
-(void) handleTimer: (NSTimer*)_
{
double date = [[NSDate date] timeIntervalSince1970];

Expand All @@ -48,7 +47,7 @@ - (void)handleTimer:(NSTimer *)_
(unsigned long long int)(date / 0.0000864) % 1000]];
}

- (void)dealloc
-(void) dealloc
{
[textField release];
[super dealloc];
Expand Down

0 comments on commit 2b0a6cb

Please sign in to comment.