diff --git a/prefs/Resources/Root.plist b/prefs/Resources/Root.plist index 7428935..c8d87e2 100644 --- a/prefs/Resources/Root.plist +++ b/prefs/Resources/Root.plist @@ -8,10 +8,32 @@ cell PSGroupCell footerText - To enable/disable, restart the app. + Fully enable/disable the tweak. label Enabled + + PostNotification + com.lint.undelete.prefs.changed + cell + PSSwitchCell + default + + defaults + com.lint.undelete.prefs + key + isEnabled + label + Enabled + + + cell + PSGroupCell + label + Enabled Applications + footerText + To enable/disable, restart the app. + PostNotification com.lint.undelete.prefs.changed @@ -25,6 +47,10 @@ isAlienBlueEnabled label Enable Alien Blue + hasIcon + + icon + app_icons/AlienBlue.png PostNotification @@ -39,6 +65,10 @@ isAntennaEnabled label Enable Antenna + hasIcon + + icon + app_icons/Antenna.png PostNotification @@ -53,6 +83,10 @@ isApolloEnabled label Enable Apollo + hasIcon + + icon + app_icons/Apollo.png PostNotification @@ -67,6 +101,10 @@ isBaconReaderEnabled label Enable BaconReader + hasIcon + + icon + app_icons/BaconReader.png PostNotification @@ -81,6 +119,10 @@ isBeamEnabled label Enable Beam + hasIcon + + icon + app_icons/Beam.png PostNotification @@ -95,6 +137,10 @@ isNarwhalEnabled label Enable Narwhal + hasIcon + + icon + app_icons/Narwhal.png PostNotification @@ -109,6 +155,10 @@ isRedditEnabled label Enable Reddit + hasIcon + + icon + app_icons/Reddit.png PostNotification @@ -123,6 +173,10 @@ isSlideEnabled label Enable Slide + hasIcon + + icon + app_icons/Slide.png cell diff --git a/prefs/Resources/app_icons/AlienBlue.png b/prefs/Resources/app_icons/AlienBlue.png new file mode 100644 index 0000000..a12246d Binary files /dev/null and b/prefs/Resources/app_icons/AlienBlue.png differ diff --git a/prefs/Resources/app_icons/AlienBlue@2x.png b/prefs/Resources/app_icons/AlienBlue@2x.png new file mode 100644 index 0000000..abc0fed Binary files /dev/null and b/prefs/Resources/app_icons/AlienBlue@2x.png differ diff --git a/prefs/Resources/app_icons/AlienBlue@3x.png b/prefs/Resources/app_icons/AlienBlue@3x.png new file mode 100644 index 0000000..362b23b Binary files /dev/null and b/prefs/Resources/app_icons/AlienBlue@3x.png differ diff --git a/prefs/Resources/app_icons/Antenna.png b/prefs/Resources/app_icons/Antenna.png new file mode 100644 index 0000000..ce02003 Binary files /dev/null and b/prefs/Resources/app_icons/Antenna.png differ diff --git a/prefs/Resources/app_icons/Antenna@2x.png b/prefs/Resources/app_icons/Antenna@2x.png new file mode 100644 index 0000000..9a47fac Binary files /dev/null and b/prefs/Resources/app_icons/Antenna@2x.png differ diff --git a/prefs/Resources/app_icons/Antenna@3x.png b/prefs/Resources/app_icons/Antenna@3x.png new file mode 100644 index 0000000..2b0e230 Binary files /dev/null and b/prefs/Resources/app_icons/Antenna@3x.png differ diff --git a/prefs/Resources/app_icons/Apollo.png b/prefs/Resources/app_icons/Apollo.png new file mode 100644 index 0000000..1c88af5 Binary files /dev/null and b/prefs/Resources/app_icons/Apollo.png differ diff --git a/prefs/Resources/app_icons/Apollo@2x.png b/prefs/Resources/app_icons/Apollo@2x.png new file mode 100644 index 0000000..641c7a8 Binary files /dev/null and b/prefs/Resources/app_icons/Apollo@2x.png differ diff --git a/prefs/Resources/app_icons/Apollo@3x.png b/prefs/Resources/app_icons/Apollo@3x.png new file mode 100644 index 0000000..17efadc Binary files /dev/null and b/prefs/Resources/app_icons/Apollo@3x.png differ diff --git a/prefs/Resources/app_icons/BaconReader.png b/prefs/Resources/app_icons/BaconReader.png new file mode 100644 index 0000000..1c6d956 Binary files /dev/null and b/prefs/Resources/app_icons/BaconReader.png differ diff --git a/prefs/Resources/app_icons/BaconReader@2x.png b/prefs/Resources/app_icons/BaconReader@2x.png new file mode 100644 index 0000000..e43dc46 Binary files /dev/null and b/prefs/Resources/app_icons/BaconReader@2x.png differ diff --git a/prefs/Resources/app_icons/BaconReader@3x.png b/prefs/Resources/app_icons/BaconReader@3x.png new file mode 100644 index 0000000..caefb71 Binary files /dev/null and b/prefs/Resources/app_icons/BaconReader@3x.png differ diff --git a/prefs/Resources/app_icons/Beam.png b/prefs/Resources/app_icons/Beam.png new file mode 100644 index 0000000..22e3510 Binary files /dev/null and b/prefs/Resources/app_icons/Beam.png differ diff --git a/prefs/Resources/app_icons/Beam@2x.png b/prefs/Resources/app_icons/Beam@2x.png new file mode 100644 index 0000000..c658511 Binary files /dev/null and b/prefs/Resources/app_icons/Beam@2x.png differ diff --git a/prefs/Resources/app_icons/Beam@3x.png b/prefs/Resources/app_icons/Beam@3x.png new file mode 100644 index 0000000..664c089 Binary files /dev/null and b/prefs/Resources/app_icons/Beam@3x.png differ diff --git a/prefs/Resources/app_icons/Narwhal.png b/prefs/Resources/app_icons/Narwhal.png new file mode 100644 index 0000000..12ce0ff Binary files /dev/null and b/prefs/Resources/app_icons/Narwhal.png differ diff --git a/prefs/Resources/app_icons/Narwhal@2x.png b/prefs/Resources/app_icons/Narwhal@2x.png new file mode 100644 index 0000000..63919a0 Binary files /dev/null and b/prefs/Resources/app_icons/Narwhal@2x.png differ diff --git a/prefs/Resources/app_icons/Narwhal@3x.png b/prefs/Resources/app_icons/Narwhal@3x.png new file mode 100644 index 0000000..dac8efe Binary files /dev/null and b/prefs/Resources/app_icons/Narwhal@3x.png differ diff --git a/prefs/Resources/app_icons/Reddit.png b/prefs/Resources/app_icons/Reddit.png new file mode 100644 index 0000000..0a73502 Binary files /dev/null and b/prefs/Resources/app_icons/Reddit.png differ diff --git a/prefs/Resources/app_icons/Reddit@2x.png b/prefs/Resources/app_icons/Reddit@2x.png new file mode 100644 index 0000000..b746269 Binary files /dev/null and b/prefs/Resources/app_icons/Reddit@2x.png differ diff --git a/prefs/Resources/app_icons/Reddit@3x.png b/prefs/Resources/app_icons/Reddit@3x.png new file mode 100644 index 0000000..bbb7779 Binary files /dev/null and b/prefs/Resources/app_icons/Reddit@3x.png differ diff --git a/prefs/Resources/app_icons/Slide.png b/prefs/Resources/app_icons/Slide.png new file mode 100644 index 0000000..0968ac5 Binary files /dev/null and b/prefs/Resources/app_icons/Slide.png differ diff --git a/prefs/Resources/app_icons/Slide@2x.png b/prefs/Resources/app_icons/Slide@2x.png new file mode 100644 index 0000000..ec83450 Binary files /dev/null and b/prefs/Resources/app_icons/Slide@2x.png differ diff --git a/prefs/Resources/app_icons/Slide@3x.png b/prefs/Resources/app_icons/Slide@3x.png new file mode 100644 index 0000000..acfe02c Binary files /dev/null and b/prefs/Resources/app_icons/Slide@3x.png differ diff --git a/prefs/TFDTSRootListController.m b/prefs/TFDTSRootListController.m index bf34ad2..9bc92b2 100644 --- a/prefs/TFDTSRootListController.m +++ b/prefs/TFDTSRootListController.m @@ -1,4 +1,5 @@ #include "TFDTSRootListController.h" +#import @implementation TFDTSRootListController @@ -10,4 +11,24 @@ return _specifiers; } +- (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 = (__bridge CFStringRef)specifier.properties[@"PostNotification"]; + + if (notificationName) { + CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), notificationName, NULL, NULL, YES); + } +} + @end