add open chat to voice channels

This commit is contained in:
ouwou 2024-06-17 03:29:03 -04:00
parent e6b4871df3
commit f8de54e47e
2 changed files with 13 additions and 2 deletions

View File

@ -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<Snowflake>((*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<Gtk::TreeModel> &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<Snowflake>((*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() {

View File

@ -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;