Mercurial > pidgin
annotate finch/libgnt/gntstyle.c @ 19122:6dded98d1c80
Fixed a merge error
author | Eric Polino <aluink@pidgin.im> |
---|---|
date | Fri, 29 Jun 2007 02:58:27 +0000 |
parents | b25cb0775be3 |
children | 576edd9c4f72 |
rev | line source |
---|---|
18049
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
1 /** |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
2 * GNT - The GLib Ncurses Toolkit |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
3 * |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
4 * GNT is the legal property of its developers, whose names are too numerous |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
6 * source distribution. |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
7 * |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
8 * This library is free software; you can redistribute it and/or modify |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
11 * (at your option) any later version. |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
12 * |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
16 * GNU General Public License for more details. |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
17 * |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
21 */ |
1cedd520cd18
Doxygen skeleton and license info for gnt files.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18045
diff
changeset
|
22 |
15817 | 23 #include "gntstyle.h" |
24 #include "gntcolors.h" | |
25 | |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
26 #include "gntws.h" |
15817 | 27 |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
28 #include <glib.h> |
15817 | 29 #include <ctype.h> |
17704
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
30 #include <glib/gprintf.h> |
18085
afd96f97c50a
Get rid of a little compile error
Mark Doliner <mark@kingant.net>
parents:
18069
diff
changeset
|
31 #include <stdlib.h> |
15817 | 32 #include <string.h> |
33 | |
17703
4ea517cb7ceb
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
17698
diff
changeset
|
34 #define MAX_WORKSPACES 99 |
4ea517cb7ceb
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
17698
diff
changeset
|
35 |
15817 | 36 #if GLIB_CHECK_VERSION(2,6,0) |
37 static GKeyFile *gkfile; | |
38 #endif | |
39 | |
40 static char * str_styles[GNT_STYLES]; | |
41 static int int_styles[GNT_STYLES]; | |
42 static int bool_styles[GNT_STYLES]; | |
43 | |
44 const char *gnt_style_get(GntStyle style) | |
45 { | |
46 return str_styles[style]; | |
47 } | |
48 | |
18312
adcb44a07a2d
This is a more flexible way of getting random settings from .gntrc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18091
diff
changeset
|
49 const char *gnt_style_get_from_name(const char *group, const char *key) |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
50 { |
18312
adcb44a07a2d
This is a more flexible way of getting random settings from .gntrc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18091
diff
changeset
|
51 #if GLIB_CHECK_VERSION(2,6,0) |
adcb44a07a2d
This is a more flexible way of getting random settings from .gntrc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18091
diff
changeset
|
52 return g_key_file_get_value(gkfile, group, key, NULL); |
adcb44a07a2d
This is a more flexible way of getting random settings from .gntrc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18091
diff
changeset
|
53 #endif |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
54 } |
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
55 |
15817 | 56 gboolean gnt_style_get_bool(GntStyle style, gboolean def) |
57 { | |
58 int i; | |
59 const char * str; | |
60 | |
61 if (bool_styles[style] != -1) | |
62 return bool_styles[style]; | |
63 | |
64 str = gnt_style_get(style); | |
65 | |
66 if (str) | |
67 { | |
68 if (strcmp(str, "false") == 0) | |
69 def = FALSE; | |
70 else if (strcmp(str, "true") == 0) | |
71 def = TRUE; | |
72 else if (sscanf(str, "%d", &i) == 1) | |
73 { | |
74 if (i) | |
75 def = TRUE; | |
76 else | |
77 def = FALSE; | |
78 } | |
79 } | |
80 | |
81 bool_styles[style] = def; | |
82 return bool_styles[style]; | |
83 } | |
84 | |
85 static void | |
86 refine(char *text) | |
87 { | |
88 char *s = text, *t = text; | |
89 | |
90 while (*s) | |
91 { | |
92 if (*s == '^' && *(s + 1) == '[') | |
93 { | |
94 *t = '\033'; /* escape */ | |
95 s++; | |
96 } | |
97 else if (*s == '\\') | |
98 { | |
99 if (*(s + 1) == '\0') | |
100 *t = ' '; | |
101 else | |
102 { | |
103 s++; | |
104 if (*s == 'r' || *s == 'n') | |
105 *t = '\r'; | |
106 else if (*s == 't') | |
107 *t = '\t'; | |
108 else | |
109 *t = *s; | |
110 } | |
111 } | |
112 else | |
113 *t = *s; | |
114 t++; | |
115 s++; | |
116 } | |
117 *t = '\0'; | |
118 } | |
119 | |
120 static char * | |
121 parse_key(const char *key) | |
122 { | |
123 return (char *)gnt_key_translate(key); | |
124 } | |
125 | |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
126 void gnt_style_read_workspaces(GntWM *wm) |
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
127 { |
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
128 #if GLIB_CHECK_VERSION(2,6,0) |
17703
4ea517cb7ceb
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
17698
diff
changeset
|
129 int i; |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
130 gchar *name; |
17704
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
131 gsize c; |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
132 |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
133 for (i = 1; i < MAX_WORKSPACES; ++i) { |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
134 int j; |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
135 GntWS *ws; |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
136 gchar **titles; |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
137 char *group = calloc(12, 1); |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
138 g_sprintf(group, "Workspace-%d", i); |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
139 name = g_key_file_get_value(gkfile, group, "name", NULL); |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
140 if (!name) |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
141 return; |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
142 |
18076
da183b86a3ef
Update for the new api.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18069
diff
changeset
|
143 ws = gnt_ws_new(name); |
17704
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
144 gnt_wm_add_workspace(wm, ws); |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
145 g_free(name); |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
146 |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
147 titles = g_key_file_get_string_list(gkfile, group, "window-names", &c, NULL); |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
148 if (titles) { |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
149 for (j = 0; j < c; ++j) |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
150 g_hash_table_replace(wm->name_places, g_strdup(titles[j]), ws); |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
151 g_strfreev(titles); |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
152 } |
17704
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
153 |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
154 titles = g_key_file_get_string_list(gkfile, group, "window-titles", &c, NULL); |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
155 if (titles) { |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
156 for (j = 0; j < c; ++j) |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
157 g_hash_table_replace(wm->title_places, g_strdup(titles[j]), ws); |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
158 g_strfreev(titles); |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
159 } |
5acee0788697
New windows can be placed on specific workspaces. They can be specified by the window name (e.g. conversation-window), or a substring in the window title. Title takes precedence.
Richard Nelson <wabz@pidgin.im>
parents:
17703
diff
changeset
|
160 g_free(group); |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
161 } |
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
162 #endif |
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
163 } |
15817 | 164 void gnt_style_read_actions(GType type, GntBindableClass *klass) |
165 { | |
166 #if GLIB_CHECK_VERSION(2,6,0) | |
167 char *name; | |
168 GError *error = NULL; | |
169 | |
170 name = g_strdup_printf("%s::binding", g_type_name(type)); | |
171 | |
172 if (g_key_file_has_group(gkfile, name)) | |
173 { | |
174 gsize len = 0; | |
175 char **keys; | |
176 | |
177 keys = g_key_file_get_keys(gkfile, name, &len, &error); | |
178 if (error) | |
179 { | |
180 g_printerr("GntStyle: %s\n", error->message); | |
181 g_error_free(error); | |
182 g_free(name); | |
183 return; | |
184 } | |
185 | |
186 while (len--) | |
187 { | |
188 char *key, *action; | |
189 | |
190 key = g_strdup(keys[len]); | |
191 action = g_key_file_get_string(gkfile, name, keys[len], &error); | |
192 | |
193 if (error) | |
194 { | |
195 g_printerr("GntStyle: %s\n", error->message); | |
196 g_error_free(error); | |
197 error = NULL; | |
198 } | |
199 else | |
200 { | |
201 const char *keycode = parse_key(key); | |
202 if (keycode == NULL) { | |
203 g_printerr("GntStyle: Invalid key-binding %s\n", key); | |
204 } else { | |
205 gnt_bindable_register_binding(klass, action, keycode, NULL); | |
206 } | |
207 } | |
208 g_free(key); | |
209 g_free(action); | |
210 } | |
211 g_strfreev(keys); | |
212 } | |
213 g_free(name); | |
214 #endif | |
215 } | |
216 | |
217 void gnt_styles_get_keyremaps(GType type, GHashTable *hash) | |
218 { | |
219 #if GLIB_CHECK_VERSION(2,6,0) | |
220 char *name; | |
221 GError *error = NULL; | |
222 | |
223 name = g_strdup_printf("%s::remap", g_type_name(type)); | |
224 | |
225 if (g_key_file_has_group(gkfile, name)) | |
226 { | |
227 gsize len = 0; | |
228 char **keys; | |
229 | |
230 keys = g_key_file_get_keys(gkfile, name, &len, &error); | |
231 if (error) | |
232 { | |
233 g_printerr("GntStyle: %s\n", error->message); | |
234 g_error_free(error); | |
235 g_free(name); | |
236 return; | |
237 } | |
238 | |
239 while (len--) | |
240 { | |
241 char *key, *replace; | |
242 | |
243 key = g_strdup(keys[len]); | |
244 replace = g_key_file_get_string(gkfile, name, keys[len], &error); | |
245 | |
246 if (error) | |
247 { | |
248 g_printerr("GntStyle: %s\n", error->message); | |
249 g_error_free(error); | |
250 error = NULL; | |
251 g_free(key); | |
252 } | |
253 else | |
254 { | |
255 refine(key); | |
256 refine(replace); | |
257 g_hash_table_insert(hash, key, replace); | |
258 } | |
259 } | |
260 g_strfreev(keys); | |
261 } | |
262 | |
263 g_free(name); | |
264 #endif | |
265 } | |
266 | |
267 #if GLIB_CHECK_VERSION(2,6,0) | |
268 static void | |
269 read_general_style(GKeyFile *kfile) | |
270 { | |
271 GError *error = NULL; | |
272 gsize nkeys; | |
273 char **keys = g_key_file_get_keys(kfile, "general", &nkeys, &error); | |
274 int i; | |
275 struct | |
276 { | |
277 const char *style; | |
278 GntStyle en; | |
279 } styles[] = {{"shadow", GNT_STYLE_SHADOW}, | |
280 {"customcolor", GNT_STYLE_COLOR}, | |
281 {"mouse", GNT_STYLE_MOUSE}, | |
282 {"wm", GNT_STYLE_WM}, | |
283 {"remember_position", GNT_STYLE_REMPOS}, | |
284 {NULL, 0}}; | |
285 | |
286 if (error) | |
287 { | |
288 g_printerr("GntStyle: %s\n", error->message); | |
289 g_error_free(error); | |
290 } | |
291 else | |
292 { | |
293 for (i = 0; styles[i].style; i++) | |
294 { | |
295 str_styles[styles[i].en] = | |
15964 | 296 g_key_file_get_string(kfile, "general", styles[i].style, NULL); |
15817 | 297 } |
298 } | |
299 g_strfreev(keys); | |
300 } | |
301 #endif | |
302 | |
303 void gnt_style_read_configure_file(const char *filename) | |
304 { | |
305 #if GLIB_CHECK_VERSION(2,6,0) | |
306 GError *error = NULL; | |
307 gkfile = g_key_file_new(); | |
308 | |
18312
adcb44a07a2d
This is a more flexible way of getting random settings from .gntrc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18091
diff
changeset
|
309 if (!g_key_file_load_from_file(gkfile, filename, |
adcb44a07a2d
This is a more flexible way of getting random settings from .gntrc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18091
diff
changeset
|
310 G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error)) |
15817 | 311 { |
312 g_printerr("GntStyle: %s\n", error->message); | |
313 g_error_free(error); | |
314 return; | |
315 } | |
316 gnt_colors_parse(gkfile); | |
317 read_general_style(gkfile); | |
318 #endif | |
319 } | |
320 | |
321 void gnt_init_styles() | |
322 { | |
323 int i; | |
324 for (i = 0; i < GNT_STYLES; i++) | |
325 { | |
326 str_styles[i] = NULL; | |
327 int_styles[i] = -1; | |
328 bool_styles[i] = -1; | |
329 } | |
330 } | |
331 | |
332 void gnt_uninit_styles() | |
333 { | |
334 int i; | |
335 for (i = 0; i < GNT_STYLES; i++) | |
336 g_free(str_styles[i]); | |
337 | |
338 #if GLIB_CHECK_VERSION(2,6,0) | |
339 g_key_file_free(gkfile); | |
340 #endif | |
341 } | |
342 |