changeset 32108:79f5a5e75152

Fixing back variants.
author tdrhq@soc.pidgin.im
date Sun, 16 Aug 2009 19:28:23 +0000
parents 5281f3b3ef4c
children 1cebf9aa291a
files pidgin/plugins/adiumthemes/message-style.c pidgin/plugins/adiumthemes/message-style.h pidgin/plugins/adiumthemes/webkit.c
diffstat 3 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/adiumthemes/message-style.c	Sun Aug 16 07:01:11 2009 +0000
+++ b/pidgin/plugins/adiumthemes/message-style.c	Sun Aug 16 19:28:23 2009 +0000
@@ -108,11 +108,12 @@
 }
 
 void
-pidgin_message_style_save_state (PidginMessageStyle *style)
+pidgin_message_style_save_state (const PidginMessageStyle *style)
 {
 	char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier);
-	char *variant = g_strdup_printf ("%s/%s", prefname, style->variant);
+	char *variant = g_strdup_printf ("%s/variant", prefname);
 
+	purple_debug_info ("webkit", "saving state with variant %s\n", style->variant);
 	purple_prefs_add_none (prefname);
 	purple_prefs_add_string (variant, "");
 	purple_prefs_set_string (variant, style->variant);
@@ -125,7 +126,7 @@
 pidgin_message_style_load_state (PidginMessageStyle *style)
 {
 	char *prefname = g_strdup_printf ("/plugins/gtk/adiumthemes/%s", style->cf_bundle_identifier);
-	char *variant = g_strdup_printf ("%s/%s", prefname, style->variant);
+	char *variant = g_strdup_printf ("%s/variant", prefname);
 
 	const char* value = purple_prefs_get_string (variant);
 	gboolean changed = !style->variant || !g_str_equal (style->variant, value);
@@ -322,8 +323,8 @@
 		style->outgoing_next_content_html = g_strdup (style->outgoing_content_html);
 	}
 
+	pidgin_message_style_read_info_plist (style, NULL);
 	pidgin_message_style_load_state (style);
-	pidgin_message_style_read_info_plist (style, style->variant);
 
 	/* non variant dependent Info.plist checks */
 	if (style->message_view_version < 3) {
@@ -339,7 +340,6 @@
 			pidgin_message_style_set_variant (style, variants->data);
 
 		glist_free_all_string (variants);
-		pidgin_message_style_save_state (style);
 	}
 
 	return style;
@@ -388,7 +388,6 @@
 	style->variant = g_strdup (variant);
 
 	pidgin_message_style_read_info_plist (style, variant);
-	pidgin_message_style_save_state (style);
 	
 	/* todo, the style has "changed". Ideally, I would like to use signals at this point. */
 }
--- a/pidgin/plugins/adiumthemes/message-style.h	Sun Aug 16 07:01:11 2009 +0000
+++ b/pidgin/plugins/adiumthemes/message-style.h	Sun Aug 16 19:28:23 2009 +0000
@@ -49,6 +49,7 @@
 
 PidginMessageStyle* pidgin_message_style_load (const char* styledir);
 PidginMessageStyle* pidgin_message_style_copy (const PidginMessageStyle *style);
+void pidgin_message_style_save_state (const PidginMessageStyle *style);
 void pidgin_message_style_unref (PidginMessageStyle *style);
 void pidgin_message_style_read_info_plist (PidginMessageStyle *style, const char* variant);
 char* pidgin_message_style_get_variant (PidginMessageStyle *style);
--- a/pidgin/plugins/adiumthemes/webkit.c	Sun Aug 16 07:01:11 2009 +0000
+++ b/pidgin/plugins/adiumthemes/webkit.c	Sun Aug 16 19:28:23 2009 +0000
@@ -333,7 +333,7 @@
 	PidginMessageStyle *style, *oldStyle;
 	oldStyle = g_object_get_data (G_OBJECT(webkit), MESSAGE_STYLE_KEY);
 	
-	g_return_if_fail (!oldStyle);
+	if (oldStyle) return;
 
 	purple_debug_info ("webkit", "loading %s\n", style_dir);
 	style = pidgin_message_style_load (style_dir);
@@ -703,7 +703,8 @@
 	g_assert (style);
 	name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combobox));
 	pidgin_message_style_set_variant (style, name);
-
+	pidgin_message_style_save_state (style);
+	
 	/* update conversations */
 	list = purple_get_conversations ();
 	while (list) {