diff --git a/src/components/channellist/channellisttree.cpp b/src/components/channellist/channellisttree.cpp index ebbed58..e5bc06e 100644 --- a/src/components/channellist/channellisttree.cpp +++ b/src/components/channellist/channellisttree.cpp @@ -29,6 +29,7 @@ ChannelListTree::ChannelListTree() #ifdef WITH_VOICE , m_menu_voice_channel_join("_Join", true) , m_menu_voice_channel_disconnect("_Disconnect", true) + , m_menu_voice_open_chat("Open _Chat", true) #endif , m_menu_dm_copy_id("_Copy ID", true) , m_menu_dm_close("") // changes depending on if group or not @@ -209,8 +210,14 @@ ChannelListTree::ChannelListTree() m_signal_action_disconnect_voice.emit(); }); + m_menu_voice_open_chat.signal_activate().connect([this]() { + const auto id = static_cast((*m_model->get_iter(m_path_for_menu))[m_columns.m_id]); + m_signal_action_channel_item_select.emit(id); + }); + m_menu_voice_channel.append(m_menu_voice_channel_join); m_menu_voice_channel.append(m_menu_voice_channel_disconnect); + m_menu_voice_channel.append(m_menu_voice_open_chat); m_menu_voice_channel.show_all(); #endif @@ -1172,8 +1179,11 @@ bool ChannelListTree::SelectionFunc(const Glib::RefPtr &model, c } } - auto type = (*model->get_iter(path))[m_columns.m_type]; - return type == RenderType::TextChannel || type == RenderType::DM || type == RenderType::Thread; + const auto type = (*model->get_iter(path))[m_columns.m_type]; + const auto id = static_cast((*model->get_iter(path))[m_columns.m_id]); + // todo maybe just keep this last check? + if (type == RenderType::TextChannel || type == RenderType::DM || type == RenderType::Thread || (id == m_active_channel)) return true; + return is_currently_selected; } void ChannelListTree::AddPrivateChannels() { diff --git a/src/components/channellist/channellisttree.hpp b/src/components/channellist/channellisttree.hpp index 4eebbdb..17acb46 100644 --- a/src/components/channellist/channellisttree.hpp +++ b/src/components/channellist/channellisttree.hpp @@ -166,6 +166,7 @@ protected: Gtk::Menu m_menu_voice_channel; Gtk::MenuItem m_menu_voice_channel_join; Gtk::MenuItem m_menu_voice_channel_disconnect; + Gtk::MenuItem m_menu_voice_open_chat; #endif Gtk::Menu m_menu_dm;