dont expand channel list when changing tabs

This commit is contained in:
ouwou
2022-04-23 15:33:54 -04:00
parent b4ab88f708
commit bfb2490938
8 changed files with 16 additions and 15 deletions

View File

@@ -462,7 +462,7 @@ void ChannelList::OnGuildUnmute(Snowflake id) {
// create a temporary channel row for non-joined threads
// and delete them when the active channel switches off of them if still not joined
void ChannelList::SetActiveChannel(Snowflake id) {
void ChannelList::SetActiveChannel(Snowflake id, bool expand_to) {
// mark channel as read when switching off
if (m_active_channel.IsValid())
Abaddon::Get().GetDiscordClient().MarkChannelAsRead(m_active_channel, [](...) {});
@@ -479,11 +479,12 @@ void ChannelList::SetActiveChannel(Snowflake id) {
const auto channel_iter = GetIteratorForChannelFromID(id);
if (channel_iter) {
m_view.expand_to_path(m_model->get_path(channel_iter));
if (expand_to) {
m_view.expand_to_path(m_model->get_path(channel_iter));
}
m_view.get_selection()->select(channel_iter);
} else {
m_view.get_selection()->unselect_all();
// SetActiveChannel should probably just take the channel object
const auto channel = Abaddon::Get().GetDiscordClient().GetChannel(id);
if (!channel.has_value() || !channel->IsThread()) return;
auto parent_iter = GetIteratorForChannelFromID(*channel->ParentID);

View File

@@ -19,7 +19,7 @@ public:
ChannelList();
void UpdateListing();
void SetActiveChannel(Snowflake id);
void SetActiveChannel(Snowflake id, bool expand_to);
// channel list should be populated when this is called
void UseExpansionState(const ExpansionStateRoot &state);

View File

@@ -21,7 +21,7 @@ ChatWindow::ChatWindow() {
#ifdef WITH_LIBHANDY
m_tab_switcher = Gtk::make_managed<ChannelTabSwitcherHandy>();
m_tab_switcher->signal_channel_switched_to().connect([this](Snowflake id) {
m_signal_action_channel_click.emit(id);
m_signal_action_channel_click.emit(id, false);
});
#endif
@@ -65,7 +65,7 @@ ChatWindow::ChatWindow() {
m_completer.show();
m_chat->signal_action_channel_click().connect([this](Snowflake id) {
m_signal_action_channel_click.emit(id);
m_signal_action_channel_click.emit(id, true);
});
m_chat->signal_action_chat_load_history().connect([this](Snowflake id) {
m_signal_action_chat_load_history.emit(id);

View File

@@ -81,7 +81,7 @@ public:
using type_signal_action_message_edit = sigc::signal<void, Snowflake, Snowflake>;
using type_signal_action_chat_submit = sigc::signal<void, std::string, Snowflake, Snowflake>;
using type_signal_action_chat_load_history = sigc::signal<void, Snowflake>;
using type_signal_action_channel_click = sigc::signal<void, Snowflake>;
using type_signal_action_channel_click = sigc::signal<void, Snowflake, bool>;
using type_signal_action_insert_mention = sigc::signal<void, Snowflake>;
using type_signal_action_reaction_add = sigc::signal<void, Snowflake, Glib::ustring>;
using type_signal_action_reaction_remove = sigc::signal<void, Snowflake, Glib::ustring>;