mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
convert impl to use m-algo and *_sort funcs
This commit is contained in:
@@ -67,7 +67,7 @@ static void
|
||||
browser->view,
|
||||
ArchiveBrowserViewModel * model,
|
||||
{
|
||||
files_array_special_sort(model->files, ArchiveFile_t_cmp);
|
||||
files_array_sort(model->files);
|
||||
model->list_loading = false;
|
||||
},
|
||||
true);
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <m-array.h>
|
||||
#include <furi.h>
|
||||
#include <m-algo.h>
|
||||
#include <m-string.h>
|
||||
#include <storage/storage.h>
|
||||
|
||||
#define FAP_MANIFEST_MAX_ICON_SIZE 32
|
||||
@@ -84,21 +86,18 @@ static int ArchiveFile_t_cmp(const ArchiveFile_t* a, const ArchiveFile_t* b) {
|
||||
return string_cmp(a->path, b->path);
|
||||
}
|
||||
|
||||
static void ArchiveFile_t_swap(ArchiveFile_t* a, ArchiveFile_t* b) {
|
||||
ArchiveFile_t tmp = *a;
|
||||
*a = *b;
|
||||
*b = tmp;
|
||||
}
|
||||
#define M_OPL_ArchiveFile_t() \
|
||||
(INIT(API_2(ArchiveFile_t_init)), \
|
||||
SET(API_6(ArchiveFile_t_set)), \
|
||||
INIT_SET(API_6(ArchiveFile_t_init_set)), \
|
||||
CLEAR(API_2(ArchiveFile_t_clear)), \
|
||||
CMP(API_6(ArchiveFile_t_cmp)), \
|
||||
SWAP(M_SWAP_DEFAULT), \
|
||||
EQUAL(API_6(M_EQUAL_DEFAULT)))
|
||||
|
||||
ARRAY_DEF(
|
||||
files_array,
|
||||
ArchiveFile_t,
|
||||
(INIT(API_2(ArchiveFile_t_init)),
|
||||
SET(API_6(ArchiveFile_t_set)),
|
||||
INIT_SET(API_6(ArchiveFile_t_init_set)),
|
||||
CLEAR(API_2(ArchiveFile_t_clear)),
|
||||
CMP(API_6(ArchiveFile_t_cmp)),
|
||||
SWAP(API_6(ArchiveFile_t_swap))))
|
||||
ARRAY_DEF(files_array, ArchiveFile_t)
|
||||
|
||||
ALGO_DEF(files_array, ARRAY_OPLIST(files_array, M_OPL_ArchiveFile_t()))
|
||||
|
||||
void archive_set_file_type(ArchiveFile_t* file, const char* path, bool is_folder, bool is_app);
|
||||
bool archive_get_items(void* context, const char* path);
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <core/common_defines.h>
|
||||
#include <core/log.h>
|
||||
#include "furi_hal_resources.h"
|
||||
#include "m-string.h"
|
||||
#include "m-algo.h"
|
||||
#include <m-array.h>
|
||||
#include <gui/elements.h>
|
||||
#include <furi.h>
|
||||
@@ -82,15 +84,18 @@ static int BrowserItem_t_cmp(const BrowserItem_t* a, const BrowserItem_t* b) {
|
||||
return string_cmp(a->path, b->path);
|
||||
}
|
||||
|
||||
ARRAY_DEF(
|
||||
items_array,
|
||||
BrowserItem_t,
|
||||
(INIT(API_2(BrowserItem_t_init)),
|
||||
SET(API_6(BrowserItem_t_set)),
|
||||
INIT_SET(API_6(BrowserItem_t_init_set)),
|
||||
CLEAR(API_2(BrowserItem_t_clear)),
|
||||
CMP(API_6(BrowserItem_t_cmp)),
|
||||
SWAP(M_SWAP_DEFAULT)))
|
||||
#define M_OPL_BrowserItem_t() \
|
||||
(INIT(API_2(BrowserItem_t_init)), \
|
||||
SET(API_6(BrowserItem_t_set)), \
|
||||
INIT_SET(API_6(BrowserItem_t_init_set)), \
|
||||
CLEAR(API_2(BrowserItem_t_clear)), \
|
||||
CMP(API_6(BrowserItem_t_cmp)), \
|
||||
SWAP(M_SWAP_DEFAULT), \
|
||||
EQUAL(API_6(M_EQUAL_DEFAULT)))
|
||||
|
||||
ARRAY_DEF(items_array, BrowserItem_t)
|
||||
|
||||
ALGO_DEF(items_array, ARRAY_OPLIST(items_array, M_OPL_BrowserItem_t()))
|
||||
|
||||
struct FileBrowser {
|
||||
View* view;
|
||||
@@ -404,7 +409,7 @@ static void
|
||||
browser->view,
|
||||
FileBrowserModel * model,
|
||||
{
|
||||
items_array_special_sort(model->items, BrowserItem_t_cmp);
|
||||
items_array_sort(model->items);
|
||||
model->list_loading = false;
|
||||
},
|
||||
true);
|
||||
|
||||
Reference in New Issue
Block a user