summaryrefslogtreecommitdiff
path: root/src/gui/connection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/connection.cpp')
-rw-r--r--src/gui/connection.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp
index a69698e9..fbf127de 100644
--- a/src/gui/connection.cpp
+++ b/src/gui/connection.cpp
@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <guichan/actionlistener.hpp>
-
#include <guichan/widgets/label.hpp>
#include "button.h"
@@ -28,23 +26,16 @@
#include "progressbar.h"
#include "../main.h"
+#include "../log.h"
#include "../utils/gettext.h"
-namespace
-{
- struct ConnectionActionListener : public gcn::ActionListener
- {
- void action(const gcn::ActionEvent &event) { state = EXIT_STATE; }
- } listener;
-}
-
-ConnectionDialog::ConnectionDialog():
- Window("Info"), mProgress(0)
+ConnectionDialog::ConnectionDialog(int previousState):
+ Window("Info"), mProgress(0), mPreviousState(previousState)
{
setContentSize(200, 100);
- Button *cancelButton = new Button(_("Cancel"), "cancelButton", &listener);
+ 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..."));
@@ -60,6 +51,12 @@ ConnectionDialog::ConnectionDialog():
setVisible(true);
}
+void ConnectionDialog::action(gcn::ActionEvent const &)
+{
+ logger->log("Cancel pressed");
+ state = mPreviousState;
+}
+
void ConnectionDialog::logic()
{
mProgress += 0.005f;