diff options
author | Ryan Petrich <rpetrich@gmail.com> | 2010-09-26 02:48:43 -0600 |
---|---|---|
committer | Jay Freeman <saurik@Jay-Freemans-MacBook-Pro.local> | 2010-10-04 00:12:21 -0700 |
commit | ef494bd899670b3e4710dd9fc3e34977d485a87d (patch) | |
tree | 882367991d3983bdb38f7f880bbecb1ff07409bc /Cydia.mm | |
parent | e2eaea534e42ae8d181d34ec8760818fd1cfb7be (diff) |
Add External Status API
status stored in the com.saurik.Cydia.status register: 0 = clean, 1 = installing, 2 = installed and requires confirmation to respring/reboot/etc
com.saurik.Cydia.status is notify_post'ed when status changes
Diffstat (limited to 'Cydia.mm')
-rw-r--r-- | Cydia.mm | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -116,6 +116,8 @@ extern "C" { #include <ext/hash_map> +#include <notify.h> + #import "UICaboodle/BrowserView.h" #import "UICaboodle/ResetView.h" @@ -257,6 +259,15 @@ static _finline NSString *CydiaURL(NSString *path) { return [[NSString stringWithUTF8String:page] stringByAppendingString:path]; } +static _finline void UpdateExternalStatus(uint64_t newStatus) { + int notify_token; + if (notify_register_check("com.saurik.Cydia.status", ¬ify_token) == NOTIFY_STATUS_OK) { + notify_set_state(notify_token, newStatus); + notify_cancel(notify_token); + } + notify_post("com.saurik.Cydia.status"); +} + /* [NSObject yieldToSelector:(withObject:)] {{{*/ @interface NSObject (Cydia) - (id) yieldToSelector:(SEL)selector withObject:(id)object; @@ -4377,6 +4388,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (void) closeButtonPushed { running_ = NO; + UpdateExternalStatus(0); + switch (Finish_) { case 0: [self dismissModalViewControllerAnimated:YES]; @@ -4450,6 +4463,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { system("su -c /usr/bin/uicache mobile"); + UpdateExternalStatus(Finish_ == 0 ? 2 : 0); + [delegate_ setStatusBarShowsProgress:NO]; } @@ -4461,6 +4476,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } - (void) detachNewThreadSelector:(SEL)selector toTarget:(id)target withObject:(id)object title:(NSString *)title { + UpdateExternalStatus(1); + if (title_ != nil) [title_ release]; if (title == nil) |