summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-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;