comparison 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
comparison
equal deleted inserted replaced
18505:8925181f26ec 18506:9f029b7208f1
46 } 46 }
47 47
48 char *gnt_style_get_from_name(const char *group, const char *key) 48 char *gnt_style_get_from_name(const char *group, const char *key)
49 { 49 {
50 #if GLIB_CHECK_VERSION(2,6,0) 50 #if GLIB_CHECK_VERSION(2,6,0)
51 if ((group == NULL && (group = g_get_prgname()) == NULL) || *group == '\0')
52 group = "general";
51 return g_key_file_get_value(gkfile, group, key, NULL); 53 return g_key_file_get_value(gkfile, group, key, NULL);
52 #endif 54 #endif
53 } 55 }
54 56
55 gboolean gnt_style_get_bool(GntStyle style, gboolean def) 57 gboolean gnt_style_get_bool(GntStyle style, gboolean def)
56 { 58 {
57 int i;
58 const char * str; 59 const char * str;
59 60
60 if (bool_styles[style] != -1) 61 if (bool_styles[style] != -1)
61 return bool_styles[style]; 62 return bool_styles[style];
62 63
63 str = gnt_style_get(style); 64 str = gnt_style_get(style);
64 65
66 bool_styles[style] = str ? gnt_style_parse_bool(str) : def;
67 return bool_styles[style];
68 }
69
70 gboolean gnt_style_parse_bool(const char *str)
71 {
72 gboolean def = FALSE;
73 int i;
74
65 if (str) 75 if (str)
66 { 76 {
67 if (strcmp(str, "false") == 0) 77 if (g_ascii_strcasecmp(str, "false") == 0)
68 def = FALSE; 78 def = FALSE;
69 else if (strcmp(str, "true") == 0) 79 else if (g_ascii_strcasecmp(str, "true") == 0)
70 def = TRUE; 80 def = TRUE;
71 else if (sscanf(str, "%d", &i) == 1) 81 else if (sscanf(str, "%d", &i) == 1)
72 { 82 {
73 if (i) 83 if (i)
74 def = TRUE; 84 def = TRUE;
75 else 85 else
76 def = FALSE; 86 def = FALSE;
77 } 87 }
78 } 88 }
79 89 return def;
80 bool_styles[style] = def;
81 return bool_styles[style];
82 } 90 }
83 91
84 static void 92 static void
85 refine(char *text) 93 refine(char *text)
86 { 94 {