| 33 #include "gtkwebview.h" |
33 #include "gtkwebview.h" |
| 34 #include "gtkwebviewtoolbar.h" |
34 #include "gtkwebviewtoolbar.h" |
| 35 |
35 |
| 36 #include "gtkinternal.h" |
36 #include "gtkinternal.h" |
| 37 #include "gtk3compat.h" |
37 #include "gtk3compat.h" |
| |
38 |
| |
39 #include "imgstore.h" /* TODO: temp */ |
| 38 |
40 |
| 39 #define MAX_FONT_SIZE 7 |
41 #define MAX_FONT_SIZE 7 |
| 40 #define MAX_SCROLL_TIME 0.4 /* seconds */ |
42 #define MAX_SCROLL_TIME 0.4 /* seconds */ |
| 41 #define SCROLL_DELAY 33 /* milliseconds */ |
43 #define SCROLL_DELAY 33 /* milliseconds */ |
| 42 #define PIDGIN_WEBVIEW_MAX_PROCESS_TIME 100000 /* microseconds */ |
44 #define PIDGIN_WEBVIEW_MAX_PROCESS_TIME 100000 /* microseconds */ |
| 2053 priv->edit.block_changed = FALSE; |
2055 priv->edit.block_changed = FALSE; |
| 2054 g_free(link); |
2056 g_free(link); |
| 2055 } |
2057 } |
| 2056 |
2058 |
| 2057 void |
2059 void |
| 2058 pidgin_webview_insert_image(PidginWebView *webview, int id) |
2060 pidgin_webview_insert_image(PidginWebView *webview, PurpleImage *image) |
| 2059 { |
2061 { |
| 2060 PidginWebViewPriv *priv; |
2062 PidginWebViewPriv *priv; |
| 2061 WebKitDOMDocument *dom; |
2063 WebKitDOMDocument *dom; |
| 2062 char *img; |
2064 char *img; |
| 2063 |
2065 guint id; |
| 2064 g_return_if_fail(webview != NULL); |
2066 |
| 2065 |
2067 g_return_if_fail(webview != NULL); |
| |
2068 |
| |
2069 id = purple_image_store_add(image); |
| 2066 priv = PIDGIN_WEBVIEW_GET_PRIVATE(webview); |
2070 priv = PIDGIN_WEBVIEW_GET_PRIVATE(webview); |
| 2067 dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); |
2071 dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview)); |
| 2068 img = g_strdup_printf("<img src='" PURPLE_STORED_IMAGE_PROTOCOL "%d'/>", |
2072 img = g_strdup_printf("<img src='" PURPLE_STORED_IMAGE_PROTOCOL |
| 2069 id); |
2073 "%u'/>", id); |
| 2070 |
2074 |
| 2071 priv->edit.block_changed = TRUE; |
2075 priv->edit.block_changed = TRUE; |
| 2072 webkit_dom_document_exec_command(dom, "insertHTML", FALSE, img); |
2076 webkit_dom_document_exec_command(dom, "insertHTML", FALSE, img); |
| 2073 priv->edit.block_changed = FALSE; |
2077 priv->edit.block_changed = FALSE; |
| 2074 g_free(img); |
2078 g_free(img); |