changeset 32110:5c53eabcea93

Adds the 'groupchat' classname to #Chat when using groupchat. This should be the only requirement for Adium 1.3.x.
author tdrhq@soc.pidgin.im
date Wed, 19 Aug 2009 05:04:01 +0000
parents 1cebf9aa291a
children 3443ed867ce3
files pidgin/plugins/adiumthemes/webkit.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/adiumthemes/webkit.c	Wed Aug 19 02:43:17 2009 +0000
+++ b/pidgin/plugins/adiumthemes/webkit.c	Wed Aug 19 05:04:01 2009 +0000
@@ -309,6 +309,20 @@
 	webkit_web_view_set_transparent (webview, style->default_background_is_transparent);
 }
 
+/*
+ * The style specification says that if the conversation is a group
+ * chat then the <div id="Chat"> element will be given a class 
+ * 'groupchat'. I can't add another '%@' in Template.html because 
+ * that breaks style-specific Template.html's. I have to either use libxml
+ * or conveniently play with WebKit's javascript engine. The javascript
+ * engine should work, but it's not an identical behavior.
+ */
+static void
+webkit_set_groupchat (GtkWebView *webview)
+{
+	gtk_webview_safe_execute_script (webview, "document.getElementById('Chat').className = 'groupchat'");
+}
+
 
 /**
  * Called when either a new PurpleConversation is created
@@ -361,6 +375,8 @@
 	/* I need to unref this style when the webkit object destroys */
 	g_signal_connect (G_OBJECT(webkit), "destroy", G_CALLBACK(webkit_on_webview_destroy), copy);
 
+	if (purple_conversation_get_type (conv) == PURPLE_CONV_TYPE_CHAT)
+		webkit_set_groupchat (GTK_WEBVIEW (webkit));
 	g_free (basedir);
 	g_free (baseuri);
 	g_free (header);