Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 32729:512d781a5849
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.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 08 Oct 2011 02:51:52 +0000 |
parents | 10e5000326a5 |
children | 29f1a6b07b9b |
comparison
equal
deleted
inserted
replaced
32728:f28a09bfe22c | 32729:512d781a5849 |
---|---|
5128 if (val && G_VALUE_HOLDS_BOOLEAN(val)) | 5128 if (val && G_VALUE_HOLDS_BOOLEAN(val)) |
5129 /* this does not work :( */ | 5129 /* this does not work :( */ |
5130 webkit_web_view_set_transparent(webview, g_value_get_boolean(val)); | 5130 webkit_web_view_set_transparent(webview, g_value_get_boolean(val)); |
5131 } | 5131 } |
5132 | 5132 |
5133 static void | |
5134 conv_variant_changed_cb(GObject *gobject, GParamSpec *pspec, gpointer user_data) | |
5135 { | |
5136 PidginConversation *gtkconv = user_data; | |
5137 const char *path; | |
5138 char *js; | |
5139 | |
5140 path = pidgin_conversation_theme_get_css_path(PIDGIN_CONV_THEME(gobject)); | |
5141 js = g_strdup_printf("setStylesheet(\"mainStyle\", \"file://%s\");", path); | |
5142 gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), js); | |
5143 g_free(js); | |
5144 } | |
5145 | |
5133 static GtkWidget * | 5146 static GtkWidget * |
5134 setup_common_pane(PidginConversation *gtkconv) | 5147 setup_common_pane(PidginConversation *gtkconv) |
5135 { | 5148 { |
5136 GtkWidget *vbox, *frame, *webview_sw, *event_box; | 5149 GtkWidget *vbox, *frame, *webview_sw, *event_box; |
5137 GtkCellRenderer *rend; | 5150 GtkCellRenderer *rend; |
5255 baseuri = g_strdup_printf("file://%s", basedir); | 5268 baseuri = g_strdup_printf("file://%s", basedir); |
5256 webkit_web_view_load_string(WEBKIT_WEB_VIEW(gtkconv->webview), template, "text/html", "UTF-8", baseuri); | 5269 webkit_web_view_load_string(WEBKIT_WEB_VIEW(gtkconv->webview), template, "text/html", "UTF-8", baseuri); |
5257 | 5270 |
5258 if (chat) | 5271 if (chat) |
5259 gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), "document.getElementById('Chat').className = 'groupchat'"); | 5272 gtk_webview_safe_execute_script(GTK_WEBVIEW(gtkconv->webview), "document.getElementById('Chat').className = 'groupchat'"); |
5273 | |
5274 g_signal_connect(G_OBJECT(gtkconv->theme), "notify::variant", | |
5275 G_CALLBACK(conv_variant_changed_cb), gtkconv); | |
5260 | 5276 |
5261 g_free(basedir); | 5277 g_free(basedir); |
5262 g_free(baseuri); | 5278 g_free(baseuri); |
5263 g_free(template); | 5279 g_free(template); |
5264 } | 5280 } |
5803 | 5819 |
5804 if (gtkconv->attach.timer) { | 5820 if (gtkconv->attach.timer) { |
5805 g_source_remove(gtkconv->attach.timer); | 5821 g_source_remove(gtkconv->attach.timer); |
5806 } | 5822 } |
5807 | 5823 |
5824 g_object_disconnect(G_OBJECT(gtkconv->theme), "any_signal::notify", | |
5825 conv_variant_changed_cb, gtkconv, NULL); | |
5808 g_object_unref(gtkconv->theme); | 5826 g_object_unref(gtkconv->theme); |
5809 | 5827 |
5810 g_free(gtkconv); | 5828 g_free(gtkconv); |
5811 } | 5829 } |
5812 | 5830 |