diff --git a/README.md b/README.md index 660323d..d9bacb6 100644 --- a/README.md +++ b/README.md @@ -291,21 +291,22 @@ For example, memory_db would be set by adding `memory_db = true` under the line #### gui -| Setting | Type | Default | Description | -|-----------------------------|---------|---------|----------------------------------------------------------------------------------------------------------------------------| -| `member_list_discriminator` | boolean | true | show user discriminators in the member list | -| `stock_emojis` | boolean | true | allow abaddon to substitute unicode emojis with images from emojis.bin, must be false to allow GTK to render emojis itself | -| `custom_emojis` | boolean | true | download and use custom Discord emojis | -| `css` | string | | path to the main CSS file | -| `animations` | boolean | true | use animated images where available (e.g. server icons, emojis, avatars). false means static images will be used | -| `animated_guild_hover_only` | boolean | true | only animate guild icons when the guild is being hovered over | -| `owner_crown` | boolean | true | show a crown next to the owner | -| `unreads` | boolean | true | show unread indicators and mention badges | -| `save_state` | boolean | true | save the state of the gui (active channels, tabs, expanded channels) | -| `alt_menu` | boolean | false | keep the menu hidden unless revealed with alt key | -| `hide_to_tray` | boolean | false | hide abaddon to the system tray on window close | -| `show_deleted_indicator` | boolean | true | show \[deleted\] indicator next to deleted messages instead of actually deleting the message | -| `font_scale` | double | | scale font rendering. 1 is unchanged | +| Setting | Type | Default | Description | +|--------------------------------|---------|---------|----------------------------------------------------------------------------------------------------------------------------| +| `member_list_discriminator` | boolean | true | show user discriminators in the member list | +| `stock_emojis` | boolean | true | allow abaddon to substitute unicode emojis with images from emojis.bin, must be false to allow GTK to render emojis itself | +| `custom_emojis` | boolean | true | download and use custom Discord emojis | +| `css` | string | | path to the main CSS file | +| `animations` | boolean | true | use animated images where available (e.g. server icons, emojis, avatars). false means static images will be used | +| `animated_guild_hover_only` | boolean | true | only animate guild icons when the guild is being hovered over | +| `owner_crown` | boolean | true | show a crown next to the owner | +| `unreads` | boolean | true | show unread indicators and mention badges | +| `save_state` | boolean | true | save the state of the gui (active channels, tabs, expanded channels) | +| `alt_menu` | boolean | false | keep the menu hidden unless revealed with alt key | +| `hide_to_tray` | boolean | false | hide abaddon to the system tray on window close | +| `show_deleted_indicator` | boolean | true | show \[deleted\] indicator next to deleted messages instead of actually deleting the message | +| `font_scale` | double | | scale font rendering. 1 is unchanged | +| `classic_change_guild_on_open` | boolean | true | change displayed guild when selecting a channel (classic channel list) | #### style diff --git a/src/components/channellist/channellist.cpp b/src/components/channellist/channellist.cpp index e4060a8..873de41 100644 --- a/src/components/channellist/channellist.cpp +++ b/src/components/channellist/channellist.cpp @@ -28,6 +28,14 @@ void ChannelList::UpdateListing() { } void ChannelList::SetActiveChannel(Snowflake id, bool expand_to) { + if (Abaddon::Get().GetSettings().ClassicChangeGuildOnOpen) { + if (const auto channel = Abaddon::Get().GetDiscordClient().GetChannel(id); channel.has_value() && channel->GuildID.has_value()) { + m_tree.SetSelectedGuild(*channel->GuildID); + } else { + m_tree.SetSelectedDMs(); + } + } + m_tree.SetActiveChannel(id, expand_to); } diff --git a/src/settings.cpp b/src/settings.cpp index 6b051e7..36fffb0 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -97,6 +97,7 @@ void SettingsManager::DefineSettings() { AddSetting("gui", "show_deleted_indicator", true, &Settings::ShowDeletedIndicator); AddSetting("gui", "font_scale", -1.0, &Settings::FontScale); AddSetting("gui", "folder_icon_only", false, &Settings::FolderIconOnly); + AddSetting("gui", "classic_change_guild_on_open", true, &Settings::ClassicChangeGuildOnOpen); AddSetting("http", "concurrent", 20, &Settings::CacheHTTPConcurrency); AddSetting("http", "user_agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"s, &Settings::UserAgent); diff --git a/src/settings.hpp b/src/settings.hpp index e508270..b8e27a4 100644 --- a/src/settings.hpp +++ b/src/settings.hpp @@ -29,6 +29,7 @@ public: bool ShowDeletedIndicator; double FontScale; bool FolderIconOnly; + bool ClassicChangeGuildOnOpen; // [http] int CacheHTTPConcurrency;