mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Use different colour for roster chat rooms with unread messages
This commit is contained in:
parent
841f907308
commit
fcbd2592cf
@ -373,8 +373,13 @@ void
|
|||||||
_rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
|
_rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
|
||||||
{
|
{
|
||||||
GString *msg = g_string_new(" ");
|
GString *msg = g_string_new(" ");
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs("online");
|
|
||||||
wattron(layout->subwin, theme_attrs(presence_colour));
|
if (mucwin->unread > 0) {
|
||||||
|
wattron(layout->subwin, theme_attrs(THEME_GREEN_BOLD));
|
||||||
|
} else {
|
||||||
|
wattron(layout->subwin, theme_attrs(THEME_GREEN));
|
||||||
|
}
|
||||||
|
|
||||||
int indent = prefs_get_roster_contact_indent();
|
int indent = prefs_get_roster_contact_indent();
|
||||||
int current_indent = 0;
|
int current_indent = 0;
|
||||||
if (indent > 0) {
|
if (indent > 0) {
|
||||||
@ -398,11 +403,16 @@ _rosterwin_room(ProfLayoutSplit *layout, ProfMucWin *mucwin)
|
|||||||
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
|
gboolean wrap = prefs_get_boolean(PREF_ROSTER_WRAP);
|
||||||
win_sub_print(layout->subwin, msg->str, FALSE, wrap, current_indent);
|
win_sub_print(layout->subwin, msg->str, FALSE, wrap, current_indent);
|
||||||
g_string_free(msg, TRUE);
|
g_string_free(msg, TRUE);
|
||||||
wattroff(layout->subwin, theme_attrs(presence_colour));
|
|
||||||
|
if (mucwin->unread > 0) {
|
||||||
|
wattroff(layout->subwin, theme_attrs(THEME_GREEN_BOLD));
|
||||||
|
} else {
|
||||||
|
wattroff(layout->subwin, theme_attrs(THEME_GREEN));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_compare_rooms(ProfMucWin *a, ProfMucWin *b)
|
_compare_rooms_unread(ProfMucWin *a, ProfMucWin *b)
|
||||||
{
|
{
|
||||||
if (a->unread > b->unread) {
|
if (a->unread > b->unread) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -422,7 +432,7 @@ _rosterwin_rooms(ProfLayoutSplit *layout, gboolean newline)
|
|||||||
while (curr_room) {
|
while (curr_room) {
|
||||||
ProfMucWin *mucwin = wins_get_muc(curr_room->data);
|
ProfMucWin *mucwin = wins_get_muc(curr_room->data);
|
||||||
if (mucwin) {
|
if (mucwin) {
|
||||||
rooms_sorted = g_list_insert_sorted(rooms_sorted, mucwin, (GCompareFunc)_compare_rooms);
|
rooms_sorted = g_list_insert_sorted(rooms_sorted, mucwin, (GCompareFunc)_compare_rooms_unread);
|
||||||
}
|
}
|
||||||
curr_room = g_list_next(curr_room);
|
curr_room = g_list_next(curr_room);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user