]> git.saurik.com Git - winterboard.git/commitdiff
Filter themes with kCFCoreFounderionVersionNumber.
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 10 Jan 2014 12:29:55 +0000 (04:29 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 10 Jan 2014 12:30:17 +0000 (04:30 -0800)
Black Navigation Bars.theme/Info.plist
Dim Wallpaper.theme/Info.plist [new file with mode: 0644]
Settings.mm
Solid Status Bar.theme/Info.plist
White Icon Labels.theme/Info.plist

index ab601e0ba89f4c9db80aed4167a76801653767bb..c68fa665abc64d6aa5422ff0f661809420ca6fd0 100644 (file)
@@ -2,6 +2,12 @@
 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0"><dict>
 
+<key>CoreFoundationVersion</key>
+<array>
+    <real>0</real>
+    <real>600</real>
+</array>
+
 <key>NavigationBarStyle-0</key>
 <string>1</string>
 
diff --git a/Dim Wallpaper.theme/Info.plist b/Dim Wallpaper.theme/Info.plist
new file mode 100644 (file)
index 0000000..63e7935
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0"><dict>
+
+<key>CoreFoundationVersion</key>
+<array>
+    <real>0</real>
+    <real>600</real>
+</array>
+
+</dict></plist>
index cba01a4ad23d6b96123fec1ebff55b2cfb2f6fb3..160073d22d2fc1d377698803589739254c5b9795 100644 (file)
@@ -48,6 +48,31 @@ static BOOL settingsChanged;
 static NSMutableDictionary *_settings;
 static NSString *_plist;
 
+void AddThemes(NSMutableArray *themesOnDisk, NSString *folder) {
+    NSArray *themes([[NSFileManager defaultManager] contentsOfDirectoryAtPath:folder error:NULL]);
+    for (NSString *theme in themes) {
+        if (NSDictionary *info = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/Info.plist", folder, theme]]) {
+            if (NSArray *version = [info objectForKey:@"CoreFoundationVersion"]) {
+                size_t count([version count]);
+                if (count == 0 || count > 2)
+                    continue;
+
+                double lower([[version objectAtIndex:0] doubleValue]);
+                if (kCFCoreFoundationVersionNumber < lower)
+                    continue;
+
+                if (count != 1) {
+                    double upper([[version objectAtIndex:1] doubleValue]);
+                    if (upper <= kCFCoreFoundationVersionNumber)
+                        continue;
+                }
+            }
+        }
+
+        [themesOnDisk addObject:theme];
+    }
+}
+
 /* [NSObject yieldToSelector:(withObject:)] {{{*/
 @interface NSObject (wb$yieldToSelector)
 - (id) wb$yieldToSelector:(SEL)selector withObject:(id)object;
@@ -172,16 +197,8 @@ static NSString *_plist;
         }
 
         NSMutableArray *themesOnDisk([NSMutableArray array]);
-
-        [themesOnDisk
-            addObjectsFromArray:[[NSFileManager defaultManager]
-            contentsOfDirectoryAtPath:@"/Library/Themes" error:NULL]
-        ];
-
-        [themesOnDisk addObjectsFromArray:[[NSFileManager defaultManager]
-            contentsOfDirectoryAtPath:[NSString stringWithFormat:@"%@/Library/SummerBoard/Themes", NSHomeDirectory()]
-            error:NULL
-        ]];
+        AddThemes(themesOnDisk, @"/Library/Themes");
+        AddThemes(themesOnDisk, [NSString stringWithFormat:@"%@/Library/SummerBoard/Themes", NSHomeDirectory()]);
 
         for (int i = 0, count = [themesOnDisk count]; i < count; i++) {
             NSString *theme = [themesOnDisk objectAtIndex:i];
index b3c7578409db651d54e1bb8a96f3b1bf9f14b88e..7cfb188a75e5492130b2b39f40eebd1147d3c27b 100644 (file)
@@ -2,6 +2,12 @@
 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0"><dict>
 
+<key>CoreFoundationVersion</key>
+<array>
+    <real>0</real>
+    <real>600</real>
+</array>
+
 <key>StatusBarMode</key>
 <string>0</string>
 
index 2fb6904bd01f4a6f89965469d706d0188065068a..f58cc73da269b239b511d463cda6f126244b9110 100644 (file)
@@ -2,6 +2,12 @@
 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0"><dict>
 
+<key>CoreFoundationVersion</key>
+<array>
+    <real>0</real>
+    <real>600</real>
+</array>
+
 <key>UndockedIconLabelStyle</key>
 <string>color: white</string>