changeset 14299:ea5193c23171

[gaim-migrate @ 16989] Now the customcolors should work. Apparently I didn't include it in last commit. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 23 Aug 2006 01:35:44 +0000
parents 6e2e9e84b99d
children b8697618399a
files console/libgnt/gntcolors.c console/libgnt/gntmain.c console/libgnt/gntstyle.c console/libgnt/gntstyle.h
diffstat 4 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/console/libgnt/gntcolors.c	Wed Aug 23 01:09:33 2006 +0000
+++ b/console/libgnt/gntcolors.c	Wed Aug 23 01:35:44 2006 +0000
@@ -1,5 +1,6 @@
 #include <ncursesw/ncurses.h>
 #include "gntcolors.h"
+#include "gntstyle.h"
 
 #include <glib.h>
 
@@ -36,7 +37,7 @@
 void gnt_init_colors()
 {
 	start_color();
-	if (can_change_color())
+	if (gnt_style_get_bool(GNT_STYLE_COLOR, FALSE) && can_change_color())
 	{
 		backup_colors();
 
@@ -63,6 +64,7 @@
 	}
 	else
 	{
+		use_default_colors();
 		init_pair(GNT_COLOR_NORMAL, COLOR_BLACK, COLOR_WHITE);
 		init_pair(GNT_COLOR_HIGHLIGHT, COLOR_WHITE, COLOR_BLUE);
 		init_pair(GNT_COLOR_SHADOW, COLOR_BLACK, COLOR_BLACK);
@@ -77,7 +79,8 @@
 void
 gnt_uninit_colors()
 {
-	restore_colors();
+	if (gnt_style_get_bool(GNT_STYLE_COLOR, FALSE) && can_change_color())
+		restore_colors();
 }
 
 static int
--- a/console/libgnt/gntmain.c	Wed Aug 23 01:09:33 2006 +0000
+++ b/console/libgnt/gntmain.c	Wed Aug 23 01:35:44 2006 +0000
@@ -782,13 +782,13 @@
 	noecho();
 	curs_set(0);
 
-	gnt_init_colors();
 	gnt_init_styles();
 
 	filename = g_build_filename(g_get_home_dir(), ".gntrc", NULL);
 	gnt_style_read_configure_file(filename);
 	g_free(filename);
 
+	gnt_init_colors();
 	X_MIN = 0;
 	Y_MIN = 0;
 	X_MAX = getmaxx(stdscr);
--- a/console/libgnt/gntstyle.c	Wed Aug 23 01:09:33 2006 +0000
+++ b/console/libgnt/gntstyle.c	Wed Aug 23 01:35:44 2006 +0000
@@ -141,6 +141,7 @@
 		const char *style;
 		GntStyle en;
 	} styles[] = {{"shadow", GNT_STYLE_SHADOW},
+	              {"customcolor", GNT_STYLE_COLOR},
 	              {NULL, 0}};
 
 	if (error)
--- a/console/libgnt/gntstyle.h	Wed Aug 23 01:09:33 2006 +0000
+++ b/console/libgnt/gntstyle.h	Wed Aug 23 01:35:44 2006 +0000
@@ -3,6 +3,7 @@
 typedef enum
 {
 	GNT_STYLE_SHADOW = 0,
+	GNT_STYLE_COLOR = 1,
 	GNT_STYLES
 } GntStyle;