Mercurial > pidgin.yaz
diff finch/libgnt/gntcolors.c @ 21691:3ed9b027479d
Add support for colour in gnttreerows, and colourise the blist. Fixes #1490
author | Richard Nelson <wabz@pidgin.im> |
---|---|
date | Fri, 30 Nov 2007 03:17:07 +0000 |
parents | 9187d331aebe |
children | 2de3a2de5f13 |
line wrap: on
line diff
--- a/finch/libgnt/gntcolors.c Thu Nov 29 23:21:14 2007 +0000 +++ b/finch/libgnt/gntcolors.c Fri Nov 30 03:17:07 2007 +0000 @@ -33,6 +33,7 @@ #include <string.h> static gboolean hascolors; +static int custom_type = GNT_COLORS; static struct { short r, g, b; @@ -137,8 +138,8 @@ } #if GLIB_CHECK_VERSION(2,6,0) -static int -get_color(char *key) +int +gnt_colors_get_color(char *key) { int color; gboolean custom = can_use_custom_color(); @@ -196,7 +197,7 @@ int color = -1; key = g_ascii_strdown(key, -1); - color = get_color(key); + color = gnt_colors_get_color(key); g_free(key); if (color == -1) continue; @@ -237,8 +238,8 @@ GntColorType type = 0; gchar *fgc = g_ascii_strdown(list[0], -1); gchar *bgc = g_ascii_strdown(list[1], -1); - int fg = get_color(fgc); - int bg = get_color(bgc); + int fg = gnt_colors_get_color(fgc); + int bg = gnt_colors_get_color(bgc); g_free(fgc); g_free(bgc); if (fg == -1 || bg == -1) @@ -287,3 +288,8 @@ pair == GNT_COLOR_TITLE_D || pair == GNT_COLOR_DISABLED) ? 0 : A_STANDOUT)); } +int gnt_color_add_pair(int fg, int bg) +{ + init_pair(custom_type, fg, bg); + return custom_type++; +}