[evolution] Add e_mail_part_id_has_prefix().



commit 366b731a169ac54a0407f5d85879c38ba463398a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat May 18 10:36:20 2013 -0400

    Add e_mail_part_id_has_prefix().

 em-format/e-mail-formatter-print-headers.c         |    4 ++--
 em-format/e-mail-part.c                            |   10 ++++++++++
 em-format/e-mail-part.h                            |    2 ++
 mail/e-mail-display.c                              |    2 +-
 .../e-mail-display-popup-prefer-plain.c            |    2 +-
 5 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/em-format/e-mail-formatter-print-headers.c b/em-format/e-mail-formatter-print-headers.c
index 2345b78..6eec667 100644
--- a/em-format/e-mail-formatter-print-headers.c
+++ b/em-format/e-mail-formatter-print-headers.c
@@ -137,7 +137,7 @@ emfpe_headers_format (EMailFormatterExtension *extension,
                if (g_queue_is_empty (&mail_part->validities))
                        continue;
 
-               if (!g_str_has_prefix (mail_part->id, part_id_prefix))
+               if (!e_mail_part_id_has_prefix (mail_part, part_id_prefix))
                        continue;
 
                if (e_mail_part_get_validity (mail_part, E_MAIL_PART_VALIDITY_PGP | 
E_MAIL_PART_VALIDITY_SIGNED)) {
@@ -181,7 +181,7 @@ emfpe_headers_format (EMailFormatterExtension *extension,
        for (link = head; link != NULL; link = g_list_next (link)) {
                EMailPart *mail_part = E_MAIL_PART (link->data);
 
-               if (!g_str_has_prefix (mail_part->id, part_id_prefix))
+               if (!e_mail_part_id_has_prefix (mail_part, part_id_prefix))
                        continue;
 
                if (!mail_part->is_attachment)
diff --git a/em-format/e-mail-part.c b/em-format/e-mail-part.c
index 15bd309..95e4929 100644
--- a/em-format/e-mail-part.c
+++ b/em-format/e-mail-part.c
@@ -201,6 +201,16 @@ e_mail_part_set_cid (EMailPart *part,
        part->cid = g_strdup (cid);
 }
 
+gboolean
+e_mail_part_id_has_prefix (EMailPart *part,
+                           const gchar *prefix)
+{
+       g_return_val_if_fail (part != NULL, FALSE);
+       g_return_val_if_fail (prefix != NULL, FALSE);
+
+       return g_str_has_prefix (part->id, prefix);
+}
+
 static EMailPartValidityPair *
 mail_part_find_validity_pair (EMailPart *part,
                               guint32 validity_type)
diff --git a/em-format/e-mail-part.h b/em-format/e-mail-part.h
index e3e2e26..8a71d3b 100644
--- a/em-format/e-mail-part.h
+++ b/em-format/e-mail-part.h
@@ -99,6 +99,8 @@ const gchar * e_mail_part_get_id              (EMailPart *part);
 const gchar *  e_mail_part_get_cid             (EMailPart *part);
 void           e_mail_part_set_cid             (EMailPart *part,
                                                 const gchar *cid);
+gboolean       e_mail_part_id_has_prefix       (EMailPart *part,
+                                                const gchar *prefix);
 void           e_mail_part_update_validity     (EMailPart *part,
                                                 CamelCipherValidity *validity,
                                                 guint32 validity_type);
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index b899ca4..c70e12e 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1206,7 +1206,7 @@ mail_parts_bind_dom (GObject *object,
 
                /* Iterate only the parts rendered in
                 * the frame and all it's subparts. */
-               if (!g_str_has_prefix (part->id, frame_name))
+               if (!e_mail_part_id_has_prefix (part, frame_name))
                        break;
 
                part_id = e_mail_part_get_id (part);
diff --git a/modules/prefer-plain/e-mail-display-popup-prefer-plain.c 
b/modules/prefer-plain/e-mail-display-popup-prefer-plain.c
index 9b7de92..3935263 100644
--- a/modules/prefer-plain/e-mail-display-popup-prefer-plain.c
+++ b/modules/prefer-plain/e-mail-display-popup-prefer-plain.c
@@ -314,7 +314,7 @@ mail_display_popup_prefer_plain_update_actions (EMailDisplayPopupExtension *exte
        for (link = head; link != NULL; link = g_list_next (link)) {
                EMailPart *p = link->data;
 
-               if (g_str_has_prefix (p->id, prefix) &&
+               if (e_mail_part_id_has_prefix (p, prefix) &&
                    (strstr (p->id, "text_html") || strstr (p->id, "plain_text"))) {
                        const gchar *p_id;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]