diff options
author | James Booth <boothj5@gmail.com> | 2016-01-19 22:38:00 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-01-19 22:38:00 +0000 |
commit | 519b10d105ba11098693a8c358273b5c94a3ac7f (patch) | |
tree | d31c49098579d4b755ddfb316bf0ac92962d08fa /src/ui | |
parent | 7b982f383cd47d5008c6f2a37e318c25971b8147 (diff) | |
download | profani-tty-519b10d105ba11098693a8c358273b5c94a3ac7f.tar.gz |
Added /roster rooms position preference
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/console.c | 4 | ||||
-rw-r--r-- | src/ui/rosterwin.c | 24 |
2 files changed, 21 insertions, 7 deletions
diff --git a/src/ui/console.c b/src/ui/console.c index 78ab8d2a..76adc58a 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -1346,6 +1346,10 @@ cons_roster_setting(void) else cons_show("Roster rooms (/roster) : hide"); + char *rooms_pos = prefs_get_string(PREF_ROSTER_ROOMS_POS); + cons_show("Roster rooms position (/roster) : %s", rooms_pos); + prefs_free_string(rooms_pos); + char *rooms_order = prefs_get_string(PREF_ROSTER_ROOMS_ORDER); cons_show("Roster rooms order (/roster) : %s", rooms_order); prefs_free_string(rooms_order); diff --git a/src/ui/rosterwin.c b/src/ui/rosterwin.c index 7593b9ab..2771420b 100644 --- a/src/ui/rosterwin.c +++ b/src/ui/rosterwin.c @@ -315,6 +315,7 @@ _rosterwin_contact(ProfLayoutSplit *layout, PContact contact) char *unreadpos = prefs_get_string(PREF_ROSTER_UNREAD); if ((g_strcmp0(unreadpos, "before") == 0) && unread > 0) { g_string_append_printf(msg, "(%d) ", unread); + unread = 0; } g_string_append(msg, name); if (g_strcmp0(unreadpos, "after") == 0) { @@ -604,11 +605,18 @@ rosterwin_roster(void) ProfLayoutSplit *layout = (ProfLayoutSplit*)console->layout; assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK); + werase(layout->subwin); + + gboolean newline = FALSE; + char *roomspos = prefs_get_string(PREF_ROSTER_ROOMS_POS); + if (prefs_get_boolean(PREF_ROSTER_ROOMS) && (g_strcmp0(roomspos, "first") == 0)) { + _rosterwin_rooms(layout, newline); + newline = TRUE; + } char *by = prefs_get_string(PREF_ROSTER_BY); if (g_strcmp0(by, "presence") == 0) { - werase(layout->subwin); - _rosterwin_contacts_by_presence(layout, "chat", "Available for chat", FALSE); + _rosterwin_contacts_by_presence(layout, "chat", "Available for chat", newline); _rosterwin_contacts_by_presence(layout, "online", "Online", TRUE); _rosterwin_contacts_by_presence(layout, "away", "Away", TRUE); _rosterwin_contacts_by_presence(layout, "xa", "Extended Away", TRUE); @@ -617,8 +625,6 @@ rosterwin_roster(void) _rosterwin_contacts_by_presence(layout, "offline", "Offline", TRUE); } } else if (g_strcmp0(by, "group") == 0) { - werase(layout->subwin); - gboolean newline = FALSE; GSList *groups = roster_get_groups(); GSList *curr_group = groups; while (curr_group) { @@ -640,14 +646,16 @@ rosterwin_roster(void) } prefs_free_string(order); - werase(layout->subwin); - wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER)); GString *title = g_string_new(" "); char ch = prefs_get_roster_header_char(); if (ch) { g_string_append_printf(title, "%c", ch); } + if (newline) { + win_sub_newline_lazy(layout->subwin); + } + g_string_append(title, "Roster"); if (prefs_get_boolean(PREF_ROSTER_COUNT)) { g_string_append_printf(title, " (%d)", g_slist_length(contacts)); @@ -669,7 +677,9 @@ rosterwin_roster(void) } prefs_free_string(by); - if (prefs_get_boolean(PREF_ROSTER_ROOMS)) { + if (prefs_get_boolean(PREF_ROSTER_ROOMS) && (g_strcmp0(roomspos, "last") == 0)) { _rosterwin_rooms(layout, TRUE); } + + prefs_free_string(roomspos); } |