diff options
author | Grant Paul <chpwn@chpwn.com> | 2010-12-04 01:12:56 -0800 |
---|---|---|
committer | Grant Paul <chpwn@chpwn.com> | 2010-12-04 01:12:56 -0800 |
commit | e954c30af6dc38a7ca6a296fbaed9863be378700 (patch) | |
tree | 8b42a16cef3ed833f00d927b1a20a4dae436362e | |
parent | 250fdfdd1a2fec70aaaab9e11d426ba53d9c9200 (diff) |
Fixed bug switching tabs while editing sections, SectionsController -> CYSectionsController.
-rw-r--r-- | MobileCydia.mm | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 932b471..5d3c652 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -7062,7 +7062,7 @@ freeing the view controllers on tab change */ /* }}} */ /* Sections Controller {{{ */ -@interface SectionsController : CYViewController < +@interface CYSectionsController : CYViewController < UITableViewDataSource, UITableViewDelegate > { @@ -7082,7 +7082,7 @@ freeing the view controllers on tab change */ @end -@implementation SectionsController +@implementation CYSectionsController - (void) dealloc { [list_ setDataSource:nil]; @@ -7095,11 +7095,27 @@ freeing the view controllers on tab change */ [super dealloc]; } +- (void) setEditing:(BOOL)editing { + if ((editing_ = editing)) + [list_ reloadData]; + else + [delegate_ updateData]; + + [[self navigationItem] setTitle:editing_ ? UCLocalize("SECTION_VISIBILITY") : UCLocalize("SECTIONS")]; + [[[self navigationItem] rightBarButtonItem] setTitle:[sections_ count] == 0 ? nil : editing_ ? UCLocalize("DONE") : UCLocalize("EDIT")]; + [[[self navigationItem] rightBarButtonItem] setStyle:editing_ ? UIBarButtonItemStyleDone : UIBarButtonItemStylePlain]; +} + - (void) viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [list_ deselectRowAtIndexPath:[list_ indexPathForSelectedRow] animated:animated]; } +- (void) viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + [self setEditing:NO]; +} + - (Section *) sectionAtIndexPath:(NSIndexPath *)indexPath { Section *section = (editing_ ? [sections_ objectAtIndex:[indexPath row]] : ([indexPath row] == 0 ? nil : [filtered_ objectAtIndex:([indexPath row] - 1)])); return section; @@ -7248,15 +7264,8 @@ freeing the view controllers on tab change */ [self editButtonClicked]; } -- (void) editButtonClicked { - if ((editing_ = !editing_)) - [list_ reloadData]; - else - [delegate_ updateData]; - - [[self navigationItem] setTitle:editing_ ? UCLocalize("SECTION_VISIBILITY") : UCLocalize("SECTIONS")]; - [[[self navigationItem] rightBarButtonItem] setTitle:[sections_ count] == 0 ? nil : editing_ ? UCLocalize("DONE") : UCLocalize("EDIT")]; - [[[self navigationItem] rightBarButtonItem] setStyle:editing_ ? UIBarButtonItemStyleDone : UIBarButtonItemStylePlain]; +- (void)editButtonClicked { + [self setEditing:!editing_]; } - (UIView *) accessoryView { @@ -8013,7 +8022,7 @@ typedef enum { unsigned locked_; unsigned activity_; - SectionsController *sections_; + CYSectionsController *sections_; ChangesController *changes_; ManageController *manage_; SearchController *search_; @@ -8407,9 +8416,9 @@ static _finline void _setHomePage(Cydia *self) { return browser; } -- (SectionsController *) sectionsController { +- (CYSectionsController *) sectionsController { if (sections_ == nil) - sections_ = [[SectionsController alloc] initWithDatabase:database_]; + sections_ = [[CYSectionsController alloc] initWithDatabase:database_]; return sections_; } |