Fix keybind settings UI functionality

This commit is contained in:
Willy-JL
2024-08-11 04:10:17 +02:00
parent b96b6dd197
commit 7a320d2472
3 changed files with 9 additions and 0 deletions

View File

@@ -7,6 +7,8 @@ static void
DesktopSettingsApp* app = context; DesktopSettingsApp* app = context;
desktop_settings_app_set_keybind(app, (const char*)index); desktop_settings_app_set_keybind(app, (const char*)index);
scene_manager_search_and_switch_to_previous_scene(
app->scene_manager, DesktopSettingsAppSceneStart);
} }
void desktop_settings_scene_keybinds_action_on_enter(void* context) { void desktop_settings_scene_keybinds_action_on_enter(void* context) {

View File

@@ -61,12 +61,16 @@ static void
furi_record_close(RECORD_STORAGE); furi_record_close(RECORD_STORAGE);
if(dialog_file_browser_show(app->dialogs, temp_path, temp_path, &browser_options)) { if(dialog_file_browser_show(app->dialogs, temp_path, temp_path, &browser_options)) {
desktop_settings_app_set_keybind(app, furi_string_get_cstr(temp_path)); desktop_settings_app_set_keybind(app, furi_string_get_cstr(temp_path));
scene_manager_search_and_switch_to_previous_scene(
app->scene_manager, DesktopSettingsAppSceneStart);
} }
furi_string_free(temp_path); furi_string_free(temp_path);
break; break;
} }
case DesktopSettingsAppKeybindActionTypeRemoveKeybind: case DesktopSettingsAppKeybindActionTypeRemoveKeybind:
desktop_settings_app_set_keybind(app, ""); desktop_settings_app_set_keybind(app, "");
scene_manager_search_and_switch_to_previous_scene(
app->scene_manager, DesktopSettingsAppSceneStart);
break; break;
default: default:
break; break;

View File

@@ -33,6 +33,9 @@ bool desktop_settings_scene_keybinds_reset_on_event(void* context, SceneManagerE
case DialogExResultRight: case DialogExResultRight:
storage_common_remove(furi_record_open(RECORD_STORAGE), DESKTOP_KEYBINDS_PATH); storage_common_remove(furi_record_open(RECORD_STORAGE), DESKTOP_KEYBINDS_PATH);
furi_record_close(RECORD_STORAGE); furi_record_close(RECORD_STORAGE);
desktop_keybinds_free(&app->keybinds);
desktop_keybinds_load(furi_record_open(RECORD_DESKTOP), &app->keybinds);
furi_record_close(RECORD_DESKTOP);
/* fall through */ /* fall through */
case DialogExResultLeft: case DialogExResultLeft:
consumed = scene_manager_previous_scene(app->scene_manager); consumed = scene_manager_previous_scene(app->scene_manager);