Mercurial > pidgin.yaz
comparison pidgin/gtkconv-theme.c @ 32682:5cf6c4a8dcab
Rearrange to drop the prototypes.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 24 Sep 2011 21:16:14 +0000 |
parents | be14cf8a4c91 |
children | a7f0fdce9a0e |
comparison
equal
deleted
inserted
replaced
32681:be14cf8a4c91 | 32682:5cf6c4a8dcab |
---|---|
35 #include <string.h> | 35 #include <string.h> |
36 | 36 |
37 #define PIDGIN_CONV_THEME_GET_PRIVATE(Gobject) \ | 37 #define PIDGIN_CONV_THEME_GET_PRIVATE(Gobject) \ |
38 (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_CONV_THEME, PidginConvThemePrivate)) | 38 (G_TYPE_INSTANCE_GET_PRIVATE((Gobject), PIDGIN_TYPE_CONV_THEME, PidginConvThemePrivate)) |
39 | 39 |
40 static void _set_variant(PidginConvTheme *theme, const char *variant); | |
41 | |
42 /****************************************************************************** | 40 /****************************************************************************** |
43 * Structs | 41 * Structs |
44 *****************************************************************************/ | 42 *****************************************************************************/ |
45 | 43 |
46 typedef struct { | 44 typedef struct { |
86 | 84 |
87 static GObjectClass *parent_class = NULL; | 85 static GObjectClass *parent_class = NULL; |
88 static GParamSpec *properties[PROP_LAST]; | 86 static GParamSpec *properties[PROP_LAST]; |
89 | 87 |
90 /****************************************************************************** | 88 /****************************************************************************** |
89 * Helper Functions | |
90 *****************************************************************************/ | |
91 | |
92 static const GValue * | |
93 get_key(PidginConvThemePrivate *priv, const char *key, gboolean specific) | |
94 { | |
95 GValue *val = NULL; | |
96 | |
97 /* Try variant-specific key */ | |
98 if (specific && priv->variant) { | |
99 char *name = g_strdup_printf("%s:%s", key, priv->variant); | |
100 val = g_hash_table_lookup(priv->info, name); | |
101 g_free(name); | |
102 } | |
103 | |
104 /* Try generic key */ | |
105 if (!val) { | |
106 val = g_hash_table_lookup(priv->info, key); | |
107 } | |
108 | |
109 return val; | |
110 } | |
111 | |
112 static const char * | |
113 get_template_html(PidginConvThemePrivate *priv, const char *dir) | |
114 { | |
115 char *file; | |
116 | |
117 if (priv->template_html) | |
118 return priv->template_html; | |
119 | |
120 /* The template path can either come from the theme, or can | |
121 * be stock Template.html that comes with the plugin */ | |
122 file = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL); | |
123 | |
124 if (!g_file_test(file, G_FILE_TEST_EXISTS)) { | |
125 g_free(file); | |
126 file = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); | |
127 } | |
128 | |
129 if (!g_file_get_contents(file, &priv->template_html, NULL, NULL)) { | |
130 purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", file); | |
131 priv->template_html = g_strdup(""); | |
132 } | |
133 g_free(file); | |
134 | |
135 return priv->template_html; | |
136 } | |
137 | |
138 static const char * | |
139 get_basestyle_css(PidginConvThemePrivate *priv, const char *dir) | |
140 { | |
141 char *file; | |
142 | |
143 if (priv->basestyle_css) | |
144 return priv->basestyle_css; | |
145 | |
146 file = g_build_filename(dir, "Contents", "Resources", "main.css", NULL); | |
147 if (!g_file_get_contents(file, &priv->basestyle_css, NULL, NULL)) | |
148 priv->basestyle_css = g_strdup(""); | |
149 g_free(file); | |
150 | |
151 return priv->basestyle_css; | |
152 } | |
153 | |
154 static const char * | |
155 get_header_html(PidginConvThemePrivate *priv, const char *dir) | |
156 { | |
157 char *file; | |
158 | |
159 if (priv->header_html) | |
160 return priv->header_html; | |
161 | |
162 file = g_build_filename(dir, "Contents", "Resources", "Header.html", NULL); | |
163 if (!g_file_get_contents(file, &priv->header_html, NULL, NULL)) | |
164 priv->header_html = g_strdup(""); | |
165 g_free(file); | |
166 | |
167 return priv->header_html; | |
168 } | |
169 | |
170 static const char * | |
171 get_footer_html(PidginConvThemePrivate *priv, const char *dir) | |
172 { | |
173 char *file; | |
174 | |
175 if (priv->footer_html) | |
176 return priv->footer_html; | |
177 | |
178 file = g_build_filename(dir, "Contents", "Resources", "Footer.html", NULL); | |
179 if (!g_file_get_contents(file, &priv->footer_html, NULL, NULL)) | |
180 priv->footer_html = g_strdup(""); | |
181 g_free(file); | |
182 | |
183 return priv->footer_html; | |
184 } | |
185 | |
186 static const char * | |
187 get_topic_html(PidginConvThemePrivate *priv, const char *dir) | |
188 { | |
189 char *file; | |
190 | |
191 if (priv->topic_html) | |
192 return priv->topic_html; | |
193 | |
194 file = g_build_filename(dir, "Contents", "Resources", "Topic.html", NULL); | |
195 if (!g_file_get_contents(file, &priv->topic_html, NULL, NULL)) { | |
196 purple_debug_info("webkit", "%s could not find Resources/Topic.html\n", dir); | |
197 priv->topic_html = g_strdup(""); | |
198 } | |
199 g_free(file); | |
200 | |
201 return priv->topic_html; | |
202 } | |
203 | |
204 static const char * | |
205 get_content_html(PidginConvThemePrivate *priv, const char *dir) | |
206 { | |
207 char *file; | |
208 | |
209 if (priv->content_html) | |
210 return priv->content_html; | |
211 | |
212 file = g_build_filename(dir, "Contents", "Resources", "Content.html", NULL); | |
213 if (!g_file_get_contents(file, &priv->content_html, NULL, NULL)) { | |
214 purple_debug_info("webkit", "%s did not have a Content.html\n", dir); | |
215 priv->content_html = g_strdup(""); | |
216 } | |
217 g_free(file); | |
218 | |
219 return priv->content_html; | |
220 } | |
221 | |
222 static const char * | |
223 get_status_html(PidginConvThemePrivate *priv, const char *dir) | |
224 { | |
225 char *file; | |
226 | |
227 if (priv->status_html) | |
228 return priv->status_html; | |
229 | |
230 file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL); | |
231 if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { | |
232 purple_debug_info("webkit", "%s could not find Resources/Status.html\n", dir); | |
233 priv->status_html = g_strdup(get_content_html(priv, dir)); | |
234 } | |
235 g_free(file); | |
236 | |
237 return priv->status_html; | |
238 } | |
239 | |
240 static const char * | |
241 get_incoming_content_html(PidginConvThemePrivate *priv, const char *dir) | |
242 { | |
243 char *file; | |
244 | |
245 if (priv->incoming_content_html) | |
246 return priv->incoming_content_html; | |
247 | |
248 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Content.html", NULL); | |
249 if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) { | |
250 purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", dir); | |
251 priv->incoming_content_html = g_strdup(get_content_html(priv, dir)); | |
252 } | |
253 g_free(file); | |
254 | |
255 return priv->incoming_content_html; | |
256 } | |
257 | |
258 static const char * | |
259 get_incoming_next_content_html(PidginConvThemePrivate *priv, const char *dir) | |
260 { | |
261 char *file; | |
262 | |
263 if (priv->incoming_next_content_html) | |
264 return priv->incoming_next_content_html; | |
265 | |
266 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); | |
267 if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) { | |
268 priv->incoming_next_content_html = g_strdup(get_incoming_content_html(priv, dir)); | |
269 } | |
270 g_free(file); | |
271 | |
272 return priv->incoming_next_content_html; | |
273 } | |
274 | |
275 static const char * | |
276 get_incoming_context_html(PidginConvThemePrivate *priv, const char *dir) | |
277 { | |
278 char *file; | |
279 | |
280 if (priv->incoming_context_html) | |
281 return priv->incoming_context_html; | |
282 | |
283 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Context.html", NULL); | |
284 if (!g_file_get_contents(file, &priv->incoming_context_html, NULL, NULL)) { | |
285 purple_debug_info("webkit", "%s did not have a Incoming/Context.html\n", dir); | |
286 priv->incoming_context_html = g_strdup(get_incoming_content_html(priv, dir)); | |
287 } | |
288 g_free(file); | |
289 | |
290 return priv->incoming_context_html; | |
291 } | |
292 | |
293 static const char * | |
294 get_incoming_next_context_html(PidginConvThemePrivate *priv, const char *dir) | |
295 { | |
296 char *file; | |
297 | |
298 if (priv->incoming_next_context_html) | |
299 return priv->incoming_next_context_html; | |
300 | |
301 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContext.html", NULL); | |
302 if (!g_file_get_contents(file, &priv->incoming_next_context_html, NULL, NULL)) { | |
303 priv->incoming_next_context_html = g_strdup(get_incoming_context_html(priv, dir)); | |
304 } | |
305 g_free(file); | |
306 | |
307 return priv->incoming_next_context_html; | |
308 } | |
309 | |
310 static const char * | |
311 get_outgoing_content_html(PidginConvThemePrivate *priv, const char *dir) | |
312 { | |
313 char *file; | |
314 | |
315 if (priv->outgoing_content_html) | |
316 return priv->outgoing_content_html; | |
317 | |
318 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Content.html", NULL); | |
319 if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) { | |
320 priv->outgoing_content_html = g_strdup(get_incoming_content_html(priv, dir)); | |
321 } | |
322 g_free(file); | |
323 | |
324 return priv->outgoing_content_html; | |
325 } | |
326 | |
327 static const char * | |
328 get_outgoing_next_content_html(PidginConvThemePrivate *priv, const char *dir) | |
329 { | |
330 char *file; | |
331 | |
332 if (priv->outgoing_next_content_html) | |
333 return priv->outgoing_next_content_html; | |
334 | |
335 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); | |
336 if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) { | |
337 priv->outgoing_next_content_html = g_strdup(get_outgoing_content_html(priv, dir)); | |
338 } | |
339 | |
340 return priv->outgoing_next_content_html; | |
341 } | |
342 | |
343 static const char * | |
344 get_outgoing_context_html(PidginConvThemePrivate *priv, const char *dir) | |
345 { | |
346 char *file; | |
347 | |
348 if (priv->outgoing_context_html) | |
349 return priv->outgoing_context_html; | |
350 | |
351 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Context.html", NULL); | |
352 if (!g_file_get_contents(file, &priv->outgoing_context_html, NULL, NULL)) { | |
353 priv->outgoing_context_html = g_strdup(get_incoming_context_html(priv, dir)); | |
354 } | |
355 g_free(file); | |
356 | |
357 return priv->outgoing_context_html; | |
358 } | |
359 | |
360 static const char * | |
361 get_outgoing_next_context_html(PidginConvThemePrivate *priv, const char *dir) | |
362 { | |
363 char *file; | |
364 | |
365 if (priv->outgoing_next_context_html) | |
366 return priv->outgoing_next_context_html; | |
367 | |
368 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContext.html", NULL); | |
369 if (!g_file_get_contents(file, &priv->outgoing_next_context_html, NULL, NULL)) { | |
370 priv->outgoing_next_context_html = g_strdup(get_outgoing_context_html(priv, dir)); | |
371 } | |
372 | |
373 return priv->outgoing_next_context_html; | |
374 } | |
375 | |
376 static void | |
377 _set_variant(PidginConvTheme *theme, const char *variant) | |
378 { | |
379 PidginConvThemePrivate *priv; | |
380 const GValue *val; | |
381 char *prefname; | |
382 | |
383 g_return_if_fail(theme != NULL); | |
384 g_return_if_fail(variant != NULL); | |
385 | |
386 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); | |
387 | |
388 g_free(priv->variant); | |
389 priv->variant = g_strdup(variant); | |
390 | |
391 val = get_key(priv, "CFBundleIdentifier", FALSE); | |
392 prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant", | |
393 g_value_get_string(val)); | |
394 purple_prefs_set_string(prefname, variant); | |
395 g_free(prefname); | |
396 } | |
397 | |
398 /****************************************************************************** | |
91 * GObject Stuff | 399 * GObject Stuff |
92 *****************************************************************************/ | 400 *****************************************************************************/ |
93 | 401 |
94 static void | 402 static void |
95 pidgin_conv_theme_get_property(GObject *obj, guint param_id, GValue *value, | 403 pidgin_conv_theme_get_property(GObject *obj, guint param_id, GValue *value, |
223 "PidginConvTheme", &info, 0); | 531 "PidginConvTheme", &info, 0); |
224 } | 532 } |
225 return type; | 533 return type; |
226 } | 534 } |
227 | 535 |
228 /****************************************************************************** | |
229 * Helper Functions | |
230 *****************************************************************************/ | |
231 | |
232 static const GValue * | |
233 get_key(PidginConvThemePrivate *priv, const char *key, gboolean specific) | |
234 { | |
235 GValue *val = NULL; | |
236 | |
237 /* Try variant-specific key */ | |
238 if (specific && priv->variant) { | |
239 char *name = g_strdup_printf("%s:%s", key, priv->variant); | |
240 val = g_hash_table_lookup(priv->info, name); | |
241 g_free(name); | |
242 } | |
243 | |
244 /* Try generic key */ | |
245 if (!val) { | |
246 val = g_hash_table_lookup(priv->info, key); | |
247 } | |
248 | |
249 return val; | |
250 } | |
251 | |
252 static const char * | |
253 get_template_html(PidginConvThemePrivate *priv, const char *dir) | |
254 { | |
255 char *file; | |
256 | |
257 if (priv->template_html) | |
258 return priv->template_html; | |
259 | |
260 /* The template path can either come from the theme, or can | |
261 * be stock Template.html that comes with the plugin */ | |
262 file = g_build_filename(dir, "Contents", "Resources", "Template.html", NULL); | |
263 | |
264 if (!g_file_test(file, G_FILE_TEST_EXISTS)) { | |
265 g_free(file); | |
266 file = g_build_filename(DATADIR, "pidgin", "webkit", "Template.html", NULL); | |
267 } | |
268 | |
269 if (!g_file_get_contents(file, &priv->template_html, NULL, NULL)) { | |
270 purple_debug_error("webkit", "Could not locate a Template.html (%s)\n", file); | |
271 priv->template_html = g_strdup(""); | |
272 } | |
273 g_free(file); | |
274 | |
275 return priv->template_html; | |
276 } | |
277 | |
278 static const char * | |
279 get_basestyle_css(PidginConvThemePrivate *priv, const char *dir) | |
280 { | |
281 char *file; | |
282 | |
283 if (priv->basestyle_css) | |
284 return priv->basestyle_css; | |
285 | |
286 file = g_build_filename(dir, "Contents", "Resources", "main.css", NULL); | |
287 if (!g_file_get_contents(file, &priv->basestyle_css, NULL, NULL)) | |
288 priv->basestyle_css = g_strdup(""); | |
289 g_free(file); | |
290 | |
291 return priv->basestyle_css; | |
292 } | |
293 | |
294 static const char * | |
295 get_header_html(PidginConvThemePrivate *priv, const char *dir) | |
296 { | |
297 char *file; | |
298 | |
299 if (priv->header_html) | |
300 return priv->header_html; | |
301 | |
302 file = g_build_filename(dir, "Contents", "Resources", "Header.html", NULL); | |
303 if (!g_file_get_contents(file, &priv->header_html, NULL, NULL)) | |
304 priv->header_html = g_strdup(""); | |
305 g_free(file); | |
306 | |
307 return priv->header_html; | |
308 } | |
309 | |
310 static const char * | |
311 get_footer_html(PidginConvThemePrivate *priv, const char *dir) | |
312 { | |
313 char *file; | |
314 | |
315 if (priv->footer_html) | |
316 return priv->footer_html; | |
317 | |
318 file = g_build_filename(dir, "Contents", "Resources", "Footer.html", NULL); | |
319 if (!g_file_get_contents(file, &priv->footer_html, NULL, NULL)) | |
320 priv->footer_html = g_strdup(""); | |
321 g_free(file); | |
322 | |
323 return priv->footer_html; | |
324 } | |
325 | |
326 static const char * | |
327 get_topic_html(PidginConvThemePrivate *priv, const char *dir) | |
328 { | |
329 char *file; | |
330 | |
331 if (priv->topic_html) | |
332 return priv->topic_html; | |
333 | |
334 file = g_build_filename(dir, "Contents", "Resources", "Topic.html", NULL); | |
335 if (!g_file_get_contents(file, &priv->topic_html, NULL, NULL)) { | |
336 purple_debug_info("webkit", "%s could not find Resources/Topic.html\n", dir); | |
337 priv->topic_html = g_strdup(""); | |
338 } | |
339 g_free(file); | |
340 | |
341 return priv->topic_html; | |
342 } | |
343 | |
344 static const char * | |
345 get_content_html(PidginConvThemePrivate *priv, const char *dir) | |
346 { | |
347 char *file; | |
348 | |
349 if (priv->content_html) | |
350 return priv->content_html; | |
351 | |
352 file = g_build_filename(dir, "Contents", "Resources", "Content.html", NULL); | |
353 if (!g_file_get_contents(file, &priv->content_html, NULL, NULL)) { | |
354 purple_debug_info("webkit", "%s did not have a Content.html\n", dir); | |
355 priv->content_html = g_strdup(""); | |
356 } | |
357 g_free(file); | |
358 | |
359 return priv->content_html; | |
360 } | |
361 | |
362 static const char * | |
363 get_status_html(PidginConvThemePrivate *priv, const char *dir) | |
364 { | |
365 char *file; | |
366 | |
367 if (priv->status_html) | |
368 return priv->status_html; | |
369 | |
370 file = g_build_filename(dir, "Contents", "Resources", "Status.html", NULL); | |
371 if (!g_file_get_contents(file, &priv->status_html, NULL, NULL)) { | |
372 purple_debug_info("webkit", "%s could not find Resources/Status.html\n", dir); | |
373 priv->status_html = g_strdup(get_content_html(priv, dir)); | |
374 } | |
375 g_free(file); | |
376 | |
377 return priv->status_html; | |
378 } | |
379 | |
380 static const char * | |
381 get_incoming_content_html(PidginConvThemePrivate *priv, const char *dir) | |
382 { | |
383 char *file; | |
384 | |
385 if (priv->incoming_content_html) | |
386 return priv->incoming_content_html; | |
387 | |
388 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Content.html", NULL); | |
389 if (!g_file_get_contents(file, &priv->incoming_content_html, NULL, NULL)) { | |
390 purple_debug_info("webkit", "%s did not have a Incoming/Content.html\n", dir); | |
391 priv->incoming_content_html = g_strdup(get_content_html(priv, dir)); | |
392 } | |
393 g_free(file); | |
394 | |
395 return priv->incoming_content_html; | |
396 } | |
397 | |
398 static const char * | |
399 get_incoming_next_content_html(PidginConvThemePrivate *priv, const char *dir) | |
400 { | |
401 char *file; | |
402 | |
403 if (priv->incoming_next_content_html) | |
404 return priv->incoming_next_content_html; | |
405 | |
406 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContent.html", NULL); | |
407 if (!g_file_get_contents(file, &priv->incoming_next_content_html, NULL, NULL)) { | |
408 priv->incoming_next_content_html = g_strdup(get_incoming_content_html(priv, dir)); | |
409 } | |
410 g_free(file); | |
411 | |
412 return priv->incoming_next_content_html; | |
413 } | |
414 | |
415 static const char * | |
416 get_incoming_context_html(PidginConvThemePrivate *priv, const char *dir) | |
417 { | |
418 char *file; | |
419 | |
420 if (priv->incoming_context_html) | |
421 return priv->incoming_context_html; | |
422 | |
423 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "Context.html", NULL); | |
424 if (!g_file_get_contents(file, &priv->incoming_context_html, NULL, NULL)) { | |
425 purple_debug_info("webkit", "%s did not have a Incoming/Context.html\n", dir); | |
426 priv->incoming_context_html = g_strdup(get_incoming_content_html(priv, dir)); | |
427 } | |
428 g_free(file); | |
429 | |
430 return priv->incoming_context_html; | |
431 } | |
432 | |
433 static const char * | |
434 get_incoming_next_context_html(PidginConvThemePrivate *priv, const char *dir) | |
435 { | |
436 char *file; | |
437 | |
438 if (priv->incoming_next_context_html) | |
439 return priv->incoming_next_context_html; | |
440 | |
441 file = g_build_filename(dir, "Contents", "Resources", "Incoming", "NextContext.html", NULL); | |
442 if (!g_file_get_contents(file, &priv->incoming_next_context_html, NULL, NULL)) { | |
443 priv->incoming_next_context_html = g_strdup(get_incoming_context_html(priv, dir)); | |
444 } | |
445 g_free(file); | |
446 | |
447 return priv->incoming_next_context_html; | |
448 } | |
449 | |
450 static const char * | |
451 get_outgoing_content_html(PidginConvThemePrivate *priv, const char *dir) | |
452 { | |
453 char *file; | |
454 | |
455 if (priv->outgoing_content_html) | |
456 return priv->outgoing_content_html; | |
457 | |
458 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Content.html", NULL); | |
459 if (!g_file_get_contents(file, &priv->outgoing_content_html, NULL, NULL)) { | |
460 priv->outgoing_content_html = g_strdup(get_incoming_content_html(priv, dir)); | |
461 } | |
462 g_free(file); | |
463 | |
464 return priv->outgoing_content_html; | |
465 } | |
466 | |
467 static const char * | |
468 get_outgoing_next_content_html(PidginConvThemePrivate *priv, const char *dir) | |
469 { | |
470 char *file; | |
471 | |
472 if (priv->outgoing_next_content_html) | |
473 return priv->outgoing_next_content_html; | |
474 | |
475 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContent.html", NULL); | |
476 if (!g_file_get_contents(file, &priv->outgoing_next_content_html, NULL, NULL)) { | |
477 priv->outgoing_next_content_html = g_strdup(get_outgoing_content_html(priv, dir)); | |
478 } | |
479 | |
480 return priv->outgoing_next_content_html; | |
481 } | |
482 | |
483 static const char * | |
484 get_outgoing_context_html(PidginConvThemePrivate *priv, const char *dir) | |
485 { | |
486 char *file; | |
487 | |
488 if (priv->outgoing_context_html) | |
489 return priv->outgoing_context_html; | |
490 | |
491 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "Context.html", NULL); | |
492 if (!g_file_get_contents(file, &priv->outgoing_context_html, NULL, NULL)) { | |
493 priv->outgoing_context_html = g_strdup(get_incoming_context_html(priv, dir)); | |
494 } | |
495 g_free(file); | |
496 | |
497 return priv->outgoing_context_html; | |
498 } | |
499 | |
500 static const char * | |
501 get_outgoing_next_context_html(PidginConvThemePrivate *priv, const char *dir) | |
502 { | |
503 char *file; | |
504 | |
505 if (priv->outgoing_next_context_html) | |
506 return priv->outgoing_next_context_html; | |
507 | |
508 file = g_build_filename(dir, "Contents", "Resources", "Outgoing", "NextContext.html", NULL); | |
509 if (!g_file_get_contents(file, &priv->outgoing_next_context_html, NULL, NULL)) { | |
510 priv->outgoing_next_context_html = g_strdup(get_outgoing_context_html(priv, dir)); | |
511 } | |
512 | |
513 return priv->outgoing_next_context_html; | |
514 } | |
515 | |
516 static void | |
517 _set_variant(PidginConvTheme *theme, const char *variant) | |
518 { | |
519 PidginConvThemePrivate *priv; | |
520 const GValue *val; | |
521 char *prefname; | |
522 | |
523 g_return_if_fail(theme != NULL); | |
524 g_return_if_fail(variant != NULL); | |
525 | |
526 priv = PIDGIN_CONV_THEME_GET_PRIVATE(theme); | |
527 | |
528 g_free(priv->variant); | |
529 priv->variant = g_strdup(variant); | |
530 | |
531 val = get_key(priv, "CFBundleIdentifier", FALSE); | |
532 prefname = g_strdup_printf(PIDGIN_PREFS_ROOT "/conversations/themes/%s/variant", | |
533 g_value_get_string(val)); | |
534 purple_prefs_set_string(prefname, variant); | |
535 g_free(prefname); | |
536 } | |
537 | |
538 /***************************************************************************** | 536 /***************************************************************************** |
539 * Public API functions | 537 * Public API functions |
540 *****************************************************************************/ | 538 *****************************************************************************/ |
541 | 539 |
542 const GHashTable * | 540 const GHashTable * |