summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2008-07-25 11:10:44 +0000
committerJay Freeman (saurik) <saurik@saurik.com>2010-09-30 07:08:12 +0000
commit6d9712c40c02cdae090ecfc58a8a669df03ef467 (patch)
treeddd66e27647327b9f6d2a718a5ec686d42159463
parentc4ce98df82d3ed1c8f40dbb7cd10664218c87599 (diff)
The return of Reorganizing, a ton of graphical enhancements, and section filters.
-rw-r--r--Cydia.app/Administration.pngbin0 -> 1403 bytes
-rw-r--r--Cydia.app/Archiving.pngbin0 -> 2475 bytes
-rw-r--r--Cydia.app/Data Storage.pngbin0 -> 2744 bytes
-rw-r--r--Cydia.app/Development.pngbin0 -> 2242 bytes
-rw-r--r--Cydia.app/Games.pngbin0 -> 1587 bytes
-rw-r--r--Cydia.app/Java.pngbin0 -> 2356 bytes
-rw-r--r--Cydia.app/Localization.pngbin0 -> 2223 bytes
-rw-r--r--Cydia.app/Multimedia.pngbin0 -> 3133 bytes
-rw-r--r--Cydia.app/Networking.pngbin0 -> 2520 bytes
-rw-r--r--Cydia.app/Packaging.pngbin0 -> 1490 bytes
-rw-r--r--Cydia.app/Repositories.pngbin0 -> 2455 bytes
-rw-r--r--Cydia.app/Scripting.pngbin0 -> 1223 bytes
-rw-r--r--Cydia.app/Security.pngbin0 -> 1959 bytes
-rw-r--r--Cydia.app/System.pngbin0 -> 1939 bytes
-rw-r--r--Cydia.app/Terminal Support.pngbin0 -> 1649 bytes
-rw-r--r--Cydia.app/Text Editors.pngbin0 -> 1272 bytes
-rw-r--r--Cydia.app/Themes.pngbin0 -> 1873 bytes
-rw-r--r--Cydia.app/Toys.pngbin0 -> 2604 bytes
-rw-r--r--Cydia.app/Tweaks.pngbin0 -> 1693 bytes
-rw-r--r--Cydia.app/Utilities.pngbin0 -> 2484 bytes
-rw-r--r--Cydia.app/X Window.pngbin0 -> 1878 bytes
-rw-r--r--Cydia.app/home.html41
-rw-r--r--Cydia.mm326
-rwxr-xr-xLibrary/free.sh6
-rwxr-xr-xLibrary/move.sh2
25 files changed, 315 insertions, 60 deletions
diff --git a/Cydia.app/Administration.png b/Cydia.app/Administration.png
new file mode 100644
index 0000000..8b4b44f
--- /dev/null
+++ b/Cydia.app/Administration.png
Binary files differ
diff --git a/Cydia.app/Archiving.png b/Cydia.app/Archiving.png
new file mode 100644
index 0000000..68b486a
--- /dev/null
+++ b/Cydia.app/Archiving.png
Binary files differ
diff --git a/Cydia.app/Data Storage.png b/Cydia.app/Data Storage.png
new file mode 100644
index 0000000..e8a8449
--- /dev/null
+++ b/Cydia.app/Data Storage.png
Binary files differ
diff --git a/Cydia.app/Development.png b/Cydia.app/Development.png
new file mode 100644
index 0000000..25afa9f
--- /dev/null
+++ b/Cydia.app/Development.png
Binary files differ
diff --git a/Cydia.app/Games.png b/Cydia.app/Games.png
new file mode 100644
index 0000000..6e0efaf
--- /dev/null
+++ b/Cydia.app/Games.png
Binary files differ
diff --git a/Cydia.app/Java.png b/Cydia.app/Java.png
new file mode 100644
index 0000000..4b543db
--- /dev/null
+++ b/Cydia.app/Java.png
Binary files differ
diff --git a/Cydia.app/Localization.png b/Cydia.app/Localization.png
new file mode 100644
index 0000000..2450175
--- /dev/null
+++ b/Cydia.app/Localization.png
Binary files differ
diff --git a/Cydia.app/Multimedia.png b/Cydia.app/Multimedia.png
new file mode 100644
index 0000000..07f20b6
--- /dev/null
+++ b/Cydia.app/Multimedia.png
Binary files differ
diff --git a/Cydia.app/Networking.png b/Cydia.app/Networking.png
new file mode 100644
index 0000000..ee1f0a1
--- /dev/null
+++ b/Cydia.app/Networking.png
Binary files differ
diff --git a/Cydia.app/Packaging.png b/Cydia.app/Packaging.png
new file mode 100644
index 0000000..c1b72a5
--- /dev/null
+++ b/Cydia.app/Packaging.png
Binary files differ
diff --git a/Cydia.app/Repositories.png b/Cydia.app/Repositories.png
new file mode 100644
index 0000000..29c9db0
--- /dev/null
+++ b/Cydia.app/Repositories.png
Binary files differ
diff --git a/Cydia.app/Scripting.png b/Cydia.app/Scripting.png
new file mode 100644
index 0000000..d020f71
--- /dev/null
+++ b/Cydia.app/Scripting.png
Binary files differ
diff --git a/Cydia.app/Security.png b/Cydia.app/Security.png
new file mode 100644
index 0000000..b091a84
--- /dev/null
+++ b/Cydia.app/Security.png
Binary files differ
diff --git a/Cydia.app/System.png b/Cydia.app/System.png
new file mode 100644
index 0000000..f16c216
--- /dev/null
+++ b/Cydia.app/System.png
Binary files differ
diff --git a/Cydia.app/Terminal Support.png b/Cydia.app/Terminal Support.png
new file mode 100644
index 0000000..864374c
--- /dev/null
+++ b/Cydia.app/Terminal Support.png
Binary files differ
diff --git a/Cydia.app/Text Editors.png b/Cydia.app/Text Editors.png
new file mode 100644
index 0000000..8176c27
--- /dev/null
+++ b/Cydia.app/Text Editors.png
Binary files differ
diff --git a/Cydia.app/Themes.png b/Cydia.app/Themes.png
new file mode 100644
index 0000000..f5b44db
--- /dev/null
+++ b/Cydia.app/Themes.png
Binary files differ
diff --git a/Cydia.app/Toys.png b/Cydia.app/Toys.png
new file mode 100644
index 0000000..88df4ab
--- /dev/null
+++ b/Cydia.app/Toys.png
Binary files differ
diff --git a/Cydia.app/Tweaks.png b/Cydia.app/Tweaks.png
new file mode 100644
index 0000000..14d400b
--- /dev/null
+++ b/Cydia.app/Tweaks.png
Binary files differ
diff --git a/Cydia.app/Utilities.png b/Cydia.app/Utilities.png
new file mode 100644
index 0000000..2d7c31d
--- /dev/null
+++ b/Cydia.app/Utilities.png
Binary files differ
diff --git a/Cydia.app/X Window.png b/Cydia.app/X Window.png
new file mode 100644
index 0000000..5b1b7f5
--- /dev/null
+++ b/Cydia.app/X Window.png
Binary files differ
diff --git a/Cydia.app/home.html b/Cydia.app/home.html
new file mode 100644
index 0000000..f72240d
--- /dev/null
+++ b/Cydia.app/home.html
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-16"?>
+<html><head>
+ <title>Network Error</title>
+ <meta name="viewport" content="width=320, minimum-scale=1.0, maximum-scale=1.0"/>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+
+ <style>
+ body {
+ background: url(pinstripe.png);
+ display: table;
+ font-family: Helvetica;
+ height: 337px;
+ margin: 0;
+ text-shadow: rgba(255, 255, 255, 0.75) 1px 1px 0
+ }
+
+ div.page {
+ display: table-cell;
+ text-align: center;
+ margin: 0 auto;
+ vertical-align: middle;
+ width: 320px;
+ }
+
+ div.title {
+ font-size: 32px;
+ }
+
+ div.error {
+ font-size: 24px;
+ }
+ </style>
+</head><body><div class="page">
+
+<div class="title">Unable To Load</div>
+
+<div class="error">(<script>
+ document.write(decodeURI(location.search.substring(1)));
+</script>)</div>
+
+</div></body></html>
diff --git a/Cydia.mm b/Cydia.mm
index 1f6e175..8048418 100644
--- a/Cydia.mm
+++ b/Cydia.mm
@@ -35,6 +35,13 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef __OBJC2__
+ #define UITextTraits UITextInputTraits
+ #define textTraits textInputTraits
+ #define setAutoCapsType setAutocapitalizationType
+ #define setAutoCorrectionType setAutocorrectionType
+#endif
+
/* #include Directives {{{ */
#include <objc/objc.h>
#include <objc/runtime.h>
@@ -406,7 +413,7 @@ class GSFont {
/* Random Global Variables {{{ */
static const int PulseInterval_ = 50000;
static const int ButtonBarHeight_ = 48;
-static const float KeyboardTime_ = 0.4f;
+static const float KeyboardTime_ = 0.3f;
static const char * const SpringBoard_ = "/System/Library/LaunchDaemons/com.apple.SpringBoard.plist";
#ifndef Cydia_
@@ -447,6 +454,7 @@ bool reload_;
static NSMutableDictionary *Metadata_;
static NSMutableDictionary *Packages_;
+static NSMutableDictionary *Sections_;
static bool Changed_;
static NSDate *now_;
@@ -523,6 +531,12 @@ NSString *Simplify(NSString *title) {
}
/* }}} */
+bool isSectionVisible(NSString *section) {
+ NSDictionary *metadata = [Sections_ objectForKey:section];
+ NSNumber *hidden = metadata == nil ? nil : [metadata objectForKey:@"Hidden"];
+ return hidden == nil || ![hidden boolValue];
+}
+
/* Delegate Prototypes {{{ */
@class Package;
@class Source;
@@ -558,6 +572,7 @@ NSString *Simplify(NSString *title) {
- (void) removePackage:(Package *)package;
- (void) slideUp:(UIAlertSheet *)alert;
- (void) distUpgrade;
+- (void) updateData;
@end
/* }}} */
@@ -924,6 +939,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
NSString *website_;
Address *sponsor_;
Address *author_;
+ NSArray *tags_;
NSArray *relationships_;
}
@@ -948,6 +964,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
- (BOOL) upgradableAndEssential:(BOOL)essential;
- (BOOL) essential;
- (BOOL) broken;
+- (BOOL) visible;
- (BOOL) half;
- (BOOL) halfConfigured;
@@ -968,6 +985,9 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
- (BOOL) matches:(NSString *)text;
+- (bool) hasUsefulPurpose;
+- (BOOL) hasTag:(NSString *)tag;
+
- (NSComparisonResult) compareByName:(Package *)package;
- (NSComparisonResult) compareBySection:(Package *)package;
- (NSComparisonResult) compareBySectionAndName:(Package *)package;
@@ -1004,6 +1024,8 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
[sponsor_ release];
if (author_ != nil)
[author_ release];
+ if (tags_ != nil)
+ [tags_ release];
if (relationships_ != nil)
[relationships_ release];
@@ -1055,6 +1077,9 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
NSString *author = Scour("Author", begin, end);
if (author != nil)
author_ = [[Address addressWithString:author] retain];
+ NSString *tags = Scour("Tag", begin, end);
+ if (tags != nil)
+ tags_ = [[tags componentsSeparatedByString:@", "] retain];
}
NSMutableDictionary *metadata = [Packages_ objectForKey:id_];
@@ -1156,6 +1181,11 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
return [database_ cache][iterator_].InstBroken();
}
+- (BOOL) visible {
+ NSString *section = [self section];
+ return [self hasUsefulPurpose] && (section == nil || isSectionVisible(section));
+}
+
- (BOOL) half {
unsigned char current = iterator_->CurrentState;
return current == pkgCache::State::HalfConfigured || current == pkgCache::State::HalfInstalled;
@@ -1272,6 +1302,33 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
return NO;
}
+- (bool) hasUsefulPurpose {
+ if (tags_ == nil)
+ return true;
+ bool purpose(false);
+
+ for (int i(0), e([tags_ count]); i != e; ++i) {
+ NSString *tag = [tags_ objectAtIndex:i];
+ if ([tag hasPrefix:@"purpose::"]) {
+ bool purpose(false);
+ if ([tag isEqualToString:@"purpose::console"]) {
+ return true;
+ } else if ([tag isEqualToString:@"purpose::library"]) {
+ return true;
+ } else if ([tag isEqualToString:@"purpose::x"]) {
+ return true;
+ } else
+ purpose = true;
+ }
+ }
+
+ return !purpose;
+}
+
+- (BOOL) hasTag:(NSString *)tag {
+ return tags_ == nil ? NO : [tags_ containsObject:tag];
+}
+
- (NSComparisonResult) compareByName:(Package *)package {
NSString *lhs = [self name];
NSString *rhs = [package name];
@@ -1376,7 +1433,7 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
NSString *section = [self section];
return [NSNumber numberWithBool:([self valid] && [self installed] == nil && (
- (name == nil ||
+ (name == nil && [self visible] ||
section == nil && [name length] == 0 ||
[name isEqualToString:section])
))];
@@ -1391,6 +1448,8 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
size_t count_;
}
+- (NSComparisonResult) compareByName:(Section *)section;
+- (Section *) initWithName:(NSString *)name;
- (Section *) initWithName:(NSString *)name row:(size_t)row;
- (NSString *) name;
- (size_t) row;
@@ -1406,6 +1465,27 @@ NSString *Scour(const char *field, const char *begin, const char *end) {
[super dealloc];
}
+- (NSComparisonResult) compareByName:(Section *)section {
+ NSString *lhs = [self name];
+ NSString *rhs = [section name];
+
+ if ([lhs length] != 0 && [rhs length] != 0) {
+ unichar lhc = [lhs characterAtIndex:0];
+ unichar rhc = [rhs characterAtIndex:0];
+
+ if (isalpha(lhc) && !isalpha(rhc))
+ return NSOrderedAscending;
+ else if (!isalpha(lhc) && isalpha(rhc))
+ return NSOrderedDescending;
+ }
+
+ return [lhs caseInsensitiveCompare:rhs];
+}
+
+- (Section *) initWithName:(NSString *)name {
+ return [self initWithName:name row:0];
+}
+
- (Section *) initWithName:(NSString *)name row:(size_t)row {
if ((self = [super init]) != nil) {
name_ = [name retain];
@@ -2625,8 +2705,10 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
UIImage *image = nil;
if (NSString *icon = [package icon])
image = [UIImage imageAtPath:[icon substringFromIndex:6]];
- if (image == nil) if (NSString *icon = [source defaultIcon])
- image = [UIImage imageAtPath:[icon substringFromIndex:6]];
+ if (image == nil) if (NSString *section = [package section])
+ image = [UIImage applicationImageNamed:[Simplify(section) stringByAppendingString:@".png"]];
+ /*if (image == nil) if (NSString *icon = [source defaultIcon])
+ image = [UIImage imageAtPath:[icon substringFromIndex:6]];*/
if (image == nil)
image = [UIImage applicationImageNamed:@"unknown.png"];
[icon_ setImage:image];
@@ -2724,24 +2806,29 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
}
+ (int) heightForPackage:(Package *)package {
+ NSString *tagline([package tagline]);
+ int height = tagline == nil || [tagline length] == 0 ? -15 : 0;
#ifdef USE_BADGES
if ([package hasMode] || [package half])
- return 96;
+ return height + 96;
else
#endif
- return 73;
+ return height + 73;
}
@end
/* }}} */
/* Section Cell {{{ */
@interface SectionCell : UITableCell {
+ NSString *section_;
UITextLabel *name_;
UITextLabel *count_;
+ UISwitchControl *switch_;
+ BOOL editing_;
}
- (id) init;
-- (void) setSection:(Section *)section;
+- (void) setSection:(Section *)section editing:(BOOL)editing;
- (void) _setSelected:(float)fraction;
- (void) setSelected:(BOOL)selected;
@@ -2753,8 +2840,11 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
@implementation SectionCell
- (void) dealloc {
+ if (section_ != nil)
+ [section_ release];
[name_ release];
[count_ release];
+ [switch_ release];
[super dealloc];
}
@@ -2763,7 +2853,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
GSFontRef bold = GSFontCreateWithName("Helvetica", kGSFontTraitBold, 22);
GSFontRef small = GSFontCreateWithName("Helvetica", kGSFontTraitBold, 12);
- name_ = [[UITextLabel alloc] initWithFrame:CGRectMake(48, 9, 250, 25)];
+ name_ = [[UITextLabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
[name_ setBackgroundColor:Clear_];
[name_ setFont:bold];
@@ -2776,6 +2866,9 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
UIImageView *folder = [[[UIImageView alloc] initWithFrame:CGRectMake(8, 7, 32, 32)] autorelease];
[folder setImage:[UIImage applicationImageNamed:@"folder.png"]];
+ switch_ = [[UISwitchControl alloc] initWithFrame:CGRectMake(218, 9, 60, 25)];
+ [switch_ addTarget:self action:@selector(onSwitch:) forEvents:kUIControlEventMouseUpInside];
+
[self addSubview:folder];
[self addSubview:name_];
[self addSubview:count_];
@@ -2787,15 +2880,46 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
} return self;
}
-- (void) setSection:(Section *)section {
+- (void) onSwitch:(id)sender {
+ NSMutableDictionary *metadata = [Sections_ objectForKey:section_];
+ if (metadata == nil) {
+ metadata = [NSMutableDictionary dictionaryWithCapacity:2];
+ [Sections_ setObject:metadata forKey:section_];
+ }
+
+ Changed_ = true;
+ [metadata setObject:[NSNumber numberWithBool:([switch_ value] == 0)] forKey:@"Hidden"];
+}
+
+- (void) setSection:(Section *)section editing:(BOOL)editing {
+ if (editing != editing_) {
+ if (editing_)
+ [switch_ removeFromSuperview];
+ else
+ [self addSubview:switch_];
+ editing_ = editing;
+ }
+
+ if (section_ != nil) {
+ [section_ release];
+ section_ = nil;
+ }
+
if (section == nil) {
[name_ setText:@"All Packages"];
[count_ setText:nil];
} else {
- NSString *name = [section name];
- [name_ setText:(name == nil ? @"(No Section)" : name)];
+ section_ = [section name];
+ if (section_ != nil)
+ section_ = [section_ retain];
+ [name_ setText:(section_ == nil ? @"(No Section)" : section_)];
[count_ setText:[NSString stringWithFormat:@"%d", [section count]]];
+
+ if (editing_)
+ [switch_ setValue:isSectionVisible(section_) animated:NO];
}
+
+ [name_ setFrame:CGRectMake(48, 9, editing_ ? 165 : 250, 25)];
}
- (void) _setSelected:(float)fraction {
@@ -3027,7 +3151,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
}
- (float) preferencesTable:(UIPreferencesTable *)table heightForRow:(int)row inGroup:(int)group withProposedHeight:(float)proposed {
- if (description_ == nil || group != 0 || row != 1)
+ if (description_ == nil || group != 0 || row != ([package_ author] == nil ? 1 : 2))
return proposed;
else
return [description_ visibleTextRect].size.height + TextViewOffset_;
@@ -3707,8 +3831,11 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
- (void) webView:(WebView *)sender didFailProvisionalLoadWithError:(NSError *)error forFrame:(WebFrame *)frame {
if ([frame parentFrame] != nil)
return;
- [self setTitle:[error localizedDescription]];
[self _finishLoading];
+ [self loadURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?%@",
+ [[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"home" ofType:@"html"]] absoluteString],
+ [[error localizedDescription] stringByAddingPercentEscapes]
+ ]]];
}
- (id) initWithBook:(RVBook *)book database:(Database *)database {
@@ -4082,14 +4209,17 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
/* Install View {{{ */
@interface InstallView : RVPage {
_transient Database *database_;
- NSMutableArray *packages_;
NSMutableArray *sections_;
+ NSMutableArray *filtered_;
+ UITransitionView *transition_;
UITable *list_;
UIView *accessory_;
+ BOOL editing_;
}
- (id) initWithBook:(RVBook *)book database:(Database *)database;
- (void) reloadData;
+- (void) resetView;
@end
@@ -4099,15 +4229,16 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
[list_ setDataSource:nil];
[list_ setDelegate:nil];
- [packages_ release];
[sections_ release];
+ [filtered_ release];
+ [transition_ release];
[list_ release];
[accessory_ release];
[super dealloc];
}
- (int) numberOfRowsInTable:(UITable *)table {
- return [sections_ count] + 1;
+ return editing_ ? [sections_ count] : [filtered_ count] + 1;
}
- (float) table:(UITable *)table heightForRow:(int)row {
@@ -4117,12 +4248,19 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
- (UITableCell *) table:(UITable *)table cellForRow:(int)row column:(UITableColumn *)col reusing:(UITableCell *)reusing {
if (reusing == nil)
reusing = [[[SectionCell alloc] init] autorelease];
- [(SectionCell *)reusing setSection:(row == 0 ? nil : [sections_ objectAtIndex:(row - 1)])];
+ [(SectionCell *)reusing setSection:(editing_ ?
+ [sections_ objectAtIndex:row] :
+ (row == 0 ? nil : [filtered_ objectAtIndex:(row - 1)])
+ ) editing:editing_];
return reusing;
}
- (BOOL) table:(UITable *)table showDisclosureForRow:(int)row {
- return YES;
+ return !editing_;
+}
+
+- (BOOL) table:(UITable *)table canSelectRow:(int)row {
+ return !editing_;
}
- (void) tableRowSelected:(NSNotification *)notification {
@@ -4139,7 +4277,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
name = nil;
title = @"All Packages";
} else {
- section = [sections_ objectAtIndex:(row - 1)];
+ section = [filtered_ objectAtIndex:(row - 1)];
name = [section name];
if (name != nil)
@@ -4167,11 +4305,14 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
if ((self = [super initWithBook:book]) != nil) {
database_ = database;
- packages_ = [[NSMutableArray arrayWithCapacity:16] retain];
sections_ = [[NSMutableArray arrayWithCapacity:16] retain];
+ filtered_ = [[NSMutableArray arrayWithCapacity:16] retain];
- list_ = [[UITable alloc] initWithFrame:[self bounds]];
- [self addSubview:list_];
+ transition_ = [[UITransitionView alloc] initWithFrame:[self bounds]];
+ [self addSubview:transition_];
+
+ list_ = [[UITable alloc] initWithFrame:[transition_ bounds]];
+ [transition_ transition:0 toView:list_];
UITableColumn *column = [[[UITableColumn alloc]
initWithTitle:@"Name"
@@ -4192,25 +4333,43 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
- (void) reloadData {
NSArray *packages = [database_ packages];
- [packages_ removeAllObjects];
[sections_ removeAllObjects];
+ [filtered_ removeAllObjects];
+
+ NSMutableArray *filtered = [NSMutableArray arrayWithCapacity:[packages count]];
+ NSMutableDictionary *sections = [NSMutableDictionary dictionaryWithCapacity:32];
for (size_t i(0); i != [packages count]; ++i) {
Package *package([packages objectAtIndex:i]);
- if ([package valid] && [package installed] == nil)
- [packages_ addObject:package];
+ NSString *name([package section]);
+
+ if (name != nil) {
+ Section *section([sections objectForKey:name]);
+ if (section == nil) {
+ section = [[[Section alloc] initWithName:name] autorelease];
+ [sections setObject:section forKey:name];
+ }
+ }
+
+ if ([package valid] && [package installed] == nil && [package visible])
+ [filtered addObject:package];
}
- [packages_ sortUsingSelector:@selector(compareBySection:)];
+ [sections_ addObjectsFromArray:[sections allValues]];
+ [sections_ sortUsingSelector:@selector(compareByName:)];
+
+ [filtered sortUsingSelector:@selector(compareBySection:)];
Section *section = nil;
- for (size_t offset = 0, count = [packages_ count]; offset != count; ++offset) {
- Package *package = [packages_ objectAtIndex:offset];
+ for (size_t offset = 0, count = [filtered count]; offset != count; ++offset) {
+ Package *package = [filtered objectAtIndex:offset];
NSString *name = [package section];
if (section == nil || name != nil && ![[section name] isEqualToString:name]) {
- section = [[[Section alloc] initWithName:name row:offset] autorelease];
- [sections_ addObject:section];
+ section = name == nil ?
+ [[[Section alloc] initWithName:nil] autorelease] :
+ [sections objectForKey:name];
+ [filtered_ addObject:section];
}
[section addToCount];
@@ -4219,18 +4378,38 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
[list_ reloadData];
}
+- (void) resetView {
+ if (editing_)
+ [self _rightButtonClicked];
+}
+
- (void) resetViewAnimated:(BOOL)animated {
[list_ resetViewAnimated:animated];
}
+- (void) _rightButtonClicked {
+ if ((editing_ = !editing_))
+ [list_ reloadData];
+ else {
+ [delegate_ updateData];
+ }
+
+ [book_ setTitle:[self title] forPage:self];
+ [book_ reloadButtonsForPage:self];
+}
+
- (NSString *) title {
- return @"Install";
+ return editing_ ? @"Section Visibility" : @"Install by Section";
}
- (NSString *) backButtonTitle {
return @"Sections";
}
+- (NSString *) rightButtonTitle {
+ return [sections_ count] == 0 ? nil : editing_ ? @"Done" : @"Edit";
+}
+
- (UIView *) accessoryView {
return accessory_;
}
@@ -4352,13 +4531,17 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
for (size_t i(0); i != [packages count]; ++i) {
Package *package([packages objectAtIndex:i]);
- if ([package installed] == nil && [package valid] || [package upgradableAndEssential:NO])
+
+ if (
+ [package installed] == nil && [package valid] && [package visible] ||
+ [package upgradableAndEssential:NO]
+ )
[packages_ addObject:package];
}
[packages_ sortUsingSelector:@selector(compareForChanges:)];
- Section *upgradable = [[[Section alloc] initWithName:@"Available Upgrades" row:0] autorelease];
+ Section *upgradable = [[[Section alloc] initWithName:@"Available Upgrades"] autorelease];
Section *section = nil;
upgrades_ = 0;
@@ -4661,7 +4844,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
1, 38}, {17, 18}};
CGRect area;
- area.origin.x = cnfrect.origin.x + cnfrect.size.width + 14;
+ area.origin.x = /*cnfrect.origin.x + cnfrect.size.width + 4 +*/ 10;
area.origin.y = 30;
area.size.width =
@@ -4687,12 +4870,13 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
[field_ setPaddingTop:5];
#endif
-#ifndef __OBJC2__
UITextTraits *traits = [field_ textTraits];
- [traits setEditingDelegate:self];
- [traits setReturnKeyType:6];
[traits setAutoCapsType:0];
[traits setAutoCorrectionType:1];
+ [traits setReturnKeyType:6];
+
+#ifndef __OBJC2__
+ [traits setEditingDelegate:self];
#endif
CGRect accrect = {{0, 6}, {6 + cnfrect.size.width + 6 + area.size.width + 6, area.size.height + 30}};
@@ -4700,11 +4884,11 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
accessory_ = [[UIView alloc] initWithFrame:accrect];
[accessory_ addSubview:field_];
- UIPushButton *configure = [[[UIPushButton alloc] initWithFrame:cnfrect] autorelease];
+ /*UIPushButton *configure = [[[UIPushButton alloc] initWithFrame:cnfrect] autorelease];
[configure setShowPressFeedback:YES];
[configure setImage:[UIImage applicationImageNamed:@"advanced.png"]];
[configure addTarget:self action:@selector(configurePushed) forEvents:1];
- [accessory_ addSubview:configure];
+ [accessory_ addSubview:configure];*/
} return self;
}
@@ -5001,6 +5185,11 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
[Metadata_ setObject:Packages_ forKey:@"Packages"];
}
+ if (Sections_ == nil) {
+ Sections_ = [[NSMutableDictionary alloc] initWithCapacity:32];
+ [Metadata_ setObject:Sections_ forKey:@"Sections"];
+ }
+
size_t changes(0);
[essential_ removeAllObjects];
@@ -5031,6 +5220,21 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
[self removeApplicationBadge];
}
+ [self updateData];
+
+ if ([packages count] == 0);
+ else if (Loaded_)
+ [self _loaded];
+ else {
+ Loaded_ = YES;
+ [book_ update];
+ }
+
+ /*[hud show:NO];
+ [hud removeFromSuperview];*/
+}
+
+- (void) updateData {
if (Changed_) {
_assert([Metadata_ writeToFile:@"/var/lib/cydia/metadata.plist" atomically:YES] == YES);
Changed_ = false;
@@ -5047,17 +5251,6 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
[search_ reloadData];
[book_ reloadData];
-
- if ([packages count] == 0);
- else if (Loaded_)
- [self _loaded];
- else {
- Loaded_ = YES;
- [book_ update];
- }
-
- /*[hud show:NO];
- [hud removeFromSuperview];*/
}
- (void) reloadData {
@@ -5250,7 +5443,8 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
if (tag == tag_) {
[book_ resetViewAnimated:YES];
return;
- }
+ } else if (tag_ == 2 && tag != 2)
+ [install_ resetView];
switch (tag) {
case 1: [self _setHomePage]; break;
@@ -5285,6 +5479,8 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
}
}
+#include "internals.h"
+
- (void) applicationWillSuspend {
[database_ clean];
@@ -5339,7 +5535,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
@"install-dn.png", kUIButtonBarButtonSelectedInfo,
[NSNumber numberWithInt:2], kUIButtonBarButtonTag,
self, kUIButtonBarButtonTarget,
- @"Install", kUIButtonBarButtonTitle,
+ @"Sections", kUIButtonBarButtonTitle,
@"0", kUIButtonBarButtonType,
nil],
@@ -5434,6 +5630,16 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
[super applicationSuspend:event];
}
+- (void) _animateSuspension:(BOOL)arg0 duration:(double)arg1 startTime:(double)arg2 scale:(float)arg3 {
+ if (hud_ == nil)
+ [super _animateSuspension:arg0 duration:arg1 startTime:arg2 scale:arg3];
+}
+
+- (void) _setSuspended:(BOOL)value {
+ if (hud_ == nil)
+ [super _setSuspended:value];
+}
+
- (void) applicationDidFinishLaunching:(id)unused {
_assert(pkgInitConfig(*_config));
_assert(pkgInitSystem(*_config, _system));
@@ -5461,14 +5667,16 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
[progress_ resetView];
- /*if (
+ if (
readlink("/Applications", NULL, 0) == -1 && errno == EINVAL ||
- readlink("/usr/share", NULL, 0) == -1 && errno == EINVAL ||
readlink("/Library/Ringtones", NULL, 0) == -1 && errno == EINVAL ||
- readlink("/Library/Wallpaper", NULL, 0) == -1 && errno == EINVAL
+ readlink("/Library/Wallpaper", NULL, 0) == -1 && errno == EINVAL ||
+ readlink("/usr/include", NULL, 0) == -1 && errno == EINVAL ||
+ readlink("/usr/libexec", NULL, 0) == -1 && errno == EINVAL ||
+ readlink("/usr/share", NULL, 0) == -1 && errno == EINVAL
) {
hud_ = [[UIProgressHUD alloc] initWithWindow:window_];
- [hud_ setText:@"Reorganizing\nOne Minute!\nPlease Wait...\nDO NOT STOP"];
+ [hud_ setText:@"Reorganizing\n\nWill Restart When Done"];
[hud_ show:YES];
[underlay_ addSubview:hud_];
@@ -5479,7 +5687,7 @@ Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
toTarget:self
withObject:nil
];
- } else*/
+ } else
[self finish];
}
@@ -5635,8 +5843,10 @@ int main(int argc, char *argv[]) {
if ((Metadata_ = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/var/lib/cydia/metadata.plist"]) == NULL)
Metadata_ = [[NSMutableDictionary alloc] initWithCapacity:2];
- else
+ else {
Packages_ = [Metadata_ objectForKey:@"Packages"];
+ Sections_ = [Metadata_ objectForKey:@"Sections"];
+ }
if (access("/User", F_OK) != 0)
system("/usr/libexec/cydia/firmware.sh");
diff --git a/Library/free.sh b/Library/free.sh
index b18b9fd..703d302 100755
--- a/Library/free.sh
+++ b/Library/free.sh
@@ -1,10 +1,14 @@
#!/bin/bash
for dir in \
- /usr/share \
/Applications \
/Library/Wallpaper \
/Library/Ringtones \
+ /usr/include \
+ /usr/libexec \
+ /usr/share \
; do
. /usr/libexec/cydia/move.sh "$@" "${dir}"
done
+
+sync
diff --git a/Library/move.sh b/Library/move.sh
index 635c153..abfe2ed 100755
--- a/Library/move.sh
+++ b/Library/move.sh
@@ -42,7 +42,7 @@ function mv_() {
}
function shift_() {
- dir=$1
+ dir=${1%/}
if [[ -d ${dir} && ! -h ${dir} ]]; then
used=$(du -bs "${dir}")