Move remaining menu_common_list functiosn to menu_list.c

This commit is contained in:
twinaphex 2015-05-19 23:10:53 +02:00
parent 5e1afcc273
commit 2bcc2d08d7
5 changed files with 43 additions and 104 deletions

View File

@ -337,7 +337,6 @@ ifeq ($(HAVE_MENU_COMMON), 1)
OBJ += menu/menu_input.o \
menu/menu.o \
menu/menu_entry.o \
menu/menu_common_list.o \
menu/menu_navigation.o \
menu/menu_setting.o \
menu/menu_database.o \

View File

@ -713,7 +713,6 @@ MENU
#include "../menu/menu_input.c"
#include "../menu/menu.c"
#include "../menu/menu_entry.c"
#include "../menu/menu_common_list.c"
#include "../menu/menu_setting.c"
#include "../menu/menu_list.c"
#include "../menu/menu_entries_cbs_ok.c"

View File

@ -1,64 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "menu_common_list.h"
#include "menu.h"
#include "menu_entries_cbs.h"
void menu_common_list_insert(void *data,
const char *path, const char *label,
unsigned type, size_t idx)
{
file_list_t *list = (file_list_t*)data;
if (!list)
return;
list->list[idx].actiondata = (menu_file_list_cbs_t*)
calloc(1, sizeof(menu_file_list_cbs_t));
if (!list->list[idx].actiondata)
{
RARCH_ERR("Action data could not be allocated.\n");
return;
}
menu_entries_cbs_init(list, path, label, type, idx);
}
void menu_common_list_delete(void *data, size_t idx,
size_t list_size)
{
menu_file_list_cbs_t *cbs = NULL;
file_list_t *list = (file_list_t*)data;
if (!list)
return;
cbs = (menu_file_list_cbs_t*)list->list[idx].actiondata;
if (cbs)
{
cbs->action_start = NULL;
cbs->action_ok = NULL;
cbs->action_cancel = NULL;
cbs->action_left = NULL;
cbs->action_right = NULL;
cbs->action_deferred_push = NULL;
free(list->list[idx].actiondata);
}
list->list[idx].actiondata = NULL;
}

View File

@ -1,37 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2015 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MENU_COMMON_LIST_H__
#define MENU_COMMON_LIST_H__
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
void menu_common_list_insert(void *data,
const char *path, const char *label,
unsigned type, size_t idx);
void menu_common_list_delete(void *data, size_t idx,
size_t list_size);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -20,8 +20,8 @@
#include "../driver.h"
#include "menu.h"
#include "menu_common_list.h"
#include "menu_list.h"
#include "menu_entries_cbs.h"
#include "menu_navigation.h"
menu_list_t *menu_list_get_ptr(void)
@ -143,6 +143,29 @@ void menu_list_refresh(file_list_t *list)
menu_navigation_clear(nav, true);
}
static void menu_common_list_delete(file_list_t *list, size_t idx,
size_t list_size)
{
menu_file_list_cbs_t *cbs = NULL;
if (!list)
return;
cbs = (menu_file_list_cbs_t*)list->list[idx].actiondata;
if (cbs)
{
cbs->action_start = NULL;
cbs->action_ok = NULL;
cbs->action_cancel = NULL;
cbs->action_left = NULL;
cbs->action_right = NULL;
cbs->action_deferred_push = NULL;
free(list->list[idx].actiondata);
}
list->list[idx].actiondata = NULL;
}
static void menu_list_destroy(file_list_t *list)
{
unsigned i;
@ -345,6 +368,25 @@ end:
file_list_clear(list);
}
static void menu_common_list_insert(file_list_t *list,
const char *path, const char *label,
unsigned type, size_t idx)
{
if (!list)
return;
list->list[idx].actiondata = (menu_file_list_cbs_t*)
calloc(1, sizeof(menu_file_list_cbs_t));
if (!list->list[idx].actiondata)
{
RARCH_ERR("Action data could not be allocated.\n");
return;
}
menu_entries_cbs_init(list, path, label, type, idx);
}
void menu_list_push(file_list_t *list,
const char *path, const char *label,
unsigned type, size_t directory_ptr)