From c025ffbb296501d2da8cba78aa6a14008055cf87 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 16 May 2013 13:10:26 -0400 Subject: Add e_mail_part_get_id(). --- mail/e-mail-display.c | 14 ++++++-------- mail/em-utils.c | 15 ++++++++++----- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'mail') diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index 00c5d2df4f..b899ca46fd 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -1201,21 +1201,19 @@ mail_parts_bind_dom (GObject *object, for (link = head; link != NULL; link = g_list_next (link)) { EMailPart *part = E_MAIL_PART (link->data); + WebKitDOMElement *element; + const gchar *part_id; /* Iterate only the parts rendered in * the frame and all it's subparts. */ if (!g_str_has_prefix (part->id, frame_name)) break; - if (part->bind_func != NULL) { - WebKitDOMElement *element; + part_id = e_mail_part_get_id (part); + element = find_element_by_id (document, part_id); - element = find_element_by_id (document, part->id); - if (element != NULL) { - d (printf ("/*bind_func*/ for %s\n", part->id)); - part->bind_func (part, element); - } - } + if (element != NULL && part->bind_func != NULL) + part->bind_func (part, element); } while (!g_queue_is_empty (&queue)) diff --git a/mail/em-utils.c b/mail/em-utils.c index 8e7d48bd19..3e3f9f022b 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -1198,6 +1198,7 @@ static gboolean is_only_text_part_in_this_level (GList *parts, EMailPart *text_html_part) { + const gchar *text_html_part_id; const gchar *dot; gint level_len; GList *iter; @@ -1205,13 +1206,16 @@ is_only_text_part_in_this_level (GList *parts, g_return_val_if_fail (parts != NULL, FALSE); g_return_val_if_fail (text_html_part != NULL, FALSE); - dot = strrchr (text_html_part->id, '.'); + text_html_part_id = e_mail_part_get_id (text_html_part); + + dot = strrchr (text_html_part_id, '.'); if (!dot) return FALSE; - level_len = dot - text_html_part->id; + level_len = dot - text_html_part_id; for (iter = parts; iter; iter = iter->next) { EMailPart *part = E_MAIL_PART (iter->data); + const gchar *part_id; if (part == NULL) continue; @@ -1228,9 +1232,10 @@ is_only_text_part_in_this_level (GList *parts, if (part->mime_type == NULL) continue; - dot = strrchr (part->id, '.'); - if (dot - part->id != level_len || - strncmp (text_html_part->id, part->id, level_len) != 0) + part_id = e_mail_part_get_id (part); + dot = strrchr (part_id, '.'); + if (dot - part_id != level_len || + strncmp (text_html_part_id, part_id, level_len) != 0) continue; if (g_ascii_strncasecmp (part->mime_type, "text/", 5) == 0) -- cgit v1.2.3