summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-05-07 02:32:30 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-05-07 02:32:30 -0400
commitd679b1af76a2e7afe8b28317268f95a1d8cdb5e2 (patch)
tree01c7e8d7693bfded9ea5fec8f9d99e2a47180f52 /components
parente2736e5806f9bd5814d5dc57ff3a422a37ee59d8 (diff)
downloadabaddon-portaudio-d679b1af76a2e7afe8b28317268f95a1d8cdb5e2.tar.gz
abaddon-portaudio-d679b1af76a2e7afe8b28317268f95a1d8cdb5e2.zip
friends: accept menu item for incoming
Diffstat (limited to 'components')
-rw-r--r--components/friendslist.cpp11
-rw-r--r--components/friendslist.hpp4
2 files changed, 14 insertions, 1 deletions
diff --git a/components/friendslist.cpp b/components/friendslist.cpp
index 029c5a1..34dffe7 100644
--- a/components/friendslist.cpp
+++ b/components/friendslist.cpp
@@ -114,7 +114,8 @@ FriendsListAddComponent::FriendsListAddComponent()
FriendsListFriendRow::FriendsListFriendRow(RelationshipType type, const UserData &data)
: Name(data.Username + "#" + data.Discriminator)
, Type(type)
- , ID(data.ID) {
+ , ID(data.ID)
+ , m_accept("Accept") {
auto *ev = Gtk::manage(new Gtk::EventBox);
auto *box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL));
auto *img = Gtk::manage(new LazyImage(32, 32, true));
@@ -142,6 +143,8 @@ FriendsListFriendRow::FriendsListFriendRow(RelationshipType type, const UserData
}
AddWidgetMenuHandler(ev, m_menu, [this] {
+ m_accept.set_visible(Type == RelationshipType::PendingIncoming);
+
switch (Type) {
case RelationshipType::Blocked:
case RelationshipType::Friend:
@@ -161,6 +164,12 @@ FriendsListFriendRow::FriendsListFriendRow(RelationshipType type, const UserData
m_remove.signal_activate().connect([this] {
m_signal_remove.emit();
});
+
+ m_accept.signal_activate().connect([this] {
+ m_signal_accept.emit();
+ });
+
+ m_menu.append(m_accept);
m_menu.append(m_remove);
m_menu.show_all();
diff --git a/components/friendslist.hpp b/components/friendslist.hpp
index 8d05c1e..445f293 100644
--- a/components/friendslist.hpp
+++ b/components/friendslist.hpp
@@ -49,12 +49,16 @@ public:
private:
Gtk::Menu m_menu;
Gtk::MenuItem m_remove; // or cancel or ignore
+ Gtk::MenuItem m_accept; // incoming
using type_signal_remove = sigc::signal<void>;
+ using type_signal_accept = sigc::signal<void>;
type_signal_remove m_signal_remove;
+ type_signal_accept m_signal_accept;
public:
type_signal_remove signal_action_remove();
+ type_signal_accept signal_action_accept();
};
class FriendsListWindow : public Gtk::Window {