From c3b5319fedfb4daac0f0bd68651adf2dc633eedf Mon Sep 17 00:00:00 2001 From: David Noblet Date: Sun, 17 Sep 2006 14:12:18 -0700 Subject: [PATCH] Dock Autohide Module This commit adds a new module that adds the ability for FMN to store/restore the "autohide" status of the Dock. NOTE: Right now, the module does not have a corresponding user-interface component, so it is always enabled. darcs-hash:20060917211218-3181a-5465d085477f0761e92801068875debcc680be7c.gz --- DockModule-Info.plist | 22 +++++ DockRestorable.h | 19 ++++ DockRestorable.m | 148 ++++++++++++++++++++++++++++++ FMN.m | 25 +++++- FMN.xcodeproj/project.pbxproj | 165 +++++++++++++++++++++++++++++++++- FMNDockModule.h | 16 ++++ FMNDockModule.m | 23 +++++ FMNRestorable.h | 6 ++ FMNWindowOrientation.m | 5 ++ X11Restorable.m | 5 ++ 10 files changed, 432 insertions(+), 2 deletions(-) create mode 100644 DockModule-Info.plist create mode 100644 DockRestorable.h create mode 100644 DockRestorable.m create mode 100644 FMNDockModule.h create mode 100644 FMNDockModule.m diff --git a/DockModule-Info.plist b/DockModule-Info.plist new file mode 100644 index 0000000..0b76877 --- /dev/null +++ b/DockModule-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.DockModule + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSPrincipalClass + FMNDockModule + + diff --git a/DockRestorable.h b/DockRestorable.h new file mode 100644 index 0000000..aa9c572 --- /dev/null +++ b/DockRestorable.h @@ -0,0 +1,19 @@ +// +// DockRestorable.h +// FMN +// +// Created by David Noblet on 9/16/06. +// Copyright 2006 __MyCompanyName__. All rights reserved. +// + +#import +#import "FMNRestorable.h" + +@interface DockRestorable : NSObject { + //NSDictionary* dockPrefs; + Boolean autohidePref; +} + +- (id) initWithCurrent; + +@end diff --git a/DockRestorable.m b/DockRestorable.m new file mode 100644 index 0000000..16a54ab --- /dev/null +++ b/DockRestorable.m @@ -0,0 +1,148 @@ +// +// DockRestorable.m +// FMN +// +// Created by David Noblet on 9/16/06. +// Copyright 2006 __MyCompanyName__. All rights reserved. +// + +#import "DockRestorable.h" + +#define DOCK CFSTR("com.apple.dock") +#define USER kCFPreferencesCurrentUser +#define HOST kCFPreferencesAnyHost +#define AUTOHIDE CFSTR("autohide") + +@implementation DockRestorable + +/*- (void) logDockPrefs +{ + NSEnumerator *enumerator = [dockPrefs keyEnumerator]; + id key; + + while ((key = [enumerator nextObject])) + { + id value = [dockPrefs valueForKey: key]; + NSLog(@"@@@@@@@@@@ Key: '%@'; Value: '%@' @@@@@@@@@@@@@", key, value); + } +}*/ + ++ (Boolean) getDockAutohide +{ + Boolean success; + return CFPreferencesGetAppBooleanValue ( + AUTOHIDE, + DOCK, + &success + ) && success; +} + +- (id) initWithCurrent +{ + self = [super init]; + if(!self) + return nil; + + NSLog(@"Storing Dock Preferences"); + + CFPreferencesAppSynchronize(DOCK); + + /*NSArray* keys; + keys = (NSArray*) CFPreferencesCopyKeyList ( + DOCK, + USER, + HOST + ); + + dockPrefs = (NSDictionary*) CFPreferencesCopyMultiple ( + (CFArrayRef) keys, + DOCK, + USER, + HOST + ); + [keys release];*/ + + autohidePref = [DockRestorable getDockAutohide]; + + NSLog(@"Storing Dock Autohide Preference: %d",autohidePref); + + //[self logDockPrefs]; + + return self; +} + +- (void) restore +{ + NSLog(@"Restoring Dock Preferences"); + /*[self logDockPrefs]; + + CFPreferencesSetMultiple ( + (CFDictionaryRef) dockPrefs, + nil, + DOCK, + USER, + HOST + );*/ + + NSLog(@"Restoring Dock Autohide Preference: %d",autohidePref); + + if([DockRestorable getDockAutohide] != autohidePref) + { + CFPreferencesSetValue( + AUTOHIDE, + autohidePref ? kCFBooleanTrue : kCFBooleanFalse, + DOCK, + USER, + HOST + ); + + CFPreferencesAppSynchronize(DOCK); + + /*CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter(); + CFNotificationCenterPostNotification ( + center, + CFSTR("com.apple.dock.prefchanged"), + DOCK, + nil, true + );*/ + + /* + tell application "System Events" + keystroke "d" using {command down, option down} + end tell + */ + + NSString *s = [NSString stringWithFormat: + @"tell application \"System Events\"\n" + @"\tkeystroke \"d\" using {command down, option down}\n" + @"end tell\n"]; + NSAppleScript *scriptObj = [[NSAppleScript alloc] initWithSource:s]; + if (scriptObj) + { + NSDictionary *errInfo; + NSAppleEventDescriptor *aed = [scriptObj executeAndReturnError:&errInfo]; + [scriptObj release]; + if (!aed) + { + NSLog(@"Got Error in deleteLoginItem"); + } + } + } +} + +- (int) priority +{ + // We want this to be restored before the window positions and sizes + return kRestorableDefaultPriority+1; +} + +- (void) dealloc +{ + /*if(dockPrefs) + { + [dockPrefs release]; + }*/ + [super dealloc]; +} + +@end diff --git a/FMN.m b/FMN.m index 1a17bc7..baab4cd 100644 --- a/FMN.m +++ b/FMN.m @@ -65,6 +65,26 @@ - (void) handlePreDisplayConfigurationChange -[startDate timeIntervalSinceNow]); } +int restorableCompare(id a, id b, void* c) +{ + FMNRestorableRef r1 = (FMNRestorableRef)a; + FMNRestorableRef r2 = (FMNRestorableRef)b; + + int p1 = [r1 priority]; + int p2 = [r2 priority]; + + if(p1 > p2) + { + return NSOrderedAscending; + } + else if (p1 == p2) + { + return NSOrderedSame; + } + + return NSOrderedDescending; +} + - (void) handlePostDisplayConfigurationChange { NSLog(@"======== Screen configuration changed! ========"); @@ -77,7 +97,7 @@ - (void) handlePostDisplayConfigurationChange [[CGDisplayConfiguration configWithCurrent] retain]; // Try to retrieve the restorables associated with the new config - NSArray* restorables = + NSMutableArray* restorables = [screenConfigurations objectForKey : currentDisplayConfiguration]; if (!restorables) @@ -87,6 +107,9 @@ - (void) handlePostDisplayConfigurationChange return; } + // Sort the restorables, according to priority + [restorables sortUsingFunction:restorableCompare context:nil]; + NSEnumerator* enumerator = [restorables objectEnumerator]; FMNRestorableRef restorable; while (restorable = [enumerator nextObject]) diff --git a/FMN.xcodeproj/project.pbxproj b/FMN.xcodeproj/project.pbxproj index e30207a..37caeda 100644 --- a/FMN.xcodeproj/project.pbxproj +++ b/FMN.xcodeproj/project.pbxproj @@ -46,6 +46,10 @@ 0E5742E60AA4085B00A42972 /* miniFlower.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 0E5742E50AA4085B00A42972 /* miniFlower.tiff */; }; 0E57434A0AA4C2B400A42972 /* Flower.icns in Resources */ = {isa = PBXBuildFile; fileRef = 0E5743490AA4C2B400A42972 /* Flower.icns */; }; 0E57434B0AA4C2B400A42972 /* Flower.icns in Resources */ = {isa = PBXBuildFile; fileRef = 0E5743490AA4C2B400A42972 /* Flower.icns */; }; + 660640E70ABD233800D7D5D7 /* FMNDockModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 660640E60ABD233800D7D5D7 /* FMNDockModule.m */; }; + 660640ED0ABD23A800D7D5D7 /* DockModule.plugin in Copy Files into Forget-Me-Not.app */ = {isa = PBXBuildFile; fileRef = 660640D90ABD227D00D7D5D7 /* DockModule.plugin */; }; + 660641140ABD273600D7D5D7 /* DockRestorable.h in Copy Files into Forget-Me-Not.app */ = {isa = PBXBuildFile; fileRef = 660641120ABD273600D7D5D7 /* DockRestorable.h */; }; + 660641150ABD273600D7D5D7 /* DockRestorable.m in Sources */ = {isa = PBXBuildFile; fileRef = 660641130ABD273600D7D5D7 /* DockRestorable.m */; }; 6613E2B80A676588003DA5B2 /* FMN.m in Sources */ = {isa = PBXBuildFile; fileRef = 6613E2B70A676588003DA5B2 /* FMN.m */; }; 6629992F0A6E0386005757CB /* CGDisplay.m in Sources */ = {isa = PBXBuildFile; fileRef = 6629992E0A6E0386005757CB /* CGDisplay.m */; }; 66299A150A6E14A4005757CB /* CGDisplayConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 66299A140A6E14A4005757CB /* CGDisplayConfiguration.m */; }; @@ -125,11 +129,25 @@ remoteGlobalIDString = 0E13E42B0A9A7DDD0093153D; remoteInfo = "Forget-Me-Not Prefpane"; }; + 660640F40ABD23C900D7D5D7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8D1107260486CEB800E47090 /* Forget-Me-Not App */; + remoteInfo = "Forget-Me-Not App"; + }; + 660641840ABD320F00D7D5D7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 660640D80ABD227D00D7D5D7 /* DockModule */; + remoteInfo = DockModule; + }; 669ED0840ABD0DC3007EF09D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; proxyType = 1; - remoteGlobalIDString = 66D404800ABCE52B0014F0F4 /* AutolaunchPrefpaneModule */; + remoteGlobalIDString = 66D404800ABCE52B0014F0F4; remoteInfo = AutolaunchPrefpaneModule; }; 66D404860ABCE53C0014F0F4 /* PBXContainerItemProxy */ = { @@ -164,6 +182,18 @@ name = "Copy into Forget-Me-Not.app"; runOnlyForDeploymentPostprocessing = 0; }; + 660640EA0ABD237F00D7D5D7 /* Copy Files into Forget-Me-Not.app */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "Forget-Me-Not.app/Contents/PlugIns"; + dstSubfolderSpec = 16; + files = ( + 660640ED0ABD23A800D7D5D7 /* DockModule.plugin in Copy Files into Forget-Me-Not.app */, + 660641140ABD273600D7D5D7 /* DockRestorable.h in Copy Files into Forget-Me-Not.app */, + ); + name = "Copy Files into Forget-Me-Not.app"; + runOnlyForDeploymentPostprocessing = 0; + }; 66D4048A0ABCE59F0014F0F4 /* Copy into Forget-Me-Not.prefpane */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -222,6 +252,12 @@ 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* FMN_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMN_Prefix.pch; sourceTree = ""; }; + 660640D90ABD227D00D7D5D7 /* DockModule.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DockModule.plugin; sourceTree = BUILT_PRODUCTS_DIR; }; + 660640DA0ABD227D00D7D5D7 /* DockModule-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "DockModule-Info.plist"; sourceTree = ""; }; + 660640E50ABD233800D7D5D7 /* FMNDockModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMNDockModule.h; sourceTree = ""; }; + 660640E60ABD233800D7D5D7 /* FMNDockModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMNDockModule.m; sourceTree = ""; }; + 660641120ABD273600D7D5D7 /* DockRestorable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DockRestorable.h; sourceTree = ""; }; + 660641130ABD273600D7D5D7 /* DockRestorable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DockRestorable.m; sourceTree = ""; }; 6613E2B60A676588003DA5B2 /* FMN.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMN.h; sourceTree = ""; }; 6613E2B70A676588003DA5B2 /* FMN.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMN.m; sourceTree = ""; }; 662998980A6DE369005757CB /* FMNWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMNWindow.h; sourceTree = ""; }; @@ -270,6 +306,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 660640D70ABD227D00D7D5D7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 66D4047F0ABCE52B0014F0F4 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -294,6 +337,7 @@ 66D404970ABCE62E0014F0F4 /* Autolaunch Prefpane Module */, 0E13E37D0A9A545D0093153D /* AX Module */, 0E13E37C0A9A54450093153D /* X11 Module */, + 660640DF0ABD22A700D7D5D7 /* Dock Module */, 6629992D0A6E0386005757CB /* CGDisplay.h */, 6629992E0A6E0386005757CB /* CGDisplay.m */, 66299A130A6E14A4005757CB /* CGDisplayConfiguration.h */, @@ -385,6 +429,7 @@ 0E4DE3CB0A9BB92C001C9EEF /* X11Module.plugin */, 0E4DE4A50A9BCADA001C9EEF /* AXModule.plugin */, 66D404810ABCE52B0014F0F4 /* AutolaunchPrefpaneModule.plugin */, + 660640D90ABD227D00D7D5D7 /* DockModule.plugin */, ); name = Products; sourceTree = ""; @@ -438,6 +483,18 @@ name = Frameworks; sourceTree = ""; }; + 660640DF0ABD22A700D7D5D7 /* Dock Module */ = { + isa = PBXGroup; + children = ( + 660640DA0ABD227D00D7D5D7 /* DockModule-Info.plist */, + 660640E50ABD233800D7D5D7 /* FMNDockModule.h */, + 660640E60ABD233800D7D5D7 /* FMNDockModule.m */, + 660641120ABD273600D7D5D7 /* DockRestorable.h */, + 660641130ABD273600D7D5D7 /* DockRestorable.m */, + ); + name = "Dock Module"; + sourceTree = ""; + }; 66299A1E0A6E14B5005757CB /* Protocols */ = { isa = PBXGroup; children = ( @@ -490,6 +547,7 @@ dependencies = ( 0E4DE54A0A9BD1CC001C9EEF /* PBXTargetDependency */, 0E4DE5480A9BD1CC001C9EEF /* PBXTargetDependency */, + 660641850ABD320F00D7D5D7 /* PBXTargetDependency */, 0E13E4320A9A7DE50093153D /* PBXTargetDependency */, ); name = "Forget-Me-Not Prefpane"; @@ -535,6 +593,25 @@ productReference = 0E4DE4A50A9BCADA001C9EEF /* AXModule.plugin */; productType = "com.apple.product-type.bundle"; }; + 660640D80ABD227D00D7D5D7 /* DockModule */ = { + isa = PBXNativeTarget; + buildConfigurationList = 660640DB0ABD227F00D7D5D7 /* Build configuration list for PBXNativeTarget "DockModule" */; + buildPhases = ( + 660640D50ABD227D00D7D5D7 /* Resources */, + 660640D60ABD227D00D7D5D7 /* Sources */, + 660640D70ABD227D00D7D5D7 /* Frameworks */, + 660640EA0ABD237F00D7D5D7 /* Copy Files into Forget-Me-Not.app */, + ); + buildRules = ( + ); + dependencies = ( + 660640F50ABD23C900D7D5D7 /* PBXTargetDependency */, + ); + name = DockModule; + productName = DockModule; + productReference = 660640D90ABD227D00D7D5D7 /* DockModule.plugin */; + productType = "com.apple.product-type.bundle"; + }; 66D404800ABCE52B0014F0F4 /* AutolaunchPrefpaneModule */ = { isa = PBXNativeTarget; buildConfigurationList = 66D404830ABCE52B0014F0F4 /* Build configuration list for PBXNativeTarget "AutolaunchPrefpaneModule" */; @@ -585,6 +662,7 @@ 8D1107260486CEB800E47090 /* Forget-Me-Not App */, 0E4DE4A40A9BCADA001C9EEF /* AXModule */, 0E4DE3CA0A9BB92C001C9EEF /* X11Module */, + 660640D80ABD227D00D7D5D7 /* DockModule */, 0E13E42B0A9A7DDD0093153D /* Forget-Me-Not Prefpane */, 66D404800ABCE52B0014F0F4 /* AutolaunchPrefpaneModule */, 0EF04FA40AAEA3B70028356D /* Package FMN */, @@ -622,6 +700,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 660640D50ABD227D00D7D5D7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 66D4047D0ABCE52B0014F0F4 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -702,6 +787,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 660640D60ABD227D00D7D5D7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 660640E70ABD233800D7D5D7 /* FMNDockModule.m in Sources */, + 660641150ABD273600D7D5D7 /* DockRestorable.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 66D4047E0ABCE52B0014F0F4 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -771,6 +865,16 @@ target = 0E13E42B0A9A7DDD0093153D /* Forget-Me-Not Prefpane */; targetProxy = 0EF04FAB0AAEA3D40028356D /* PBXContainerItemProxy */; }; + 660640F50ABD23C900D7D5D7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8D1107260486CEB800E47090 /* Forget-Me-Not App */; + targetProxy = 660640F40ABD23C900D7D5D7 /* PBXContainerItemProxy */; + }; + 660641850ABD320F00D7D5D7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 660640D80ABD227D00D7D5D7 /* DockModule */; + targetProxy = 660641840ABD320F00D7D5D7 /* PBXContainerItemProxy */; + }; 669ED0850ABD0DC3007EF09D /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 66D404800ABCE52B0014F0F4 /* AutolaunchPrefpaneModule */; @@ -1015,6 +1119,56 @@ }; name = Release; }; + 660640DC0ABD227F00D7D5D7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "DockModule-Info.plist"; + INSTALL_PATH = "$(HOME)/Library/Bundles"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DockModule; + WRAPPER_EXTENSION = plugin; + ZERO_LINK = YES; + }; + name = Debug; + }; + 660640DD0ABD227F00D7D5D7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "DockModule-Info.plist"; + INSTALL_PATH = "$(HOME)/Library/Bundles"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DockModule; + WRAPPER_EXTENSION = plugin; + ZERO_LINK = NO; + }; + name = Release; + }; 66D404840ABCE52B0014F0F4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1179,6 +1333,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 660640DB0ABD227F00D7D5D7 /* Build configuration list for PBXNativeTarget "DockModule" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 660640DC0ABD227F00D7D5D7 /* Debug */, + 660640DD0ABD227F00D7D5D7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 66D404830ABCE52B0014F0F4 /* Build configuration list for PBXNativeTarget "AutolaunchPrefpaneModule" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/FMNDockModule.h b/FMNDockModule.h new file mode 100644 index 0000000..7f26bd8 --- /dev/null +++ b/FMNDockModule.h @@ -0,0 +1,16 @@ +// +// FMNDockModule.h +// FMN +// +// Created by David Noblet on 9/16/06. +// Copyright 2006 __MyCompanyName__. All rights reserved. +// + +#import +#import "FMNModule.h" + +@interface FMNDockModule : NSObject { + +} + +@end diff --git a/FMNDockModule.m b/FMNDockModule.m new file mode 100644 index 0000000..2cf459e --- /dev/null +++ b/FMNDockModule.m @@ -0,0 +1,23 @@ +// +// FMNDockModule.m +// FMN +// +// Created by David Noblet on 9/16/06. +// Copyright 2006 __MyCompanyName__. All rights reserved. +// + +#import "FMNDockModule.h" +#import "DockRestorable.h" + +@implementation FMNDockModule + +- (NSArray *) getRestorables +{ + NSMutableArray* dockRestorables = [NSMutableArray arrayWithCapacity : 1]; + DockRestorable* dockPrefs = [[DockRestorable alloc] initWithCurrent]; + [dockRestorables addObject:[dockPrefs autorelease]]; + + return dockRestorables; +} + +@end diff --git a/FMNRestorable.h b/FMNRestorable.h index 7f19a21..1a19847 100644 --- a/FMNRestorable.h +++ b/FMNRestorable.h @@ -9,6 +9,11 @@ #import +enum +{ + kRestorableDefaultPriority = 0 +}; + /* * This protocol represents the class of objects that can be restored after * a display configuration change. @@ -16,6 +21,7 @@ @protocol FMNRestorable - (void) restore; +- (int) priority; @end diff --git a/FMNWindowOrientation.m b/FMNWindowOrientation.m index ae8a41e..71e95dd 100644 --- a/FMNWindowOrientation.m +++ b/FMNWindowOrientation.m @@ -43,6 +43,11 @@ - (void) restore NSLog(@"Restored %@", window); } +- (int) priority +{ + return kRestorableDefaultPriority; +} + - (void) dealloc { [window release]; diff --git a/X11Restorable.m b/X11Restorable.m index a71dfb4..6092bff 100644 --- a/X11Restorable.m +++ b/X11Restorable.m @@ -93,4 +93,9 @@ - (void) restore } } +- (int) priority +{ + return kRestorableDefaultPriority; +} + @end