summaryrefslogtreecommitdiff
path: root/src/gui/socialwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/socialwindow.cpp')
-rw-r--r--src/gui/socialwindow.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 8d833123..2043da52 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -326,6 +326,8 @@ SocialWindow::SocialWindow() :
{
addTab(player_node->getParty());
}
+ else
+ updateButtons();
}
SocialWindow::~SocialWindow()
@@ -360,6 +362,8 @@ bool SocialWindow::addTab(Guild *guild)
mTabs->addTab(tab, tab->mScroll);
+ updateButtons();
+
return true;
}
@@ -373,6 +377,8 @@ bool SocialWindow::removeTab(Guild *guild)
delete it->second;
mGuilds.erase(it);
+ updateButtons();
+
return true;
}
@@ -386,6 +392,8 @@ bool SocialWindow::addTab(Party *party)
mTabs->addTab(tab, tab->mScroll);
+ updateButtons();
+
return true;
}
@@ -399,6 +407,8 @@ bool SocialWindow::removeTab(Party *party)
delete it->second;
mParties.erase(it);
+ updateButtons();
+
return true;
}
@@ -451,11 +461,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();
}
@@ -594,3 +604,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);
+}