/pidgin/main: ab65d36fd975: Add a convenience function to activa...

Elliott Sales de Andrade qulogic at pidgin.im
Mon Aug 6 03:42:21 EDT 2012


Changeset: ab65d36fd9757d0e234097d6f8401a7f1af4c06e
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2012-08-06 00:16 -0400
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/ab65d36fd975

Description:

Add a convenience function to activate a WebKit anchor element.

diffstat:

 pidgin/gtkwebview.c |  12 ++++++++++++
 pidgin/gtkwebview.h |   9 +++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diffs (41 lines):

diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c
--- a/pidgin/gtkwebview.c
+++ b/pidgin/gtkwebview.c
@@ -995,6 +995,18 @@ gtk_webview_set_format_functions(GtkWebV
 	g_object_unref(object);
 }
 
+void
+gtk_webview_activate_anchor(WebKitDOMHTMLAnchorElement *link)
+{
+	WebKitDOMDocument *doc;
+	WebKitDOMEvent *event;
+
+	doc = webkit_dom_node_get_owner_document(WEBKIT_DOM_NODE(link));
+	event = webkit_dom_document_create_event(doc, "MouseEvent", NULL);
+	webkit_dom_event_init_event(event, "click", TRUE, TRUE);
+	webkit_dom_node_dispatch_event(WEBKIT_DOM_NODE(link), event, NULL);
+}
+
 gboolean
 gtk_webview_class_register_protocol(const char *name,
 	gboolean (*activate)(GtkWebView *webview, const char *uri),
diff --git a/pidgin/gtkwebview.h b/pidgin/gtkwebview.h
--- a/pidgin/gtkwebview.h
+++ b/pidgin/gtkwebview.h
@@ -220,6 +220,15 @@ void gtk_webview_set_format_functions(Gt
                                       GtkWebViewButtons buttons);
 
 /**
+ * Activates a WebKitDOMHTMLAnchorElement object. This triggers the navigation
+ * signals, and marks the link as visited (when possible).
+ *
+ * @param link   The WebKitDOMHTMLAnchorElement object
+ *
+ */
+void gtk_webview_activate_anchor(WebKitDOMHTMLAnchorElement *link);
+
+/**
  * Register a protocol with the GtkWebView widget. Registering a protocol would
  * allow certain text to be clickable.
  *



More information about the Commits mailing list