pidgin/gtkdebug.c

changeset 33920
6a4eaacdd207
parent 33919
9f3f19ab8342
child 33921
d1e2fdbc3d56
equal deleted inserted replaced
33919:9f3f19ab8342 33920:6a4eaacdd207
92 "alert('appended');" \ 92 "alert('appended');" \
93 "}" \ 93 "}" \
94 "function clear() {" \ 94 "function clear() {" \
95 "document.body.innerHTML = '';" \ 95 "document.body.innerHTML = '';" \
96 "}" \ 96 "}" \
97 "function pauseOutput() {" \
98 "document.body.insertAdjacentHTML('beforeEnd', '<div id=pause></div>');" \
99 "}" \
100 "function resumeOutput() {" \
101 "var pause = document.getElementById('pause');" \
102 "if (pause) {" \
103 "var parent = pause.parentNode;" \
104 "parent.removeChild(pause);" \
105 "}" \
106 "}" \
97 "</script></head><body class=l0></body></html>" 107 "</script></head><body class=l0></body></html>"
98 108
99 static DebugWindow *debug_win = NULL; 109 static DebugWindow *debug_win = NULL;
100 static guint debug_enabled_timer = 0; 110 static guint debug_enabled_timer = 0;
101 111
175 static void 185 static void
176 pause_cb(GtkWidget *w, DebugWindow *win) 186 pause_cb(GtkWidget *w, DebugWindow *win)
177 { 187 {
178 win->paused = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(w)); 188 win->paused = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(w));
179 189
180 if (win->paused) { 190 if (win->paused)
181 gtk_webview_append_html(GTK_WEBVIEW(win->text), "<div id=pause></div>"); 191 gtk_webview_safe_execute_script(GTK_WEBVIEW(win->text), "pauseOutput();");
182 } else { 192 else
183 WebKitDOMDocument *dom; 193 gtk_webview_safe_execute_script(GTK_WEBVIEW(win->text), "resumeOutput();");
184 WebKitDOMElement *pause;
185
186 dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(win->text));
187 pause = webkit_dom_document_get_element_by_id(dom, "pause");
188 if (pause) {
189 WebKitDOMNode *parent;
190 parent = webkit_dom_node_get_parent_node(WEBKIT_DOM_NODE(pause));
191 webkit_dom_node_remove_child(parent, WEBKIT_DOM_NODE(pause), NULL);
192 }
193 }
194 } 194 }
195 195
196 /****************************************************************************** 196 /******************************************************************************
197 * regex stuff 197 * regex stuff
198 *****************************************************************************/ 198 *****************************************************************************/

mercurial