#include <UIKit/UIKit.h>
#include <MessageUI/MessageUI.h>
-#include <CydiaSubstrate/CydiaSubstrate.h>
+#include <Menes/ObjectHandle.h>
@class IndirectDelegate;
MFMailComposeViewControllerDelegate,
UIWebViewDelegate
> {
- _transient CyteWebView *webview_;
+ _H<CyteWebView, 1> webview_;
_transient UIScrollView *scroller_;
_H<UIActivityIndicatorView> indicator_;
- _H<IndirectDelegate> indirect_;
+ _H<IndirectDelegate, 1> indirect_;
_H<NSURLAuthenticationChallenge> challenge_;
bool error_;
#include <WebKit/DOMHTMLBodyElement.h>
#include <WebKit/DOMRGBColor.h>
+#include <dlfcn.h>
+#include <objc/runtime.h>
+
#define ForSaurik 0
#define DefaultTimeout_ 120.0
NSLog(@"[CyteWebViewController dealloc]");
#endif
- [webview_ setDelegate:nil];
- [indirect_ setDelegate:nil];
-
if ([loading_ count] != 0)
[delegate_ releaseNetworkActivityIndicator];
}
- (void) dispatchEvent:(NSString *)event {
- [webview_ dispatchEvent:event];
+ [(CyteWebView *) webview_ dispatchEvent:event];
}
- (bool) hidesNavigationBar {
#ifndef Menes_ObjectHandle_H
#define Menes_ObjectHandle_H
+template <typename Type_, unsigned Delegate_>
+struct MenesObjectHandle_;
+
template <typename Type_>
+struct MenesObjectHandle_<Type_, 0> {
+ static _finline void Execute(Type_ *value) {
+ }
+};
+
+template <typename Type_>
+struct MenesObjectHandle_<Type_, 1> {
+ static _finline void Execute(Type_ *value) {
+ [value setDelegate:nil];
+ }
+};
+
+template <typename Type_>
+struct MenesObjectHandle_<Type_, 2> {
+ static _finline void Execute(Type_ *value) {
+ [value setDelegate:nil];
+ [value setDataSource:nil];
+ }
+};
+
+template <typename Type_, unsigned Delegate_ = 0>
class MenesObjectHandle {
private:
Type_ *value_;
}
_finline void Clear_() {
- if (value_ != nil)
+ if (value_ != nil) {
+ MenesObjectHandle_<Type_, Delegate_>::Execute(value_);
CFRelease((CFTypeRef) value_);
+ }
}
public:
ProgressDelegate
> {
_transient Database *database_;
- _H<CydiaProgressData> progress_;
+ _H<CydiaProgressData, 1> progress_;
unsigned cancel_;
}
- (void) dealloc {
[database_ setProgressDelegate:nil];
- [progress_ setDelegate:nil];
[super dealloc];
}
_H<Package> package_;
_H<NSString> name_;
_H<NSMutableArray> files_;
- _H<UITableView> list_;
+ _H<UITableView, 2> list_;
}
- (id) initWithDatabase:(Database *)database;
@implementation FileTable
-- (void) dealloc {
- [(UITableView *) list_ setDataSource:nil];
- [list_ setDelegate:nil];
- [super dealloc];
-}
-
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return files_ == nil ? 0 : [files_ count];
}
unsigned era_;
_H<NSArray> packages_;
_H<NSMutableArray> sections_;
- _H<UITableView> list_;
+ _H<UITableView, 2> list_;
_H<NSMutableArray> index_;
_H<NSMutableDictionary> indices_;
_H<NSString> title_;
@implementation PackageListController
-- (void) dealloc {
- [list_ setDataSource:nil];
- [list_ setDelegate:nil];
- [super dealloc];
-}
-
- (bool) isSummarized {
return false;
}
ProgressDelegate
> {
_transient Database *database_;
- _H<RefreshBar> refreshbar_;
+ _H<RefreshBar, 1> refreshbar_;
bool dropped_;
bool updating_;
}
- (void) dealloc {
- [refreshbar_ setDelegate:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
_transient Database *database_;
_H<NSMutableArray> sections_;
_H<NSMutableArray> filtered_;
- _H<UITableView> list_;
+ _H<UITableView, 2> list_;
}
- (id) initWithDatabase:(Database *)database;
unsigned era_;
_H<NSArray> packages_;
_H<NSMutableArray> sections_;
- _H<UITableView> list_;
+ _H<UITableView, 2> list_;
unsigned upgrades_;
}
@interface SearchController : FilteredPackageListController <
UISearchBarDelegate
> {
- _H<UISearchBar> search_;
+ _H<UISearchBar, 1> search_;
BOOL searchloaded_;
}
@implementation SearchController
-- (void) dealloc {
- [search_ setDelegate:nil];
- [super dealloc];
-}
-
- (NSURL *) navigationURL {
if ([search_ text] == nil || [[search_ text] isEqualToString:@""])
return [NSURL URLWithString:@"cydia://search"];
_transient Database *database_;
_H<NSString> name_;
_H<Package> package_;
- _H<UITableView> table_;
+ _H<UITableView, 2> table_;
_H<UISwitch> subscribedSwitch_;
_H<UISwitch> ignoredSwitch_;
_H<UITableViewCell> subscribedCell_;
@implementation InstalledController
-- (void) dealloc {
- [super dealloc];
-}
-
- (NSURL *) navigationURL {
return [NSURL URLWithString:@"cydia://installed"];
}
UITableViewDelegate
> {
_transient Database *database_;
- _H<UITableView> list_;
+ _H<UITableView, 2> list_;
_H<NSMutableArray> sources_;
int offset_;
_transient Database *database_;
// XXX: ok, "roledelegate_"?...
_transient id roledelegate_;
- _H<UITableView> table_;
+ _H<UITableView, 2> table_;
_H<UISegmentedControl> segment_;
_H<UIView> container_;
}