soc.2009.webkitmessageview: d4f6fb83: Adds the 'groupchat' classname to #Chat ...

tdrhq at soc.pidgin.im tdrhq at soc.pidgin.im
Tue Aug 25 12:05:32 EDT 2009


-----------------------------------------------------------------
Revision: d4f6fb837f984907c2d37941d93af9fd51aa0477
Ancestor: 465414369d1f2d85dd66379e3fa6e9fe267a024f
Author: tdrhq at soc.pidgin.im
Date: 2009-08-19T05:04:01
Branch: im.pidgin.soc.2009.webkitmessageview
URL: http://d.pidgin.im/viewmtn/revision/info/d4f6fb837f984907c2d37941d93af9fd51aa0477

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

ChangeLog: 

Adds the 'groupchat' classname to #Chat when using groupchat. 

This should be the only requirement for Adium 1.3.x.

-------------- next part --------------
============================================================
--- pidgin/plugins/adiumthemes/webkit.c	cc7aad4afd0e47f53b01cc3903a41e350b4dd0d3
+++ pidgin/plugins/adiumthemes/webkit.c	5c04da3f452580866d8ad343b112999010602bde
@@ -309,7 +309,21 @@ static void set_theme_webkit_settings (W
 	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
  * or when a PidginConversation changes its active PurpleConversation
@@ -361,6 +375,8 @@ init_theme_for_webkit (PurpleConversatio
 	/* 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);


More information about the Commits mailing list