summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2021-08-02 00:52:37 -0400
committerouwou <26526779+ouwou@users.noreply.github.com>2021-08-02 00:52:37 -0400
commit6c77e89bbe18a2f03d4f00072dc3afe6b97c8866 (patch)
tree6204a8cfc0e48e3b9dca22f854fb175ac5b3ad16 /components
parent22376ba54af0cfe85f006679467850de04b3feae (diff)
downloadabaddon-portaudio-6c77e89bbe18a2f03d4f00072dc3afe6b97c8866.tar.gz
abaddon-portaudio-6c77e89bbe18a2f03d4f00072dc3afe6b97c8866.zip
leave thread via menu
Diffstat (limited to 'components')
-rw-r--r--components/channels.cpp19
-rw-r--r--components/channels.hpp4
2 files changed, 22 insertions, 1 deletions
diff --git a/components/channels.cpp b/components/channels.cpp
index e175e8c..ed5de62 100644
--- a/components/channels.cpp
+++ b/components/channels.cpp
@@ -17,7 +17,9 @@ ChannelList::ChannelList()
, m_menu_category_copy_id("_Copy ID", true)
, m_menu_channel_copy_id("_Copy ID", true)
, m_menu_dm_close("") // changes depending on if group or not
- , m_menu_dm_copy_id("_Copy ID", true) {
+ , m_menu_dm_copy_id("_Copy ID", true)
+ , m_menu_thread_copy_id("_Copy ID", true)
+ , m_menu_thread_leave("_Leave", true) {
get_style_context()->add_class("channel-list");
const auto cb = [this](const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *column) {
@@ -121,6 +123,17 @@ ChannelList::ChannelList()
m_menu_dm.append(m_menu_dm_close);
m_menu_dm.show_all();
+ m_menu_thread_copy_id.signal_activate().connect([this] {
+ Gtk::Clipboard::get()->set_text(std::to_string((*m_model->get_iter(m_path_for_menu))[m_columns.m_id]));
+ });
+ m_menu_thread_leave.signal_activate().connect([this] {
+ if (Abaddon::Get().ShowConfirm("Are you sure you want to leave this thread?"))
+ Abaddon::Get().GetDiscordClient().LeaveThread(static_cast<Snowflake>((*m_model->get_iter(m_path_for_menu))[m_columns.m_id]), "Context%20Menu", [](...) {});
+ });
+ m_menu_thread.append(m_menu_thread_copy_id);
+ m_menu_thread.append(m_menu_thread_leave);
+ m_menu_thread.show_all();
+
auto &discord = Abaddon::Get().GetDiscordClient();
discord.signal_message_create().connect(sigc::mem_fun(*this, &ChannelList::OnMessageCreate));
discord.signal_guild_create().connect(sigc::mem_fun(*this, &ChannelList::UpdateNewGuild));
@@ -578,6 +591,10 @@ bool ChannelList::OnButtonPressEvent(GdkEventButton *ev) {
m_menu_dm_close.hide();
m_menu_dm.popup_at_pointer(reinterpret_cast<GdkEvent *>(ev));
} break;
+ case RenderType::Thread: {
+ m_menu_thread.popup_at_pointer(reinterpret_cast<GdkEvent *>(ev));
+ break;
+ } break;
default:
break;
}
diff --git a/components/channels.hpp b/components/channels.hpp
index ed87b57..c131a07 100644
--- a/components/channels.hpp
+++ b/components/channels.hpp
@@ -209,6 +209,10 @@ protected:
Gtk::MenuItem m_menu_dm_copy_id;
Gtk::MenuItem m_menu_dm_close;
+ Gtk::Menu m_menu_thread;
+ Gtk::MenuItem m_menu_thread_copy_id;
+ Gtk::MenuItem m_menu_thread_leave;
+
bool m_updating_listing = false;
public: