diff --git a/src/addons/addons_manager.cpp b/src/addons/addons_manager.cpp index b112279ba..eda93c636 100644 --- a/src/addons/addons_manager.cpp +++ b/src/addons/addons_manager.cpp @@ -190,16 +190,6 @@ void AddonsManager::downloadIcons() return; } // downloadIcons -// ---------------------------------------------------------------------------- -/** Returns true if the list of online addons has been downloaded. This is - * used to grey out the 'addons' entry till a network connections could be - * established. - */ -bool AddonsManager::onlineReady() -{ - return m_state.getAtomic()==STATE_READY; -} // onlineReady - // ---------------------------------------------------------------------------- /** Loads the installed addons from .../addons/addons_installed.xml. */ diff --git a/src/addons/addons_manager.hpp b/src/addons/addons_manager.hpp index d070686c3..900fe2579 100644 --- a/src/addons/addons_manager.hpp +++ b/src/addons/addons_manager.hpp @@ -57,22 +57,29 @@ private: public: AddonsManager(); void initOnline(const XMLNode *xml); - bool onlineReady(); - /** Marks addon as not being available. */ - void setErrorState() { m_state.setAtomic(STATE_ERROR); } const Addon* getAddon(const std::string &id) const; int getAddonIndex(const std::string &id) const; bool install(const Addon &addon); bool uninstall(const Addon &addon); void reInit(); // ------------------------------------------------------------------------ + /** Returns true if the list of online addons has been downloaded. This is + * used to grey out the 'addons' entry till a network connections could be + * established. */ + bool onlineReady() const {return m_state.getAtomic()==STATE_READY;} + // ------------------------------------------------------------------------ + bool wasError() const { return m_state.getAtomic()==STATE_ERROR;} + // ------------------------------------------------------------------------ + /** Marks addon as not being available. */ + void setErrorState() { m_state.setAtomic(STATE_ERROR); } + // ------------------------------------------------------------------------ /** Returns the list of addons (installed and uninstalled). */ unsigned int getNumAddons() const { return m_addons_list.getData().size();} // ------------------------------------------------------------------------ /** Returns the i-th addons. */ const Addon& getAddon(unsigned int i) { return m_addons_list.getData()[i];} -}; +}; // class AddonsManager extern AddonsManager *addons_manager; #endif diff --git a/src/states_screens/main_menu_screen.cpp b/src/states_screens/main_menu_screen.cpp index f6eceb449..e3fa3fb46 100644 --- a/src/states_screens/main_menu_screen.cpp +++ b/src/states_screens/main_menu_screen.cpp @@ -131,17 +131,24 @@ void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver) addons_icon->resetAllBadges(); addons_icon->setBadge(BAD_BADGE); } - else if (!addons_manager->onlineReady()) + else if (addons_manager->wasError()) { addons_icon->setDeactivated(); addons_icon->resetAllBadges(); - addons_icon->setBadge(LOADING_BADGE); + addons_icon->setBadge(BAD_BADGE); } - else + else if (addons_manager->onlineReady()) { addons_icon->setActivated(); addons_icon->resetAllBadges(); } + else + { + // Addons manager is still initialising/downloading. + addons_icon->setDeactivated(); + addons_icon->resetAllBadges(); + addons_icon->setBadge(LOADING_BADGE); + } } LabelWidget* w = this->getWidget("info_addons");