# HG changeset patch # User Elliott Sales de Andrade # Date 1318042312 0 # Node ID 512d781a5849ccef27665b4c266c408631164017 # Parent f28a09bfe22c172c6621f11af14e9032e2d800c2 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. diff -r f28a09bfe22c -r 512d781a5849 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Sat Oct 08 02:44:27 2011 +0000 +++ b/pidgin/gtkconv.c Sat Oct 08 02:51:52 2011 +0000 @@ -5130,6 +5130,19 @@ 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 @@ 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 @@ 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);