changeset 32099: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
files pidgin/plugins/adiumthemes/webkit.c
diffstat 1 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/adiumthemes/webkit.c	Tue Aug 11 23:25:16 2009 +0000
+++ b/pidgin/plugins/adiumthemes/webkit.c	Tue Aug 11 23:54:39 2009 +0000
@@ -64,11 +64,12 @@
 
 	/* current config options */
 	char     *variant;
+	char     *bg_color;
 
 	/* Info.plist keys */
 	int      message_view_version;
 	char     *cf_bundle_name;
-	char     *cf_bundle_identifier;
+	char     *cf_bundle_identifier; /* we're not using this */
 	char     *cf_bundle_get_info_string;
 	char     *default_font_family;
 	int      default_font_size;
@@ -198,7 +199,7 @@
 
 	for (; val && val->type != XMLNODE_TYPE_TAG; val = val->next);
 	if (!val) return FALSE;
-
+	
 	if (expected == NULL || g_str_equal (expected, "string")) {
 		char** dest = (char**) destination;
 		if (!g_str_equal (val->name, BAD_CAST "string")) return FALSE;
@@ -229,6 +230,11 @@
 		&& g_str_has_suffix (found, variant)
 		&& strlen (found) == strlen (key) + strlen (variant) + 1);
 }
+
+/**
+ * Info.plist should be re-read every time the variant changes, this is because
+ * the keys that take precedence depend on the value of the current variant.
+ */
 static void
 pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant)
 {
@@ -370,11 +376,24 @@
 
 	pidgin_message_style_read_info_plist (style, NULL);
 
-	/* let's see if we did this well */
-	printf ("bundle name: %s\n", style->cf_bundle_name);
+	/* non variant dependent Info.plist checks */
+	if (style->message_view_version < 3) {
+		pidgin_message_style_unref (style);
+		return NULL;
+	}
+
 	return style;
 }
 
+static void
+pidgin_message_style_set_variant (PidginMessageStyle *style, const char *variant)
+{
+	/* I'm not going to test whether this variant is valid! */
+	g_free (style->variant);
+	style->variant = g_strdup (variant);
+
+	pidgin_message_style_read_info_plist (style, variant);
+}
 
 static void* webkit_plugin_get_handle ()
 {