From dfd642bb82d2998cc563f0f401f2d522632692c1 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Thu, 20 Jan 2022 01:34:36 -0500 Subject: show unread indicators for threads --- src/components/channelscellrenderer.cpp | 32 ++++++++++++++++++++++++++++++++ src/discord/discord.cpp | 6 +++++- 2 files changed, 37 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/components/channelscellrenderer.cpp b/src/components/channelscellrenderer.cpp index 4578020..fa7880f 100644 --- a/src/components/channelscellrenderer.cpp +++ b/src/components/channelscellrenderer.cpp @@ -438,7 +438,39 @@ void CellRendererChannels::render_vfunc_thread(const Cairo::RefPtrset_source_rgb(1.0, 1.0, 1.0); + const auto x = background_area.get_x(); + const auto y = background_area.get_y(); + const auto w = background_area.get_width(); + const auto h = background_area.get_height(); + cr->rectangle(x, y, 3, h); + cr->fill(); + } + + if (unread_state < 1) return; + auto *paned = static_cast(widget.get_ancestor(Gtk::Paned::get_type())); + if (paned != nullptr) { + const auto edge = std::min(paned->get_position(), cell_area.get_width()); + + unread_render_mentions(cr, widget, unread_state, edge, cell_area); + } } // dm header diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp index 5b3cdb5..ff269df 100644 --- a/src/discord/discord.cpp +++ b/src/discord/discord.cpp @@ -2343,10 +2343,14 @@ void DiscordClient::StoreMessageData(Message &msg) { // here the absence of an entry in m_unread indicates a read channel and the value is only the mention count since the message doesnt matter // no entry.id cannot be a guild even though sometimes it looks like it void DiscordClient::HandleReadyReadState(const ReadyEventData &data) { - for (const auto &guild : data.Guilds) + for (const auto &guild : data.Guilds) { for (const auto &channel : *guild.Channels) if (channel.LastMessageID.has_value()) m_last_message_id[channel.ID] = *channel.LastMessageID; + for (const auto &thread : *guild.Threads) + if (thread.LastMessageID.has_value()) + m_last_message_id[thread.ID] = *thread.LastMessageID; + } for (const auto &channel : data.PrivateChannels) if (channel.LastMessageID.has_value()) m_last_message_id[channel.ID] = *channel.LastMessageID; -- cgit v1.2.3