diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-10-24 22:45:31 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-10-24 22:45:31 -0400 |
commit | 182128705e10adf529b39a290232f0cd27bf4837 (patch) | |
tree | 99c1441b87b520a3f1563aad382ffb66db3b2e63 /src/components/channellist/channellist.cpp | |
parent | 8b034e48e27e4889b08ed648745a74d05630a431 (diff) | |
download | abaddon-portaudio-182128705e10adf529b39a290232f0cd27bf4837.tar.gz abaddon-portaudio-182128705e10adf529b39a290232f0cd27bf4837.zip |
very very rudimentary classic channels list
Diffstat (limited to 'src/components/channellist/channellist.cpp')
-rw-r--r-- | src/components/channellist/channellist.cpp | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/src/components/channellist/channellist.cpp b/src/components/channellist/channellist.cpp index 38a9ecc..6cb5321 100644 --- a/src/components/channellist/channellist.cpp +++ b/src/components/channellist/channellist.cpp @@ -1,12 +1,26 @@ #include "channellist.hpp" ChannelList::ChannelList() { + ConnectSignals(); + + m_guilds.set_halign(Gtk::ALIGN_START); + + m_guilds_scroll.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + + m_guilds.signal_guild_selected().connect([this](Snowflake guild_id) { + m_tree.SetSelectedGuild(guild_id); + }); + + m_guilds.show(); m_tree.show(); - add(m_tree); + m_guilds_scroll.add(m_guilds); + pack_start(m_guilds_scroll, false, false); // only take the space it needs + pack_start(m_tree, true, true); // use all the remaining space } void ChannelList::UpdateListing() { m_tree.UpdateListing(); + m_guilds.UpdateListing(); } void ChannelList::SetActiveChannel(Snowflake id, bool expand_to) { @@ -18,13 +32,45 @@ void ChannelList::UseExpansionState(const ExpansionStateRoot &state) { } ExpansionStateRoot ChannelList::GetExpansionState() const { - m_tree.GetExpansionState(); + return m_tree.GetExpansionState(); } void ChannelList::UsePanedHack(Gtk::Paned &paned) { m_tree.UsePanedHack(paned); } +void ChannelList::SetClassic(bool value) { + m_tree.SetClassic(value); + m_guilds_scroll.set_visible(value); +} + +void ChannelList::ConnectSignals() { + // TODO: if these all just travel upwards to the singleton then get rid of them but mayeb they dont + m_tree.signal_action_open_new_tab().connect([this](Snowflake id) { + m_signal_action_open_new_tab.emit(id); + }); + + m_tree.signal_action_join_voice_channel().connect([this](Snowflake id) { + m_signal_action_join_voice_channel.emit(id); + }); + + m_tree.signal_action_disconnect_voice().connect([this]() { + m_signal_action_disconnect_voice.emit(); + }); + + m_tree.signal_action_channel_item_select().connect([this](Snowflake id) { + m_signal_action_channel_item_select.emit(id); + }); + + m_tree.signal_action_guild_leave().connect([this](Snowflake id) { + m_signal_action_guild_leave.emit(id); + }); + + m_tree.signal_action_guild_settings().connect([this](Snowflake id) { + m_signal_action_guild_settings.emit(id); + }); +} + ChannelList::type_signal_action_open_new_tab ChannelList::signal_action_open_new_tab() { return m_signal_action_open_new_tab; } |