diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 318f5dfb16..1e33745001 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -491,24 +491,12 @@ static void rgui_render(void) char message[PATH_MAX_LENGTH], type_str[PATH_MAX_LENGTH], entry_title_buf[PATH_MAX_LENGTH], type_str_buf[PATH_MAX_LENGTH], path_buf[PATH_MAX_LENGTH]; - const char *path = NULL, *entry_label = NULL; - unsigned type = 0, w = 0; + unsigned w = 0; bool selected = false; - menu_file_list_cbs_t *cbs = NULL; - menu_list_get_at_offset(menu->menu_list->selection_buf, i, &path, - &entry_label, &type); - - cbs = (menu_file_list_cbs_t*) - menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf, - i); - - if (cbs && cbs->action_get_representation) - cbs->action_get_representation(menu->menu_list->selection_buf, - &w, type, i, label, - type_str, sizeof(type_str), - entry_label, path, - path_buf, sizeof(path_buf)); + menu_display_setting_label(i, &w, label, + type_str, sizeof(type_str), + path_buf, sizeof(path_buf)); selected = (i == menu->navigation.selection_ptr); diff --git a/menu/menu_display.c b/menu/menu_display.c index 202ce420ca..2ee67a336d 100644 --- a/menu/menu_display.c +++ b/menu/menu_display.c @@ -206,3 +206,29 @@ void menu_display_unset_viewport(menu_handle_t *menu) video_driver_set_viewport(global->video_data.width, global->video_data.height, false, true); } + +void menu_display_setting_label(unsigned i, unsigned *w, + const char *label, + char *type_str, size_t sizeof_type_str, + char *path_buf, size_t sizeof_path_buf) +{ + unsigned type = 0; + const char *path = NULL; + const char *entry_label = NULL; + menu_file_list_cbs_t *cbs = NULL; + menu_handle_t *menu = menu_driver_get_ptr(); + + menu_list_get_at_offset(menu->menu_list->selection_buf, i, &path, + &entry_label, &type); + + cbs = (menu_file_list_cbs_t*) + menu_list_get_actiondata_at_offset(menu->menu_list->selection_buf, + i); + + if (cbs && cbs->action_get_representation) + cbs->action_get_representation(menu->menu_list->selection_buf, + w, type, i, label, + type_str, sizeof_type_str, + entry_label, path, + path_buf, sizeof_path_buf); +} diff --git a/menu/menu_display.h b/menu/menu_display.h index 1fc8a7f6fd..c712482ca8 100644 --- a/menu/menu_display.h +++ b/menu/menu_display.h @@ -53,6 +53,11 @@ void menu_display_set_viewport(menu_handle_t *menu); void menu_display_unset_viewport(menu_handle_t *menu); +void menu_display_setting_label(unsigned i, unsigned *w, + const char *label, + char *type_str, size_t sizeof_type_str, + char *path_buf, size_t sizeof_path_buf); + #ifdef __cplusplus } #endif