summaryrefslogtreecommitdiff
path: root/src/gui/gui.cpp
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2010-11-13 17:00:46 -0500
committerChuck Miller <shadowmil@gmail.com>2010-11-13 17:39:15 -0500
commitf8d22e47ac3b6392d68f1a8a45383798f5751101 (patch)
treee29b42821ec8f6e579f2cfd4d2a20bc8c248b930 /src/gui/gui.cpp
parent8e7e63a2473eedd36eeef726e45dacc9d17d157a (diff)
downloadmana-client-f8d22e47ac3b6392d68f1a8a45383798f5751101.tar.gz
mana-client-f8d22e47ac3b6392d68f1a8a45383798f5751101.tar.bz2
mana-client-f8d22e47ac3b6392d68f1a8a45383798f5751101.tar.xz
mana-client-f8d22e47ac3b6392d68f1a8a45383798f5751101.zip
Replace config listeners with the event system
Reviewed-by: Jared Adams
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r--src/gui/gui.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index c8568b0f..c0d1babf 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -29,8 +29,8 @@
#include "gui/widgets/window.h"
#include "gui/widgets/windowcontainer.h"
-#include "configlistener.h"
#include "configuration.h"
+#include "listener.h"
#include "graphics.h"
#include "log.h"
@@ -50,19 +50,23 @@ SDLInput *guiInput = 0;
// Bolded font
gcn::Font *boldFont = 0;
-class GuiConfigListener : public ConfigListener
+class GuiConfigListener : public Mana::Listener
{
public:
GuiConfigListener(Gui *g):
mGui(g)
{}
- void optionChanged(const std::string &name)
+ void event(Channels channel, const Mana::Event &event)
{
- if (name == "customcursor")
+ if (channel == CHANNEL_CONFIG)
{
- bool bCustomCursor = config.getBoolValue("customcursor");
- mGui->setUseCustomCursor(bCustomCursor);
+ if (event.getName() == EVENT_CONFIGOPTIONCHANGED &&
+ event.getString("option") == "customcursor")
+ {
+ bool bCustomCursor = config.getBoolValue("customcursor");
+ mGui->setUseCustomCursor(bCustomCursor);
+ }
}
}
private:
@@ -137,12 +141,11 @@ Gui::Gui(Graphics *graphics):
// Initialize mouse cursor and listen for changes to the option
setUseCustomCursor(config.getBoolValue("customcursor"));
mConfigListener = new GuiConfigListener(this);
- config.addListener("customcursor", mConfigListener);
+ mConfigListener->listen(CHANNEL_CONFIG);
}
Gui::~Gui()
{
- config.removeListener("customcursor", mConfigListener);
delete mConfigListener;
if (mMouseCursors)