soc.2009.webkitmessageview: 42e91db1: Yep, tested, and changed some code from ...
tdrhq at soc.pidgin.im
tdrhq at soc.pidgin.im
Tue Aug 25 12:02:12 EDT 2009
-----------------------------------------------------------------
Revision: 42e91db125cee1c3d56784a26618afe0bb7f9dec
Ancestor: 9ce58be3c321eb4d5785d13edc89a3993aaf921c
Author: tdrhq at soc.pidgin.im
Date: 2009-08-10T07:42:54
Branch: im.pidgin.soc.2009.webkitmessageview
URL: http://d.pidgin.im/viewmtn/revision/info/42e91db125cee1c3d56784a26618afe0bb7f9dec
Modified files:
pidgin/gtkwebview.c pidgin/plugins/adiumthemes/webkit.c
ChangeLog:
Yep, tested, and changed some code from previous commit. This is a hard
to test code, so I just hope it works flawlessly. :)
-------------- next part --------------
============================================================
--- pidgin/gtkwebview.c 341d6be43d3db18c70c294a37e6fc70aae7eb034
+++ pidgin/gtkwebview.c 6f53dd006aaa41c751c2e6c9502700b62baa9753
@@ -155,6 +155,12 @@ gtk_webview_finalize (GObject *view)
static void
gtk_webview_finalize (GObject *view)
{
+ gpointer temp;
+
+ while ((temp = g_queue_pop_head (GTK_WEBVIEW(view)->priv->js_queue)))
+ g_free (temp);
+ g_queue_free (GTK_WEBVIEW(view)->priv->js_queue);
+
clear_images (GTK_WEBVIEW (view));
g_free (GTK_WEBVIEW(view)->priv);
G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT(view));
@@ -260,6 +266,7 @@ gtk_webview_init (GtkWebView *view, gpoi
view);
view->priv->empty = TRUE;
+ view->priv->js_queue = g_queue_new ();
}
============================================================
--- pidgin/plugins/adiumthemes/webkit.c ebd963b2a5149f5328992628e9fa1ca1fb88e149
+++ pidgin/plugins/adiumthemes/webkit.c 6105e117d4c615581c72f9fa5e0245ec1a049b5e
@@ -494,22 +494,6 @@ webkit_on_webview_destroy (GtkObject *ob
g_object_set_data (G_OBJECT(object), MESSAGE_STYLE_KEY, NULL);
}
-struct webkit_script {
- GtkWidget *webkit;
- char *script;
-};
-
-static gboolean purple_webkit_execute_script(gpointer _script)
-{
- struct webkit_script *script = (struct webkit_script*) _script;
- printf ("%s\n", script->script);
- webkit_web_view_execute_script(WEBKIT_WEB_VIEW(script->webkit), script->script);
- g_free(script->script);
- g_free(script);
- return FALSE;
-}
-
-
static gboolean webkit_on_displaying_im_msg (PurpleAccount *account,
const char* name,
char **pmessage,
@@ -529,7 +513,6 @@ static gboolean webkit_on_displaying_im_
char *smileyed;
time_t mtime = time (NULL); /* FIXME: this should come from the write_conv calback, but the signal doesn't pass this to me */
- struct webkit_script *wk_script;
PurpleMessageFlags old_flags = GPOINTER_TO_INT(purple_conversation_get_data(conv, "webkit-lastflags"));
PidginMessageStyle *style;
@@ -560,12 +543,9 @@ static gboolean webkit_on_displaying_im_
escape = gtk_webview_quote_js_string (msg);
script = g_strdup_printf("%s(%s)", func, escape);
- wk_script = g_new0(struct webkit_script, 1);
- wk_script->script = script;
- wk_script->webkit = webkit;
+ gtk_webview_safe_execute_script (GTK_WEBVIEW (webkit), script);
- g_idle_add (purple_webkit_execute_script, wk_script);
-
+ g_free(script);
g_free(smileyed);
g_free(msg);
g_free(stripped);
@@ -761,7 +741,7 @@ variant_update_conversation (PurpleConve
g_assert (style && style->css_path);
script = g_strdup_printf ("setStylesheet(\"mainStyle\",\"%s\")", style->css_path);
- webkit_web_view_execute_script (webview, script);
+ gtk_webview_safe_execute_script (GTK_WEBVIEW(webview), script);
g_free (script);
}
More information about the Commits
mailing list