diff finch/libgnt/gntstyle.c @ 18506:9f029b7208f1

Allow one-line high buttons. Specify 'small-button = true' under 'general', or 'finch'. This gets rid of the border from the buttons, and does the highlighting a little differently.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 12 Jul 2007 23:57:56 +0000
parents 65ed0916d3bc
children c96a0d4a84e2
line wrap: on
line diff
--- a/finch/libgnt/gntstyle.c	Thu Jul 12 03:19:38 2007 +0000
+++ b/finch/libgnt/gntstyle.c	Thu Jul 12 23:57:56 2007 +0000
@@ -48,13 +48,14 @@
 char *gnt_style_get_from_name(const char *group, const char *key)
 {
 #if GLIB_CHECK_VERSION(2,6,0)
+	if ((group == NULL && (group = g_get_prgname()) == NULL) || *group == '\0')
+		group = "general";
 	return g_key_file_get_value(gkfile, group, key, NULL);
 #endif
 }
 
 gboolean gnt_style_get_bool(GntStyle style, gboolean def)
 {
-	int i;
 	const char * str;
 
 	if (bool_styles[style] != -1)
@@ -62,11 +63,20 @@
 	
 	str = gnt_style_get(style);
 
+	bool_styles[style] = str ? gnt_style_parse_bool(str) : def;
+	return bool_styles[style];
+}
+
+gboolean gnt_style_parse_bool(const char *str)
+{
+	gboolean def = FALSE;
+	int i;
+
 	if (str)
 	{
-		if (strcmp(str, "false") == 0)
+		if (g_ascii_strcasecmp(str, "false") == 0)
 			def = FALSE;
-		else if (strcmp(str, "true") == 0)
+		else if (g_ascii_strcasecmp(str, "true") == 0)
 			def = TRUE;
 		else if (sscanf(str, "%d", &i) == 1)
 		{
@@ -76,9 +86,7 @@
 				def = FALSE;
 		}
 	}
-
-	bool_styles[style] = def;
-	return bool_styles[style];
+	return def;
 }
 
 static void