pidgin: 90f15c63: Update the variant in existing conversat...

qulogic at pidgin.im qulogic at pidgin.im
Sat Oct 8 03:50:48 EDT 2011


----------------------------------------------------------------------
Revision: 90f15c63f2388339abd6e198e7c547152d20a01a
Parent:   9c6cf403ea89eb7f104231f4b96c86c8dfcfff22
Author:   qulogic at pidgin.im
Date:     10/07/11 22:51:52
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/90f15c63f2388339abd6e198e7c547152d20a01a

Changelog: 

Update the variant in existing conversations when changed. Actually,
this doesn't really work since opening the prefs re-scans the themes
and creates new GObjects.

Changes against parent 9c6cf403ea89eb7f104231f4b96c86c8dfcfff22

  patched  pidgin/gtkconv.c

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	2c322847b757a588e843d7bef0e8e1b735e51436
+++ pidgin/gtkconv.c	a5dcff3e3b0ff84a4bcc28a561556cb7da4bdb99
@@ -5130,6 +5130,19 @@ set_theme_webkit_settings(WebKitWebView 
 		webkit_web_view_set_transparent(webview, g_value_get_boolean(val));
 }
 
+static void
+conv_variant_changed_cb(GObject *gobject, GParamSpec *pspec, gpointer user_data)
+{
+	PidginConversation *gtkconv = user_data;
+	const char *path;
+	char *js;
+
+	path = pidgin_conversation_theme_get_css_path(PIDGIN_CONV_THEME(gobject));
+	js = g_strdup_printf("setStylesheet(\"mainStyle\", \"file://%s\");", path);
+	gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), js);
+	g_free(js);
+}
+
 static GtkWidget *
 setup_common_pane(PidginConversation *gtkconv)
 {
@@ -5258,6 +5271,9 @@ setup_common_pane(PidginConversation *gt
 		if (chat)
 			gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), "document.getElementById('Chat').className = 'groupchat'");
 
+		g_signal_connect(G_OBJECT(gtkconv->theme), "notify::variant",
+		                 G_CALLBACK(conv_variant_changed_cb), gtkconv);
+
 		g_free(basedir);
 		g_free(baseuri);
 		g_free(template);
@@ -5805,6 +5821,8 @@ pidgin_conv_destroy(PurpleConversation *
 		g_source_remove(gtkconv->attach.timer);
 	}
 
+	g_object_disconnect(G_OBJECT(gtkconv->theme), "any_signal::notify",
+	                    conv_variant_changed_cb, gtkconv, NULL);
 	g_object_unref(gtkconv->theme);
 
 	g_free(gtkconv);


More information about the Commits mailing list