mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added support for bold theme settings
This commit is contained in:
parent
ed4391ec8a
commit
976e5aac0a
@ -715,6 +715,7 @@ cmd_theme(gchar **args, struct cmd_help_t help)
|
||||
} else if (theme_load(args[1])) {
|
||||
ui_load_colours();
|
||||
prefs_set_string(PREF_THEME, args[1]);
|
||||
ui_redraw();
|
||||
cons_show("Loaded theme: %s", args[1]);
|
||||
} else {
|
||||
cons_show("Couldn't find theme: %s", args[1]);
|
||||
|
@ -50,6 +50,7 @@
|
||||
|
||||
static GString *theme_loc;
|
||||
static GKeyFile *theme;
|
||||
static GHashTable *bold_items;
|
||||
|
||||
struct colour_string_t {
|
||||
char *str;
|
||||
@ -117,11 +118,12 @@ static struct colours_t {
|
||||
NCURSES_COLOR_T otrended;
|
||||
NCURSES_COLOR_T otrtrusted;
|
||||
NCURSES_COLOR_T otruntrusted;
|
||||
NCURSES_COLOR_T rosterheader;
|
||||
NCURSES_COLOR_T occupantsheader;
|
||||
} colour_prefs;
|
||||
|
||||
static NCURSES_COLOR_T _lookup_colour(const char * const colour);
|
||||
static void _set_colour(gchar *val, NCURSES_COLOR_T *pref,
|
||||
NCURSES_COLOR_T def);
|
||||
static void _set_colour(gchar *val, NCURSES_COLOR_T *pref, NCURSES_COLOR_T def, theme_item_t theme_item);
|
||||
static void _load_colours(void);
|
||||
static gchar * _get_themes_dir(void);
|
||||
void _theme_list_dir(const gchar * const dir, GSList **result);
|
||||
@ -190,6 +192,9 @@ theme_close(void)
|
||||
if (theme_loc != NULL) {
|
||||
g_string_free(theme_loc, TRUE);
|
||||
}
|
||||
if (bold_items) {
|
||||
g_hash_table_destroy(bold_items);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -255,6 +260,10 @@ theme_init_colours(void)
|
||||
init_pair(41, colour_prefs.otrended, colour_prefs.bkgnd);
|
||||
init_pair(42, colour_prefs.otrtrusted, colour_prefs.bkgnd);
|
||||
init_pair(43, colour_prefs.otruntrusted, colour_prefs.bkgnd);
|
||||
|
||||
// subwin headers
|
||||
init_pair(44, colour_prefs.rosterheader, colour_prefs.bkgnd);
|
||||
init_pair(45, colour_prefs.occupantsheader, colour_prefs.bkgnd);
|
||||
}
|
||||
|
||||
static NCURSES_COLOR_T
|
||||
@ -271,13 +280,19 @@ _lookup_colour(const char * const colour)
|
||||
}
|
||||
|
||||
static void
|
||||
_set_colour(gchar *val, NCURSES_COLOR_T *pref,
|
||||
NCURSES_COLOR_T def)
|
||||
_set_colour(gchar *val, NCURSES_COLOR_T *pref, NCURSES_COLOR_T def, theme_item_t theme_item)
|
||||
{
|
||||
if(!val) {
|
||||
*pref = def;
|
||||
} else {
|
||||
NCURSES_COLOR_T col = _lookup_colour(val);
|
||||
gchar *true_val = val;
|
||||
if (g_str_has_prefix(val, "bold_")) {
|
||||
true_val = &val[5];
|
||||
if (theme_item != THEME_NONE) {
|
||||
g_hash_table_insert(bold_items, GINT_TO_POINTER(theme_item), GINT_TO_POINTER(theme_item));
|
||||
}
|
||||
}
|
||||
NCURSES_COLOR_T col = _lookup_colour(true_val);
|
||||
if (col == -99) {
|
||||
*pref = def;
|
||||
} else {
|
||||
@ -289,189 +304,202 @@ _set_colour(gchar *val, NCURSES_COLOR_T *pref,
|
||||
static void
|
||||
_load_colours(void)
|
||||
{
|
||||
if (bold_items) {
|
||||
g_hash_table_destroy(bold_items);
|
||||
}
|
||||
bold_items = g_hash_table_new(g_direct_hash, g_direct_equal);
|
||||
|
||||
gchar *bkgnd_val = g_key_file_get_string(theme, "colours", "bkgnd", NULL);
|
||||
_set_colour(bkgnd_val, &colour_prefs.bkgnd, -1);
|
||||
_set_colour(bkgnd_val, &colour_prefs.bkgnd, -1, THEME_NONE);
|
||||
g_free(bkgnd_val);
|
||||
|
||||
gchar *titlebar_val = g_key_file_get_string(theme, "colours", "titlebar", NULL);
|
||||
_set_colour(titlebar_val, &colour_prefs.titlebar, COLOR_BLUE);
|
||||
_set_colour(titlebar_val, &colour_prefs.titlebar, COLOR_BLUE, THEME_NONE);
|
||||
g_free(titlebar_val);
|
||||
|
||||
gchar *statusbar_val = g_key_file_get_string(theme, "colours", "statusbar", NULL);
|
||||
_set_colour(statusbar_val, &colour_prefs.statusbar, COLOR_BLUE);
|
||||
_set_colour(statusbar_val, &colour_prefs.statusbar, COLOR_BLUE, THEME_NONE);
|
||||
g_free(statusbar_val);
|
||||
|
||||
gchar *titlebartext_val = g_key_file_get_string(theme, "colours", "titlebar.text", NULL);
|
||||
_set_colour(titlebartext_val, &colour_prefs.titlebartext, COLOR_WHITE);
|
||||
_set_colour(titlebartext_val, &colour_prefs.titlebartext, COLOR_WHITE, THEME_TITLE_TEXT);
|
||||
g_free(titlebartext_val);
|
||||
|
||||
gchar *titlebarbrackets_val = g_key_file_get_string(theme, "colours", "titlebar.brackets", NULL);
|
||||
_set_colour(titlebarbrackets_val, &colour_prefs.titlebarbrackets, COLOR_CYAN);
|
||||
_set_colour(titlebarbrackets_val, &colour_prefs.titlebarbrackets, COLOR_CYAN, THEME_TITLE_BRACKET);
|
||||
g_free(titlebarbrackets_val);
|
||||
|
||||
gchar *titlebarunencrypted_val = g_key_file_get_string(theme, "colours", "titlebar.unencrypted", NULL);
|
||||
_set_colour(titlebarunencrypted_val, &colour_prefs.titlebarunencrypted, COLOR_RED);
|
||||
_set_colour(titlebarunencrypted_val, &colour_prefs.titlebarunencrypted, COLOR_RED, THEME_TITLE_UNENCRYPTED);
|
||||
g_free(titlebarunencrypted_val);
|
||||
|
||||
gchar *titlebarencrypted_val = g_key_file_get_string(theme, "colours", "titlebar.encrypted", NULL);
|
||||
_set_colour(titlebarencrypted_val, &colour_prefs.titlebarencrypted, COLOR_WHITE);
|
||||
_set_colour(titlebarencrypted_val, &colour_prefs.titlebarencrypted, COLOR_WHITE, THEME_TITLE_ENCRYPTED);
|
||||
g_free(titlebarencrypted_val);
|
||||
|
||||
gchar *titlebaruntrusted_val = g_key_file_get_string(theme, "colours", "titlebar.untrusted", NULL);
|
||||
_set_colour(titlebaruntrusted_val, &colour_prefs.titlebaruntrusted, COLOR_YELLOW);
|
||||
_set_colour(titlebaruntrusted_val, &colour_prefs.titlebaruntrusted, COLOR_YELLOW, THEME_TITLE_UNTRUSTED);
|
||||
g_free(titlebaruntrusted_val);
|
||||
|
||||
gchar *titlebartrusted_val = g_key_file_get_string(theme, "colours", "titlebar.trusted", NULL);
|
||||
_set_colour(titlebartrusted_val, &colour_prefs.titlebartrusted, COLOR_WHITE);
|
||||
_set_colour(titlebartrusted_val, &colour_prefs.titlebartrusted, COLOR_WHITE, THEME_TITLE_TRUSTED);
|
||||
g_free(titlebartrusted_val);
|
||||
|
||||
gchar *titlebaronline_val = g_key_file_get_string(theme, "colours", "titlebar.online", NULL);
|
||||
_set_colour(titlebaronline_val, &colour_prefs.titlebaronline, COLOR_WHITE);
|
||||
_set_colour(titlebaronline_val, &colour_prefs.titlebaronline, COLOR_WHITE, THEME_TITLE_ONLINE);
|
||||
g_free(titlebaronline_val);
|
||||
|
||||
gchar *titlebaroffline_val = g_key_file_get_string(theme, "colours", "titlebar.offline", NULL);
|
||||
_set_colour(titlebaroffline_val, &colour_prefs.titlebaroffline, COLOR_WHITE);
|
||||
_set_colour(titlebaroffline_val, &colour_prefs.titlebaroffline, COLOR_WHITE, THEME_TITLE_OFFLINE);
|
||||
g_free(titlebaroffline_val);
|
||||
|
||||
gchar *titlebaraway_val = g_key_file_get_string(theme, "colours", "titlebar.away", NULL);
|
||||
_set_colour(titlebaraway_val, &colour_prefs.titlebaraway, COLOR_WHITE);
|
||||
_set_colour(titlebaraway_val, &colour_prefs.titlebaraway, COLOR_WHITE, THEME_TITLE_AWAY);
|
||||
g_free(titlebaraway_val);
|
||||
|
||||
gchar *titlebarchat_val = g_key_file_get_string(theme, "colours", "titlebar.chat", NULL);
|
||||
_set_colour(titlebarchat_val, &colour_prefs.titlebarchat, COLOR_WHITE);
|
||||
_set_colour(titlebarchat_val, &colour_prefs.titlebarchat, COLOR_WHITE, THEME_TITLE_CHAT);
|
||||
g_free(titlebarchat_val);
|
||||
|
||||
gchar *titlebardnd_val = g_key_file_get_string(theme, "colours", "titlebar.dnd", NULL);
|
||||
_set_colour(titlebardnd_val, &colour_prefs.titlebardnd, COLOR_WHITE);
|
||||
_set_colour(titlebardnd_val, &colour_prefs.titlebardnd, COLOR_WHITE, THEME_TITLE_DND);
|
||||
g_free(titlebardnd_val);
|
||||
|
||||
gchar *titlebarxa_val = g_key_file_get_string(theme, "colours", "titlebar.xa", NULL);
|
||||
_set_colour(titlebarxa_val, &colour_prefs.titlebarxa, COLOR_WHITE);
|
||||
_set_colour(titlebarxa_val, &colour_prefs.titlebarxa, COLOR_WHITE, THEME_TITLE_XA);
|
||||
g_free(titlebarxa_val);
|
||||
|
||||
gchar *statusbartext_val = g_key_file_get_string(theme, "colours", "statusbar.text", NULL);
|
||||
_set_colour(statusbartext_val, &colour_prefs.statusbartext, COLOR_WHITE);
|
||||
_set_colour(statusbartext_val, &colour_prefs.statusbartext, COLOR_WHITE, THEME_STATUS_TEXT);
|
||||
g_free(statusbartext_val);
|
||||
|
||||
gchar *statusbarbrackets_val = g_key_file_get_string(theme, "colours", "statusbar.brackets", NULL);
|
||||
_set_colour(statusbarbrackets_val, &colour_prefs.statusbarbrackets, COLOR_CYAN);
|
||||
_set_colour(statusbarbrackets_val, &colour_prefs.statusbarbrackets, COLOR_CYAN, THEME_STATUS_BRACKET);
|
||||
g_free(statusbarbrackets_val);
|
||||
|
||||
gchar *statusbaractive_val = g_key_file_get_string(theme, "colours", "statusbar.active", NULL);
|
||||
_set_colour(statusbaractive_val, &colour_prefs.statusbaractive, COLOR_CYAN);
|
||||
_set_colour(statusbaractive_val, &colour_prefs.statusbaractive, COLOR_CYAN, THEME_STATUS_ACTIVE);
|
||||
g_free(statusbaractive_val);
|
||||
|
||||
gchar *statusbarnew_val = g_key_file_get_string(theme, "colours", "statusbar.new", NULL);
|
||||
_set_colour(statusbarnew_val, &colour_prefs.statusbarnew, COLOR_WHITE);
|
||||
_set_colour(statusbarnew_val, &colour_prefs.statusbarnew, COLOR_WHITE, THEME_STATUS_NEW);
|
||||
g_free(statusbarnew_val);
|
||||
|
||||
gchar *maintext_val = g_key_file_get_string(theme, "colours", "main.text", NULL);
|
||||
_set_colour(maintext_val, &colour_prefs.maintext, COLOR_WHITE);
|
||||
_set_colour(maintext_val, &colour_prefs.maintext, COLOR_WHITE, THEME_TEXT);
|
||||
g_free(maintext_val);
|
||||
|
||||
gchar *maintextme_val = g_key_file_get_string(theme, "colours", "main.text.me", NULL);
|
||||
_set_colour(maintextme_val, &colour_prefs.maintextme, COLOR_WHITE);
|
||||
_set_colour(maintextme_val, &colour_prefs.maintextme, COLOR_WHITE, THEME_TEXT_ME);
|
||||
g_free(maintextme_val);
|
||||
|
||||
gchar *maintextthem_val = g_key_file_get_string(theme, "colours", "main.text.them", NULL);
|
||||
_set_colour(maintextthem_val, &colour_prefs.maintextthem, COLOR_WHITE);
|
||||
_set_colour(maintextthem_val, &colour_prefs.maintextthem, COLOR_WHITE, THEME_TEXT_THEM);
|
||||
g_free(maintextthem_val);
|
||||
|
||||
gchar *splashtext_val = g_key_file_get_string(theme, "colours", "main.splash", NULL);
|
||||
_set_colour(splashtext_val, &colour_prefs.splashtext, COLOR_CYAN);
|
||||
_set_colour(splashtext_val, &colour_prefs.splashtext, COLOR_CYAN, THEME_SPLASH);
|
||||
g_free(splashtext_val);
|
||||
|
||||
gchar *inputtext_val = g_key_file_get_string(theme, "colours", "input.text", NULL);
|
||||
_set_colour(inputtext_val, &colour_prefs.inputtext, COLOR_WHITE);
|
||||
_set_colour(inputtext_val, &colour_prefs.inputtext, COLOR_WHITE, THEME_INPUT_TEXT);
|
||||
g_free(inputtext_val);
|
||||
|
||||
gchar *timetext_val = g_key_file_get_string(theme, "colours", "main.time", NULL);
|
||||
_set_colour(timetext_val, &colour_prefs.timetext, COLOR_WHITE);
|
||||
_set_colour(timetext_val, &colour_prefs.timetext, COLOR_WHITE, THEME_TIME);
|
||||
g_free(timetext_val);
|
||||
|
||||
gchar *subscribed_val = g_key_file_get_string(theme, "colours", "subscribed", NULL);
|
||||
_set_colour(subscribed_val, &colour_prefs.subscribed, COLOR_GREEN);
|
||||
_set_colour(subscribed_val, &colour_prefs.subscribed, COLOR_GREEN, THEME_SUBSCRIBED);
|
||||
g_free(subscribed_val);
|
||||
|
||||
gchar *unsubscribed_val = g_key_file_get_string(theme, "colours", "unsubscribed", NULL);
|
||||
_set_colour(unsubscribed_val, &colour_prefs.unsubscribed, COLOR_RED);
|
||||
_set_colour(unsubscribed_val, &colour_prefs.unsubscribed, COLOR_RED, THEME_UNSUBSCRIBED);
|
||||
g_free(unsubscribed_val);
|
||||
|
||||
gchar *otrstartedtrusted_val = g_key_file_get_string(theme, "colours", "otr.started.trusted", NULL);
|
||||
_set_colour(otrstartedtrusted_val, &colour_prefs.otrstartedtrusted, COLOR_GREEN);
|
||||
_set_colour(otrstartedtrusted_val, &colour_prefs.otrstartedtrusted, COLOR_GREEN, THEME_OTR_STARTED_TRUSTED);
|
||||
g_free(otrstartedtrusted_val);
|
||||
|
||||
gchar *otrstarteduntrusted_val = g_key_file_get_string(theme, "colours", "otr.started.untrusted", NULL);
|
||||
_set_colour(otrstarteduntrusted_val, &colour_prefs.otrstarteduntrusted, COLOR_YELLOW);
|
||||
_set_colour(otrstarteduntrusted_val, &colour_prefs.otrstarteduntrusted, COLOR_YELLOW, THEME_OTR_STARTED_UNTRUSTED);
|
||||
g_free(otrstarteduntrusted_val);
|
||||
|
||||
gchar *otrended_val = g_key_file_get_string(theme, "colours", "otr.ended", NULL);
|
||||
_set_colour(otrended_val, &colour_prefs.otrended, COLOR_RED);
|
||||
_set_colour(otrended_val, &colour_prefs.otrended, COLOR_RED, THEME_OTR_ENDED);
|
||||
g_free(otrended_val);
|
||||
|
||||
gchar *otrtrusted_val = g_key_file_get_string(theme, "colours", "otr.trusted", NULL);
|
||||
_set_colour(otrtrusted_val, &colour_prefs.otrtrusted, COLOR_GREEN);
|
||||
_set_colour(otrtrusted_val, &colour_prefs.otrtrusted, COLOR_GREEN, THEME_OTR_TRUSTED);
|
||||
g_free(otrtrusted_val);
|
||||
|
||||
gchar *otruntrusted_val = g_key_file_get_string(theme, "colours", "otr.untrusted", NULL);
|
||||
_set_colour(otruntrusted_val, &colour_prefs.otruntrusted, COLOR_YELLOW);
|
||||
_set_colour(otruntrusted_val, &colour_prefs.otruntrusted, COLOR_YELLOW, THEME_OTR_UNTRUSTED);
|
||||
g_free(otruntrusted_val);
|
||||
|
||||
gchar *online_val = g_key_file_get_string(theme, "colours", "online", NULL);
|
||||
_set_colour(online_val, &colour_prefs.online, COLOR_GREEN);
|
||||
_set_colour(online_val, &colour_prefs.online, COLOR_GREEN, THEME_ONLINE);
|
||||
g_free(online_val);
|
||||
|
||||
gchar *away_val = g_key_file_get_string(theme, "colours", "away", NULL);
|
||||
_set_colour(away_val, &colour_prefs.away, COLOR_CYAN);
|
||||
_set_colour(away_val, &colour_prefs.away, COLOR_CYAN, THEME_AWAY);
|
||||
g_free(away_val);
|
||||
|
||||
gchar *chat_val = g_key_file_get_string(theme, "colours", "chat", NULL);
|
||||
_set_colour(chat_val, &colour_prefs.chat, COLOR_GREEN);
|
||||
_set_colour(chat_val, &colour_prefs.chat, COLOR_GREEN, THEME_CHAT);
|
||||
g_free(chat_val);
|
||||
|
||||
gchar *dnd_val = g_key_file_get_string(theme, "colours", "dnd", NULL);
|
||||
_set_colour(dnd_val, &colour_prefs.dnd, COLOR_RED);
|
||||
_set_colour(dnd_val, &colour_prefs.dnd, COLOR_RED, THEME_DND);
|
||||
g_free(dnd_val);
|
||||
|
||||
gchar *xa_val = g_key_file_get_string(theme, "colours", "xa", NULL);
|
||||
_set_colour(xa_val, &colour_prefs.xa, COLOR_CYAN);
|
||||
_set_colour(xa_val, &colour_prefs.xa, COLOR_CYAN, THEME_XA);
|
||||
g_free(xa_val);
|
||||
|
||||
gchar *offline_val = g_key_file_get_string(theme, "colours", "offline", NULL);
|
||||
_set_colour(offline_val, &colour_prefs.offline, COLOR_RED);
|
||||
_set_colour(offline_val, &colour_prefs.offline, COLOR_RED, THEME_OFFLINE);
|
||||
g_free(offline_val);
|
||||
|
||||
gchar *typing_val = g_key_file_get_string(theme, "colours", "typing", NULL);
|
||||
_set_colour(typing_val, &colour_prefs.typing, COLOR_YELLOW);
|
||||
_set_colour(typing_val, &colour_prefs.typing, COLOR_YELLOW, THEME_TYPING);
|
||||
g_free(typing_val);
|
||||
|
||||
gchar *gone_val = g_key_file_get_string(theme, "colours", "gone", NULL);
|
||||
_set_colour(gone_val, &colour_prefs.gone, COLOR_RED);
|
||||
_set_colour(gone_val, &colour_prefs.gone, COLOR_RED, THEME_GONE);
|
||||
g_free(gone_val);
|
||||
|
||||
gchar *error_val = g_key_file_get_string(theme, "colours", "error", NULL);
|
||||
_set_colour(error_val, &colour_prefs.error, COLOR_RED);
|
||||
_set_colour(error_val, &colour_prefs.error, COLOR_RED, THEME_ERROR);
|
||||
g_free(error_val);
|
||||
|
||||
gchar *incoming_val = g_key_file_get_string(theme, "colours", "incoming", NULL);
|
||||
_set_colour(incoming_val, &colour_prefs.incoming, COLOR_YELLOW);
|
||||
_set_colour(incoming_val, &colour_prefs.incoming, COLOR_YELLOW, THEME_INCOMING);
|
||||
g_free(incoming_val);
|
||||
|
||||
gchar *roominfo_val = g_key_file_get_string(theme, "colours", "roominfo", NULL);
|
||||
_set_colour(roominfo_val, &colour_prefs.roominfo, COLOR_YELLOW);
|
||||
_set_colour(roominfo_val, &colour_prefs.roominfo, COLOR_YELLOW, THEME_ROOMINFO);
|
||||
g_free(roominfo_val);
|
||||
|
||||
gchar *roommention_val = g_key_file_get_string(theme, "colours", "roommention", NULL);
|
||||
_set_colour(roommention_val, &colour_prefs.roommention, COLOR_YELLOW);
|
||||
_set_colour(roommention_val, &colour_prefs.roommention, COLOR_YELLOW, THEME_ROOMMENTION);
|
||||
g_free(roommention_val);
|
||||
|
||||
gchar *me_val = g_key_file_get_string(theme, "colours", "me", NULL);
|
||||
_set_colour(me_val, &colour_prefs.me, COLOR_YELLOW);
|
||||
_set_colour(me_val, &colour_prefs.me, COLOR_YELLOW, THEME_ME);
|
||||
g_free(me_val);
|
||||
|
||||
gchar *them_val = g_key_file_get_string(theme, "colours", "them", NULL);
|
||||
_set_colour(them_val, &colour_prefs.them, COLOR_GREEN);
|
||||
_set_colour(them_val, &colour_prefs.them, COLOR_GREEN, THEME_THEM);
|
||||
g_free(them_val);
|
||||
|
||||
gchar *rosterheader_val = g_key_file_get_string(theme, "colours", "roster.header", NULL);
|
||||
_set_colour(rosterheader_val, &colour_prefs.rosterheader, COLOR_YELLOW, THEME_ROSTER_HEADER);
|
||||
g_free(rosterheader_val);
|
||||
|
||||
gchar *occupantsheader_val = g_key_file_get_string(theme, "colours", "occupants.header", NULL);
|
||||
_set_colour(occupantsheader_val, &colour_prefs.occupantsheader, COLOR_YELLOW, THEME_OCCUPANTS_HEADER);
|
||||
g_free(occupantsheader_val);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
@ -579,8 +607,15 @@ theme_attrs(theme_item_t attrs)
|
||||
case THEME_OTR_ENDED: result = COLOR_PAIR(41); break;
|
||||
case THEME_OTR_TRUSTED: result = COLOR_PAIR(42); break;
|
||||
case THEME_OTR_UNTRUSTED: result = COLOR_PAIR(43); break;
|
||||
default: break;
|
||||
case THEME_ROSTER_HEADER: result = COLOR_PAIR(44); break;
|
||||
case THEME_OCCUPANTS_HEADER: result = COLOR_PAIR(45); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
if (g_hash_table_lookup(bold_items, GINT_TO_POINTER(attrs))) {
|
||||
return result | A_BOLD;
|
||||
} else {
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
@ -87,7 +87,10 @@ typedef enum {
|
||||
THEME_OTR_STARTED_UNTRUSTED,
|
||||
THEME_OTR_ENDED,
|
||||
THEME_OTR_TRUSTED,
|
||||
THEME_OTR_UNTRUSTED
|
||||
THEME_OTR_UNTRUSTED,
|
||||
THEME_OCCUPANTS_HEADER,
|
||||
THEME_ROSTER_HEADER,
|
||||
THEME_NONE
|
||||
} theme_item_t;
|
||||
|
||||
void theme_init(const char * const theme_name);
|
||||
|
@ -217,6 +217,14 @@ _ui_resize(const int ch, const char * const input, const int size)
|
||||
win_update_virtual(window);
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_redraw(void)
|
||||
{
|
||||
title_bar_resize();
|
||||
wins_resize_all();
|
||||
status_bar_resize();
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_load_colours(void)
|
||||
{
|
||||
@ -2861,9 +2869,9 @@ static void
|
||||
_ui_roster_contacts_by_presence(const char * const presence, char *title)
|
||||
{
|
||||
ProfWin *window = wins_get_console();
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattron(window->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||
win_printline_nowrap(window->subwin, title);
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||
GSList *contacts = roster_get_contacts_by_presence(presence);
|
||||
if (contacts) {
|
||||
GSList *curr_contact = contacts;
|
||||
@ -2880,12 +2888,12 @@ static void
|
||||
_ui_roster_contacts_by_group(char *group)
|
||||
{
|
||||
ProfWin *window = wins_get_console();
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattron(window->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||
GString *title = g_string_new(" -");
|
||||
g_string_append(title, group);
|
||||
win_printline_nowrap(window->subwin, title->str);
|
||||
g_string_free(title, TRUE);
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||
GSList *contacts = roster_get_group(group);
|
||||
if (contacts) {
|
||||
GSList *curr_contact = contacts;
|
||||
@ -2904,9 +2912,9 @@ _ui_roster_contacts_by_no_group(void)
|
||||
ProfWin *window = wins_get_console();
|
||||
GSList *contacts = roster_get_nogroup();
|
||||
if (contacts) {
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattron(window->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||
win_printline_nowrap(window->subwin, " -no group");
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||
GSList *curr_contact = contacts;
|
||||
while (curr_contact) {
|
||||
PContact contact = curr_contact->data;
|
||||
@ -2947,9 +2955,9 @@ _ui_roster(void)
|
||||
GSList *contacts = roster_get_contacts();
|
||||
if (contacts) {
|
||||
werase(window->subwin);
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattron(window->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||
win_printline_nowrap(window->subwin, " -Roster");
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROSTER_HEADER));
|
||||
GSList *curr_contact = contacts;
|
||||
while (curr_contact) {
|
||||
PContact contact = curr_contact->data;
|
||||
@ -2973,9 +2981,9 @@ _ui_muc_roster(const char * const room)
|
||||
werase(window->subwin);
|
||||
|
||||
if (prefs_get_boolean(PREF_MUC_PRIVILEGES)) {
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattron(window->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||
win_printline_nowrap(window->subwin, " -Moderators");
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattroff(window->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||
GList *roster_curr = occupants;
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
@ -2994,9 +3002,9 @@ _ui_muc_roster(const char * const room)
|
||||
roster_curr = g_list_next(roster_curr);
|
||||
}
|
||||
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattron(window->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||
win_printline_nowrap(window->subwin, " -Participants");
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattroff(window->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||
roster_curr = occupants;
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
@ -3015,9 +3023,9 @@ _ui_muc_roster(const char * const room)
|
||||
roster_curr = g_list_next(roster_curr);
|
||||
}
|
||||
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattron(window->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||
win_printline_nowrap(window->subwin, " -Visitors");
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattroff(window->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||
roster_curr = occupants;
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
@ -3036,9 +3044,9 @@ _ui_muc_roster(const char * const room)
|
||||
roster_curr = g_list_next(roster_curr);
|
||||
}
|
||||
} else {
|
||||
wattron(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattron(window->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||
win_printline_nowrap(window->subwin, " -Occupants\n");
|
||||
wattroff(window->subwin, theme_attrs(THEME_ROOMINFO));
|
||||
wattroff(window->subwin, theme_attrs(THEME_OCCUPANTS_HEADER));
|
||||
GList *roster_curr = occupants;
|
||||
while (roster_curr) {
|
||||
Occupant *occupant = roster_curr->data;
|
||||
@ -3415,4 +3423,5 @@ ui_init_module(void)
|
||||
ui_room_occupant_affiliation_change = _ui_room_occupant_affiliation_change;
|
||||
ui_room_occupant_role_and_affiliation_change = _ui_room_occupant_role_and_affiliation_change;
|
||||
ui_redraw_all_room_rosters = _ui_redraw_all_room_rosters;
|
||||
ui_redraw = _ui_redraw;
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ void (*ui_init)(void);
|
||||
void (*ui_load_colours)(void);
|
||||
void (*ui_update)(void);
|
||||
void (*ui_close)(void);
|
||||
void (*ui_redraw)(void);
|
||||
void (*ui_resize)(const int ch, const char * const input,
|
||||
const int size);
|
||||
GSList* (*ui_get_recipients)(void);
|
||||
|
@ -2,21 +2,21 @@
|
||||
bkgnd=default
|
||||
titlebar=blue
|
||||
statusbar=blue
|
||||
titlebar.text=white
|
||||
titlebar.text=bold_white
|
||||
titlebar.brackets=white
|
||||
statusbar.text=white
|
||||
statusbar.text=bold_white
|
||||
statusbar.brackets=white
|
||||
statusbar.active=black
|
||||
statusbar.new=white
|
||||
statusbar.active=bold_black
|
||||
statusbar.new=bold_white
|
||||
main.text=white
|
||||
main.text.me=cyan
|
||||
main.text.them=white
|
||||
input.text=green
|
||||
main.text.them=bold_white
|
||||
input.text=bold_green
|
||||
main.time=yellow
|
||||
main.splash=red
|
||||
online=green
|
||||
main.splash=bold_red
|
||||
online=bold_green
|
||||
away=cyan
|
||||
chat=white
|
||||
chat=bold_white
|
||||
dnd=magenta
|
||||
xa=blue
|
||||
offline=red
|
||||
@ -25,21 +25,23 @@ gone=red
|
||||
error=red
|
||||
incoming=yellow
|
||||
roominfo=yellow
|
||||
roommention=red
|
||||
roommention=bold_red
|
||||
me=blue
|
||||
them=green
|
||||
titlebar.unencrypted=red
|
||||
titlebar.encrypted=white
|
||||
titlebar.untrusted=yellow
|
||||
titlebar.trusted=white
|
||||
titlebar.online=green
|
||||
titlebar.offline=red
|
||||
titlebar.away=cyan
|
||||
titlebar.xa=cyan
|
||||
titlebar.dnd=red
|
||||
titlebar.chat=green
|
||||
them=bold_green
|
||||
titlebar.unencrypted=bold_red
|
||||
titlebar.encrypted=bold_white
|
||||
titlebar.untrusted=bold_yellow
|
||||
titlebar.trusted=bold_white
|
||||
titlebar.online=bold_green
|
||||
titlebar.offline=bold_red
|
||||
titlebar.away=bold_cyan
|
||||
titlebar.xa=bold_cyan
|
||||
titlebar.dnd=bold_red
|
||||
titlebar.chat=bold_green
|
||||
otr.started.trusted=green
|
||||
otr.started.untrusted=yellow
|
||||
otr.ended=red
|
||||
otr.trusted=green
|
||||
otr.untrusted=yellow
|
||||
roster.header=bold_yellow
|
||||
occupants.header=bold_cyan
|
||||
|
Loading…
Reference in New Issue
Block a user