From 15cb0eeafdc81e0f181b289b8022615d428cdd2a Mon Sep 17 00:00:00 2001 From: nakst <> Date: Wed, 13 Oct 2021 21:19:47 +0100 Subject: [PATCH] bugfixes --- apps/file_manager/ui.cpp | 23 ++++++++++++----------- desktop/api.cpp | 4 ++-- res/Theme Source.dat | Bin 520444 -> 520444 bytes res/Theme.dat | Bin 28956 -> 28956 bytes 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/apps/file_manager/ui.cpp b/apps/file_manager/ui.cpp index 1ac18a0..8110fee 100644 --- a/apps/file_manager/ui.cpp +++ b/apps/file_manager/ui.cpp @@ -31,14 +31,21 @@ bool InstanceLoadFolder(Instance *instance, String path /* takes ownership */, i instance->issuedPasteTask = nullptr; - InstanceRemoveContents(instance); - FolderAttachInstance(instance, path, false); - StringDestroy(&path); - Task task = {}; task.context = historyMode; task.cDescription = interfaceString_FileManagerOpenFolderTask; + EsListViewIndex focusedIndex; + + if (EsListViewGetFocusedItem(instance->list, nullptr, &focusedIndex)) { + String name = instance->listContents[focusedIndex].entry->GetName(); + task.string = StringDuplicate(name); + } + + InstanceRemoveContents(instance); + FolderAttachInstance(instance, path, false); + StringDestroy(&path); + task.callback = [] (Instance *instance, Task *) { Folder *folder = instance->folder; EsMutexAcquire(&folder->modifyEntriesMutex); @@ -70,13 +77,7 @@ bool InstanceLoadFolder(Instance *instance, String path /* takes ownership */, i HistoryEntry historyEntry = {}; historyEntry.path = instance->path; - - EsListViewIndex focusedIndex; - - if (EsListViewGetFocusedItem(instance->list, nullptr, &focusedIndex)) { - String name = instance->listContents[focusedIndex].entry->GetName(); - historyEntry.focusedItem = StringDuplicate(name); - } + historyEntry.focusedItem = task->string; if (historyMode == LOAD_FOLDER_BACK) { instance->pathForwardHistory.Add(historyEntry); diff --git a/desktop/api.cpp b/desktop/api.cpp index 2ebf0e1..bd649bd 100644 --- a/desktop/api.cpp +++ b/desktop/api.cpp @@ -1573,10 +1573,10 @@ void EsCommandAddButton(EsCommand *command, EsButton *button) { Array elements = { command->elements }; elements.Add(button); command->elements = elements.array; - EsButtonOnCommand(button, command->callback, command); button->state |= UI_STATE_COMMAND_BUTTON; EsElementSetEnabled(button, command->enabled); - EsButtonSetCheck(button, command->check); + EsButtonSetCheck(button, command->check); // Set the check before setting the callback, so that it doesn't get called. + EsButtonOnCommand(button, command->callback, command); } EsCommand *EsCommandRegister(EsCommand *command, EsInstance *_instance, diff --git a/res/Theme Source.dat b/res/Theme Source.dat index 7207ceed8e1238beb0623848e11cb0c1afb5b2ea..6d079fde8b0cadf6656faa8b470701c78ededae0 100644 GIT binary patch delta 102 zcmezKQ2x(D`Gzfw%hQ+`-%XzQfAyrBoYP~|8Qmv4IBHBk@Qhh_`~MP_sZ7(F*)*mr zEM|tIF*6Xe05K~Nvu)SOWrF9%(h)8oBebP6C>Aj!)NTq K({(