--- a/gntcolors.c Wed Nov 28 03:52:27 2007 +0000
+++ b/gntcolors.c Fri Nov 30 03:17:07 2007 +0000
@@ -33,6 +33,7 @@
static gboolean hascolors;
+static int custom_type = GNT_COLORS; @@ -137,8 +138,8 @@
#if GLIB_CHECK_VERSION(2,6,0)
+gnt_colors_get_color(char *key) gboolean custom = can_use_custom_color();
@@ -196,7 +197,7 @@
key = g_ascii_strdown(key, -1);
- color = get_color(key);
+ color = gnt_colors_get_color(key); @@ -237,8 +238,8 @@
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); 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); --- a/gntcolors.h Wed Nov 28 03:52:27 2007 +0000
+++ b/gntcolors.h Fri Nov 30 03:17:07 2007 +0000
@@ -86,6 +86,16 @@
void gnt_color_pairs_parse(GKeyFile *kfile);
+ * @param kfile The string value + * @since 2.3.1 (gnt), 2.3.1 (pidgin) +int gnt_colors_get_color(char *key); @@ -101,4 +111,15 @@
int gnt_color_pair(int color);
+ * Adds a color definition +int gnt_color_add_pair(int fg, int bg); --- a/gntstyle.c Wed Nov 28 03:52:27 2007 +0000
+++ b/gntstyle.c Fri Nov 30 03:17:07 2007 +0000
@@ -59,6 +59,21 @@
+char **gnt_style_get_string_list(const char *group, const char *key, gsize *length) +#if GLIB_CHECK_VERSION(2,6,0) + const char *prg = g_get_prgname(); + if ((group == NULL || *group == '\0') && prg && + g_key_file_has_group(gkfile, prg)) + return g_key_file_get_string_list(gkfile, group, key, length, NULL); gboolean gnt_style_get_bool(GntStyle style, gboolean def)
--- a/gntstyle.h Wed Nov 28 03:52:27 2007 +0000
+++ b/gntstyle.h Fri Nov 30 03:17:07 2007 +0000
@@ -65,6 +65,20 @@
char *gnt_style_get_from_name(const char *group, const char *key);
+ * Get the value of a preference in ~/.gntrc. + * @param group The name of the group in the keyfile. If @c NULL, the prgname + * will be used first, if available. Otherwise, "general" will be used. + * @param length Return location for the number of strings returned, or NULL + * @return NULL terminated string array. The array should be freed with g_strfreev(). + * @since 2.3.1 (gnt), 2.3.1 (pidgin) +char **gnt_style_get_string_list(const char *group, const char *key, gsize *length); * Parse a boolean preference. For example, if 'value' is "false" (ignoring case)
* or "0", the return value will be @c FALSE, otherwise @c TRUE.
--- a/gnttree.c Wed Nov 28 03:52:27 2007 +0000
+++ b/gnttree.c Fri Nov 30 03:17:07 2007 +0000
@@ -75,6 +75,7 @@
If choice is true, then child will be NULL */
GntTextFormatFlags flags;
@@ -522,9 +523,14 @@
if (flags & GNT_TEXT_FLAG_DIM)
- attr |= (A_DIM | gnt_color_pair(GNT_COLOR_DISABLED));
+ attr |= (A_DIM | gnt_color_pair(row->color)); + attr |= (A_DIM | gnt_color_pair(GNT_COLOR_DISABLED)); else if (flags & GNT_TEXT_FLAG_HIGHLIGHT)
attr |= (A_DIM | gnt_color_pair(GNT_COLOR_HIGHLIGHT));
+ attr |= gnt_color_pair(row->color); attr |= gnt_color_pair(GNT_COLOR_NORMAL);
@@ -1559,6 +1565,16 @@
redraw_tree(tree); /* XXX: It shouldn't be necessary to redraw the whole darned tree */
+void gnt_tree_set_row_color(GntTree *tree, void *key, int color) + GntTreeRow *row = g_hash_table_lookup(tree->hash, key); + if (!row || row->color == color) void gnt_tree_set_selected(GntTree *tree , void *key)
--- a/gnttree.h Wed Nov 28 03:52:27 2007 +0000
+++ b/gnttree.h Fri Nov 30 03:17:07 2007 +0000
@@ -325,6 +325,15 @@
void gnt_tree_set_row_flags(GntTree *tree, void *key, GntTextFormatFlags flags);
+ * Set color for the text in a row in the tree. + * @param key The key for the row + * @param color The color +void gnt_tree_set_row_color(GntTree *, void *, int);