Mercurial > pidgin.yaz
comparison pidgin/plugins/adiumthemes/webkit.c @ 32560:84f75556188f
some work... temporary towards the bigger picture.
author | tdrhq@soc.pidgin.im |
---|---|
date | Tue, 11 Aug 2009 23:54:39 +0000 |
parents | 64a3d266e6ff |
children | 9f6affeb2a92 |
comparison
equal
deleted
inserted
replaced
32559:64a3d266e6ff | 32560:84f75556188f |
---|---|
62 typedef struct _PidginMessageStyle { | 62 typedef struct _PidginMessageStyle { |
63 int ref_counter; | 63 int ref_counter; |
64 | 64 |
65 /* current config options */ | 65 /* current config options */ |
66 char *variant; | 66 char *variant; |
67 char *bg_color; | |
67 | 68 |
68 /* Info.plist keys */ | 69 /* Info.plist keys */ |
69 int message_view_version; | 70 int message_view_version; |
70 char *cf_bundle_name; | 71 char *cf_bundle_name; |
71 char *cf_bundle_identifier; | 72 char *cf_bundle_identifier; /* we're not using this */ |
72 char *cf_bundle_get_info_string; | 73 char *cf_bundle_get_info_string; |
73 char *default_font_family; | 74 char *default_font_family; |
74 int default_font_size; | 75 int default_font_size; |
75 gboolean shows_user_icons; | 76 gboolean shows_user_icons; |
76 gboolean disable_combine_consecutive; | 77 gboolean disable_combine_consecutive; |
196 { | 197 { |
197 xmlnode *val = key->next; | 198 xmlnode *val = key->next; |
198 | 199 |
199 for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next); | 200 for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next); |
200 if (!val) return FALSE; | 201 if (!val) return FALSE; |
201 | 202 |
202 if (expected == NULL || g_str_equal (expected, "string")) { | 203 if (expected == NULL || g_str_equal (expected, "string")) { |
203 char** dest = (char**) destination; | 204 char** dest = (char**) destination; |
204 if (!g_str_equal (val->name, BAD_CAST "string")) return FALSE; | 205 if (!g_str_equal (val->name, BAD_CAST "string")) return FALSE; |
205 if (*dest) g_free (*dest); | 206 if (*dest) g_free (*dest); |
206 *dest = xmlnode_get_data_unescaped (val); | 207 *dest = xmlnode_get_data_unescaped (val); |
227 if (!variant) return FALSE; | 228 if (!variant) return FALSE; |
228 return (g_str_has_prefix (found, key) | 229 return (g_str_has_prefix (found, key) |
229 && g_str_has_suffix (found, variant) | 230 && g_str_has_suffix (found, variant) |
230 && strlen (found) == strlen (key) + strlen (variant) + 1); | 231 && strlen (found) == strlen (key) + strlen (variant) + 1); |
231 } | 232 } |
233 | |
234 /** | |
235 * Info.plist should be re-read every time the variant changes, this is because | |
236 * the keys that take precedence depend on the value of the current variant. | |
237 */ | |
232 static void | 238 static void |
233 pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant) | 239 pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant) |
234 { | 240 { |
235 /* note that if a variant is used the option:VARIANTNAME takes precedence */ | 241 /* note that if a variant is used the option:VARIANTNAME takes precedence */ |
236 char *contents = g_build_filename (style->style_dir, "Contents", NULL); | 242 char *contents = g_build_filename (style->style_dir, "Contents", NULL); |
368 /* find some variant file (or load from user's settings) */ | 374 /* find some variant file (or load from user's settings) */ |
369 variant_set_default (style); | 375 variant_set_default (style); |
370 | 376 |
371 pidgin_message_style_read_info_plist (style, NULL); | 377 pidgin_message_style_read_info_plist (style, NULL); |
372 | 378 |
373 /* let's see if we did this well */ | 379 /* non variant dependent Info.plist checks */ |
374 printf ("bundle name: %s\n", style->cf_bundle_name); | 380 if (style->message_view_version < 3) { |
381 pidgin_message_style_unref (style); | |
382 return NULL; | |
383 } | |
384 | |
375 return style; | 385 return style; |
376 } | 386 } |
377 | 387 |
388 static void | |
389 pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant) | |
390 { | |
391 /* I'm not going to test whether this variant is valid! */ | |
392 g_free (style->variant); | |
393 style->variant = g_strdup (variant); | |
394 | |
395 pidgin_message_style_read_info_plist (style, variant); | |
396 } | |
378 | 397 |
379 static void* webkit_plugin_get_handle () | 398 static void* webkit_plugin_get_handle () |
380 { | 399 { |
381 if (handle) return handle; | 400 if (handle) return handle; |
382 else return (handle = g_malloc (1)); | 401 else return (handle = g_malloc (1)); |