From 3e0cd83dd6026dc701c548dc40b41f5accbc29db Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 16 Oct 2023 21:31:28 -0400 Subject: start channel list refactor for server list --- .../channellist/classic/guildlistguilditem.cpp | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/components/channellist/classic/guildlistguilditem.cpp (limited to 'src/components/channellist/classic/guildlistguilditem.cpp') diff --git a/src/components/channellist/classic/guildlistguilditem.cpp b/src/components/channellist/classic/guildlistguilditem.cpp new file mode 100644 index 0000000..88ed2a9 --- /dev/null +++ b/src/components/channellist/classic/guildlistguilditem.cpp @@ -0,0 +1,29 @@ +#include "guildlistguilditem.hpp" + +GuildListGuildItem::GuildListGuildItem(const GuildData &guild) + : ID(guild.ID) { + m_image.property_pixbuf() = Abaddon::Get().GetImageManager().GetPlaceholder(48); + add(m_image); + show_all_children(); + + signal_button_press_event().connect([this](GdkEventButton *event) -> bool { + if (event->type == GDK_BUTTON_PRESS && event->button == GDK_BUTTON_PRIMARY) { + printf("Click %llu\n", (uint64_t)ID); + } + return true; + }); + + set_tooltip_text(guild.Name); + + UpdateIcon(); +} + +void GuildListGuildItem::UpdateIcon() { + const auto guild = Abaddon::Get().GetDiscordClient().GetGuild(ID); + if (!guild.has_value()) return; + Abaddon::Get().GetImageManager().LoadFromURL(guild->GetIconURL("png", "64"), sigc::mem_fun(*this, &GuildListGuildItem::OnIconFetched)); +} + +void GuildListGuildItem::OnIconFetched(const Glib::RefPtr &pb) { + m_image.property_pixbuf() = pb->scale_simple(48, 48, Gdk::INTERP_BILINEAR); +} -- cgit v1.2.3 From 182128705e10adf529b39a290232f0cd27bf4837 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Tue, 24 Oct 2023 22:45:31 -0400 Subject: very very rudimentary classic channels list --- src/components/channellist/channellist.cpp | 50 +++++++++++++++++++++- src/components/channellist/channellist.hpp | 10 ++++- src/components/channellist/channellisttree.cpp | 14 +++++- src/components/channellist/channellisttree.hpp | 6 +++ src/components/channellist/classic/guildlist.cpp | 24 ++++++++++- src/components/channellist/classic/guildlist.hpp | 12 +++++- .../channellist/classic/guildlistguilditem.cpp | 7 --- src/windows/mainwindow.cpp | 2 + 8 files changed, 112 insertions(+), 13 deletions(-) (limited to 'src/components/channellist/classic/guildlistguilditem.cpp') diff --git a/src/components/channellist/channellist.cpp b/src/components/channellist/channellist.cpp index 38a9ecc..6cb5321 100644 --- a/src/components/channellist/channellist.cpp +++ b/src/components/channellist/channellist.cpp @@ -1,12 +1,26 @@ #include "channellist.hpp" ChannelList::ChannelList() { + ConnectSignals(); + + m_guilds.set_halign(Gtk::ALIGN_START); + + m_guilds_scroll.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); + + m_guilds.signal_guild_selected().connect([this](Snowflake guild_id) { + m_tree.SetSelectedGuild(guild_id); + }); + + m_guilds.show(); m_tree.show(); - add(m_tree); + m_guilds_scroll.add(m_guilds); + pack_start(m_guilds_scroll, false, false); // only take the space it needs + pack_start(m_tree, true, true); // use all the remaining space } void ChannelList::UpdateListing() { m_tree.UpdateListing(); + m_guilds.UpdateListing(); } void ChannelList::SetActiveChannel(Snowflake id, bool expand_to) { @@ -18,13 +32,45 @@ void ChannelList::UseExpansionState(const ExpansionStateRoot &state) { } ExpansionStateRoot ChannelList::GetExpansionState() const { - m_tree.GetExpansionState(); + return m_tree.GetExpansionState(); } void ChannelList::UsePanedHack(Gtk::Paned &paned) { m_tree.UsePanedHack(paned); } +void ChannelList::SetClassic(bool value) { + m_tree.SetClassic(value); + m_guilds_scroll.set_visible(value); +} + +void ChannelList::ConnectSignals() { + // TODO: if these all just travel upwards to the singleton then get rid of them but mayeb they dont + m_tree.signal_action_open_new_tab().connect([this](Snowflake id) { + m_signal_action_open_new_tab.emit(id); + }); + + m_tree.signal_action_join_voice_channel().connect([this](Snowflake id) { + m_signal_action_join_voice_channel.emit(id); + }); + + m_tree.signal_action_disconnect_voice().connect([this]() { + m_signal_action_disconnect_voice.emit(); + }); + + m_tree.signal_action_channel_item_select().connect([this](Snowflake id) { + m_signal_action_channel_item_select.emit(id); + }); + + m_tree.signal_action_guild_leave().connect([this](Snowflake id) { + m_signal_action_guild_leave.emit(id); + }); + + m_tree.signal_action_guild_settings().connect([this](Snowflake id) { + m_signal_action_guild_settings.emit(id); + }); +} + ChannelList::type_signal_action_open_new_tab ChannelList::signal_action_open_new_tab() { return m_signal_action_open_new_tab; } diff --git a/src/components/channellist/channellist.hpp b/src/components/channellist/channellist.hpp index 5863485..692afa7 100644 --- a/src/components/channellist/channellist.hpp +++ b/src/components/channellist/channellist.hpp @@ -2,11 +2,12 @@ #include #include #include "channellisttree.hpp" +#include "classic/guildlist.hpp" #include "discord/snowflake.hpp" #include "state.hpp" // Contains the actual ChannelListTree and the classic listing if enabled -class ChannelList : public Gtk::Box { +class ChannelList : public Gtk::HBox { // have to proxy public and signals to underlying tree... ew!!! public: ChannelList(); @@ -20,9 +21,16 @@ public: void UsePanedHack(Gtk::Paned &paned); + void SetClassic(bool value); + private: + void ConnectSignals(); + ChannelListTree m_tree; + Gtk::ScrolledWindow m_guilds_scroll; + GuildList m_guilds; + public: using type_signal_action_channel_item_select = sigc::signal; using type_signal_action_guild_leave = sigc::signal; diff --git a/src/components/channellist/channellisttree.cpp b/src/components/channellist/channellisttree.cpp index 22f8581..b9b5c08 100644 --- a/src/components/channellist/channellisttree.cpp +++ b/src/components/channellist/channellisttree.cpp @@ -85,8 +85,10 @@ ChannelListTree::ChannelListTree() }); m_filter_model->set_visible_func([this](const Gtk::TreeModel::const_iterator &iter) -> bool { + if (!m_classic) return true; + if ((*iter)[m_columns.m_type] == RenderType::Guild) { - return (*iter)[m_columns.m_id] == 754921263616753776ULL; + return (*iter)[m_columns.m_id] == m_classic_selected_guild; } return true; }); @@ -301,6 +303,16 @@ void ChannelListTree::UsePanedHack(Gtk::Paned &paned) { paned.property_position().signal_changed().connect(sigc::mem_fun(*this, &ChannelListTree::OnPanedPositionChanged)); } +void ChannelListTree::SetClassic(bool value) { + m_classic = value; + m_filter_model->refilter(); +} + +void ChannelListTree::SetSelectedGuild(Snowflake guild_id) { + m_classic_selected_guild = guild_id; + m_filter_model->refilter(); +} + void ChannelListTree::OnPanedPositionChanged() { m_view.queue_draw(); } diff --git a/src/components/channellist/channellisttree.hpp b/src/components/channellist/channellisttree.hpp index 0cd76e0..bb7396e 100644 --- a/src/components/channellist/channellisttree.hpp +++ b/src/components/channellist/channellisttree.hpp @@ -33,6 +33,9 @@ public: void UsePanedHack(Gtk::Paned &paned); + void SetClassic(bool value); + void SetSelectedGuild(Snowflake guild_id); + protected: void OnPanedPositionChanged(); @@ -186,6 +189,9 @@ protected: bool m_updating_listing = false; + bool m_classic = false; + Snowflake m_classic_selected_guild; + Snowflake m_active_channel; public: diff --git a/src/components/channellist/classic/guildlist.cpp b/src/components/channellist/classic/guildlist.cpp index 0d5737b..6c1fbc3 100644 --- a/src/components/channellist/classic/guildlist.cpp +++ b/src/components/channellist/classic/guildlist.cpp @@ -6,18 +6,40 @@ GuildList::GuildList() { show_all_children(); } +void GuildList::UpdateListing() { + auto &discord = Abaddon::Get().GetDiscordClient(); + + Clear(); + + // does this function still even work ??lol + const auto ids = discord.GetUserSortedGuilds(); + for (const auto id : ids) { + AddGuild(id); + } +} + void GuildList::AddGuild(Snowflake id) { const auto guild = Abaddon::Get().GetDiscordClient().GetGuild(id); if (!guild.has_value()) return; auto *item = Gtk::make_managed(*guild); + item->signal_button_press_event().connect([this, id](GdkEventButton *event) -> bool { + if (event->type == GDK_BUTTON_PRESS && event->button == GDK_BUTTON_PRIMARY) { + m_signal_guild_selected.emit(id); + } + return true; + }); item->show(); add(*item); } void GuildList::Clear() { const auto children = get_children(); - for (auto child : children) { + for (auto *child : children) { delete child; } } + +GuildList::type_signal_guild_selected GuildList::signal_guild_selected() { + return m_signal_guild_selected; +} diff --git a/src/components/channellist/classic/guildlist.hpp b/src/components/channellist/classic/guildlist.hpp index 244313f..856cf4d 100644 --- a/src/components/channellist/classic/guildlist.hpp +++ b/src/components/channellist/classic/guildlist.hpp @@ -6,7 +6,17 @@ class GuildList : public Gtk::ListBox { public: GuildList(); - void AddGuild(Snowflake id); + void UpdateListing(); +private: + void AddGuild(Snowflake id); void Clear(); + +public: + using type_signal_guild_selected = sigc::signal; + + type_signal_guild_selected signal_guild_selected(); + +private: + type_signal_guild_selected m_signal_guild_selected; }; diff --git a/src/components/channellist/classic/guildlistguilditem.cpp b/src/components/channellist/classic/guildlistguilditem.cpp index 88ed2a9..5cec281 100644 --- a/src/components/channellist/classic/guildlistguilditem.cpp +++ b/src/components/channellist/classic/guildlistguilditem.cpp @@ -6,13 +6,6 @@ GuildListGuildItem::GuildListGuildItem(const GuildData &guild) add(m_image); show_all_children(); - signal_button_press_event().connect([this](GdkEventButton *event) -> bool { - if (event->type == GDK_BUTTON_PRESS && event->button == GDK_BUTTON_PRIMARY) { - printf("Click %llu\n", (uint64_t)ID); - } - return true; - }); - set_tooltip_text(guild.Name); UpdateIcon(); diff --git a/src/windows/mainwindow.cpp b/src/windows/mainwindow.cpp index 8e030ed..ea67d2b 100644 --- a/src/windows/mainwindow.cpp +++ b/src/windows/mainwindow.cpp @@ -33,6 +33,8 @@ MainWindow::MainWindow() }); #endif + // TEMP TEMP TEMP TEMP!!!!!!!!!!!! AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH + m_channel_list.SetClassic(true); m_channel_list.set_vexpand(true); m_channel_list.set_size_request(-1, -1); m_channel_list.show(); -- cgit v1.2.3 From d1f6e1daa99e70ab3a9d583a0de286c97ab13413 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 19 Jan 2024 01:29:25 -0500 Subject: headers --- src/components/channellist/channellist.cpp | 2 ++ src/components/channellist/channellisttree.cpp | 6 +++++- src/components/channellist/classic/guildlist.cpp | 2 ++ src/components/channellist/classic/guildlistfolderitem.cpp | 3 +++ src/components/channellist/classic/guildlistfolderitem.hpp | 2 ++ src/components/channellist/classic/guildlistguilditem.cpp | 2 ++ src/components/channellist/classic/guildlistguilditem.hpp | 1 + 7 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/components/channellist/classic/guildlistguilditem.cpp') diff --git a/src/components/channellist/channellist.cpp b/src/components/channellist/channellist.cpp index 873de41..1cdf619 100644 --- a/src/components/channellist/channellist.cpp +++ b/src/components/channellist/channellist.cpp @@ -1,5 +1,7 @@ #include "channellist.hpp" +#include "abaddon.hpp" + ChannelList::ChannelList() { ConnectSignals(); diff --git a/src/components/channellist/channellisttree.cpp b/src/components/channellist/channellisttree.cpp index a509f21..8049f58 100644 --- a/src/components/channellist/channellisttree.cpp +++ b/src/components/channellist/channellisttree.cpp @@ -1,9 +1,13 @@ #include "channellisttree.hpp" -#include "imgmanager.hpp" + #include #include #include + +#include + #include "abaddon.hpp" +#include "imgmanager.hpp" #include "util.hpp" ChannelListTree::ChannelListTree() diff --git a/src/components/channellist/classic/guildlist.cpp b/src/components/channellist/classic/guildlist.cpp index 53ba1d7..ae613bf 100644 --- a/src/components/channellist/classic/guildlist.cpp +++ b/src/components/channellist/classic/guildlist.cpp @@ -1,4 +1,6 @@ #include "guildlist.hpp" + +#include "abaddon.hpp" #include "guildlistfolderitem.hpp" class GuildListDMsButton : public Gtk::EventBox { diff --git a/src/components/channellist/classic/guildlistfolderitem.cpp b/src/components/channellist/classic/guildlistfolderitem.cpp index e79a5f7..fea735c 100644 --- a/src/components/channellist/classic/guildlistfolderitem.cpp +++ b/src/components/channellist/classic/guildlistfolderitem.cpp @@ -1,5 +1,8 @@ #include "guildlistfolderitem.hpp" + +#include "abaddon.hpp" #include "guildlistguilditem.hpp" +#include "util.hpp" // doing my best to copy discord here diff --git a/src/components/channellist/classic/guildlistfolderitem.hpp b/src/components/channellist/classic/guildlistfolderitem.hpp index 6a9fb50..82a5a14 100644 --- a/src/components/channellist/classic/guildlistfolderitem.hpp +++ b/src/components/channellist/classic/guildlistfolderitem.hpp @@ -1,8 +1,10 @@ #pragma once #include #include +#include #include #include +#include #include "guildlistguilditem.hpp" #include "discord/usersettings.hpp" diff --git a/src/components/channellist/classic/guildlistguilditem.cpp b/src/components/channellist/classic/guildlistguilditem.cpp index 5cec281..c608dd9 100644 --- a/src/components/channellist/classic/guildlistguilditem.cpp +++ b/src/components/channellist/classic/guildlistguilditem.cpp @@ -1,5 +1,7 @@ #include "guildlistguilditem.hpp" +#include "abaddon.hpp" + GuildListGuildItem::GuildListGuildItem(const GuildData &guild) : ID(guild.ID) { m_image.property_pixbuf() = Abaddon::Get().GetImageManager().GetPlaceholder(48); diff --git a/src/components/channellist/classic/guildlistguilditem.hpp b/src/components/channellist/classic/guildlistguilditem.hpp index 3114a05..6bc0037 100644 --- a/src/components/channellist/classic/guildlistguilditem.hpp +++ b/src/components/channellist/classic/guildlistguilditem.hpp @@ -1,5 +1,6 @@ #pragma once #include +#include #include #include "discord/guild.hpp" -- cgit v1.2.3 From dbfdd01b13af7394c0b6117e878728d0eac097c2 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:08:17 -0500 Subject: add missing guild.HasIcon checks --- src/components/channellist/classic/guildlistfolderitem.cpp | 2 +- src/components/channellist/classic/guildlistguilditem.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/components/channellist/classic/guildlistguilditem.cpp') diff --git a/src/components/channellist/classic/guildlistfolderitem.cpp b/src/components/channellist/classic/guildlistfolderitem.cpp index fea735c..2c8bc3b 100644 --- a/src/components/channellist/classic/guildlistfolderitem.cpp +++ b/src/components/channellist/classic/guildlistfolderitem.cpp @@ -24,7 +24,7 @@ void GuildListFolderButton::SetGuilds(const std::vector &guild_ids) { if (i < guild_ids.size()) { widget.show(); - if (const auto guild = Abaddon::Get().GetDiscordClient().GetGuild(guild_ids[i]); guild.has_value()) { + if (const auto guild = Abaddon::Get().GetDiscordClient().GetGuild(guild_ids[i]); guild.has_value() && guild->HasIcon()) { const auto cb = [&widget](const Glib::RefPtr &pb) { widget.property_pixbuf() = pb->scale_simple(FolderGridImageSize, FolderGridImageSize, Gdk::INTERP_BILINEAR); }; diff --git a/src/components/channellist/classic/guildlistguilditem.cpp b/src/components/channellist/classic/guildlistguilditem.cpp index c608dd9..2b26e73 100644 --- a/src/components/channellist/classic/guildlistguilditem.cpp +++ b/src/components/channellist/classic/guildlistguilditem.cpp @@ -15,7 +15,7 @@ GuildListGuildItem::GuildListGuildItem(const GuildData &guild) void GuildListGuildItem::UpdateIcon() { const auto guild = Abaddon::Get().GetDiscordClient().GetGuild(ID); - if (!guild.has_value()) return; + if (!guild.has_value() || !guild->HasIcon()) return; Abaddon::Get().GetImageManager().LoadFromURL(guild->GetIconURL("png", "64"), sigc::mem_fun(*this, &GuildListGuildItem::OnIconFetched)); } -- cgit v1.2.3 From 473ff6f777ae3a8d1b3fa08a3ea15e2905340e03 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 19 Feb 2024 02:24:57 -0500 Subject: widget tweaking for styling --- src/components/channellist/classic/guildlist.cpp | 2 +- src/components/channellist/classic/guildlistfolderitem.cpp | 2 +- src/components/channellist/classic/guildlistguilditem.cpp | 6 +++++- src/components/channellist/classic/guildlistguilditem.hpp | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/components/channellist/classic/guildlistguilditem.cpp') diff --git a/src/components/channellist/classic/guildlist.cpp b/src/components/channellist/classic/guildlist.cpp index 9c634f7..d756c6f 100644 --- a/src/components/channellist/classic/guildlist.cpp +++ b/src/components/channellist/classic/guildlist.cpp @@ -23,7 +23,7 @@ GuildList::GuildList() , m_menu_guild_settings("View _Settings", true) , m_menu_guild_leave("_Leave", true) , m_menu_guild_mark_as_read("Mark as _Read", true) { - get_style_context()->add_class("guild-list"); + get_style_context()->add_class("classic-guild-list"); set_selection_mode(Gtk::SELECTION_NONE); show_all_children(); diff --git a/src/components/channellist/classic/guildlistfolderitem.cpp b/src/components/channellist/classic/guildlistfolderitem.cpp index 2c8bc3b..30e1adb 100644 --- a/src/components/channellist/classic/guildlistfolderitem.cpp +++ b/src/components/channellist/classic/guildlistfolderitem.cpp @@ -36,7 +36,7 @@ void GuildListFolderButton::SetGuilds(const std::vector &guild_ids) { } GuildListFolderItem::GuildListFolderItem(const UserSettingsGuildFoldersEntry &folder) { - get_style_context()->add_class("classic-guild-folder"); + get_style_context()->add_class("classic-guild-list-folder"); if (folder.Name.has_value()) { set_tooltip_text(*folder.Name); diff --git a/src/components/channellist/classic/guildlistguilditem.cpp b/src/components/channellist/classic/guildlistguilditem.cpp index 2b26e73..ee6b35a 100644 --- a/src/components/channellist/classic/guildlistguilditem.cpp +++ b/src/components/channellist/classic/guildlistguilditem.cpp @@ -4,8 +4,12 @@ GuildListGuildItem::GuildListGuildItem(const GuildData &guild) : ID(guild.ID) { + get_style_context()->add_class("classic-guild-list-guild"); + m_image.property_pixbuf() = Abaddon::Get().GetImageManager().GetPlaceholder(48); - add(m_image); + + add(m_box); + m_box.pack_start(m_image); show_all_children(); set_tooltip_text(guild.Name); diff --git a/src/components/channellist/classic/guildlistguilditem.hpp b/src/components/channellist/classic/guildlistguilditem.hpp index 6bc0037..e5504f6 100644 --- a/src/components/channellist/classic/guildlistguilditem.hpp +++ b/src/components/channellist/classic/guildlistguilditem.hpp @@ -14,5 +14,6 @@ private: void UpdateIcon(); void OnIconFetched(const Glib::RefPtr &pb); + Gtk::Box m_box; Gtk::Image m_image; }; -- cgit v1.2.3 From 3badc04db5770defa308dc70e5ddde07828202cf Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:27:03 -0500 Subject: unread indicators for classic guilds --- res/css/main.css | 19 +++++++++++++++++++ .../channellist/classic/guildlistguilditem.cpp | 22 ++++++++++++++++++++++ .../channellist/classic/guildlistguilditem.hpp | 3 +++ 3 files changed, 44 insertions(+) (limited to 'src/components/channellist/classic/guildlistguilditem.cpp') diff --git a/res/css/main.css b/res/css/main.css index 71434cf..db548ac 100644 --- a/res/css/main.css +++ b/res/css/main.css @@ -160,3 +160,22 @@ .channel-list .view:selected { background-color: @theme_selected_bg_color; } + +.classic-guild-list > row { + padding-left: 0px; + box-shadow: none; + border: none; + outline: none; +} + +.classic-guild-list > row:hover { + background: none; +} + +.classic-guild-list-guild.has-unread { + background: radial-gradient(7px circle at left, @theme_selected_bg_color 50%, transparent 20%); +} + +.classic-guild-list-guild box, .classic-guild-list-folder stack { + padding-left: 10px; +} diff --git a/src/components/channellist/classic/guildlistguilditem.cpp b/src/components/channellist/classic/guildlistguilditem.cpp index ee6b35a..5acad02 100644 --- a/src/components/channellist/classic/guildlistguilditem.cpp +++ b/src/components/channellist/classic/guildlistguilditem.cpp @@ -15,6 +15,9 @@ GuildListGuildItem::GuildListGuildItem(const GuildData &guild) set_tooltip_text(guild.Name); UpdateIcon(); + + Abaddon::Get().GetDiscordClient().signal_message_create().connect(sigc::mem_fun(*this, &GuildListGuildItem::OnMessageCreate)); + Abaddon::Get().GetDiscordClient().signal_message_ack().connect(sigc::mem_fun(*this, &GuildListGuildItem::OnMessageAck)); } void GuildListGuildItem::UpdateIcon() { @@ -26,3 +29,22 @@ void GuildListGuildItem::UpdateIcon() { void GuildListGuildItem::OnIconFetched(const Glib::RefPtr &pb) { m_image.property_pixbuf() = pb->scale_simple(48, 48, Gdk::INTERP_BILINEAR); } + +void GuildListGuildItem::OnMessageCreate(const Message &msg) { + if (msg.GuildID.has_value() && *msg.GuildID == ID) CheckUnreadStatus(); +} + +void GuildListGuildItem::OnMessageAck(const MessageAckData &data) { + CheckUnreadStatus(); +} + +void GuildListGuildItem::CheckUnreadStatus() { + auto &discord = Abaddon::Get().GetDiscordClient(); + if (!Abaddon::Get().GetSettings().Unreads) return; + int mentions; + if (!discord.IsGuildMuted(ID) && discord.GetUnreadStateForGuild(ID, mentions)) { + get_style_context()->add_class("has-unread"); + } else { + get_style_context()->remove_class("has-unread"); + } +} diff --git a/src/components/channellist/classic/guildlistguilditem.hpp b/src/components/channellist/classic/guildlistguilditem.hpp index e5504f6..6e2b241 100644 --- a/src/components/channellist/classic/guildlistguilditem.hpp +++ b/src/components/channellist/classic/guildlistguilditem.hpp @@ -13,6 +13,9 @@ public: private: void UpdateIcon(); void OnIconFetched(const Glib::RefPtr &pb); + void OnMessageCreate(const Message &msg); + void OnMessageAck(const MessageAckData &data); + void CheckUnreadStatus(); Gtk::Box m_box; Gtk::Image m_image; -- cgit v1.2.3 From 3c54ff85622ff7210f8acee00e075b12128567a9 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Fri, 23 Feb 2024 21:57:24 -0500 Subject: check unread status for classic guild on launch --- src/components/channellist/classic/guildlistguilditem.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/components/channellist/classic/guildlistguilditem.cpp') diff --git a/src/components/channellist/classic/guildlistguilditem.cpp b/src/components/channellist/classic/guildlistguilditem.cpp index 5acad02..5b578be 100644 --- a/src/components/channellist/classic/guildlistguilditem.cpp +++ b/src/components/channellist/classic/guildlistguilditem.cpp @@ -18,6 +18,8 @@ GuildListGuildItem::GuildListGuildItem(const GuildData &guild) Abaddon::Get().GetDiscordClient().signal_message_create().connect(sigc::mem_fun(*this, &GuildListGuildItem::OnMessageCreate)); Abaddon::Get().GetDiscordClient().signal_message_ack().connect(sigc::mem_fun(*this, &GuildListGuildItem::OnMessageAck)); + + CheckUnreadStatus(); } void GuildListGuildItem::UpdateIcon() { -- cgit v1.2.3