Mercurial > pidgin.yaz
annotate finch/libgnt/gntstyle.c @ 19105:fd27baf1711b
disapproval of revision 'c80d121e4fd54ef1ba9c1ce9e4afa059f6b777e9'
author | Eric Polino <aluink@pidgin.im> |
---|---|
date | Tue, 19 Jun 2007 19:33:16 +0000 |
parents | ac904659104f |
children | 1cb69ea47a6e |
rev | line source |
---|---|
17718
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
1 /** |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
2 * GNT - The GLib Ncurses Toolkit |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
3 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
4 * GNT is the legal property of its developers, whose names are too numerous |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
6 * source distribution. |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
7 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
8 * This library is free software; you can redistribute it and/or modify |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
11 * (at your option) any later version. |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
12 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
16 * GNU General Public License for more details. |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
17 * |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
21 */ |
8410511f4dbb
applied changes from 016401bd409e6229fae0ab1e80d9fef9365511b3
Eric Polino <aluink@pidgin.im>
parents:
15964
diff
changeset
|
22 |
15818 | 23 #include "gntstyle.h" |
24 #include "gntcolors.h" | |
25 | |
16414
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
26 #include "gntws.h" |
15818 | 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> |
15818 | 29 #include <ctype.h> |
16473
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:
16472
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> |
15818 | 32 #include <string.h> |
33 | |
16472
4ea517cb7ceb
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16414
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:
16414
diff
changeset
|
35 |
15818 | 36 #if GLIB_CHECK_VERSION(2,6,0) |
37 static GKeyFile *gkfile; | |
38 #endif | |
39 | |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
40 static GHashTable *unknowns; |
15818 | 41 static char * str_styles[GNT_STYLES]; |
42 static int int_styles[GNT_STYLES]; | |
43 static int bool_styles[GNT_STYLES]; | |
44 | |
45 const char *gnt_style_get(GntStyle style) | |
46 { | |
47 return str_styles[style]; | |
48 } | |
49 | |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
50 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
|
51 { |
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
52 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
|
53 } |
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
54 |
15818 | 55 gboolean gnt_style_get_bool(GntStyle style, gboolean def) |
56 { | |
57 int i; | |
58 const char * str; | |
59 | |
60 if (bool_styles[style] != -1) | |
61 return bool_styles[style]; | |
62 | |
63 str = gnt_style_get(style); | |
64 | |
65 if (str) | |
66 { | |
67 if (strcmp(str, "false") == 0) | |
68 def = FALSE; | |
69 else if (strcmp(str, "true") == 0) | |
70 def = TRUE; | |
71 else if (sscanf(str, "%d", &i) == 1) | |
72 { | |
73 if (i) | |
74 def = TRUE; | |
75 else | |
76 def = FALSE; | |
77 } | |
78 } | |
79 | |
80 bool_styles[style] = def; | |
81 return bool_styles[style]; | |
82 } | |
83 | |
84 static void | |
85 refine(char *text) | |
86 { | |
87 char *s = text, *t = text; | |
88 | |
89 while (*s) | |
90 { | |
91 if (*s == '^' && *(s + 1) == '[') | |
92 { | |
93 *t = '\033'; /* escape */ | |
94 s++; | |
95 } | |
96 else if (*s == '\\') | |
97 { | |
98 if (*(s + 1) == '\0') | |
99 *t = ' '; | |
100 else | |
101 { | |
102 s++; | |
103 if (*s == 'r' || *s == 'n') | |
104 *t = '\r'; | |
105 else if (*s == 't') | |
106 *t = '\t'; | |
107 else | |
108 *t = *s; | |
109 } | |
110 } | |
111 else | |
112 *t = *s; | |
113 t++; | |
114 s++; | |
115 } | |
116 *t = '\0'; | |
117 } | |
118 | |
119 static char * | |
120 parse_key(const char *key) | |
121 { | |
122 return (char *)gnt_key_translate(key); | |
123 } | |
124 | |
16414
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
125 void gnt_style_read_workspaces(GntWM *wm) |
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
126 { |
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
127 #if GLIB_CHECK_VERSION(2,6,0) |
16472
4ea517cb7ceb
Show an activity message when a window in the non-current workspace is flagged urgent
Richard Nelson <wabz@pidgin.im>
parents:
16414
diff
changeset
|
128 int i; |
16414
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
129 gchar *name; |
16473
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:
16472
diff
changeset
|
130 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:
16472
diff
changeset
|
131 |
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:
16472
diff
changeset
|
132 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:
16472
diff
changeset
|
133 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:
16472
diff
changeset
|
134 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:
16472
diff
changeset
|
135 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:
16472
diff
changeset
|
136 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:
16472
diff
changeset
|
137 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:
16472
diff
changeset
|
138 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:
16472
diff
changeset
|
139 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:
16472
diff
changeset
|
140 return; |
16414
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
141 |
16473
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:
16472
diff
changeset
|
142 ws = g_object_new(GNT_TYPE_WS, 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:
16472
diff
changeset
|
143 gnt_ws_set_name(ws, 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:
16472
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:
16472
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:
16472
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:
16472
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:
16472
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:
16472
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:
16472
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:
16472
diff
changeset
|
151 g_strfreev(titles); |
16414
56d2ae9cbb5c
Initial workspace support. refs #51
Richard Nelson <wabz@pidgin.im>
parents:
15964
diff
changeset
|
152 } |
16473
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:
16472
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:
16472
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:
16472
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:
16472
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:
16472
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:
16472
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:
16472
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:
16472
diff
changeset
|
160 g_free(group); |
16414
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 } |
15818 | 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); |
15818 | 297 } |
18045
08e93462f189
Update the irssi WM to allow tiling the conversation windows.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15964
diff
changeset
|
298 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
|
299 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
|
300 g_strdup(g_key_file_get_string(kfile, "general", keys[i], NULL))); |
15818 | 301 } |
302 g_strfreev(keys); | |
303 } | |
304 #endif | |
305 | |
306 void gnt_style_read_configure_file(const char *filename) | |
307 { | |
308 #if GLIB_CHECK_VERSION(2,6,0) | |
309 GError *error = NULL; | |
310 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
|
311 unknowns = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
15818 | 312 |
313 if (!g_key_file_load_from_file(gkfile, filename, G_KEY_FILE_NONE, &error)) | |
314 { | |
315 g_printerr("GntStyle: %s\n", error->message); | |
316 g_error_free(error); | |
317 return; | |
318 } | |
319 gnt_colors_parse(gkfile); | |
320 read_general_style(gkfile); | |
321 #endif | |
322 } | |
323 | |
324 void gnt_init_styles() | |
325 { | |
326 int i; | |
327 for (i = 0; i < GNT_STYLES; i++) | |
328 { | |
329 str_styles[i] = NULL; | |
330 int_styles[i] = -1; | |
331 bool_styles[i] = -1; | |
332 } | |
333 } | |
334 | |
335 void gnt_uninit_styles() | |
336 { | |
337 int i; | |
338 for (i = 0; i < GNT_STYLES; i++) | |
339 g_free(str_styles[i]); | |
340 | |
341 #if GLIB_CHECK_VERSION(2,6,0) | |
342 g_key_file_free(gkfile); | |
343 #endif | |
344 } | |
345 |