qulogic/pidgin

2a86ad923464
Parents 71633b02da75
Children 65e95df8daea
Add some convenience functions to get the contents of a GtkWebView.
--- a/pidgin/gtkwebview.c Mon Jun 04 16:10:42 2012 +0000
+++ b/pidgin/gtkwebview.c Sat Jun 02 19:01:44 2012 +0000
@@ -743,6 +743,48 @@
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)
{
--- a/pidgin/gtkwebview.h Mon Jun 04 16:10:42 2012 +0000
+++ b/pidgin/gtkwebview.h Sat Jun 02 19:01:44 2012 +0000
@@ -283,6 +283,34 @@
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