Skip to content

Commit

Permalink
switch to correct guild on channel open in classic channels
Browse files Browse the repository at this point in the history
  • Loading branch information
ouwou committed Jan 12, 2024
1 parent 615f2c8 commit 09bf732
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/components/channellist/channellist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
1 change: 1 addition & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SettingsManager {
bool ShowDeletedIndicator;
double FontScale;
bool FolderIconOnly;
bool ClassicChangeGuildOnOpen;

// [http]
int CacheHTTPConcurrency;
Expand Down

0 comments on commit 09bf732

Please sign in to comment.