diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/options.cpp | 19 | ||||
-rw-r--r-- | gui/options.h | 1 |
2 files changed, 18 insertions, 2 deletions
diff --git a/gui/options.cpp b/gui/options.cpp index f3afd58c96..ac548f53c7 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1624,10 +1624,17 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 } case kRefreshStorageCmd: { - CloudMan.info(new Common::Callback<GlobalOptionsDialog, Cloud::Storage::StorageInfoResponse>(this, &GlobalOptionsDialog::storageInfoCallback), nullptr); + CloudMan.info( + new Common::Callback<GlobalOptionsDialog, Cloud::Storage::StorageInfoResponse>(this, &GlobalOptionsDialog::storageInfoCallback), + new Common::Callback<GlobalOptionsDialog, Networking::ErrorResponse>(this, &GlobalOptionsDialog::storageErrorCallback) + ); Common::String dir = CloudMan.savesDirectoryPath(); if (dir.lastChar() == '/') dir.deleteLastChar(); - CloudMan.listDirectory(dir, new Common::Callback<GlobalOptionsDialog, Cloud::Storage::ListDirectoryResponse>(this, &GlobalOptionsDialog::storageListDirectoryCallback), nullptr); + CloudMan.listDirectory( + dir, + new Common::Callback<GlobalOptionsDialog, Cloud::Storage::ListDirectoryResponse>(this, &GlobalOptionsDialog::storageListDirectoryCallback), + new Common::Callback<GlobalOptionsDialog, Networking::ErrorResponse>(this, &GlobalOptionsDialog::storageErrorCallback) + ); break; } case kDownloadStorageCmd: @@ -1825,6 +1832,14 @@ void GlobalOptionsDialog::storageListDirectoryCallback(Cloud::Storage::ListDirec CloudMan.setStorageUsedSpace(CloudMan.getStorageIndex(), totalSize); _redrawCloudTab = true; } + +void GlobalOptionsDialog::storageErrorCallback(Networking::ErrorResponse response) { + debug("error response (%s, %ld):", (response.failed ? "failed" : "interrupted"), response.httpResponseCode); + debug("%s", response.response.c_str()); + + if (!response.interrupted) + g_system->displayMessageOnOSD(_("Request failed.\nCheck your Internet connection.")); +} #endif } // End of namespace GUI diff --git a/gui/options.h b/gui/options.h index e68778cf8e..a7e98adff6 100644 --- a/gui/options.h +++ b/gui/options.h @@ -277,6 +277,7 @@ protected: #ifdef USE_LIBCURL void storageInfoCallback(Cloud::Storage::StorageInfoResponse response); void storageListDirectoryCallback(Cloud::Storage::ListDirectoryResponse response); + void storageErrorCallback(Networking::ErrorResponse response); #endif }; |