diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-24 03:14:41 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-24 03:15:22 -0500 |
commit | 4326c5e29b279ba8ca58139848aaea4e3c62fb03 (patch) | |
tree | dd416b391b622cd8dc3050c1c51ccc3cbfc40705 /src/components/channels.cpp | |
parent | a51a54bc5979a2491f152abc47ad54e6b63f27c8 (diff) | |
download | abaddon-portaudio-4326c5e29b279ba8ca58139848aaea4e3c62fb03.tar.gz abaddon-portaudio-4326c5e29b279ba8ca58139848aaea4e3c62fb03.zip |
remove SimpleIni as a dependency
use Glib::KeyFile instead which is basically the same file format
also read into and save from struct once, cuz its faster and less redundant
Diffstat (limited to 'src/components/channels.cpp')
-rw-r--r-- | src/components/channels.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/components/channels.cpp b/src/components/channels.cpp index da31de0..6d5e1a6 100644 --- a/src/components/channels.cpp +++ b/src/components/channels.cpp @@ -263,11 +263,9 @@ void ChannelList::UpdateGuild(Snowflake id) { const auto guild = Abaddon::Get().GetDiscordClient().GetGuild(id); if (!iter || !guild.has_value()) return; - static const bool show_animations = Abaddon::Get().GetSettings().GetShowAnimations(); - (*iter)[m_columns.m_name] = "<b>" + Glib::Markup::escape_text(guild->Name) + "</b>"; (*iter)[m_columns.m_icon] = img.GetPlaceholder(GuildIconSize); - if (show_animations && guild->HasAnimatedIcon()) { + if (Abaddon::Get().GetSettings().ShowAnimations && guild->HasAnimatedIcon()) { const auto cb = [this, id](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) { auto iter = GetIteratorForGuildFromID(id); if (iter) (*iter)[m_columns.m_icon_anim] = pb; @@ -436,9 +434,7 @@ Gtk::TreeModel::iterator ChannelList::AddGuild(const GuildData &guild) { guild_row[m_columns.m_name] = "<b>" + Glib::Markup::escape_text(guild.Name) + "</b>"; guild_row[m_columns.m_icon] = img.GetPlaceholder(GuildIconSize); - static const bool show_animations = Abaddon::Get().GetSettings().GetShowAnimations(); - - if (show_animations && guild.HasAnimatedIcon()) { + if (Abaddon::Get().GetSettings().ShowAnimations && guild.HasAnimatedIcon()) { const auto cb = [this, id = guild.ID](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) { auto iter = GetIteratorForGuildFromID(id); if (iter) (*iter)[m_columns.m_icon_anim] = pb; @@ -998,7 +994,7 @@ void CellRendererChannels::render_vfunc_guild(const Cairo::RefPtr<Cairo::Context m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); - const static bool hover_only = Abaddon::Get().GetSettings().GetAnimatedGuildHoverOnly(); + const bool hover_only = Abaddon::Get().GetSettings().AnimatedGuildHoverOnly; const bool is_hovered = flags & Gtk::CELL_RENDERER_PRELIT; auto anim = m_property_pixbuf_animation.get_value(); @@ -1069,7 +1065,7 @@ void CellRendererChannels::render_vfunc_category(const Cairo::RefPtr<Cairo::Cont cr->move_to(x1, y1); cr->line_to(x2, y2); cr->line_to(x3, y3); - static const auto expander_color = Gdk::RGBA(Abaddon::Get().GetSettings().GetChannelsExpanderColor()); + const auto expander_color = Gdk::RGBA(Abaddon::Get().GetSettings().ChannelsExpanderColor); cr->set_source_rgb(expander_color.get_red(), expander_color.get_green(), expander_color.get_blue()); cr->stroke(); @@ -1115,7 +1111,7 @@ void CellRendererChannels::render_vfunc_channel(const Cairo::RefPtr<Cairo::Conte Gdk::Rectangle text_cell_area(text_x, text_y, text_w, text_h); - const static auto nsfw_color = Gdk::RGBA(Abaddon::Get().GetSettings().GetNSFWChannelColor()); + const auto nsfw_color = Gdk::RGBA(Abaddon::Get().GetSettings().NSFWChannelColor); if (m_property_nsfw.get_value()) m_renderer_text.property_foreground_rgba() = nsfw_color; m_renderer_text.render(cr, widget, background_area, text_cell_area, flags); |