Ignore:
Timestamp:
01/30/03 05:31:29 (17 years ago)
Author:
Nicholas Riley
Message:

ICeCoffEE 1.3b2 plus some changes for 1.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ICeCoffEE/ICeCoffEE/ICeCoffEEController.m

    r72 r74  
    1313#import <ApplicationEnhancer/ApplicationEnhancer.h>
    1414#import "ICeCoffEEController.h"
     15#import "ICeCoffEEShared.h"
    1516
    1617// Just a handy macro for localized strings from our bundle; unused in this project.
     
    5152// This method should return an NSView to be loaded into APE Manager preference
    5253// area.
    53 - (NSView*)mainView
     54- (NSView *)mainView
    5455{
    55     return [window contentView];                        // we return our window's contentView
     56    return [window contentView];
    5657}
     58
     59#define ICP(pref) (NSString *)kIC ## pref
    5760
    5861// This method is called once our nib file is loaded (we load it in the init method)
    5962- (void)awakeFromNib
    60 { 
    61     prefs = [[CFPreferencesWrapper_ICeCoffEE preferencesWithApplication:@"net.sabi.ICeCoffEE"] retain];
    62                                                         // load the preferences for our APE module
     63{
     64    // load the preferences for our APE module
     65    prefs = [[CFPreferencesWrapper_ICeCoffEE preferencesWithApplication: (NSString *)kICBundleIdentifier] retain];
    6366
    64     // do other inits here
     67    [commandClickEnabled setState: [prefs boolForKey: ICP(CommandClickEnabled)]];
     68    [self commandClickEnabled: nil];
     69    [textBlinkEnabled setState: [prefs boolForKey: ICP(TextBlinkEnabled)]];
     70    [self textBlinkEnabled: nil];
     71    int blink = [prefs integerForKey: ICP(TextBlinkCount)];
     72    if (blink != -1 && (blink = [textBlinkCount indexOfItemWithTag: blink]) != -1)
     73        [textBlinkCount selectItemAtIndex: blink];
     74    [servicesInContextualMenu setState: [prefs boolForKey: ICP(ServicesInContextualMenu)]];
     75    [servicesInMenuBar setState: [prefs boolForKey: ICP(ServicesInMenuBar)]];
     76    [errorSoundEnabled setState: [prefs boolForKey: ICP(ErrorSoundEnabled)]];
     77    [errorDialogEnabled setState: [prefs boolForKey: ICP(ErrorDialogEnabled)]];
    6578}
    6679
     
    7790    return [_bundle retain];
    7891}
     92
     93- (void)prefsChanged;
     94{
     95    [prefs synchronize];
     96    APEMessageBroadcast(kICBundleIdentifier, kICPreferencesChanged, NULL);
     97}
     98
     99- (IBAction)commandClickEnabled:(NSButton *)sender;
     100{
     101    BOOL enabled = [commandClickEnabled state];
     102    if (sender != nil) {
     103        [prefs setBool: enabled forKey: ICP(CommandClickEnabled)];
     104        [self prefsChanged];
     105    }
     106    [textBlinkEnabled setEnabled: enabled];
     107    [textBlinkCount setEnabled: enabled ? [textBlinkEnabled state] : NO];
     108}
     109- (IBAction)textBlinkEnabled:(NSButton *)sender;
     110{
     111    BOOL enabled = [textBlinkEnabled state];
     112    if (sender != nil) {
     113        [prefs setBool: enabled forKey: ICP(TextBlinkEnabled)];
     114        [self prefsChanged];
     115    }
     116    [textBlinkCount setEnabled: enabled];
     117}
     118- (IBAction)textBlinkCount:(NSPopUpButton *)sender;
     119{
     120    [prefs setInteger: [[textBlinkCount selectedItem] tag] forKey: ICP(TextBlinkCount)];
     121    [self prefsChanged];
     122}
     123- (IBAction)servicesInContextualMenu:(NSButton *)sender;
     124{
     125    [prefs setBool: [servicesInContextualMenu state] forKey: ICP(ServicesInContextualMenu)];
     126    [self prefsChanged];
     127}
     128- (IBAction)servicesInMenuBar:(NSButton *)sender;
     129{
     130    [prefs setBool: [servicesInMenuBar state] forKey: ICP(ServicesInMenuBar)];
     131    [self prefsChanged];
     132}
     133- (IBAction)errorSoundEnabled:(NSButton *)sender;
     134{
     135    [prefs setBool: [errorSoundEnabled state] forKey: ICP(ErrorSoundEnabled)];
     136    [self prefsChanged];
     137}
     138- (IBAction)errorDialogEnabled:(NSButton *)sender;
     139{
     140    [prefs setBool: [errorDialogEnabled state] forKey: ICP(ErrorDialogEnabled)];
     141    [self prefsChanged];
     142}
     143
    79144@end
Note: See TracChangeset for help on using the changeset viewer.