#require 'RubyFrictionlessAppDelegate' class GeneralPreferences < OSX::NSObject attr_accessor :identifier,:mainView,:label,:icon,:category,:appDelegate def initWithController_appDelegate(controller,appDelegate) @label="General" @category="Frictionless" @identifier="General" @icon= NSImage.imageNamed("Frictionless") @appDelegate=appDelegate controller.addPane_withIdentifier(self, @identifier) end def mainView NSBundle.loadNibNamed_owner("GeneralPreferences",self) unless @mainView @mainView end def GeneralPreferences.defaultValues defaults = { "dueColor" => NSArchiver.archivedDataWithRootObject(NSColor.redColor.blendedColorWithFraction_ofColor(0.5,NSColor.blackColor)), "beforeStartColor" => NSArchiver.archivedDataWithRootObject(NSColor.lightGrayColor), "nextColor" => NSArchiver.archivedDataWithRootObject(NSColor.purpleColor.blendedColorWithFraction_ofColor(0.5,NSColor.blackColor)), "doneColor" => NSArchiver.archivedDataWithRootObject(NSColor.greenColor.blendedColorWithFraction_ofColor(0.5,NSColor.blackColor)), "UIColor" => NSArchiver.archivedDataWithRootObject(NSColor.orangeColor.blendedColorWithFraction_ofColor(0.1,NSColor.blackColor)), "IColor" => NSArchiver.archivedDataWithRootObject(NSColor.blueColor.blendedColorWithFraction_ofColor(0.25,NSColor.blackColor)), "UColor" => NSArchiver.archivedDataWithRootObject(NSColor.yellowColor.blendedColorWithFraction_ofColor(0.25,NSColor.blackColor)), "todayColor" => NSArchiver.archivedDataWithRootObject(NSColor.alternateSelectedControlColor), } defaults end def GeneralPreferences.registerDefaults dc=NSUserDefaultsController.sharedUserDefaultsController iv= dc.initialValues iv ={} unless iv newIV = defaultValues.merge(iv) dc.setInitialValues(newIV) Action.loadDefaults end GeneralPreferences.registerDefaults def willUnselect Action.loadDefaults return 1 end end