mirror of
https://github.com/celisej567/abaddon.git
synced 2026-09-13 20:18:50 +03:00
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
This commit is contained in:
@@ -130,8 +130,7 @@ void GuildSettingsEmojisPane::AddEmojiRow(const EmojiData &emoji) {
|
||||
else
|
||||
row[m_columns.m_col_available] = "Yes";
|
||||
|
||||
static bool show_animations = Abaddon::Get().GetSettings().GetShowAnimations();
|
||||
if (show_animations && emoji.IsAnimated.has_value() && *emoji.IsAnimated) {
|
||||
if (Abaddon::Get().GetSettings().ShowAnimations && emoji.IsAnimated.has_value() && *emoji.IsAnimated) {
|
||||
const auto cb = [this, id = emoji.ID](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) {
|
||||
for (auto &row : m_model->children()) {
|
||||
if (static_cast<Snowflake>(row[m_columns.m_col_id]) == id) {
|
||||
|
||||
@@ -81,7 +81,7 @@ GuildSettingsInfoPane::GuildSettingsInfoPane(Snowflake id)
|
||||
void GuildSettingsInfoPane::FetchGuildIcon(const GuildData &guild) {
|
||||
m_guild_icon.property_pixbuf() = Abaddon::Get().GetImageManager().GetPlaceholder(32);
|
||||
if (guild.HasIcon()) {
|
||||
if (Abaddon::Get().GetSettings().GetShowAnimations() && guild.HasAnimatedIcon()) {
|
||||
if (Abaddon::Get().GetSettings().ShowAnimations && guild.HasAnimatedIcon()) {
|
||||
auto cb = [this](const Glib::RefPtr<Gdk::PixbufAnimation> &pixbuf) {
|
||||
m_guild_icon.property_pixbuf_animation() = pixbuf;
|
||||
};
|
||||
|
||||
@@ -99,7 +99,7 @@ GuildSettingsMembersListItem::GuildSettingsMembersListItem(const GuildData &guil
|
||||
|
||||
auto &discord = Abaddon::Get().GetDiscordClient();
|
||||
|
||||
if (member.User->HasAnimatedAvatar() && Abaddon::Get().GetSettings().GetShowAnimations())
|
||||
if (member.User->HasAnimatedAvatar() && Abaddon::Get().GetSettings().ShowAnimations)
|
||||
m_avatar.SetURL(member.User->GetAvatarURL("gif", "32"));
|
||||
else
|
||||
m_avatar.SetURL(member.User->GetAvatarURL("png", "32"));
|
||||
@@ -113,8 +113,7 @@ GuildSettingsMembersListItem::GuildSettingsMembersListItem(const GuildData &guil
|
||||
discord.signal_guild_member_update().connect(sigc::track_obj(member_update_cb, *this));
|
||||
UpdateColor();
|
||||
|
||||
static bool crown = Abaddon::Get().GetSettings().GetShowOwnerCrown();
|
||||
if (crown && guild.OwnerID == member.User->ID) {
|
||||
if (Abaddon::Get().GetSettings().ShowOwnerCrown && guild.OwnerID == member.User->ID) {
|
||||
try {
|
||||
const static auto crown_path = Abaddon::GetResPath("/crown.png");
|
||||
auto pixbuf = Gdk::Pixbuf::create_from_file(crown_path, 12, 12);
|
||||
|
||||
@@ -9,10 +9,9 @@ MutualFriendItem::MutualFriendItem(const UserData &user)
|
||||
|
||||
m_avatar.set_margin_end(10);
|
||||
|
||||
const auto show_animations = Abaddon::Get().GetSettings().GetShowAnimations();
|
||||
auto &img = Abaddon::Get().GetImageManager();
|
||||
m_avatar.property_pixbuf() = img.GetPlaceholder(24);
|
||||
if (user.HasAnimatedAvatar() && show_animations) {
|
||||
if (user.HasAnimatedAvatar() && Abaddon::Get().GetSettings().ShowAnimations) {
|
||||
auto cb = [this](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) {
|
||||
m_avatar.property_pixbuf_animation() = pb;
|
||||
};
|
||||
|
||||
@@ -13,11 +13,10 @@ MutualGuildItem::MutualGuildItem(const MutualGuildData &guild)
|
||||
// discord will return info (id + nick) for "deleted" guilds from this endpoint. strange !
|
||||
const auto data = Abaddon::Get().GetDiscordClient().GetGuild(guild.ID);
|
||||
if (data.has_value()) {
|
||||
const auto show_animations = Abaddon::Get().GetSettings().GetShowAnimations();
|
||||
auto &img = Abaddon::Get().GetImageManager();
|
||||
m_icon.property_pixbuf() = img.GetPlaceholder(24);
|
||||
if (data->HasIcon()) {
|
||||
if (data->HasAnimatedIcon() && show_animations) {
|
||||
if (data->HasAnimatedIcon() && Abaddon::Get().GetSettings().ShowAnimations) {
|
||||
auto cb = [this](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) {
|
||||
m_icon.property_pixbuf_animation() = pb;
|
||||
};
|
||||
|
||||
@@ -44,7 +44,6 @@ ProfileWindow::ProfileWindow(Snowflake user_id)
|
||||
return false;
|
||||
});
|
||||
|
||||
static const bool show_animations = Abaddon::Get().GetSettings().GetShowAnimations();
|
||||
auto &img = Abaddon::Get().GetImageManager();
|
||||
m_avatar.property_pixbuf() = img.GetPlaceholder(64);
|
||||
auto icon_cb = [this](const Glib::RefPtr<Gdk::Pixbuf> &pb) {
|
||||
@@ -52,7 +51,7 @@ ProfileWindow::ProfileWindow(Snowflake user_id)
|
||||
};
|
||||
img.LoadFromURL(user.GetAvatarURL("png", "64"), sigc::track_obj(icon_cb, *this));
|
||||
|
||||
if (show_animations && user.HasAnimatedAvatar()) {
|
||||
if (Abaddon::Get().GetSettings().ShowAnimations && user.HasAnimatedAvatar()) {
|
||||
auto cb = [this](const Glib::RefPtr<Gdk::PixbufAnimation> &pb) {
|
||||
m_avatar.property_pixbuf_animation() = pb;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user