pidgin/gtkwebview.c

changeset 33221
0215244831ec
parent 33197
151a6a5a0521
child 33222
868965128ec8
equal deleted inserted replaced
33213:2852fbde4722 33221:0215244831ec
53 /****************************************************************************** 53 /******************************************************************************
54 * Structs 54 * Structs
55 *****************************************************************************/ 55 *****************************************************************************/
56 56
57 typedef struct _GtkWebViewPriv { 57 typedef struct _GtkWebViewPriv {
58 gboolean empty; /**< whether anything has been appended **/
59
60 /* Processing queues */ 58 /* Processing queues */
61 GQueue *html_queue; 59 GQueue *html_queue;
62 GQueue *js_queue; 60 GQueue *js_queue;
63 gboolean is_loading; 61 gboolean is_loading;
64 62
160 html = g_queue_pop_head(priv->html_queue); 158 html = g_queue_pop_head(priv->html_queue);
161 doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); 159 doc = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
162 body = webkit_dom_document_get_body(doc); 160 body = webkit_dom_document_get_body(doc);
163 webkit_dom_html_element_insert_adjacent_html(body, "beforeend", html, NULL); 161 webkit_dom_html_element_insert_adjacent_html(body, "beforeend", html, NULL);
164 g_free(html); 162 g_free(html);
165 priv->empty = FALSE;
166 163
167 return TRUE; 164 return TRUE;
168 } 165 }
169 166
170 static void 167 static void
487 static void 484 static void
488 gtk_webview_init(GtkWebView *webview, gpointer userdata) 485 gtk_webview_init(GtkWebView *webview, gpointer userdata)
489 { 486 {
490 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); 487 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
491 488
492 priv->empty = TRUE;
493 priv->html_queue = g_queue_new(); 489 priv->html_queue = g_queue_new();
494 priv->js_queue = g_queue_new(); 490 priv->js_queue = g_queue_new();
495 491
496 g_signal_connect(webview, "navigation-policy-decision-requested", 492 g_signal_connect(webview, "navigation-policy-decision-requested",
497 G_CALLBACK(webview_link_clicked), NULL); 493 G_CALLBACK(webview_link_clicked), NULL);
531 527
532 /***************************************************************************** 528 /*****************************************************************************
533 * Public API functions 529 * Public API functions
534 *****************************************************************************/ 530 *****************************************************************************/
535 531
536 gboolean
537 gtk_webview_is_empty(GtkWebView *webview)
538 {
539 GtkWebViewPriv *priv;
540
541 g_return_val_if_fail(webview != NULL, TRUE);
542
543 priv = GTK_WEBVIEW_GET_PRIVATE(webview);
544 return priv->empty;
545 }
546
547 char * 532 char *
548 gtk_webview_quote_js_string(const char *text) 533 gtk_webview_quote_js_string(const char *text)
549 { 534 {
550 GString *str = g_string_new("\""); 535 GString *str = g_string_new("\"");
551 const char *cur = text; 536 const char *cur = text;

mercurial