1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-29 19:56:07 -04:00

Tidied title bar draw

This commit is contained in:
James Booth 2014-12-02 20:05:52 +00:00
parent e756daf2be
commit aae88753a3

View File

@ -169,35 +169,32 @@ title_bar_set_typing(gboolean is_typing)
static void static void
_title_bar_draw(void) _title_bar_draw(void)
{ {
werase(win); ProfWin *current = wins_get_current();
// show title werase(win);
wmove(win, 0, 0); wmove(win, 0, 0);
int i; int i;
for (i = 0; i < 45; i++) for (i = 0; i < 45; i++) {
waddch(win, ' '); waddch(win, ' ');
}
mvwprintw(win, 0, 0, " %s", current_title); mvwprintw(win, 0, 0, " %s", current_title);
if (current && current->type == WIN_CHAT) {
if (prefs_get_boolean(PREF_PRESENCE)) { if (prefs_get_boolean(PREF_PRESENCE)) {
_show_contact_presence(); _show_contact_presence();
} }
#ifdef HAVE_LIBOTR #ifdef HAVE_LIBOTR
_show_privacy(); _show_privacy();
#endif #endif
// show indicator for unsaved forms
ProfWin *current = wins_get_current();
if ((current != NULL ) && (current->type == WIN_MUC_CONFIG)) {
if ((current->form != NULL) && (current->form->modified)) {
wprintw(win, " *");
}
}
// show contact typing
if (typing) { if (typing) {
wprintw(win, " (typing...)"); wprintw(win, " (typing...)");
} }
} else if (current && current->type == WIN_MUC_CONFIG) {
if (current->form && current->form->modified) {
wprintw(win, " *");
}
}
_show_self_presence(); _show_self_presence();
@ -268,7 +265,6 @@ _show_privacy(void)
int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET); int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
ProfWin *current = wins_get_current(); ProfWin *current = wins_get_current();
if (current && current->type == WIN_CHAT) {
if (!current->is_otr) { if (!current->is_otr) {
if (prefs_get_boolean(PREF_OTR_WARN)) { if (prefs_get_boolean(PREF_OTR_WARN)) {
int unencrypted_attrs = theme_attrs(THEME_TITLE_UNENCRYPTED); int unencrypted_attrs = theme_attrs(THEME_TITLE_UNENCRYPTED);
@ -321,7 +317,6 @@ _show_privacy(void)
wattroff(win, bracket_attrs); wattroff(win, bracket_attrs);
} }
} }
}
} }
#endif #endif
@ -330,8 +325,6 @@ _show_contact_presence(void)
{ {
int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET); int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
ProfWin *current = wins_get_current();
if (current && current->type == WIN_CHAT) {
theme_item_t presence_colour = THEME_TITLE_OFFLINE; theme_item_t presence_colour = THEME_TITLE_OFFLINE;
const char *presence = "offline"; const char *presence = "offline";
@ -366,5 +359,4 @@ _show_contact_presence(void)
wattron(win, bracket_attrs); wattron(win, bracket_attrs);
wprintw(win, "]"); wprintw(win, "]");
wattroff(win, bracket_attrs); wattroff(win, bracket_attrs);
}
} }