pidgin: a1328bde: Add some convenience functions to get th...

qulogic at pidgin.im qulogic at pidgin.im
Mon Jun 4 04:25:54 EDT 2012


----------------------------------------------------------------------
Revision: a1328bdeb01ec697c6d125f8a089de977d07a2de
Parent:   e115a6b0a00b19e911711d227add3511559c2754
Author:   qulogic at pidgin.im
Date:     06/02/12 15:01:44
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/a1328bdeb01ec697c6d125f8a089de977d07a2de

Changelog: 

Add some convenience functions to get the contents of a GtkWebView.

Changes against parent e115a6b0a00b19e911711d227add3511559c2754

  patched  pidgin/gtkwebview.c
  patched  pidgin/gtkwebview.h

-------------- next part --------------
============================================================
--- pidgin/gtkwebview.c	1dd5c39e0271a012fd807ba82ce739048b59385d
+++ pidgin/gtkwebview.c	31b13c0d659cab9d3e2f93cd155df4bdf371c510
@@ -743,6 +743,48 @@ gtk_webview_set_format_functions(GtkWebV
 	g_object_unref(object);
 }
 
+gchar *
+gtk_webview_get_head_html(GtkWebView *webview)
+{
+	WebKitDOMDocument *doc;
+	WebKitDOMHTMLHeadElement *head;
+	gchar *html;
+
+	doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
+	head = webkit_dom_document_get_head(doc);
+	html = webkit_dom_html_element_get_inner_html(WEBKIT_DOM_HTML_ELEMENT(head));
+
+	return html;
+}
+
+gchar *
+gtk_webview_get_body_html(GtkWebView *webview)
+{
+	WebKitDOMDocument *doc;
+	WebKitDOMHTMLElement *body;
+	gchar *html;
+
+	doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
+	body = webkit_dom_document_get_body(doc);
+	html = webkit_dom_html_element_get_inner_html(body);
+
+	return html;
+}
+
+gchar *
+gtk_webview_get_body_text(GtkWebView *webview)
+{
+	WebKitDOMDocument *doc;
+	WebKitDOMHTMLElement *body;
+	gchar *text;
+
+	doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
+	body = webkit_dom_document_get_body(doc);
+	text = webkit_dom_html_element_get_inner_text(body);
+
+	return text;
+}
+
 GtkWebViewButtons
 gtk_webview_get_format_functions(GtkWebView *webview)
 {
============================================================
--- pidgin/gtkwebview.h	6bb63249a6b732e32d65db66928dca4808e811ea
+++ pidgin/gtkwebview.h	1f05634edfb3596dfa86f7aa6546594bae69bb76
@@ -283,6 +283,34 @@ gboolean gtk_webview_get_editable(GtkWeb
 gboolean gtk_webview_get_editable(GtkWebView *webview);
 
 /**
+ * Gets the content of the head element of a GtkWebView as HTML.
+ *
+ * @param webview The GtkWebView
+ *
+ * @return The HTML from the head element.
+ */
+gchar *gtk_webview_get_head_html(GtkWebView *webview);
+
+/**
+ * Gets the HTML content of a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ *
+ * @return The HTML that is currently displayed.
+ */
+gchar *gtk_webview_get_body_html(GtkWebView *webview);
+
+/**
+ * Gets the text content of a GtkWebView.
+ *
+ * @param webview The GtkWebView
+ *
+ * @return The HTML-free text that is currently displayed.
+ */
+gchar *gtk_webview_get_body_text(GtkWebView *webview);
+gchar *gtk_webview_get_head_text(GtkWebView *webview);
+
+/**
  * Clear all the formatting on a GtkWebView.
  *
  * @param webview The GtkWebView


More information about the Commits mailing list