mirror of
https://github.com/celisej567/abaddon.git
synced 2026-01-04 10:10:03 +03:00
unread indicators for classic guilds
This commit is contained in:
@@ -160,3 +160,22 @@
|
|||||||
.channel-list .view:selected {
|
.channel-list .view:selected {
|
||||||
background-color: @theme_selected_bg_color;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ GuildListGuildItem::GuildListGuildItem(const GuildData &guild)
|
|||||||
set_tooltip_text(guild.Name);
|
set_tooltip_text(guild.Name);
|
||||||
|
|
||||||
UpdateIcon();
|
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() {
|
void GuildListGuildItem::UpdateIcon() {
|
||||||
@@ -26,3 +29,22 @@ void GuildListGuildItem::UpdateIcon() {
|
|||||||
void GuildListGuildItem::OnIconFetched(const Glib::RefPtr<Gdk::Pixbuf> &pb) {
|
void GuildListGuildItem::OnIconFetched(const Glib::RefPtr<Gdk::Pixbuf> &pb) {
|
||||||
m_image.property_pixbuf() = pb->scale_simple(48, 48, Gdk::INTERP_BILINEAR);
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
void UpdateIcon();
|
void UpdateIcon();
|
||||||
void OnIconFetched(const Glib::RefPtr<Gdk::Pixbuf> &pb);
|
void OnIconFetched(const Glib::RefPtr<Gdk::Pixbuf> &pb);
|
||||||
|
void OnMessageCreate(const Message &msg);
|
||||||
|
void OnMessageAck(const MessageAckData &data);
|
||||||
|
void CheckUnreadStatus();
|
||||||
|
|
||||||
Gtk::Box m_box;
|
Gtk::Box m_box;
|
||||||
Gtk::Image m_image;
|
Gtk::Image m_image;
|
||||||
|
|||||||
Reference in New Issue
Block a user