diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index 546b55f7b..e6d062992 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -271,6 +271,14 @@ bool COPKGManager::hasUpdates() return ret; } +void COPKGManager::doUpdate() +{ + int r = execCmd(pkg_types[OM_UPDATE]); + if (r) { + showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPDATE), strerror(errno), pkg_types[OM_UPDATE]); + } +} + void COPKGManager::refreshMenu() { list_installed_done = false, list_upgradeable_done = false; @@ -280,11 +288,7 @@ void COPKGManager::refreshMenu() { int COPKGManager::showMenu() { installed = false; - - int r = execCmd(pkg_types[OM_UPDATE]); - if (r) { - showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPDATE), strerror(errno), pkg_types[OM_UPDATE]); - } + doUpdate(); getPkgData(OM_LIST); getPkgData(OM_LIST_UPGRADEABLE); diff --git a/src/gui/opkg_manager.h b/src/gui/opkg_manager.h index bfbda558f..4404666c8 100644 --- a/src/gui/opkg_manager.h +++ b/src/gui/opkg_manager.h @@ -69,6 +69,7 @@ class COPKGManager : public CMenuTarget void refreshMenu(); bool badpackage(std::string &s); void showError(const char* local_msg, char* sys_msg, const std::string& command); + void doUpdate(); struct pkg { std::string name;