Added show_char and attrs to ProfWin->print_line

This commit is contained in:
James Booth
2013-10-06 18:00:22 +01:00
parent fc8982e761
commit a527beabd3
4 changed files with 11 additions and 6 deletions

View File

@@ -824,7 +824,7 @@ ui_current_print_line(const char * const msg, ...)
ProfWin *current = wins_get_current(); ProfWin *current = wins_get_current();
va_list arg; va_list arg;
va_start(arg, msg); va_start(arg, msg);
current->print_line(current, msg, arg); current->print_line(current, '-', 0, msg, arg);
va_end(arg); va_end(arg);
current->refresh_win(current); current->refresh_win(current);
} }

View File

@@ -30,7 +30,7 @@ muc_handle_error_message(ProfWin *self, const char * const from,
{ {
gboolean handled = FALSE; gboolean handled = FALSE;
if (g_strcmp0(err_msg, "conflict") == 0) { if (g_strcmp0(err_msg, "conflict") == 0) {
win_print_line(self, "Nickname already in use."); win_print_line(self, '-', 0, "Nickname already in use.");
win_refresh(self); win_refresh(self);
handled = TRUE; handled = TRUE;
} }

View File

@@ -100,14 +100,17 @@ _win_print_time(ProfWin* self, char show_char)
} }
void void
win_print_line(ProfWin *self, const char * const msg, ...) win_print_line(ProfWin *self, const char show_char, int attrs,
const char * const msg, ...)
{ {
va_list arg; va_list arg;
va_start(arg, msg); va_start(arg, msg);
GString *fmt_msg = g_string_new(NULL); GString *fmt_msg = g_string_new(NULL);
g_string_vprintf(fmt_msg, msg, arg); g_string_vprintf(fmt_msg, msg, arg);
_win_print_time(self, '-'); _win_print_time(self, show_char);
wattron(self->win, attrs);
wprintw(self->win, "%s\n", fmt_msg->str); wprintw(self->win, "%s\n", fmt_msg->str);
wattroff(self->win, attrs);
g_string_free(fmt_msg, TRUE); g_string_free(fmt_msg, TRUE);
va_end(arg); va_end(arg);
} }

View File

@@ -53,7 +53,8 @@ typedef struct prof_win_t {
int unread; int unread;
int history_shown; int history_shown;
void (*print_time)(struct prof_win_t *self, char show_char); void (*print_time)(struct prof_win_t *self, char show_char);
void (*print_line)(struct prof_win_t *self, const char * const msg, ...); void (*print_line)(struct prof_win_t *self, const char show_char,
int attrs, const char * const msg, ...);
void (*refresh_win)(struct prof_win_t *self); void (*refresh_win)(struct prof_win_t *self);
void (*presence_colour_on)(struct prof_win_t *self, const char * const presence); void (*presence_colour_on)(struct prof_win_t *self, const char * const presence);
void (*presence_colour_off)(struct prof_win_t *self, const char * const presence); void (*presence_colour_off)(struct prof_win_t *self, const char * const presence);
@@ -64,7 +65,8 @@ typedef struct prof_win_t {
ProfWin* win_create(const char * const title, int cols, win_type_t type); ProfWin* win_create(const char * const title, int cols, win_type_t type);
void win_free(ProfWin *window); void win_free(ProfWin *window);
void win_print_line(ProfWin *self, const char * const msg, ...); void win_print_line(ProfWin *self, const char show_char, int attrs,
const char * const msg, ...);
void win_refresh(ProfWin *self); void win_refresh(ProfWin *self);
#endif #endif