Mercurial > pidgin
annotate finch/libgnt/gntstyle.c @ 18076:da183b86a3ef
Update for the new api.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sun, 10 Jun 2007 15:41:14 +0000 |
parents | 08776fc5c06f |
children | 7e0bd339533c |
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" | |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
25 #include "gntws.h" |
15817 | 26 |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
27 #include <glib.h> |
15817 | 28 #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
|
29 #include <glib/gprintf.h> |
15817 | 30 #include <string.h> |
31 | |
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
|
32 #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
|
33 |
15817 | 34 #if GLIB_CHECK_VERSION(2,6,0) |
35 static GKeyFile *gkfile; | |
36 #endif | |
37 | |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
38 static GHashTable *unknowns; |
15817 | 39 static char * str_styles[GNT_STYLES]; |
40 static int int_styles[GNT_STYLES]; | |
41 static int bool_styles[GNT_STYLES]; | |
42 | |
43 const char *gnt_style_get(GntStyle style) | |
44 { | |
45 return str_styles[style]; | |
46 } | |
47 | |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
48 const char *gnt_style_get_from_name(const char *name) |
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
49 { |
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
50 return g_hash_table_lookup(unknowns, name); |
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
51 } |
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
52 |
15817 | 53 gboolean gnt_style_get_bool(GntStyle style, gboolean def) |
54 { | |
55 int i; | |
56 const char * str; | |
57 | |
58 if (bool_styles[style] != -1) | |
59 return bool_styles[style]; | |
60 | |
61 str = gnt_style_get(style); | |
62 | |
63 if (str) | |
64 { | |
65 if (strcmp(str, "false") == 0) | |
66 def = FALSE; | |
67 else if (strcmp(str, "true") == 0) | |
68 def = TRUE; | |
69 else if (sscanf(str, "%d", &i) == 1) | |
70 { | |
71 if (i) | |
72 def = TRUE; | |
73 else | |
74 def = FALSE; | |
75 } | |
76 } | |
77 | |
78 bool_styles[style] = def; | |
79 return bool_styles[style]; | |
80 } | |
81 | |
82 static void | |
83 refine(char *text) | |
84 { | |
85 char *s = text, *t = text; | |
86 | |
87 while (*s) | |
88 { | |
89 if (*s == '^' && *(s + 1) == '[') | |
90 { | |
91 *t = '\033'; /* escape */ | |
92 s++; | |
93 } | |
94 else if (*s == '\\') | |
95 { | |
96 if (*(s + 1) == '\0') | |
97 *t = ' '; | |
98 else | |
99 { | |
100 s++; | |
101 if (*s == 'r' || *s == 'n') | |
102 *t = '\r'; | |
103 else if (*s == 't') | |
104 *t = '\t'; | |
105 else | |
106 *t = *s; | |
107 } | |
108 } | |
109 else | |
110 *t = *s; | |
111 t++; | |
112 s++; | |
113 } | |
114 *t = '\0'; | |
115 } | |
116 | |
117 static char * | |
118 parse_key(const char *key) | |
119 { | |
120 return (char *)gnt_key_translate(key); | |
121 } | |
122 | |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
123 void gnt_style_read_workspaces(GntWM *wm) |
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
124 { |
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
125 #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
|
126 int i; |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
127 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
|
128 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
|
129 |
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
|
130 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
|
131 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
|
132 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
|
133 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
|
134 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
|
135 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
|
136 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
|
137 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
|
138 return; |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
139 |
18076
da183b86a3ef
Update for the new api.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18069
diff
changeset
|
140 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
|
141 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
|
142 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
|
143 |
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 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
|
145 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
|
146 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
|
147 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
|
148 g_strfreev(titles); |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
149 } |
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
|
150 |
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 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
|
152 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
|
153 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
|
154 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
|
155 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
|
156 } |
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_free(group); |
17698
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
158 } |
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
159 #endif |
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
160 } |
15817 | 161 void gnt_style_read_actions(GType type, GntBindableClass *klass) |
162 { | |
163 #if GLIB_CHECK_VERSION(2,6,0) | |
164 char *name; | |
165 GError *error = NULL; | |
166 | |
167 name = g_strdup_printf("%s::binding", g_type_name(type)); | |
168 | |
169 if (g_key_file_has_group(gkfile, name)) | |
170 { | |
171 gsize len = 0; | |
172 char **keys; | |
173 | |
174 keys = g_key_file_get_keys(gkfile, name, &len, &error); | |
175 if (error) | |
176 { | |
177 g_printerr("GntStyle: %s\n", error->message); | |
178 g_error_free(error); | |
179 g_free(name); | |
180 return; | |
181 } | |
182 | |
183 while (len--) | |
184 { | |
185 char *key, *action; | |
186 | |
187 key = g_strdup(keys[len]); | |
188 action = g_key_file_get_string(gkfile, name, keys[len], &error); | |
189 | |
190 if (error) | |
191 { | |
192 g_printerr("GntStyle: %s\n", error->message); | |
193 g_error_free(error); | |
194 error = NULL; | |
195 } | |
196 else | |
197 { | |
198 const char *keycode = parse_key(key); | |
199 if (keycode == NULL) { | |
200 g_printerr("GntStyle: Invalid key-binding %s\n", key); | |
201 } else { | |
202 gnt_bindable_register_binding(klass, action, keycode, NULL); | |
203 } | |
204 } | |
205 g_free(key); | |
206 g_free(action); | |
207 } | |
208 g_strfreev(keys); | |
209 } | |
210 g_free(name); | |
211 #endif | |
212 } | |
213 | |
214 void gnt_styles_get_keyremaps(GType type, GHashTable *hash) | |
215 { | |
216 #if GLIB_CHECK_VERSION(2,6,0) | |
217 char *name; | |
218 GError *error = NULL; | |
219 | |
220 name = g_strdup_printf("%s::remap", g_type_name(type)); | |
221 | |
222 if (g_key_file_has_group(gkfile, name)) | |
223 { | |
224 gsize len = 0; | |
225 char **keys; | |
226 | |
227 keys = g_key_file_get_keys(gkfile, name, &len, &error); | |
228 if (error) | |
229 { | |
230 g_printerr("GntStyle: %s\n", error->message); | |
231 g_error_free(error); | |
232 g_free(name); | |
233 return; | |
234 } | |
235 | |
236 while (len--) | |
237 { | |
238 char *key, *replace; | |
239 | |
240 key = g_strdup(keys[len]); | |
241 replace = g_key_file_get_string(gkfile, name, keys[len], &error); | |
242 | |
243 if (error) | |
244 { | |
245 g_printerr("GntStyle: %s\n", error->message); | |
246 g_error_free(error); | |
247 error = NULL; | |
248 g_free(key); | |
249 } | |
250 else | |
251 { | |
252 refine(key); | |
253 refine(replace); | |
254 g_hash_table_insert(hash, key, replace); | |
255 } | |
256 } | |
257 g_strfreev(keys); | |
258 } | |
259 | |
260 g_free(name); | |
261 #endif | |
262 } | |
263 | |
264 #if GLIB_CHECK_VERSION(2,6,0) | |
265 static void | |
266 read_general_style(GKeyFile *kfile) | |
267 { | |
268 GError *error = NULL; | |
269 gsize nkeys; | |
270 char **keys = g_key_file_get_keys(kfile, "general", &nkeys, &error); | |
271 int i; | |
272 struct | |
273 { | |
274 const char *style; | |
275 GntStyle en; | |
276 } styles[] = {{"shadow", GNT_STYLE_SHADOW}, | |
277 {"customcolor", GNT_STYLE_COLOR}, | |
278 {"mouse", GNT_STYLE_MOUSE}, | |
279 {"wm", GNT_STYLE_WM}, | |
280 {"remember_position", GNT_STYLE_REMPOS}, | |
281 {NULL, 0}}; | |
282 | |
283 if (error) | |
284 { | |
285 g_printerr("GntStyle: %s\n", error->message); | |
286 g_error_free(error); | |
287 } | |
288 else | |
289 { | |
290 for (i = 0; styles[i].style; i++) | |
291 { | |
292 str_styles[styles[i].en] = | |
15964 | 293 g_key_file_get_string(kfile, "general", styles[i].style, NULL); |
15817 | 294 } |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
295 |
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
296 for (i = 0; i < nkeys; i++) |
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
297 g_hash_table_replace(unknowns, g_strdup(keys[i]), |
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
298 g_strdup(g_key_file_get_string(kfile, "general", keys[i], NULL))); |
15817 | 299 } |
300 g_strfreev(keys); | |
301 } | |
302 #endif | |
303 | |
304 void gnt_style_read_configure_file(const char *filename) | |
305 { | |
306 #if GLIB_CHECK_VERSION(2,6,0) | |
307 GError *error = NULL; | |
308 gkfile = g_key_file_new(); | |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
309 unknowns = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
15817 | 310 |
311 if (!g_key_file_load_from_file(gkfile, filename, G_KEY_FILE_NONE, &error)) | |
312 { | |
313 g_printerr("GntStyle: %s\n", error->message); | |
314 g_error_free(error); | |
315 return; | |
316 } | |
317 gnt_colors_parse(gkfile); | |
318 read_general_style(gkfile); | |
319 #endif | |
320 } | |
321 | |
322 void gnt_init_styles() | |
323 { | |
324 int i; | |
325 for (i = 0; i < GNT_STYLES; i++) | |
326 { | |
327 str_styles[i] = NULL; | |
328 int_styles[i] = -1; | |
329 bool_styles[i] = -1; | |
330 } | |
331 } | |
332 | |
333 void gnt_uninit_styles() | |
334 { | |
335 int i; | |
336 for (i = 0; i < GNT_STYLES; i++) | |
337 g_free(str_styles[i]); | |
338 | |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
339 g_hash_table_destroy(unknowns); |
15817 | 340 #if GLIB_CHECK_VERSION(2,6,0) |
341 g_key_file_free(gkfile); | |
342 #endif | |
343 } | |
344 |