Fri, 07 Aug 2009 18:44:27 +0000
more cleanup.
| 32445 | 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 | |
| 13 | * under the terms of the GNU General Public License as published by | |
| 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 | ||
| 28 | #ifdef HAVE_CONFIG_H | |
| 29 | #include <config.h> | |
| 30 | #endif | |
|
32441
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
31 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
32 | #include <ctype.h> |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
33 | #include <string.h> |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
34 | #include <glib.h> |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
35 | #include <glib/gstdio.h> |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
36 | #include <JavaScriptCore/JavaScript.h> |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
37 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
38 | #include "util.h" |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
39 | #include "gtkwebview.h" |
| 32445 | 40 | #include "imgstore.h" |
|
32441
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
41 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
42 | static WebKitWebViewClass *parent_class = NULL; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
43 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
44 | GtkWidget* gtk_webview_new () |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
45 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
46 | return GTK_WIDGET(g_object_new(gtk_webview_get_type(), NULL)); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
47 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
48 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
49 | static char* |
| 32445 | 50 | get_image_filename_from_id (GtkWebView* view, int id) |
|
32441
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
51 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
52 | char *filename = NULL; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
53 | FILE *file; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
54 | PurpleStoredImage* img; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
55 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
56 | if (!view->images) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
57 | view->images = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
58 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
59 | filename = (char*) g_hash_table_lookup (view->images, GINT_TO_POINTER (id)); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
60 | if (filename) return filename; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
61 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
62 | /* else get from img store */ |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
63 | file = purple_mkstemp (&filename, TRUE); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
64 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
65 | img = purple_imgstore_find_by_id (id); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
66 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
67 | fwrite (purple_imgstore_get_data (img), purple_imgstore_get_size (img), 1, file); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
68 | g_hash_table_insert (view->images, GINT_TO_POINTER (id), filename); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
69 | fclose (file); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
70 | return filename; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
71 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
72 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
73 | static void |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
74 | clear_single_image (gpointer key, gpointer value, gpointer userdata) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
75 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
76 | g_unlink ((char*) value); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
77 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
78 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
79 | static void |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
80 | clear_images (GtkWebView* view) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
81 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
82 | if (!view->images) return; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
83 | g_hash_table_foreach (view->images, clear_single_image, NULL); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
84 | g_hash_table_unref (view->images); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
85 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
86 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
87 | /* |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
88 | * Replace all <img id=""> tags with <img src="">. I hoped to never |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
89 | * write any HTML parsing code, but I'm forced to do this, until |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
90 | * purple changes the way it works. |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
91 | */ |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
92 | static char* |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
93 | replace_img_id_with_src (GtkWebView *view, const char* html) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
94 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
95 | GString *buffer = g_string_sized_new (strlen (html)); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
96 | const char* cur = html; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
97 | char *id; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
98 | int nid; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
99 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
100 | while (*cur) { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
101 | const char* img = strstr (cur, "<img"); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
102 | if (!img) { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
103 | g_string_append (buffer, cur); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
104 | break; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
105 | } else |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
106 | g_string_append_len (buffer, cur, img - cur); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
107 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
108 | cur = strstr (img, "/>"); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
109 | if (!cur) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
110 | cur = strstr (img, ">"); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
111 | |
| 32446 | 112 | if (!cur) { /* invalid html? */ |
|
32441
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
113 | g_string_printf (buffer, "%s", html); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
114 | break; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
115 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
116 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
117 | if (strstr (img, "src=") || !strstr (img, "id=")) { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
118 | g_string_printf (buffer, "%s", html); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
119 | break; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
120 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
121 | |
| 32446 | 122 | /* |
| 123 | * if this is valid HTML, then I can be sure that it | |
| 124 | * has an id= and does not have an src=, since | |
| 125 | * '=' cannot appear in parameters. | |
| 126 | */ | |
| 127 | ||
|
32441
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
128 | id = strstr (img, "id=") + 3; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
129 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
130 | /* *id can't be \0, since a ">" appears after this */ |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
131 | if (isdigit (*id)) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
132 | nid = atoi (id); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
133 | else |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
134 | nid = atoi (id+1); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
135 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
136 | /* let's dump this, tag and then dump the src information */ |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
137 | g_string_append_len (buffer, img, cur - img); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
138 | |
| 32445 | 139 | g_string_append_printf (buffer, " src='file://%s' ", get_image_filename_from_id (view, nid)); |
|
32441
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
140 | } |
| 32446 | 141 | |
|
32441
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
142 | return g_string_free (buffer, FALSE); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
143 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
144 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
145 | static void |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
146 | gtk_webview_finalize (GObject *view) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
147 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
148 | clear_images (GTK_WEBVIEW (view)); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
149 | G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT(view)); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
150 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
151 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
152 | static void |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
153 | gtk_webview_class_init (GtkWebViewClass *klass, gpointer userdata) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
154 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
155 | parent_class = g_type_class_ref (webkit_web_view_get_type ()); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
156 | G_OBJECT_CLASS (klass)->finalize = gtk_webview_finalize; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
157 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
158 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
159 | static gboolean |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
160 | webview_link_clicked (WebKitWebView *view, |
| 32446 | 161 | WebKitWebFrame *frame, |
| 162 | WebKitNetworkRequest *request, | |
| 163 | WebKitWebNavigationAction *navigation_action, | |
|
32441
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
164 | WebKitWebPolicyDecision *policy_decision) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
165 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
166 | const gchar *uri; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
167 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
168 | uri = webkit_network_request_get_uri (request); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
169 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
170 | /* the gtk imhtml way was to create an idle cb, not sure |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
171 | * why, so right now just using purple_notify_uri directly */ |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
172 | purple_notify_uri (NULL, uri); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
173 | return TRUE; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
174 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
175 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
176 | char* |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
177 | gtk_webview_execute_script (GtkWebView *view, const char *script) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
178 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
179 | JSStringRef js_script = JSStringCreateWithUTF8CString (script); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
180 | JSContextRef ctxt = webkit_web_frame_get_global_context ( |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
181 | webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view)) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
182 | ); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
183 | JSValueRef ret = JSEvaluateScript (ctxt, js_script, NULL, NULL, 0, NULL); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
184 | JSStringRef ret_as_str = JSValueToStringCopy (ctxt, ret, NULL); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
185 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
186 | size_t cstr_len = JSStringGetMaximumUTF8CStringSize (ret_as_str); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
187 | char *cstr = g_new0(char, cstr_len + 1); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
188 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
189 | JSStringGetUTF8CString (ret_as_str, cstr, cstr_len); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
190 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
191 | /* TODO: I'm not sure what, if at all, I need to free here! */ |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
192 | return cstr; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
193 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
194 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
195 | static void |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
196 | gtk_webview_init (GtkWebView *view, gpointer userdata) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
197 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
198 | g_signal_connect (view, "navigation-policy-decision-requested", |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
199 | G_CALLBACK (webview_link_clicked), |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
200 | view); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
201 | view->empty = TRUE; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
202 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
203 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
204 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
205 | void |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
206 | gtk_webview_load_html_string_with_imgstore (GtkWebView* view, const char* html) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
207 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
208 | char* html_imged; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
209 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
210 | clear_images (view); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
211 | html_imged = replace_img_id_with_src (view, html); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
212 | printf ("%s\n", html_imged); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
213 | webkit_web_view_load_html_string (WEBKIT_WEB_VIEW (view), html_imged, "file:///"); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
214 | g_free (html_imged); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
215 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
216 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
217 | char *gtk_webview_quote_js_string(const char *text) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
218 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
219 | GString *str = g_string_new("\""); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
220 | const char *cur = text; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
221 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
222 | while (cur && *cur) { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
223 | switch (*cur) { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
224 | case '\\': |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
225 | g_string_append(str, "\\\\"); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
226 | break; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
227 | case '\"': |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
228 | g_string_append(str, "\\\""); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
229 | break; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
230 | case '\r': |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
231 | g_string_append(str, "<br/>"); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
232 | break; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
233 | case '\n': |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
234 | break; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
235 | default: |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
236 | g_string_append_c(str, *cur); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
237 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
238 | cur ++; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
239 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
240 | g_string_append_c (str, '"'); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
241 | return g_string_free (str, FALSE); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
242 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
243 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
244 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
245 | /* this is a "hack", my plan is to eventually handle this |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
246 | * correctly using a signals and a plugin: the plugin will have |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
247 | * the information as to what javascript function to call. It seems |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
248 | * wrong to hardcode that here. |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
249 | */ |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
250 | void |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
251 | gtk_webview_append_html (GtkWebView* view, const char* html) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
252 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
253 | char* escaped = gtk_webview_quote_js_string (html); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
254 | char* script = g_strdup_printf ("document.write(%s)", escaped); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
255 | printf ("script: %s\n", script); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
256 | webkit_web_view_execute_script (WEBKIT_WEB_VIEW (view), script); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
257 | view->empty = FALSE; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
258 | g_free (script); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
259 | g_free (escaped); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
260 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
261 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
262 | char* |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
263 | gtk_webview_get_markup (GtkWebView *view) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
264 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
265 | return gtk_webview_execute_script (view, "document.body.innerHTML"); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
266 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
267 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
268 | char* |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
269 | gtk_webview_get_text (GtkWebView *view) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
270 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
271 | return gtk_webview_execute_script (view, "document.body.textContent"); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
272 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
273 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
274 | gboolean gtk_webview_is_empty (GtkWebView *view) |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
275 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
276 | return view->empty; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
277 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
278 | |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
279 | GType gtk_webview_get_type () |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
280 | { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
281 | static GType mview_type = 0; |
| 32446 | 282 | if (G_UNLIKELY (mview_type == 0)) { |
|
32441
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
283 | static const GTypeInfo mview_info = { |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
284 | sizeof (GtkWebViewClass), |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
285 | NULL, |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
286 | NULL, |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
287 | (GClassInitFunc) gtk_webview_class_init, |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
288 | NULL, |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
289 | NULL, |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
290 | sizeof (GtkWebView), |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
291 | 0, |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
292 | (GInstanceInitFunc) gtk_webview_init, |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
293 | NULL |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
294 | }; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
295 | mview_type = g_type_register_static(webkit_web_view_get_type (), |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
296 | "GtkWebView", &mview_info, 0); |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
297 | } |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
298 | return mview_type; |
|
8a015ca299f9
Apparently I missed these in my previous commit.
Arnold Noronha <tdrhq@soc.pidgin.im>
parents:
diff
changeset
|
299 | } |