From d50c9236f44e3251ccc035f55c70674c2e07092c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 8 May 2015 19:44:46 +0200 Subject: [PATCH] Rename some static functions --- menu/menu_list.c | 55 ++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/menu/menu_list.c b/menu/menu_list.c index 614c478c29..bd957c9841 100644 --- a/menu/menu_list.c +++ b/menu/menu_list.c @@ -30,30 +30,6 @@ menu_list_t *menu_list_get_ptr(void) return menu->menu_list; } -/** - * Before a refresh, we could have deleted a - * file on disk, causing selection_ptr to - * suddendly be out of range. - * - * Ensure it doesn't overflow. - **/ -static void menu_entries_refresh(file_list_t *list) -{ - menu_navigation_t *nav = menu_navigation_get_ptr(); - menu_list_t *menu_list = menu_list_get_ptr(); - if (!nav || !menu_list) - return; - if (!list) - return; - - if (nav->selection_ptr >= menu_list_get_size(menu_list) - && menu_list_get_size(menu_list)) - menu_navigation_set(nav, - menu_list_get_size(menu_list) - 1, true); - else if (!menu_list_get_size(menu_list)) - menu_navigation_clear(nav, true); -} - /** * menu_entries_list_elem_is_dir: * @list : File list handle. @@ -103,7 +79,7 @@ static INLINE int menu_entries_list_get_first_char( return ret; } -static void menu_entries_build_scroll_indices(file_list_t *list) +static void menu_list_build_scroll_indices(file_list_t *list) { size_t i; int current; @@ -139,6 +115,32 @@ static void menu_entries_build_scroll_indices(file_list_t *list) list->size - 1; } +/** + * Before a refresh, we could have deleted a + * file on disk, causing selection_ptr to + * suddendly be out of range. + * + * Ensure it doesn't overflow. + **/ +static void menu_list_refresh(file_list_t *list) +{ + menu_navigation_t *nav = menu_navigation_get_ptr(); + menu_list_t *menu_list = menu_list_get_ptr(); + if (!nav || !menu_list) + return; + if (!list) + return; + + menu_list_build_scroll_indices(list); + + if (nav->selection_ptr >= menu_list_get_size(menu_list) + && menu_list_get_size(menu_list)) + menu_navigation_set(nav, + menu_list_get_size(menu_list) - 1, true); + else if (!menu_list_get_size(menu_list)) + menu_navigation_clear(nav, true); +} + static void menu_list_destroy(file_list_t *list) { unsigned i; @@ -419,8 +421,7 @@ int menu_list_populate_generic(file_list_t *list, const char *path, nav->scroll.indices.size = 0; - menu_entries_build_scroll_indices(list); - menu_entries_refresh(list); + menu_list_refresh(list); menu_driver_populate_entries(path, label, type);