summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-04-25 20:06:53 -0600
committerJared Adams <jaxad0127@gmail.com>2010-04-25 23:10:57 -0600
commit5e75167f64473d645e40d7f6eb58eb1ef8f6cdea (patch)
tree224a58953254aa447e5c532cefbc946a933b2a00 /src
parent88524a71b8d3727b5ad4a8a60e146fd8e786b7ad (diff)
downloadmana-5e75167f64473d645e40d7f6eb58eb1ef8f6cdea.tar.gz
mana-5e75167f64473d645e40d7f6eb58eb1ef8f6cdea.tar.bz2
mana-5e75167f64473d645e40d7f6eb58eb1ef8f6cdea.tar.xz
mana-5e75167f64473d645e40d7f6eb58eb1ef8f6cdea.zip
Fix some button issues in SocialWindow
The invite and leave buttons are now only enabled when there are tabs. Also, the code to handle them will do nothing if no tab is selected (backup logic). Reviewed-by: Chuck Miller
Diffstat (limited to 'src')
-rw-r--r--src/gui/socialwindow.cpp21
-rw-r--r--src/gui/socialwindow.h2
2 files changed, 21 insertions, 2 deletions
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 10ed680e..468a94c4 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -328,6 +328,8 @@ SocialWindow::SocialWindow() :
{
addTab(player_node->getParty());
}
+ else
+ updateButtons();
}
SocialWindow::~SocialWindow()
@@ -362,6 +364,8 @@ bool SocialWindow::addTab(Guild *guild)
mTabs->addTab(tab, tab->mScroll);
+ updateButtons();
+
return true;
}
@@ -375,6 +379,8 @@ bool SocialWindow::removeTab(Guild *guild)
delete it->second;
mGuilds.erase(it);
+ updateButtons();
+
return true;
}
@@ -388,6 +394,8 @@ bool SocialWindow::addTab(Party *party)
mTabs->addTab(tab, tab->mScroll);
+ updateButtons();
+
return true;
}
@@ -401,6 +409,8 @@ bool SocialWindow::removeTab(Party *party)
delete it->second;
mParties.erase(it);
+ updateButtons();
+
return true;
}
@@ -453,11 +463,11 @@ void SocialWindow::action(const gcn::ActionEvent &event)
else
showPartyCreate();
}
- else if (event.getId() == "invite")
+ else if (event.getId() == "invite" && mTabs->getSelectedTabIndex() > -1)
{
static_cast<SocialTab*>(mTabs->getSelectedTab())->invite();
}
- else if (event.getId() == "leave")
+ else if (event.getId() == "leave" && mTabs->getSelectedTabIndex() > -1)
{
static_cast<SocialTab*>(mTabs->getSelectedTab())->leave();
}
@@ -596,3 +606,10 @@ void SocialWindow::showPartyCreate()
mPartyCreateDialog->setActionEventId("create party");
mPartyCreateDialog->addActionListener(this);
}
+
+void SocialWindow::updateButtons()
+{
+ bool hasTabs = mTabs->getNumberOfTabs() > 0;
+ mInviteButton->setEnabled(hasTabs);
+ mLeaveButton->setEnabled(hasTabs);
+}
diff --git a/src/gui/socialwindow.h b/src/gui/socialwindow.h
index d3e69cc5..885c0e54 100644
--- a/src/gui/socialwindow.h
+++ b/src/gui/socialwindow.h
@@ -77,6 +77,8 @@ public:
protected:
friend class SocialTab;
+ void updateButtons();
+
int mGuildInvited;
ConfirmDialog *mGuildAcceptDialog;
TextDialog *mGuildCreateDialog;