mirror of
				https://github.com/gilshahar7/DuplexCalendar.git
				synced 2025-11-04 07:46:18 +00:00 
			
		
		
		
	Version 1.0
This commit is contained in:
		
							
								
								
									
										5
									
								
								duplexcalendarprefs/DCPRootListController.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								duplexcalendarprefs/DCPRootListController.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
#import <Preferences/PSListController.h>
 | 
			
		||||
 | 
			
		||||
@interface DCPRootListController : PSListController
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
							
								
								
									
										40
									
								
								duplexcalendarprefs/DCPRootListController.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								duplexcalendarprefs/DCPRootListController.m
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,40 @@
 | 
			
		||||
#import <Preferences/PSSpecifier.h>
 | 
			
		||||
#include "DCPRootListController.h"
 | 
			
		||||
 | 
			
		||||
@implementation DCPRootListController
 | 
			
		||||
 | 
			
		||||
- (id)readPreferenceValue:(PSSpecifier*)specifier {
 | 
			
		||||
	NSString *path = [NSString stringWithFormat:@"/User/Library/Preferences/%@.plist", specifier.properties[@"defaults"]];
 | 
			
		||||
	NSMutableDictionary *settings = [NSMutableDictionary dictionary];
 | 
			
		||||
	[settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:path]];
 | 
			
		||||
	return (settings[specifier.properties[@"key"]]) ?: specifier.properties[@"default"];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
- (void)setPreferenceValue:(id)value specifier:(PSSpecifier*)specifier {
 | 
			
		||||
	NSString *path = [NSString stringWithFormat:@"/User/Library/Preferences/%@.plist", specifier.properties[@"defaults"]];
 | 
			
		||||
	NSMutableDictionary *settings = [NSMutableDictionary dictionary];
 | 
			
		||||
	[settings addEntriesFromDictionary:[NSDictionary dictionaryWithContentsOfFile:path]];
 | 
			
		||||
	[settings setObject:value forKey:specifier.properties[@"key"]];
 | 
			
		||||
	[settings writeToFile:path atomically:YES];
 | 
			
		||||
	CFStringRef notificationName = (CFStringRef)specifier.properties[@"PostNotification"];
 | 
			
		||||
	if (notificationName) {
 | 
			
		||||
		CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), notificationName, NULL, NULL, YES);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
