78 lines
No EOL
1.8 KiB
C
78 lines
No EOL
1.8 KiB
C
// Header
|
|
#include "archive.h"
|
|
|
|
// Structures
|
|
typedef enum {
|
|
FP_Scene_Archive_Event_Import,
|
|
FP_Scene_Archive_Event_Export
|
|
} FP_Scene_Archive_Event;
|
|
|
|
// Functions
|
|
void FP_Scene_Callback_Archive(void* context, uint32_t index){
|
|
// Setting context
|
|
FP_App* app = context;
|
|
|
|
// Sending it to the scene manager
|
|
scene_manager_handle_custom_event(app->scene_manager, index);
|
|
}
|
|
void FP_Scene_Enter_Archive(void* context){
|
|
// Setting the context
|
|
FP_App* app = context;
|
|
|
|
// Reset view
|
|
submenu_reset(app->submenu);
|
|
|
|
// Adding some stuff
|
|
submenu_add_item(
|
|
app->submenu,
|
|
"Import Archive",
|
|
FP_Scene_Archive_Event_Import,
|
|
FP_Scene_Callback_Archive,
|
|
app
|
|
);
|
|
submenu_add_item(
|
|
app->submenu,
|
|
"Export Archive",
|
|
FP_Scene_Archive_Event_Export,
|
|
FP_Scene_Callback_Archive,
|
|
app
|
|
);
|
|
|
|
// Send view to Flipper
|
|
view_dispatcher_switch_to_view(app->view_dispatcher, FP_View_Submenu);
|
|
}
|
|
void FP_Scene_Exit_Archive(void* context){
|
|
// Setting context
|
|
FP_App* app = context;
|
|
|
|
// Reset menu
|
|
submenu_reset(app->submenu);
|
|
}
|
|
bool FP_Scene_Event_Archive(void* context, SceneManagerEvent event){
|
|
// Setting context
|
|
FP_App* app = context;
|
|
bool consumed = false;
|
|
|
|
// Switching based on event
|
|
if (event.type == SceneManagerEventTypeCustom) {
|
|
// We consumed it
|
|
consumed = true;
|
|
|
|
// What did we choose?
|
|
switch (event.event) {
|
|
case FP_Scene_Archive_Event_Import:
|
|
scene_manager_next_scene(
|
|
app->scene_manager,
|
|
FP_Scene_Import
|
|
);
|
|
break;
|
|
case FP_Scene_Archive_Event_Export:
|
|
break;
|
|
}
|
|
} else {
|
|
consumed = false;
|
|
}
|
|
|
|
// Return result
|
|
return consumed;
|
|
} |