/pidgin/main: 9f3f19ab8342: Rewrite debug window clearing in JS.

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


Changeset: 9f3f19ab8342bf79512e0ae7eca1921d86773b70
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2013-05-04 22:32 -0400
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/9f3f19ab8342

Description:

Rewrite debug window clearing in JS.

diffstat:

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

diffs (38 lines):

diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c
--- a/pidgin/gtkdebug.c
+++ b/pidgin/gtkdebug.c
@@ -91,7 +91,10 @@ typedef struct
 		"document.body.appendChild(div);" \
 		"alert('appended');" \
 	"}" \
-	"</script></head><body class=l%d></body></html>"
+	"function clear() {" \
+		"document.body.innerHTML = '';" \
+	"}" \
+	"</script></head><body class=l0></body></html>"
 
 static DebugWindow *debug_win = NULL;
 static guint debug_enabled_timer = 0;
@@ -166,13 +169,7 @@ save_cb(GtkWidget *w, DebugWindow *win)
 static void
 clear_cb(GtkWidget *w, DebugWindow *win)
 {
-	char *tmp;
-	int level;
-
-	level = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel");
-	tmp = g_strdup_printf(EMPTY_HTML, level);
-	gtk_webview_load_html_string(GTK_WEBVIEW(win->text), tmp);
-	g_free(tmp);
+	gtk_webview_safe_execute_script(GTK_WEBVIEW(win->text), "clear();");
 }
 
 static void
@@ -849,6 +846,7 @@ debug_window_new(void)
 	gtk_webview_set_format_functions(GTK_WEBVIEW(win->text),
 	                                 GTK_WEBVIEW_ALL ^ GTK_WEBVIEW_SMILEY ^ GTK_WEBVIEW_IMAGE);
 	gtk_webview_set_autoscroll(GTK_WEBVIEW(win->text), TRUE);
+	gtk_webview_load_html_string(GTK_WEBVIEW(win->text), EMPTY_HTML);
 	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
 	gtk_widget_show(frame);
 



More information about the Commits mailing list