- (NSArray *)specifiers {
 | 
			
		||||
	if (!_specifiers) {
 | 
			
		||||
		_specifiers = [[self loadSpecifiersFromPlistName:@"Root" target:self] retain];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return _specifiers;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
-(void)save
 | 
			
		||||
{
 | 
			
		||||
    [self.view endEditing:YES];
 | 
			
		||||
	CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), CFSTR("duplexcalendar.savepressed"), NULL, NULL, YES);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@end
 | 
			
		||||
							
								
								
									
										13
									
								
								duplexcalendarprefs/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								duplexcalendarprefs/Makefile
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
			
		||||
include $(THEOS)/makefiles/common.mk
 | 
			
		||||
 | 
			
		||||
BUNDLE_NAME = DuplexCalendarPrefs
 | 
			
		||||
DuplexCalendarPrefs_FILES = DCPRootListController.m
 | 
			
		||||
DuplexCalendarPrefs_INSTALL_PATH = /Library/PreferenceBundles
 | 
			
		||||
DuplexCalendarPrefs_FRAMEWORKS = UIKit
 | 
			
		||||
DuplexCalendarPrefs_PRIVATE_FRAMEWORKS = Preferences
 | 
			
		||||
 | 
			
		||||
include $(THEOS_MAKE_PATH)/bundle.mk
 | 
			
		||||
 | 
			
		||||
internal-stage::
 | 
			
		||||
	$(ECHO_NOTHING)mkdir -p $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences$(ECHO_END)
 | 
			
		||||
	$(ECHO_NOTHING)cp entry.plist $(THEOS_STAGING_DIR)/Library/PreferenceLoader/Preferences/DuplexCalendarPrefs.plist$(ECHO_END)
 | 
			
		||||
							
								
								
									
										24
									
								
								duplexcalendarprefs/Resources/Info.plist
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								duplexcalendarprefs/Resources/Info.plist
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 | 
			
		||||
<plist version="1.0">
 | 
			
		||||
<dict>
 | 
			
		||||
	<key>CFBundleDevelopmentRegion</key>
 | 
			
		||||
	<string>English</string>
 | 
			
		||||
	<key>CFBundleExecutable</key>
 | 
			
		||||
	<string>DuplexCalendarPrefs</string>
 | 
			
		||||
	<key>CFBundleIdentifier</key>
 | 
			
		||||
	<string>com.gilshahar7.duplexcalendarprefs</string>
 | 
			
		||||
	<key>CFBundleInfoDictionaryVersion</key>
 | 
			
		||||
	<string>6.0</string>
 | 
			
		||||
	<key>CFBundlePackageType</key>
 | 
			
		||||
	<string>BNDL</string>
 | 
			
		||||
	<key>CFBundleShortVersionString</key>
 | 
			
		||||
	<string>1.0.0</string>
 | 
			
		||||
	<key>CFBundleSignature</key>
 | 
			
		||||
	<string>????</string>
 | 
			
		||||
	<key>CFBundleVersion</key>
 | 
			
		||||
	<string>1.0</string>
 | 
			
		||||
	<key>NSPrincipalClass</key>
 | 
			
		||||
	<string>DCPRootListController</string>
 | 
			
		||||
</dict>
 | 
			
		||||
</plist>
 | 
			
		||||
							
								
								
									
										69
									
								
								duplexcalendarprefs/Resources/Root.plist
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								duplexcalendarprefs/Resources/Root.plist
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,69 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 | 
			
		||||
<plist version="1.0">
 | 
			
		||||
<dict>
 | 
			
		||||
	<key>items</key>
 | 
			
		||||
	<array>
 | 
			
		||||
		<dict>
 | 
			
		||||
			<key>cell</key>
 | 
			
		||||
			<string>PSGroupCell</string>
 | 
			
		||||
			<key>label</key>
 | 
			
		||||
			<string>DuplexCalendar's Options</string>
 | 
			
		||||
		</dict>
 | 
			
		||||
		<dict>
 | 
			
		||||
			<key>cell</key>
 | 
			
		||||
			<string>PSEditTextCell</string>
 | 
			
		||||
			<key>placeholder</key>
 | 
			
		||||
			<string>0</string>
 | 
			
		||||
			<key>bestGuess</key>
 | 
			
		||||
			<string>0</string>
 | 
			
		||||
			<key>defaults</key>
 | 
			
		||||
			<string>com.gilshahar7.duplexcalendarprefs</string>
 | 
			
		||||
			<key>key</key>
 | 
			
		||||
			<string>offsetXTextField</string>
 | 
			
		||||
			<key>label</key>
 | 
			
		||||
			<string>X Offset:</string>
 | 
			
		||||
		</dict>
 | 
			
		||||
		<dict>
 | 
			
		||||
			<key>cell</key>
 | 
			
		||||
			<string>PSEditTextCell</string>
 | 
			
		||||
			<key>placeholder</key>
 | 
			
		||||
			<string>0</string>
 | 
			
		||||
			<key>bestGuess</key>
 | 
			
		||||
			<string>0</string>
 | 
			
		||||
			<key>defaults</key>
 | 
			
		||||
			<string>com.gilshahar7.duplexcalendarprefs</string>
 | 
			
		||||
			<key>key</key>
 | 
			
		||||
			<string>offsetYTextField</string>
 | 
			
		||||
			<key>label</key>
 | 
			
		||||
			<string>Y Offset:</string>
 | 
			
		||||
		</dict>
 | 
			
		||||
		<dict>
 | 
			
		||||
			<key>cell</key>
 | 
			
		||||
			<string>PSEditTextCell</string>
 | 
			
		||||
			<key>placeholder</key>
 | 
			
		||||
			<string>16</string>
 | 
			
		||||
			<key>bestGuess</key>
 | 
			
		||||
			<string>16</string>
 | 
			
		||||
			<key>defaults</key>
 | 
			
		||||
			<string>com.gilshahar7.duplexcalendarprefs</string>
 | 
			
		||||
			<key>isDecimalPad</key>
 | 
			
		||||
			<true/>
 | 
			
		||||
			<key>key</key>
 | 
			
		||||
			<string>FontSizeTextField</string>
 | 
			
		||||
			<key>label</key>
 | 
			
		||||
			<string>Font Size:</string>
 | 
			
		||||
		</dict>
 | 
			
		||||
		<dict>
 | 
			
		||||
            <key>cell</key>
 | 
			
		||||
			<string>PSButtonCell</string>
 | 
			
		||||
            <key>label</key>
 | 
			
		||||
            <string>Save</string>
 | 
			
		||||
            <key>action</key>
 | 
			
		||||
			<string>save</string>
 | 
			
		||||
        </dict>
 | 
			
		||||
	</array>
 | 
			
		||||
	<key>title</key>
 | 
			
		||||
	<string>DuplexCalendar</string>
 | 
			
		||||
</dict>
 | 
			
		||||
</plist>
 | 
			
		||||
							
								
								
									
										21
									
								
								duplexcalendarprefs/entry.plist
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								duplexcalendarprefs/entry.plist
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,21 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 | 
			
		||||
<plist version="1.0">
 | 
			
		||||
<dict>
 | 
			
		||||
	<key>entry</key>
 | 
			
		||||
	<dict>
 | 
			
		||||
		<key>bundle</key>
 | 
			
		||||
		<string>DuplexCalendarPrefs</string>
 | 
			
		||||
		<key>cell</key>
 | 
			
		||||
		<string>PSLinkCell</string>
 | 
			
		||||
		<key>detail</key>
 | 
			
		||||
		<string>DCPRootListController</string>
 | 
			
		||||
		<key>icon</key>
 | 
			
		||||
		<string>icon.png</string>
 | 
			
		||||
		<key>isController</key>
 | 
			
		||||
		<true/>
 | 
			
		||||
		<key>label</key>
 | 
			
		||||
		<string>DuplexCalendarPrefs</string>
 | 
			
		||||
	</dict>
 | 
			
		||||
</dict>
 | 
			
		||||
</plist>
 | 
			
		||||
		Reference in New Issue
	
	Block a user