Mercurial > pidgin
annotate pidgin/gtkwebview.c @ 32457:d503827d7fcc
Emit the allowed-formats-updated signal when the set_format_functions
function is called.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Thu, 05 Jan 2012 06:11:04 +0000 |
parents | 0250c8b3e159 |
children | c89d7ad82dba |
rev | line source |
---|---|
32065 | 1 /* |
2 * @file gtkwebview.c GTK+ WebKitWebView wrapper class. | |
3 * @ingroup pidgin | |
4 */ | |
5 | |
6 /* pidgin | |
7 * | |
8 * Pidgin is the legal property of its developers, whose names are too numerous | |
9 * to list here. Please refer to the COPYRIGHT file distributed with this | |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
32065 | 14 * the Free Software Foundation; either version 2 of the License, or |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA | |
25 * | |
26 */ | |
27 | |
32437
5dea9a26078d
Use internal.h for less (conditional) #includes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32421
diff
changeset
|
28 #include "internal.h" |
5dea9a26078d
Use internal.h for less (conditional) #includes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32421
diff
changeset
|
29 #include "pidgin.h" |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
30 |
32456
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
31 #include <gdk/gdkkeysyms.h> |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
32 #include "gtkwebview.h" |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
33 |
32450
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
34 #define MAX_FONT_SIZE 7 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
35 #define MAX_SCROLL_TIME 0.4 /* seconds */ |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
36 #define SCROLL_DELAY 33 /* milliseconds */ |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
37 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
38 #define GTK_WEBVIEW_GET_PRIVATE(obj) \ |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
39 (G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_WEBVIEW, GtkWebViewPriv)) |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
40 |
32456
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
41 enum { |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
42 BUTTONS_UPDATE, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
43 TOGGLE_FORMAT, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
44 CLEAR_FORMAT, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
45 UPDATE_FORMAT, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
46 LAST_SIGNAL |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
47 }; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
48 static guint signals[LAST_SIGNAL] = { 0 }; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
49 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
50 /****************************************************************************** |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
51 * Structs |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
52 *****************************************************************************/ |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
53 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
54 typedef struct _GtkWebViewPriv { |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
55 GHashTable *images; /**< a map from id to temporary file for the image */ |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
56 gboolean empty; /**< whether anything has been appended **/ |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
57 |
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
58 /* JS execute queue */ |
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
59 GQueue *js_queue; |
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
60 gboolean is_loading; |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
61 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
62 /* Scroll adjustments */ |
32120
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
63 GtkAdjustment *vadj; |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
64 guint scroll_src; |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
65 GTimer *scroll_time; |
32450
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
66 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
67 /* Format options */ |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
68 GtkWebViewButtons format_functions; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
69 struct { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
70 gboolean wbfo:1; /* Whole buffer formatting only. */ |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
71 gboolean bold:1; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
72 gboolean italic:1; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
73 gboolean underline:1; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
74 gboolean strike:1; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
75 gchar *forecolor; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
76 gchar *backcolor; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
77 gchar *background; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
78 gchar *fontface; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
79 int fontsize; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
80 /*GtkTextTag *link;*/ |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
81 } edit; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
82 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
83 } GtkWebViewPriv; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
84 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
85 /****************************************************************************** |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
86 * Globals |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
87 *****************************************************************************/ |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
88 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
89 static WebKitWebViewClass *parent_class = NULL; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
90 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
91 /****************************************************************************** |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
92 * Helpers |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
93 *****************************************************************************/ |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
94 |
32439
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
95 static const char * |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
96 get_image_src_from_id(GtkWebViewPriv *priv, int id) |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
97 { |
32439
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
98 char *src; |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
99 PurpleStoredImage *img; |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
100 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
101 if (priv->images) { |
32439
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
102 /* Check for already loaded image */ |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
103 src = (char *)g_hash_table_lookup(priv->images, GINT_TO_POINTER(id)); |
32439
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
104 if (src) |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
105 return src; |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
106 } else { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
107 priv->images = g_hash_table_new_full(g_direct_hash, g_direct_equal, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
108 NULL, g_free); |
32439
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
109 } |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
110 |
32439
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
111 /* Find image in store */ |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
112 img = purple_imgstore_find_by_id(id); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
113 |
32439
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
114 src = (char *)purple_imgstore_get_filename(img); |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
115 if (src) { |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
116 src = g_strdup_printf("file://%s", src); |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
117 } else { |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
118 char *tmp; |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
119 tmp = purple_base64_encode(purple_imgstore_get_data(img), |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
120 purple_imgstore_get_size(img)); |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
121 src = g_strdup_printf("data:base64,%s", tmp); |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
122 g_free(tmp); |
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
123 } |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
124 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
125 g_hash_table_insert(priv->images, GINT_TO_POINTER(id), src); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
126 |
32439
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
127 return src; |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
128 } |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
129 |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
130 /* |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
131 * Replace all <img id=""> tags with <img src="">. I hoped to never |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
132 * write any HTML parsing code, but I'm forced to do this, until |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
133 * purple changes the way it works. |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
134 */ |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
135 static char * |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
136 replace_img_id_with_src(GtkWebViewPriv *priv, const char *html) |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
137 { |
32440
1809d65d4f92
This strlen seems redundant.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32439
diff
changeset
|
138 GString *buffer = g_string_new(NULL); |
1809d65d4f92
This strlen seems redundant.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32439
diff
changeset
|
139 const char *cur = html; |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
140 char *id; |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
141 int nid; |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
142 |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
143 while (*cur) { |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
144 const char *img = strstr(cur, "<img"); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
145 if (!img) { |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
146 g_string_append(buffer, cur); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
147 break; |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
148 } else |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
149 g_string_append_len(buffer, cur, img - cur); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
150 |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
151 cur = strstr(img, "/>"); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
152 if (!cur) |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
153 cur = strstr(img, ">"); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
154 |
32066 | 155 if (!cur) { /* invalid html? */ |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
156 g_string_printf(buffer, "%s", html); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
157 break; |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
158 } |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
159 |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
160 if (strstr(img, "src=") || !strstr(img, "id=")) { |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
161 g_string_printf(buffer, "%s", html); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
162 break; |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
163 } |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
164 |
32066 | 165 /* |
166 * if this is valid HTML, then I can be sure that it | |
167 * has an id= and does not have an src=, since | |
168 * '=' cannot appear in parameters. | |
169 */ | |
170 | |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
171 id = strstr(img, "id=") + 3; |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
172 |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
173 /* *id can't be \0, since a ">" appears after this */ |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
174 if (isdigit(*id)) |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
175 nid = atoi(id); |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
176 else |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
177 nid = atoi(id + 1); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
178 |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
179 /* let's dump this, tag and then dump the src information */ |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
180 g_string_append_len(buffer, img, cur - img); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
181 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
182 g_string_append_printf(buffer, " src='%s' ", get_image_src_from_id(priv, nid)); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
183 } |
32066 | 184 |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
185 return g_string_free(buffer, FALSE); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
186 } |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
187 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
188 static gboolean |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
189 process_js_script_queue(GtkWebView *webview) |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
190 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
191 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
192 char *script; |
32081
3bd8fb942ea4
Yep, tested, and changed some code from previous commit. This is a hard
tdrhq@soc.pidgin.im
parents:
32080
diff
changeset
|
193 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
194 if (priv->is_loading) |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
195 return FALSE; /* we will be called when loaded */ |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
196 if (!priv->js_queue || g_queue_is_empty(priv->js_queue)) |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
197 return FALSE; /* nothing to do! */ |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
198 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
199 script = g_queue_pop_head(priv->js_queue); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
200 webkit_web_view_execute_script(WEBKIT_WEB_VIEW(webview), script); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
201 g_free(script); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
202 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
203 return TRUE; /* there may be more for now */ |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
204 } |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
205 |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
206 static void |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
207 webview_load_started(WebKitWebView *webview, WebKitWebFrame *frame, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
208 gpointer userdata) |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
209 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
210 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
211 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
212 /* is there a better way to test for is_loading? */ |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
213 priv->is_loading = TRUE; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
214 } |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
215 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
216 static void |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
217 webview_load_finished(WebKitWebView *webview, WebKitWebFrame *frame, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
218 gpointer userdata) |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
219 { |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
220 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
221 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
222 priv->is_loading = FALSE; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
223 g_idle_add((GSourceFunc)process_js_script_queue, webview); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
224 } |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
225 |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
226 static gboolean |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
227 webview_link_clicked(WebKitWebView *webview, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
228 WebKitWebFrame *frame, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
229 WebKitNetworkRequest *request, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
230 WebKitWebNavigationAction *navigation_action, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
231 WebKitWebPolicyDecision *policy_decision, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
232 gpointer userdata) |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
233 { |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
234 const gchar *uri; |
32126
a17de1f525a9
Handle better webkit's navigation-policy-decision-requested signal to be able to manage external files, links and theme files.
masca@cpw.pidgin.im
parents:
32122
diff
changeset
|
235 WebKitWebNavigationReason reason; |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
236 |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
237 uri = webkit_network_request_get_uri(request); |
32126
a17de1f525a9
Handle better webkit's navigation-policy-decision-requested signal to be able to manage external files, links and theme files.
masca@cpw.pidgin.im
parents:
32122
diff
changeset
|
238 reason = webkit_web_navigation_action_get_reason(navigation_action); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
239 |
32126
a17de1f525a9
Handle better webkit's navigation-policy-decision-requested signal to be able to manage external files, links and theme files.
masca@cpw.pidgin.im
parents:
32122
diff
changeset
|
240 if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) { |
a17de1f525a9
Handle better webkit's navigation-policy-decision-requested signal to be able to manage external files, links and theme files.
masca@cpw.pidgin.im
parents:
32122
diff
changeset
|
241 /* the gtk imhtml way was to create an idle cb, not sure |
a17de1f525a9
Handle better webkit's navigation-policy-decision-requested signal to be able to manage external files, links and theme files.
masca@cpw.pidgin.im
parents:
32122
diff
changeset
|
242 * why, so right now just using purple_notify_uri directly */ |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
243 purple_notify_uri(NULL, uri); |
32446
aeaf9eebd5ec
If we handle a navigation request, then we should tell WebKit
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32445
diff
changeset
|
244 webkit_web_policy_decision_ignore(policy_decision); |
32449
692d5408983d
We don't want WebKit to process a Refresh, or Back/Forward
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32446
diff
changeset
|
245 } else if (reason == WEBKIT_WEB_NAVIGATION_REASON_OTHER) |
32143
e7eba7a6a989
Let webview manage the navigation ONLY if the reason is the user clicked a link.
masca@cpw.pidgin.im
parents:
32133
diff
changeset
|
246 webkit_web_policy_decision_use(policy_decision); |
32449
692d5408983d
We don't want WebKit to process a Refresh, or Back/Forward
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32446
diff
changeset
|
247 else |
692d5408983d
We don't want WebKit to process a Refresh, or Back/Forward
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32446
diff
changeset
|
248 webkit_web_policy_decision_ignore(policy_decision); |
32126
a17de1f525a9
Handle better webkit's navigation-policy-decision-requested signal to be able to manage external files, links and theme files.
masca@cpw.pidgin.im
parents:
32122
diff
changeset
|
249 |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
250 return TRUE; |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
251 } |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
252 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
253 /* |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
254 * Smoothly scroll a WebView. |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
255 * |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
256 * @return TRUE if the window needs to be scrolled further, FALSE if we're at the bottom. |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
257 */ |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
258 static gboolean |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
259 smooth_scroll_cb(gpointer data) |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
260 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
261 GtkWebViewPriv *priv = data; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
262 GtkAdjustment *adj; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
263 gdouble max_val; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
264 gdouble scroll_val; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
265 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
266 g_return_val_if_fail(priv->scroll_time != NULL, FALSE); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
267 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
268 adj = priv->vadj; |
32443
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
269 #if GTK_CHECK_VERSION(2,14,0) |
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
270 max_val = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj); |
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
271 #else |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
272 max_val = adj->upper - adj->page_size; |
32443
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
273 #endif |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
274 scroll_val = gtk_adjustment_get_value(adj) + |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
275 ((max_val - gtk_adjustment_get_value(adj)) / 3); |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
276 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
277 if (g_timer_elapsed(priv->scroll_time, NULL) > MAX_SCROLL_TIME |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
278 || scroll_val >= max_val) { |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
279 /* time's up. jump to the end and kill the timer */ |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
280 gtk_adjustment_set_value(adj, max_val); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
281 g_timer_destroy(priv->scroll_time); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
282 priv->scroll_time = NULL; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
283 g_source_remove(priv->scroll_src); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
284 priv->scroll_src = 0; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
285 return FALSE; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
286 } |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
287 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
288 /* scroll by 1/3rd the remaining distance */ |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
289 gtk_adjustment_set_value(adj, scroll_val); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
290 return TRUE; |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
291 } |
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
292 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
293 static gboolean |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
294 scroll_idle_cb(gpointer data) |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
295 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
296 GtkWebViewPriv *priv = data; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
297 GtkAdjustment *adj = priv->vadj; |
32443
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
298 gdouble max_val; |
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
299 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
300 if (adj) { |
32443
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
301 #if GTK_CHECK_VERSION(2,14,0) |
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
302 max_val = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj); |
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
303 #else |
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
304 max_val = adj->upper - adj->page_size; |
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
305 #endif |
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
306 gtk_adjustment_set_value(adj, max_val); |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
307 } |
32443
16925948a003
Use accessor functions where available.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32442
diff
changeset
|
308 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
309 priv->scroll_src = 0; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
310 return FALSE; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
311 } |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
312 |
32455
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
313 static void |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
314 webview_clear_formatting(GtkWebView *webview) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
315 { |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
316 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
317 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
318 if (!webkit_web_view_get_editable(WEBKIT_WEB_VIEW(webview))) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
319 return; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
320 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
321 priv->edit.bold = FALSE; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
322 priv->edit.italic = FALSE; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
323 priv->edit.underline = FALSE; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
324 priv->edit.strike = FALSE; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
325 priv->edit.fontsize = 0; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
326 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
327 g_free(priv->edit.fontface); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
328 priv->edit.fontface = NULL; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
329 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
330 g_free(priv->edit.forecolor); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
331 priv->edit.forecolor = NULL; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
332 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
333 g_free(priv->edit.backcolor); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
334 priv->edit.backcolor = NULL; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
335 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
336 g_free(priv->edit.background); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
337 priv->edit.background = NULL; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
338 } |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
339 |
32456
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
340 static void |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
341 webview_toggle_format(GtkWebView *webview, GtkWebViewButtons buttons) |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
342 { |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
343 /* since this function is the handler for the formatting keystrokes, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
344 we need to check here that the formatting attempted is permitted */ |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
345 buttons &= gtk_webview_get_format_functions(webview); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
346 |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
347 switch (buttons) { |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
348 case GTK_WEBVIEW_BOLD: |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
349 gtk_webview_toggle_bold(webview); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
350 break; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
351 case GTK_WEBVIEW_ITALIC: |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
352 gtk_webview_toggle_italic(webview); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
353 break; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
354 case GTK_WEBVIEW_UNDERLINE: |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
355 gtk_webview_toggle_underline(webview); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
356 break; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
357 case GTK_WEBVIEW_STRIKE: |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
358 gtk_webview_toggle_strike(webview); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
359 break; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
360 case GTK_WEBVIEW_SHRINK: |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
361 gtk_webview_font_shrink(webview); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
362 break; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
363 case GTK_WEBVIEW_GROW: |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
364 gtk_webview_font_grow(webview); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
365 break; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
366 default: |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
367 break; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
368 } |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
369 } |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
370 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
371 /****************************************************************************** |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
372 * GObject Stuff |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
373 *****************************************************************************/ |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
374 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
375 GtkWidget * |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
376 gtk_webview_new(void) |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
377 { |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
378 return GTK_WIDGET(g_object_new(gtk_webview_get_type(), NULL)); |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
379 } |
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
380 |
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
381 static void |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
382 gtk_webview_finalize(GObject *webview) |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
383 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
384 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
385 gpointer temp; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
386 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
387 while ((temp = g_queue_pop_head(priv->js_queue))) |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
388 g_free(temp); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
389 g_queue_free(priv->js_queue); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
390 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
391 if (priv->images) |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
392 g_hash_table_unref(priv->images); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
393 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
394 G_OBJECT_CLASS(parent_class)->finalize(G_OBJECT(webview)); |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
395 } |
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
396 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
397 static void |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
398 gtk_webview_class_init(GtkWebViewClass *klass, gpointer userdata) |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
399 { |
32456
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
400 GObjectClass *gobject_class; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
401 GtkBindingSet *binding_set; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
402 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
403 parent_class = g_type_class_ref(webkit_web_view_get_type()); |
32456
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
404 gobject_class = G_OBJECT_CLASS(klass); |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
405 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
406 g_type_class_add_private(klass, sizeof(GtkWebViewPriv)); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
407 |
32456
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
408 signals[BUTTONS_UPDATE] = g_signal_new("allowed-formats-updated", |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
409 G_TYPE_FROM_CLASS(gobject_class), |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
410 G_SIGNAL_RUN_FIRST, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
411 G_STRUCT_OFFSET(GtkWebViewClass, buttons_update), |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
412 NULL, 0, g_cclosure_marshal_VOID__INT, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
413 G_TYPE_NONE, 1, G_TYPE_INT); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
414 signals[TOGGLE_FORMAT] = g_signal_new("format-toggled", |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
415 G_TYPE_FROM_CLASS(gobject_class), |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
416 G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
417 G_STRUCT_OFFSET(GtkWebViewClass, toggle_format), |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
418 NULL, 0, g_cclosure_marshal_VOID__INT, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
419 G_TYPE_NONE, 1, G_TYPE_INT); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
420 signals[CLEAR_FORMAT] = g_signal_new("format-cleared", |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
421 G_TYPE_FROM_CLASS(gobject_class), |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
422 G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
423 G_STRUCT_OFFSET(GtkWebViewClass, clear_format), |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
424 NULL, 0, g_cclosure_marshal_VOID__VOID, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
425 G_TYPE_NONE, 0); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
426 signals[UPDATE_FORMAT] = g_signal_new("format-updated", |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
427 G_TYPE_FROM_CLASS(gobject_class), |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
428 G_SIGNAL_RUN_FIRST, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
429 G_STRUCT_OFFSET(GtkWebViewClass, update_format), |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
430 NULL, 0, g_cclosure_marshal_VOID__VOID, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
431 G_TYPE_NONE, 0); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
432 |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
433 klass->toggle_format = webview_toggle_format; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
434 klass->clear_format = webview_clear_formatting; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
435 |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
436 gobject_class->finalize = gtk_webview_finalize; |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
437 |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
438 binding_set = gtk_binding_set_by_class(parent_class); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
439 gtk_binding_entry_add_signal(binding_set, GDK_KEY_b, GDK_CONTROL_MASK, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
440 "format-toggled", 1, G_TYPE_INT, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
441 GTK_WEBVIEW_BOLD); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
442 gtk_binding_entry_add_signal(binding_set, GDK_KEY_i, GDK_CONTROL_MASK, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
443 "format-toggled", 1, G_TYPE_INT, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
444 GTK_WEBVIEW_ITALIC); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
445 gtk_binding_entry_add_signal(binding_set, GDK_KEY_u, GDK_CONTROL_MASK, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
446 "format-toggled", 1, G_TYPE_INT, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
447 GTK_WEBVIEW_UNDERLINE); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
448 gtk_binding_entry_add_signal(binding_set, GDK_KEY_plus, GDK_CONTROL_MASK, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
449 "format-toggled", 1, G_TYPE_INT, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
450 GTK_WEBVIEW_GROW); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
451 gtk_binding_entry_add_signal(binding_set, GDK_KEY_equal, GDK_CONTROL_MASK, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
452 "format-toggled", 1, G_TYPE_INT, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
453 GTK_WEBVIEW_GROW); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
454 gtk_binding_entry_add_signal(binding_set, GDK_KEY_minus, GDK_CONTROL_MASK, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
455 "format-toggled", 1, G_TYPE_INT, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
456 GTK_WEBVIEW_SHRINK); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
457 |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
458 binding_set = gtk_binding_set_by_class(klass); |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
459 gtk_binding_entry_add_signal(binding_set, GDK_KEY_r, GDK_CONTROL_MASK, |
0250c8b3e159
Add some formatting signals to webview from imhtml.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32455
diff
changeset
|
460 "format-cleared", 0); |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
461 } |
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
462 |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
463 static void |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
464 gtk_webview_init(GtkWebView *webview, gpointer userdata) |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
465 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
466 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
467 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
468 priv->empty = TRUE; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
469 priv->js_queue = g_queue_new(); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
470 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
471 g_signal_connect(webview, "navigation-policy-decision-requested", |
32445
072e2329b659
Passing the webview as userdata when the webview is the object
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32443
diff
changeset
|
472 G_CALLBACK(webview_link_clicked), NULL); |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
473 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
474 g_signal_connect(webview, "load-started", |
32445
072e2329b659
Passing the webview as userdata when the webview is the object
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32443
diff
changeset
|
475 G_CALLBACK(webview_load_started), NULL); |
32080
b89351c7580b
safely execute JS scripts only after loading is done. Untested code as of now, will test it in next commit.
tdrhq@soc.pidgin.im
parents:
32066
diff
changeset
|
476 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
477 g_signal_connect(webview, "load-finished", |
32445
072e2329b659
Passing the webview as userdata when the webview is the object
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32443
diff
changeset
|
478 G_CALLBACK(webview_load_finished), NULL); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
479 } |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
480 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
481 GType |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
482 gtk_webview_get_type(void) |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
483 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
484 static GType mview_type = 0; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
485 if (G_UNLIKELY(mview_type == 0)) { |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
486 static const GTypeInfo mview_info = { |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
487 sizeof(GtkWebViewClass), |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
488 NULL, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
489 NULL, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
490 (GClassInitFunc)gtk_webview_class_init, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
491 NULL, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
492 NULL, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
493 sizeof(GtkWebView), |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
494 0, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
495 (GInstanceInitFunc)gtk_webview_init, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
496 NULL |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
497 }; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
498 mview_type = g_type_register_static(webkit_web_view_get_type(), |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
499 "GtkWebView", &mview_info, 0); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
500 } |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
501 return mview_type; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
502 } |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
503 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
504 /***************************************************************************** |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
505 * Public API functions |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
506 *****************************************************************************/ |
32439
5022cf604d6e
Avoid creating temporary files for images in a webview.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32437
diff
changeset
|
507 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
508 gboolean |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
509 gtk_webview_is_empty(GtkWebView *webview) |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
510 { |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
511 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
512 return priv->empty; |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
513 } |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
514 |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
515 char * |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
516 gtk_webview_quote_js_string(const char *text) |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
517 { |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
518 GString *str = g_string_new("\""); |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
519 const char *cur = text; |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
520 |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
521 while (cur && *cur) { |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
522 switch (*cur) { |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
523 case '\\': |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
524 g_string_append(str, "\\\\"); |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
525 break; |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
526 case '\"': |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
527 g_string_append(str, "\\\""); |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
528 break; |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
529 case '\r': |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
530 g_string_append(str, "<br/>"); |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
531 break; |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
532 case '\n': |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
533 break; |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
534 default: |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
535 g_string_append_c(str, *cur); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
536 } |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
537 cur++; |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
538 } |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
539 |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
540 g_string_append_c(str, '"'); |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
541 |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
542 return g_string_free(str, FALSE); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
543 } |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
544 void |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
545 gtk_webview_safe_execute_script(GtkWebView *webview, const char *script) |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
546 { |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
547 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
548 g_queue_push_tail(priv->js_queue, g_strdup(script)); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
549 g_idle_add((GSourceFunc)process_js_script_queue, webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
550 } |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
551 |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
552 void |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
553 gtk_webview_load_html_string_with_imgstore(GtkWebView *webview, const char *html) |
32120
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
554 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
555 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
556 char *html_imged; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
557 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
558 if (priv->images) { |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
559 g_hash_table_unref(priv->images); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
560 priv->images = NULL; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
561 } |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
562 |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
563 html_imged = replace_img_id_with_src(priv, html); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
564 webkit_web_view_load_string(WEBKIT_WEB_VIEW(webview), html_imged, NULL, |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
565 NULL, "file:///"); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
566 g_free(html_imged); |
32120
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
567 } |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
568 |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
569 /* this is a "hack", my plan is to eventually handle this |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
570 * correctly using a signals and a plugin: the plugin will have |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
571 * the information as to what javascript function to call. It seems |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
572 * wrong to hardcode that here. |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
573 */ |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
574 void |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
575 gtk_webview_append_html(GtkWebView *webview, const char *html) |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
576 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
577 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
578 char *escaped = gtk_webview_quote_js_string(html); |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
579 char *script = g_strdup_printf("document.write(%s)", escaped); |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
580 webkit_web_view_execute_script(WEBKIT_WEB_VIEW(webview), script); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
581 priv->empty = FALSE; |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
582 gtk_webview_scroll_to_end(webview, TRUE); |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
583 g_free(script); |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
584 g_free(escaped); |
32061
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
585 } |
ac42a0dfda48
Apparently I missed these in my previous commit.
tdrhq@soc.pidgin.im
parents:
diff
changeset
|
586 |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
587 void |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
588 gtk_webview_set_vadjustment(GtkWebView *webview, GtkAdjustment *vadj) |
32120
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
589 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
590 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
591 priv->vadj = vadj; |
32120
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
592 } |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
593 |
32133
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
594 void |
8e1ec44ede75
Clean up this WebKit stuff. Fix up broken merging, mark unfinished
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32126
diff
changeset
|
595 gtk_webview_scroll_to_end(GtkWebView *webview, gboolean smooth) |
32120
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
596 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
597 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
32120
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
598 if (priv->scroll_time) |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
599 g_timer_destroy(priv->scroll_time); |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
600 if (priv->scroll_src) |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
601 g_source_remove(priv->scroll_src); |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
602 if (smooth) { |
32120
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
603 priv->scroll_time = g_timer_new(); |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
604 priv->scroll_src = g_timeout_add_full(G_PRIORITY_LOW, SCROLL_DELAY, smooth_scroll_cb, priv, NULL); |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
605 } else { |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
606 priv->scroll_time = NULL; |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
607 priv->scroll_src = g_idle_add_full(G_PRIORITY_LOW, scroll_idle_cb, priv, NULL); |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
608 } |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
609 } |
24c8a98a6acc
webkit: Scroll to end when appending html.
masca@cpw.pidgin.im
parents:
32109
diff
changeset
|
610 |
32419
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
611 void gtk_webview_page_up(GtkWebView *webview) |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
612 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
613 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
614 GtkAdjustment *vadj = priv->vadj; |
32419
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
615 gdouble scroll_val; |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
616 |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
617 #if GTK_CHECK_VERSION(2,14,0) |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
618 scroll_val = gtk_adjustment_get_value(vadj) - gtk_adjustment_get_page_size(vadj); |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
619 scroll_val = MAX(scroll_val, gtk_adjustment_get_lower(vadj)); |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
620 #else |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
621 scroll_val = gtk_adjustment_get_value(vadj) - vadj->page_size; |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
622 scroll_val = MAX(scroll_val, vadj->lower); |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
623 #endif |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
624 |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
625 gtk_adjustment_set_value(vadj, scroll_val); |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
626 } |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
627 |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
628 void gtk_webview_page_down(GtkWebView *webview) |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
629 { |
32442
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
630 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
fb8447f6649c
Rearrange these files a bit to group common functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32440
diff
changeset
|
631 GtkAdjustment *vadj = priv->vadj; |
32419
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
632 gdouble scroll_val; |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
633 gdouble page_size; |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
634 |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
635 #if GTK_CHECK_VERSION(2,14,0) |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
636 page_size = gtk_adjustment_get_page_size(vadj); |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
637 scroll_val = gtk_adjustment_get_value(vadj) + page_size; |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
638 scroll_val = MIN(scroll_val, gtk_adjustment_get_upper(vadj) - page_size); |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
639 #else |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
640 page_size = vadj->page_size; |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
641 scroll_val = gtk_adjustment_get_value(vadj) + page_size; |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
642 scroll_val = MIN(scroll_val, vadj->upper - page_size); |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
643 #endif |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
644 |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
645 gtk_adjustment_set_value(vadj, scroll_val); |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
646 } |
7b9566b77501
Add page up/down for WebKit view.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32199
diff
changeset
|
647 |
32450
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
648 void |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
649 gtk_webview_set_editable(GtkWebView *webview, gboolean editable) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
650 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
651 webkit_web_view_set_editable(WEBKIT_WEB_VIEW(webview), editable); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
652 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
653 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
654 void |
32455
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
655 gtk_webview_setup_entry(GtkWebView *webview, PurpleConnectionFlags flags) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
656 { |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
657 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
658 GtkWebViewButtons buttons; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
659 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
660 if (flags & PURPLE_CONNECTION_HTML) { |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
661 char color[8]; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
662 GdkColor fg_color, bg_color; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
663 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
664 buttons = GTK_WEBVIEW_ALL; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
665 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
666 if (flags & PURPLE_CONNECTION_NO_BGCOLOR) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
667 buttons &= ~GTK_WEBVIEW_BACKCOLOR; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
668 if (flags & PURPLE_CONNECTION_NO_FONTSIZE) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
669 { |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
670 buttons &= ~GTK_WEBVIEW_GROW; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
671 buttons &= ~GTK_WEBVIEW_SHRINK; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
672 } |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
673 if (flags & PURPLE_CONNECTION_NO_URLDESC) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
674 buttons &= ~GTK_WEBVIEW_LINKDESC; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
675 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
676 gtk_webview_set_format_functions(webview, GTK_WEBVIEW_ALL); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
677 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_bold") != priv->edit.bold) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
678 gtk_webview_toggle_bold(webview); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
679 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
680 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_italic") != priv->edit.italic) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
681 gtk_webview_toggle_italic(webview); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
682 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
683 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_underline") != priv->edit.underline) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
684 gtk_webview_toggle_underline(webview); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
685 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
686 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/send_strike") != priv->edit.strike) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
687 gtk_webview_toggle_strike(webview); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
688 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
689 gtk_webview_toggle_fontface(webview, |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
690 purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/font_face")); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
691 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
692 if (!(flags & PURPLE_CONNECTION_NO_FONTSIZE)) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
693 { |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
694 int size = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/font_size"); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
695 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
696 /* 3 is the default. */ |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
697 if (size != 3) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
698 gtk_webview_font_set_size(webview, size); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
699 } |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
700 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
701 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor"), "") != 0) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
702 { |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
703 gdk_color_parse(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/fgcolor"), |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
704 &fg_color); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
705 g_snprintf(color, sizeof(color), "#%02x%02x%02x", |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
706 fg_color.red / 256, |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
707 fg_color.green / 256, |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
708 fg_color.blue / 256); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
709 } else |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
710 strcpy(color, ""); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
711 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
712 gtk_webview_toggle_forecolor(webview, color); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
713 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
714 if(!(flags & PURPLE_CONNECTION_NO_BGCOLOR) && |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
715 strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), "") != 0) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
716 { |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
717 gdk_color_parse(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/bgcolor"), |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
718 &bg_color); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
719 g_snprintf(color, sizeof(color), "#%02x%02x%02x", |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
720 bg_color.red / 256, |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
721 bg_color.green / 256, |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
722 bg_color.blue / 256); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
723 } else |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
724 strcpy(color, ""); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
725 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
726 gtk_webview_toggle_background(webview, color); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
727 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
728 if (flags & PURPLE_CONNECTION_FORMATTING_WBFO) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
729 gtk_webview_set_whole_buffer_formatting_only(webview, TRUE); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
730 else |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
731 gtk_webview_set_whole_buffer_formatting_only(webview, FALSE); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
732 } else { |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
733 buttons = GTK_WEBVIEW_SMILEY | GTK_WEBVIEW_IMAGE; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
734 webview_clear_formatting(webview); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
735 } |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
736 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
737 if (flags & PURPLE_CONNECTION_NO_IMAGES) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
738 buttons &= ~GTK_WEBVIEW_IMAGE; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
739 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
740 if (flags & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
741 buttons |= GTK_WEBVIEW_CUSTOM_SMILEY; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
742 else |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
743 buttons &= ~GTK_WEBVIEW_CUSTOM_SMILEY; |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
744 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
745 gtk_webview_set_format_functions(webview, buttons); |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
746 } |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
747 |
c5e5938bb89a
Add a function for setting a WebView entry based on the
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32450
diff
changeset
|
748 void |
32450
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
749 gtk_webview_set_whole_buffer_formatting_only(GtkWebView *webview, gboolean wbfo) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
750 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
751 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
752 priv->edit.wbfo = wbfo; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
753 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
754 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
755 void |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
756 gtk_webview_set_format_functions(GtkWebView *webview, GtkWebViewButtons buttons) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
757 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
758 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
32457
d503827d7fcc
Emit the allowed-formats-updated signal when the set_format_functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32456
diff
changeset
|
759 GObject *object = g_object_ref(G_OBJECT(webview)); |
32450
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
760 priv->format_functions = buttons; |
32457
d503827d7fcc
Emit the allowed-formats-updated signal when the set_format_functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32456
diff
changeset
|
761 g_signal_emit(object, signals[BUTTONS_UPDATE], 0, buttons); |
d503827d7fcc
Emit the allowed-formats-updated signal when the set_format_functions
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32456
diff
changeset
|
762 g_object_unref(object); |
32450
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
763 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
764 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
765 GtkWebViewButtons |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
766 gtk_webview_get_format_functions(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
767 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
768 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
769 return priv->format_functions; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
770 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
771 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
772 void |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
773 gtk_webview_get_current_format(GtkWebView *webview, gboolean *bold, |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
774 gboolean *italic, gboolean *underline, |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
775 gboolean *strike) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
776 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
777 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
778 if (bold) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
779 *bold = priv->edit.bold; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
780 if (italic) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
781 *italic = priv->edit.italic; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
782 if (underline) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
783 *underline = priv->edit.underline; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
784 if (strike) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
785 *strike = priv->edit.strike; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
786 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
787 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
788 const char * |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
789 gtk_webview_get_current_fontface(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
790 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
791 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
792 return priv->edit.fontface; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
793 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
794 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
795 const char * |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
796 gtk_webview_get_current_forecolor(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
797 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
798 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
799 return priv->edit.forecolor; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
800 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
801 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
802 const char * |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
803 gtk_webview_get_current_backcolor(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
804 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
805 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
806 return priv->edit.backcolor; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
807 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
808 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
809 const char * |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
810 gtk_webview_get_current_background(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
811 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
812 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
813 return priv->edit.background; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
814 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
815 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
816 gint |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
817 gtk_webview_get_current_fontsize(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
818 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
819 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
820 return priv->edit.fontsize; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
821 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
822 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
823 gboolean |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
824 gtk_webview_get_editable(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
825 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
826 return webkit_web_view_get_editable(WEBKIT_WEB_VIEW(webview)); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
827 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
828 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
829 void |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
830 gtk_webview_clear_formatting(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
831 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
832 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
833 priv->edit.bold = FALSE; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
834 priv->edit.italic = FALSE; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
835 priv->edit.underline = FALSE; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
836 priv->edit.strike = FALSE; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
837 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
838 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
839 void |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
840 gtk_webview_toggle_bold(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
841 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
842 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
843 priv->edit.bold = !priv->edit.bold; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
844 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
845 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
846 void |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
847 gtk_webview_toggle_italic(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
848 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
849 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
850 priv->edit.italic = !priv->edit.italic; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
851 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
852 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
853 void |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
854 gtk_webview_toggle_underline(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
855 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
856 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
857 priv->edit.underline = !priv->edit.underline; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
858 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
859 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
860 void |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
861 gtk_webview_toggle_strike(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
862 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
863 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
864 priv->edit.strike = !priv->edit.strike; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
865 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
866 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
867 gboolean |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
868 gtk_webview_toggle_forecolor(GtkWebView *webview, const char *color) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
869 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
870 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
871 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
872 g_free(priv->edit.forecolor); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
873 priv->edit.forecolor = g_strdup(color); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
874 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
875 return FALSE; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
876 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
877 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
878 gboolean |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
879 gtk_webview_toggle_backcolor(GtkWebView *webview, const char *color) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
880 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
881 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
882 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
883 g_free(priv->edit.backcolor); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
884 priv->edit.backcolor = g_strdup(color); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
885 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
886 return FALSE; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
887 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
888 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
889 gboolean |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
890 gtk_webview_toggle_background(GtkWebView *webview, const char *color) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
891 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
892 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
893 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
894 g_free(priv->edit.background); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
895 priv->edit.background = g_strdup(color); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
896 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
897 return FALSE; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
898 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
899 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
900 gboolean |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
901 gtk_webview_toggle_fontface(GtkWebView *webview, const char *face) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
902 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
903 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
904 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
905 g_free(priv->edit.fontface); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
906 priv->edit.fontface = g_strdup(face); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
907 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
908 return FALSE; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
909 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
910 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
911 void |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
912 gtk_webview_font_set_size(GtkWebView *webview, gint size) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
913 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
914 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
915 priv->edit.fontsize = size; |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
916 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
917 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
918 void |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
919 gtk_webview_font_shrink(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
920 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
921 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
922 priv->edit.fontsize = MAX(priv->edit.fontsize - 1, 1); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
923 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
924 |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
925 void |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
926 gtk_webview_font_grow(GtkWebView *webview) |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
927 { |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
928 GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
929 priv->edit.fontsize = MIN(priv->edit.fontsize + 1, MAX_FONT_SIZE); |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
930 } |
0d50155445fd
Copy some editing functions from GtkIMHtml. These are incomplete.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32449
diff
changeset
|
931 |