pidgin: 1b1f16fa: Apparently, there's an object signal for...

qulogic at pidgin.im qulogic at pidgin.im
Fri Jun 8 03:12:14 EDT 2012


----------------------------------------------------------------------
Revision: 1b1f16fa7a366753f87ab710ced6bcf4683a9480
Parent:   c99c88a4824d471cfd4058037dadd284ff310f2d
Author:   qulogic at pidgin.im
Date:     06/07/12 21:18:55
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1b1f16fa7a366753f87ab710ced6bcf4683a9480

Changelog: 

Apparently, there's an object signal for this.

Unfortunately, this signal is also called when we do programmatic
changes, which could be trouble.

Changes against parent c99c88a4824d471cfd4058037dadd284ff310f2d

  patched  pidgin/gtkwebview.c

-------------- next part --------------
============================================================
--- pidgin/gtkwebview.c	24de934b7497fbaad4a8cf96eb0d3030553a451d
+++ pidgin/gtkwebview.c	54bfd97b4396c27c944259fc1568776617763d94
@@ -414,7 +414,7 @@ static void
 }
 
 static void
-editable_input_cb(GObject *target, WebKitDOMEvent *event, GtkWebView *webview)
+editable_input_cb(GtkWebView *webview, gpointer data)
 {
 	GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
 	if (!priv->edit.block_changed)
@@ -704,19 +704,15 @@ gtk_webview_set_editable(GtkWebView *web
 void
 gtk_webview_set_editable(GtkWebView *webview, gboolean editable)
 {
-	WebKitDOMDocument *doc;
-
 	webkit_web_view_set_editable(WEBKIT_WEB_VIEW(webview), editable);
 
-	doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
 	if (editable) {
-		webkit_dom_event_target_add_event_listener(WEBKIT_DOM_EVENT_TARGET(doc),
-	    	                                       "input", G_CALLBACK(editable_input_cb),
-	    	                                       FALSE, webview);
+		g_signal_connect(G_OBJECT(webview), "user-changed-contents",
+		                 G_CALLBACK(editable_input_cb), NULL);
 	} else {
-		webkit_dom_event_target_remove_event_listener(WEBKIT_DOM_EVENT_TARGET(doc),
-		                                              "input", G_CALLBACK(editable_input_cb),
-		                                              FALSE);
+		g_signal_handlers_disconnect_by_func(G_OBJECT(webview),
+		                                     G_CALLBACK(editable_input_cb),
+		                                     NULL);
 	}
 }
 


More information about the Commits mailing list