diff --git a/file_list.c b/file_list.c index 510628b620..e9f0db2019 100644 --- a/file_list.c +++ b/file_list.c @@ -35,8 +35,14 @@ void file_list_push(file_list_t *list, } #ifdef HAVE_MENU - if (driver.menu_ctx && driver.menu_ctx->list_insert) - driver.menu_ctx->list_insert(list, path, label, list->size); + if (driver.menu_ctx) + { + if (driver.menu_ctx->list_insert) + driver.menu_ctx->list_insert(list, path, label, list->size); + + if (driver.menu_ctx->backend->list_insert) + driver.menu_ctx->backend->list_insert(list, path, label, list->size); + } #endif list->list[list->size].label = strdup(label); @@ -65,8 +71,13 @@ void file_list_pop(file_list_t *list, size_t *directory_ptr) { --list->size; #ifdef HAVE_MENU - if (driver.menu_ctx && driver.menu_ctx->list_delete) - driver.menu_ctx->list_delete(list, list->size, list->size); + if (driver.menu_ctx) + { + if (driver.menu_ctx->list_delete) + driver.menu_ctx->list_delete(list, list->size, list->size); + if (driver.menu_ctx->backend->list_delete) + driver.menu_ctx->backend->list_delete(list, list->size, list->size); + } #endif free(list->list[list->size].path); free(list->list[list->size].label); @@ -76,8 +87,14 @@ void file_list_pop(file_list_t *list, size_t *directory_ptr) *directory_ptr = list->list[list->size].directory_ptr; #ifdef HAVE_MENU - if (driver.menu_ctx && driver.menu_ctx->list_set_selection) - driver.menu_ctx->list_set_selection(list); + if (driver.menu_ctx) + { + if (driver.menu_ctx->list_set_selection) + driver.menu_ctx->list_set_selection(list); + + if (driver.menu_ctx->backend->list_set_selection) + driver.menu_ctx->backend->list_set_selection(list); + } #endif } @@ -91,8 +108,13 @@ void file_list_free(file_list_t *list) for (i = 0; i < list->size; i++) { #ifdef HAVE_MENU - if (driver.menu_ctx && driver.menu_ctx->list_delete) - driver.menu_ctx->list_delete(list, i, list->size); + if (driver.menu_ctx) + { + if (driver.menu_ctx->list_delete) + driver.menu_ctx->list_delete(list, i, list->size); + if (driver.menu_ctx->backend->list_delete) + driver.menu_ctx->backend->list_delete(list, i, list->size); + } #endif free(list->list[i].path); free(list->list[i].label); @@ -116,8 +138,14 @@ void file_list_clear(file_list_t *list) } #ifdef HAVE_MENU - if (driver.menu_ctx && driver.menu_ctx->list_clear) - driver.menu_ctx->list_clear(list); + if (driver.menu_ctx) + { + if (driver.menu_ctx->list_clear) + driver.menu_ctx->list_clear(list); + + if (driver.menu_ctx->backend->list_clear) + driver.menu_ctx->backend->list_clear(list); + } #endif list->size = 0; } @@ -171,6 +199,11 @@ void *file_list_get_userdata_at_offset(const file_list_t *list, size_t index) return list->list[index].userdata; } +void *file_list_get_actiondata_at_offset(const file_list_t *list, size_t index) +{ + return list->list[index].actiondata; +} + void file_list_get_at_offset(const file_list_t *list, size_t index, const char **path, const char **label, unsigned *file_type) { diff --git a/file_list.h b/file_list.h index f1d7627a9e..0245f7cab8 100644 --- a/file_list.h +++ b/file_list.h @@ -31,6 +31,7 @@ struct item_file unsigned type; size_t directory_ptr; void *userdata; + void *actiondata; }; typedef struct file_list diff --git a/frontend/menu/backend/menu_backend.h b/frontend/menu/backend/menu_backend.h index dc71eb0133..dcc7762043 100644 --- a/frontend/menu/backend/menu_backend.h +++ b/frontend/menu/backend/menu_backend.h @@ -11,6 +11,10 @@ typedef struct menu_ctx_driver_backend unsigned (*type_is)(const char *, unsigned); void (*setting_set_label)(char *, size_t, unsigned *, unsigned, const char *, const char *, unsigned); + void (*list_insert)(void *, const char *, const char *, size_t); + void (*list_delete)(void *, size_t, size_t); + void (*list_clear)(void *); + void (*list_set_selection)(void *); const char *ident; } menu_ctx_driver_backend_t; diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index a1ebf9e12a..6901f3b1b0 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -1121,9 +1121,32 @@ static void menu_common_setting_set_label(char *type_str, type, menu_label, label, index); } +static void menu_common_list_insert(void *data, + const char *path, const char *unused, size_t list_size) +{ +} + +static void menu_common_list_delete(void *data, size_t index, + size_t list_size) +{ +} + +static void menu_common_list_clear(void *data) +{ +} + +static void menu_common_list_set_selection(void *data) +{ +} + menu_ctx_driver_backend_t menu_ctx_backend_common = { menu_common_iterate, menu_common_type_is, menu_common_setting_set_label, + menu_common_list_insert, + menu_common_list_delete, + menu_common_list_clear, + menu_common_list_set_selection, + "menu_common", }; diff --git a/frontend/menu/backend/menu_lakka_backend.c b/frontend/menu/backend/menu_lakka_backend.c index 7f09b33b24..006324a7dd 100644 --- a/frontend/menu/backend/menu_lakka_backend.c +++ b/frontend/menu/backend/menu_lakka_backend.c @@ -545,5 +545,9 @@ menu_ctx_driver_backend_t menu_ctx_backend_lakka = { menu_lakka_iterate, NULL, NULL, + NULL, + NULL, + NULL, + NULL, "menu_lakka", };