From 63311bac267ed0ebacc10068d8ffd2354a5f4371 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Wed, 20 Jul 2016 13:02:18 +0600 Subject: GUI: Add error callback in Options' Cloud tab Shows OSD message. --- gui/options.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'gui/options.cpp') 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(this, &GlobalOptionsDialog::storageInfoCallback), nullptr); + CloudMan.info( + new Common::Callback(this, &GlobalOptionsDialog::storageInfoCallback), + new Common::Callback(this, &GlobalOptionsDialog::storageErrorCallback) + ); Common::String dir = CloudMan.savesDirectoryPath(); if (dir.lastChar() == '/') dir.deleteLastChar(); - CloudMan.listDirectory(dir, new Common::Callback(this, &GlobalOptionsDialog::storageListDirectoryCallback), nullptr); + CloudMan.listDirectory( + dir, + new Common::Callback(this, &GlobalOptionsDialog::storageListDirectoryCallback), + new Common::Callback(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 -- cgit v1.2.3