soc.2009.webkitmessageview: b049d3e6: Fixing back variants.

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


-----------------------------------------------------------------
Revision: b049d3e6cdc452dd5f422f6972caca2e45675008
Ancestor: e4e58d4b4143636dd7f7d688dca9378608e41afa
Author: tdrhq at soc.pidgin.im
Date: 2009-08-16T19:28:23
Branch: im.pidgin.soc.2009.webkitmessageview
URL: http://d.pidgin.im/viewmtn/revision/info/b049d3e6cdc452dd5f422f6972caca2e45675008

Modified files:
        pidgin/plugins/adiumthemes/message-style.c
        pidgin/plugins/adiumthemes/message-style.h
        pidgin/plugins/adiumthemes/webkit.c

ChangeLog: 

Fixing back variants.

-------------- next part --------------
============================================================
--- pidgin/plugins/adiumthemes/message-style.c	1962727925f8c2959aa2a476bf1f974843e54c9f
+++ pidgin/plugins/adiumthemes/message-style.c	9582aa34a87d6ebe5a39605045601d4d6ce6c97f
@@ -108,11 +108,12 @@ void
 }
 
 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 (PidginM
 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 @@ pidgin_message_style_load (const char* s
 		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_load (const char* s
 			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 @@ pidgin_message_style_set_variant (Pidgin
 	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. */
 }
============================================================
--- pidgin/plugins/adiumthemes/message-style.h	2cfd168626c813dd9c8ccf010f3a3db589f5da75
+++ pidgin/plugins/adiumthemes/message-style.h	4132245016bbddc113fd6c227f839b56ad08e6f9
@@ -49,6 +49,7 @@ PidginMessageStyle* pidgin_message_style
 
 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);
============================================================
--- pidgin/plugins/adiumthemes/webkit.c	562f58b02a6e31cf60a67668b4734eae11eb0271
+++ pidgin/plugins/adiumthemes/webkit.c	cc7aad4afd0e47f53b01cc3903a41e350b4dd0d3
@@ -333,7 +333,7 @@ init_theme_for_webkit (PurpleConversatio
 	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 @@ variant_changed (GtkWidget* combobox, gp
 	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) {


More information about the Commits mailing list