soc.2009.webkitmessageview: a72d5126: some work... temporary towards the bigge...

tdrhq at soc.pidgin.im tdrhq at soc.pidgin.im
Tue Aug 25 12:03:51 EDT 2009


-----------------------------------------------------------------
Revision: a72d5126518f21997dc1b5efa412337d028730af
Ancestor: 4c1d88c147ced10c561f5535099338b02b4c4ec9
Author: tdrhq at soc.pidgin.im
Date: 2009-08-11T23:54:39
Branch: im.pidgin.soc.2009.webkitmessageview
URL: http://d.pidgin.im/viewmtn/revision/info/a72d5126518f21997dc1b5efa412337d028730af

Modified files:
        pidgin/plugins/adiumthemes/webkit.c

ChangeLog: 

some work... temporary towards the bigger picture.

-------------- next part --------------
============================================================
--- pidgin/plugins/adiumthemes/webkit.c	bc13869c0dd2e0a307d4ec36230b96b8e10bd513
+++ pidgin/plugins/adiumthemes/webkit.c	11d8c4bae9681efb8769c57c8bf258b9f9b90149
@@ -64,11 +64,12 @@ typedef struct _PidginMessageStyle {
 
 	/* 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 @@ parse_info_plist_key_value (xmlnode* key
 
 	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 @@ gboolean str_for_key (const char *key, c
 		&& 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,12 +376,25 @@ pidgin_message_style_load (const char* s
 
 	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 ()
 {
 	if (handle) return handle;


More information about the Commits mailing list