item.h 946 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #include <m-array.h>
  3. #define MAX_EXT_LEN 6
  4. typedef enum { Item_Action, Item_Group } ItemType;
  5. typedef struct Item {
  6. ItemType type;
  7. FuriString* name;
  8. FuriString* path;
  9. char ext[MAX_EXT_LEN + 1];
  10. } Item;
  11. ARRAY_DEF(ItemArray, Item, M_POD_OPLIST);
  12. typedef struct ItemsView {
  13. FuriString* name;
  14. FuriString* path;
  15. ItemArray_t items;
  16. } ItemsView;
  17. /** Allocates and returns an ItemsView* which contains the list of
  18. * items to display for the given path.
  19. *
  20. * @param context App*
  21. * @param path FuriString*
  22. * @return ItemsView*
  23. */
  24. ItemsView* item_get_items_view_from_path(void* context, FuriString* path);
  25. /** Free ItemsView
  26. * @param items_view
  27. */
  28. void item_items_view_free(ItemsView* items_view);
  29. /** Prettify the name by removing a leading XX_, only if both X are digits,
  30. * as well as replace all '_' with ' '.
  31. * @param name FuriString*
  32. */
  33. void item_prettify_name(FuriString* name);