summaryrefslogtreecommitdiff
path: root/src/gui/connection.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-22 15:23:58 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-22 15:23:58 +0000
commit836e7158bd9819c893e426ea5f88c959c606ce12 (patch)
tree0f58565fbe342b48619a3798b9a021fdecc3ef75 /src/gui/connection.cpp
parent69ae4ca599df6a5de249b2214c839bcac2e2feba (diff)
downloadmana-836e7158bd9819c893e426ea5f88c959c606ce12.tar.gz
mana-836e7158bd9819c893e426ea5f88c959c606ce12.tar.bz2
mana-836e7158bd9819c893e426ea5f88c959c606ce12.tar.xz
mana-836e7158bd9819c893e426ea5f88c959c606ce12.zip
Plugged memory leak in connection dialog box.
Diffstat (limited to 'src/gui/connection.cpp')
-rw-r--r--src/gui/connection.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp
index 17b397ba..e7923b9a 100644
--- a/src/gui/connection.cpp
+++ b/src/gui/connection.cpp
@@ -23,8 +23,6 @@
#include "connection.h"
-#include <guichan/actionlistener.hpp>
-
#include <guichan/widgets/label.hpp>
#include "button.h"
@@ -34,30 +32,12 @@
#include "../utils/gettext.h"
-namespace {
- struct ConnectionActionListener : public gcn::ActionListener
- {
- ConnectionActionListener(unsigned char previousState):
- mPreviousState(previousState) {};
-
- void action(const gcn::ActionEvent &event) {
- state = mPreviousState;
- }
-
- unsigned char mPreviousState;
- };
-}
-
-ConnectionDialog::ConnectionDialog(unsigned char previousState):
- Window("Info"), mProgress(0)
+ConnectionDialog::ConnectionDialog(int previousState):
+ Window("Info"), mProgress(0), mPreviousState(previousState)
{
setContentSize(200, 100);
- ConnectionActionListener *connectionListener =
- new ConnectionActionListener(previousState);
-
- Button *cancelButton = new Button(_("Cancel"), "cancelButton",
- connectionListener);
+ Button *cancelButton = new Button(_("Cancel"), "cancelButton", this);
mProgressBar = new ProgressBar(0.0, 200 - 10, 20, 128, 128, 128);
gcn::Label *label = new gcn::Label(_("Connecting..."));
@@ -73,6 +53,11 @@ ConnectionDialog::ConnectionDialog(unsigned char previousState):
setVisible(true);
}
+void ConnectionDialog::action(gcn::ActionEvent const &)
+{
+ state = mPreviousState;
+}
+
void ConnectionDialog::logic()
{
mProgress += 0.005f;