Merge pull request #1273 from jeapostrophe/master

Fixing iOS menu problems and cleaning code
This commit is contained in:
Twinaphex 2014-11-26 20:41:48 +01:00
commit 5597603849
2 changed files with 33 additions and 31 deletions

View File

@ -416,16 +416,23 @@ static void RunActionSheet(const char* title, const struct string_list* items, U
list = [[RADirectoryList alloc] initWithPath:path extensions:self.setting->values action:
^(RADirectoryList* list, RADirectoryItem* item)
{
if (!list.allowBlank && !item)
const char *newval = NULL;
if (item) {
if (list.forDirectory && !item.isDirectory)
return;
if (list.forDirectory && !item.isDirectory)
newval = [item.path UTF8String];
} else {
if (!list.allowBlank)
return;
newval = "";
}
setting_data_set_with_string_representation(weakSelf.setting, newval);
[[list navigationController] popViewControllerAnimated:YES];
setting_data_set_with_string_representation(weakSelf.setting, item ? [item.path UTF8String] : "");
[[list navigationController] popViewControllerAnimated:YES];
[weakSelf.parentTable reloadData];
[weakSelf.parentTable reloadData];
}];
list.allowBlank = (self.setting->flags & SD_FLAG_ALLOW_EMPTY);

View File

@ -194,34 +194,29 @@ static const input_driver_t *input_drivers[] = {
* the drivers.
*/
const char* config_get_input_driver_options(void)
{
char *input_options;
int i;
int input_option_k = 0;
int input_options_len = 0;
unsigned offset = 0;
const char* config_get_input_driver_options(void) {
char *input_options = NULL;
int input_option_k = 0;
int input_options_len = 0;
union string_list_elem_attr attr;
attr.i = 0;
struct string_list *input_options_l = string_list_new();
while (input_drivers[input_option_k])
{
const char *opt = input_drivers[input_option_k]->ident;
input_options_len += strlen(opt) + 1;
input_option_k++;
}
for (input_option_k = 0; input_drivers[input_option_k]; input_option_k++) {
const char *opt = input_drivers[input_option_k]->ident;
input_options_len += strlen(opt) + 1;
string_list_append(input_options_l, opt, attr);
}
input_options = (char*)calloc(input_options_len, sizeof(char));
input_options = (char*)calloc(input_options_len, sizeof(char));
for (i = 0; i < input_option_k; i++)
{
const char *opt = input_drivers[i]->ident;
strlcpy(input_options + offset, opt, input_options_len - offset);
offset += strlen(opt);
input_options[offset] = '|';
offset += 1;
}
input_options[input_options_len - 1] = '\0';
string_list_join_concat(input_options, input_options_len, input_options_l, "|");
string_list_free(input_options_l);
input_options_l = NULL;
return input_options;
return input_options;
}
static const input_osk_driver_t *osk_drivers[] = {