(CocoaTouch) Cleanups

This commit is contained in:
Twinaphex 2015-05-05 22:52:42 +02:00
parent 9dafeaec3a
commit aac9012485

View File

@ -214,7 +214,6 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
size_t i; size_t i;
RARunActionSheetDelegate* delegate = [[RARunActionSheetDelegate alloc] initWithCallbackBlock:callback]; RARunActionSheetDelegate* delegate = [[RARunActionSheetDelegate alloc] initWithCallbackBlock:callback];
UIActionSheet* actionSheet = [UIActionSheet new]; UIActionSheet* actionSheet = [UIActionSheet new];
actionSheet.title = BOXSTRING(title); actionSheet.title = BOXSTRING(title);
actionSheet.delegate = delegate; actionSheet.delegate = delegate;
@ -399,7 +398,8 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
- (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action - (id)initWithSetting:(rarch_setting_t*)setting action:(void (^)())action
{ {
if ((self = [super init])) { if ((self = [super init]))
{
_setting = setting; _setting = setting;
_action = action; _action = action;
} }
@ -494,15 +494,12 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
- (void)resetValue:(UIGestureRecognizer*)gesture - (void)resetValue:(UIGestureRecognizer*)gesture
{ {
struct string_list* items; RAMenuItemGeneralSetting __weak* weakSelf = self;
RAMenuItemGeneralSetting __weak* weakSelf; struct string_list *items = string_split("OK", "|");
if (gesture.state != UIGestureRecognizerStateBegan) if (gesture.state != UIGestureRecognizerStateBegan)
return; return;
weakSelf = self;
items = (struct string_list*)string_split("OK", "|");
RunActionSheet("Really Reset Value?", items, self.parentTable, RunActionSheet("Really Reset Value?", items, self.parentTable,
^(UIActionSheet* actionSheet, NSInteger buttonIndex) ^(UIActionSheet* actionSheet, NSInteger buttonIndex)
{ {
@ -641,11 +638,10 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
- (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller - (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller
{ {
struct string_list* items;
RAMenuItemEnumSetting __weak* weakSelf = self; RAMenuItemEnumSetting __weak* weakSelf = self;
rarch_setting_t *setting = self.setting; rarch_setting_t *setting = self.setting;
struct string_list *items = string_split(setting->values, "|");
items = (struct string_list*)string_split(setting->values, "|");
RunActionSheet(setting->short_description, items, self.parentTable, RunActionSheet(setting->short_description, items, self.parentTable,
^(UIActionSheet* actionSheet, NSInteger buttonIndex) ^(UIActionSheet* actionSheet, NSInteger buttonIndex)
{ {
@ -890,9 +886,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
- (void)menuRefresh - (void)menuRefresh
{ {
menu_handle_t *menu = menu_driver_get_ptr(); menu_handle_t *menu = menu_driver_get_ptr();
if (!menu) if (!menu || !menu->need_refresh)
return;
if (!menu->need_refresh)
return; return;
menu_entries_deferred_push(menu->menu_list->selection_buf, menu_entries_deferred_push(menu->menu_list->selection_buf,