/pidgin/main: d1e2fdbc3d56: Rewrite debug window filtering in JS.

Elliott Sales de Andrade qulogic at pidgin.im
Thu May 9 02:56:35 EDT 2013


Changeset: d1e2fdbc3d56c1621fe2ced4bd839f84d70555d1
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2013-05-04 23:21 -0400
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/d1e2fdbc3d56

Description:

Rewrite debug window filtering in JS.

diffstat:

 pidgin/gtkdebug.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (34 lines):

diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c
--- a/pidgin/gtkdebug.c
+++ b/pidgin/gtkdebug.c
@@ -104,6 +104,9 @@ typedef struct
 			"parent.removeChild(pause);" \
 		"}" \
 	"}" \
+	"function setFilterLevel(l) {" \
+		"document.body.className = 'l'+l;" \
+	"}" \
 	"</script></head><body class=l0></body></html>"
 
 static DebugWindow *debug_win = NULL;
@@ -584,18 +587,14 @@ static void
 filter_level_pref_changed(const char *name, PurplePrefType type, gconstpointer value, gpointer data)
 {
 	DebugWindow *win = data;
-	WebKitDOMDocument *dom;
-	WebKitDOMHTMLElement *body;
 	int level = GPOINTER_TO_INT(value);
 	char *tmp;
 
 	if (level != gtk_combo_box_get_active(GTK_COMBO_BOX(win->filterlevel)))
 		gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), level);
 
-	dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(win->text));
-	body = webkit_dom_document_get_body(dom);
-	tmp = g_strdup_printf("l%d", level);
-	webkit_dom_html_element_set_class_name(body, tmp);
+	tmp = g_strdup_printf("setFilterLevel('%d');", level);
+	gtk_webview_safe_execute_script(GTK_WEBVIEW(win->text), tmp);
 	g_free(tmp);
 }
 



More information about the Commits mailing list