Don't emit the changed signal when modifying the webview ourselves.

Sun, 03 Jun 2012 20:03:35 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sun, 03 Jun 2012 20:03:35 +0000
changeset 33010
aa658ddce5ec
parent 33009
364b314b125a
child 33011
861a290f5464

Don't emit the changed signal when modifying the webview ourselves.

pidgin/gtkwebview.c file | annotate | diff | comparison | revisions
--- a/pidgin/gtkwebview.c	Sun Jun 03 20:01:56 2012 +0000
+++ b/pidgin/gtkwebview.c	Sun Jun 03 20:03:35 2012 +0000
@@ -69,6 +69,7 @@
 	GtkWebViewButtons format_functions;
 	struct {
 		gboolean wbfo:1;	/* Whole buffer formatting only. */
+		gboolean block_changed:1;
 	} edit;
 
 } GtkWebViewPriv;
@@ -319,7 +320,9 @@
 		webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview));
 	}
 
+	priv->edit.block_changed = TRUE;
 	webkit_dom_document_exec_command(dom, name, FALSE, value);
+	priv->edit.block_changed = FALSE;
 
 	if (priv->edit.wbfo) {
 		sel = webkit_dom_dom_window_get_selection(win);
@@ -371,7 +374,9 @@
 static void
 editable_input_cb(GObject *target, WebKitDOMEvent *event, GtkWebView *webview)
 {
-	g_signal_emit(webview, signals[CHANGED], 0);
+	GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
+	if (!priv->edit.block_changed)
+		g_signal_emit(webview, signals[CHANGED], 0);
 }
 
 /******************************************************************************

mercurial