Commit d0759c43 authored by Milan Crha's avatar Milan Crha

Expand/collapse buttons in vCard preview do nothing

Clicking the buttons didn't do anything, because the DOM binding
was not done when the inner iframe had been loaded in case of the Mail
preview and because the Contacts preview used incorrect signal binding.
parent a1798c9e
......@@ -534,8 +534,8 @@ eab_contact_display_init (EABContactDisplay *display)
display, "web-process-crashed",
G_CALLBACK (contact_display_web_process_crashed_cb), NULL);
e_signal_connect_notify (
web_view, "notify::load-changed",
g_signal_connect (
web_view, "load-changed",
G_CALLBACK (contact_display_load_changed), NULL);
g_signal_connect (
web_view, "style-updated",
......
......@@ -1613,12 +1613,27 @@ e_dom_utils_module_vcard_inline_update_button (WebKitDOMDocument *document,
}
}
static void
iframe_inner_doc_gone (gpointer iframe,
GObject *inner_doc)
{
WebKitDOMDocument *inner_document;
inner_document = webkit_dom_html_iframe_element_get_content_document (iframe);
if (inner_document)
e_dom_utils_eab_contact_formatter_bind_dom (inner_document);
g_object_unref (iframe);
}
void
e_dom_utils_module_vcard_inline_set_iframe_src (WebKitDOMDocument *document,
const gchar *button_id,
const gchar *src)
{
WebKitDOMElement *element, *parent, *iframe;
WebKitDOMDocument *inner_document;
gchar *selector;
selector = g_strconcat ("button[id='", button_id, "']", NULL);
......@@ -1633,6 +1648,12 @@ e_dom_utils_module_vcard_inline_set_iframe_src (WebKitDOMDocument *document,
if (!iframe)
return;
inner_document = webkit_dom_html_iframe_element_get_content_document (WEBKIT_DOM_HTML_IFRAME_ELEMENT (iframe));
/* This is an ugly hack, relying on the WebKitGTK+ behavior to
free the inner document GObject when the new source is loaded. */
g_object_weak_ref (G_OBJECT (inner_document), iframe_inner_doc_gone, g_object_ref (iframe));
webkit_dom_html_iframe_element_set_src (
WEBKIT_DOM_HTML_IFRAME_ELEMENT (iframe), src);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment