[evolution/webkit] Change bind_func slightly
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit] Change bind_func slightly
- Date: Mon, 26 Mar 2012 20:48:06 +0000 (UTC)
commit ef6e3beecbaa80210b5f53f3eba157e751d373b4
Author: Dan VrÃtil <dvratil redhat com>
Date: Thu Mar 15 19:41:07 2012 +0100
Change bind_func slightly
Instead of passing EMailDisplay and letting callee to find itself in the
entire document, EMailDisplay will find the top-level DOM element of the
PURI and will pass it to the handler
em-format/em-format.h | 4 ++--
mail/e-mail-display.c | 16 +++++++++++-----
plugins/vcard-inline/vcard-inline.c | 10 ++--------
3 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/em-format/em-format.h b/em-format/em-format.h
index 8f3a718..5b93294 100644
--- a/em-format/em-format.h
+++ b/em-format/em-format.h
@@ -65,7 +65,7 @@ typedef struct _EMFormatHeader EMFormatHeader;
typedef struct _EMFormatHandler EMFormatHandler;
typedef struct _EMFormatParserInfo EMFormatParserInfo;
typedef struct _EMFormatWriterInfo EMFormatWriterInfo;
-typedef struct _EMailDisplay EMailDisplay;
+typedef struct _WebKitDOMElement WebKitDOMElement;
typedef void (*EMFormatParseFunc) (EMFormat *emf,
CamelMimePart *part,
@@ -80,7 +80,7 @@ typedef void (*EMFormatWriteFunc) (EMFormat *emf,
typedef GtkWidget* (*EMFormatWidgetFunc) (EMFormat *emf,
EMFormatPURI *puri,
GCancellable *cancellable);
-typedef void (*EMailDisplayBindFunc) (EMailDisplay *display,
+typedef void (*EMailDisplayBindFunc) (WebKitDOMElement *root,
EMFormatPURI *puri);
typedef enum {
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index af9a4e2..8629414 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -893,10 +893,10 @@ mail_display_plugin_widget_requested (WebKitWebView *web_view,
* is expanded/collapsed or shown/hidden */
g_signal_connect_data (widget, "notify::expanded",
G_CALLBACK (attachment_button_expanded),
- g_object_ref (attachment), g_object_unref, 0);
+ g_object_ref (attachment), (GClosureNotify) g_object_unref, 0);
g_signal_connect_data (widget, "notify::visible",
G_CALLBACK (attachment_button_expanded),
- g_object_ref (attachment), g_object_unref, 0);
+ g_object_ref (attachment), (GClosureNotify) g_object_unref, 0);
/* Initial synchronization */
attachment_button_expanded (G_OBJECT (widget),
NULL, attachment);
@@ -1115,6 +1115,7 @@ puri_bind_dom (GObject *object,
WebKitWebFrame *frame;
WebKitLoadStatus load_status;
WebKitWebView *web_view;
+ WebKitDOMDocument *document;
EMailDisplay *display;
GList *iter;
EMFormat *emf;
@@ -1138,6 +1139,8 @@ puri_bind_dom (GObject *object,
emf->mail_part_table,
webkit_web_frame_get_name (frame));
+ document = webkit_web_view_get_dom_document (web_view);
+
while (iter) {
EMFormatPURI *puri = iter->data;
@@ -1145,13 +1148,16 @@ puri_bind_dom (GObject *object,
if (!puri)
continue;
- /* Iterate the PURI rendered in the frame and all it's "subPURIs" */
+ /* Iterate only the PURI rendered in the frame and all it's "subPURIs" */
if (!g_str_has_prefix (puri->uri, frame_puri))
break;
if (puri->bind_func) {
- d(printf("bind_func for %s", puri->uri));
- puri->bind_func (display, puri);
+ WebKitDOMElement *el = find_element_by_id (document, puri->uri);
+ if (el) {
+ d(printf("bind_func for %s\n", puri->uri));
+ puri->bind_func (el, puri);
+ }
}
iter = iter->next;
diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c
index 16a797a..7ddfb19 100644
--- a/plugins/vcard-inline/vcard-inline.c
+++ b/plugins/vcard-inline/vcard-inline.c
@@ -257,22 +257,16 @@ org_gnome_vcard_inline_toggle_cb (WebKitDOMEventTarget *button,
}
static void
-org_gnome_vcard_inline_bind_dom (EMailDisplay *display,
+org_gnome_vcard_inline_bind_dom (WebKitDOMElement *attachment,
EMFormatPURI *puri)
{
- WebKitDOMDocument *document;
- WebKitDOMElement *attachment;
WebKitDOMNodeList *list;
WebKitDOMElement *iframe, *toggle_button, *save_button;
VCardInlinePURI *vcard_object;
vcard_object = (VCardInlinePURI *) puri;
- document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (display));
- attachment = webkit_dom_document_get_element_by_id (document, puri->uri);
- if (!attachment)
- return;
- /* IFRAME */
+ /* IFRAME */
list = webkit_dom_element_get_elements_by_tag_name (attachment, "iframe");
if (webkit_dom_node_list_get_length (list) != 1)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]