aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--em-format/e-mail-formatter-attachment.c26
-rw-r--r--em-format/e-mail-formatter-print-headers.c2
-rw-r--r--em-format/e-mail-formatter-secure-button.c12
-rw-r--r--em-format/e-mail-part.c25
-rw-r--r--em-format/e-mail-part.h6
-rw-r--r--mail/e-mail-reader-utils.c22
-rw-r--r--mail/em-utils.c15
7 files changed, 60 insertions, 48 deletions
diff --git a/em-format/e-mail-formatter-attachment.c b/em-format/e-mail-formatter-attachment.c
index 25df816186..54647edd4a 100644
--- a/em-format/e-mail-formatter-attachment.c
+++ b/em-format/e-mail-formatter-attachment.c
@@ -126,21 +126,25 @@ emfe_attachment_format (EMailFormatterExtension *extension,
if ((context->mode == E_MAIL_FORMATTER_MODE_NORMAL) ||
(context->mode == E_MAIL_FORMATTER_MODE_PRINTING) ||
(context->mode == E_MAIL_FORMATTER_MODE_ALL_HEADERS)) {
- if (part->validities) {
- GSList *lst;
+ GList *head, *link;
- for (lst = part->validities; lst; lst = lst->next) {
- EMailPartValidityPair *pair = lst->data;
+ head = g_queue_peek_head_link (&part->validities);
- if (!pair)
- continue;
+ for (link = head; link != NULL; link = g_list_next (link)) {
+ EMailPartValidityPair *pair = link->data;
- if ((pair->validity_type & E_MAIL_PART_VALIDITY_SIGNED) != 0)
- e_attachment_set_signed (empa->attachment, pair->validity->sign.status);
+ if (pair == NULL)
+ continue;
- if ((pair->validity_type & E_MAIL_PART_VALIDITY_ENCRYPTED) != 0)
- e_attachment_set_encrypted (empa->attachment, pair->validity->encrypt.status);
- }
+ if ((pair->validity_type & E_MAIL_PART_VALIDITY_SIGNED) != 0)
+ e_attachment_set_signed (
+ empa->attachment,
+ pair->validity->sign.status);
+
+ if ((pair->validity_type & E_MAIL_PART_VALIDITY_ENCRYPTED) != 0)
+ e_attachment_set_encrypted (
+ empa->attachment,
+ pair->validity->encrypt.status);
}
store = find_attachment_store (context->part_list, part->id);
diff --git a/em-format/e-mail-formatter-print-headers.c b/em-format/e-mail-formatter-print-headers.c
index a79dfa1f70..03d35c300c 100644
--- a/em-format/e-mail-formatter-print-headers.c
+++ b/em-format/e-mail-formatter-print-headers.c
@@ -130,7 +130,7 @@ emfpe_headers_format (EMailFormatterExtension *extension,
for (link = head; link != NULL; link = g_list_next (link)) {
EMailPart *mail_part = link->data;
- if (!mail_part->validities)
+ if (g_queue_is_empty (&mail_part->validities))
continue;
if (!g_str_has_prefix (mail_part->id, part_id_prefix))
diff --git a/em-format/e-mail-formatter-secure-button.c b/em-format/e-mail-formatter-secure-button.c
index 571b90d220..442a6d3e26 100644
--- a/em-format/e-mail-formatter-secure-button.c
+++ b/em-format/e-mail-formatter-secure-button.c
@@ -428,7 +428,7 @@ emfe_secure_button_get_widget (EMailFormatterExtension *extension,
GHashTable *params)
{
GtkWidget *grid;
- GSList *lst;
+ GList *head, *link;
g_return_val_if_fail (part != NULL, NULL);
@@ -440,15 +440,17 @@ emfe_secure_button_get_widget (EMailFormatterExtension *extension,
"hexpand", TRUE,
NULL);
- for (lst = part->validities; lst; lst = lst->next) {
- EMailPartValidityPair *pair = lst->data;
+ head = g_queue_peek_head_link (&part->validities);
+
+ for (link = head; link != NULL; link = g_list_next (link)) {
+ EMailPartValidityPair *pair = link->data;
GtkWidget *widget;
- if (!pair)
+ if (pair == NULL)
continue;
widget = secure_button_get_widget_for_validity (pair->validity);
- if (widget) {
+ if (widget != NULL) {
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_widget_set_hexpand (widget, TRUE);
gtk_container_add (GTK_CONTAINER (grid), widget);
diff --git a/em-format/e-mail-part.c b/em-format/e-mail-part.c
index 657b677cb9..9e280e07bf 100644
--- a/em-format/e-mail-part.c
+++ b/em-format/e-mail-part.c
@@ -53,6 +53,8 @@ mail_part_validity_pair_free (gpointer ptr)
static void
mail_part_free (EMailPart *part)
{
+ EMailPartValidityPair *pair;
+
if (!part)
return;
@@ -71,10 +73,8 @@ mail_part_free (EMailPart *part)
part->mime_type = NULL;
}
- if (part->validities) {
- g_slist_free_full (part->validities, mail_part_validity_pair_free);
- part->validities = NULL;
- }
+ while ((pair = g_queue_pop_head (&part->validities)) != NULL)
+ mail_part_validity_pair_free (pair);
if (part->priv->free_func) {
part->priv->free_func (part);
@@ -180,12 +180,17 @@ static EMailPartValidityPair *
mail_part_find_validity_pair (EMailPart *part,
guint32 validity_type)
{
- GSList *lst;
+ GList *head, *link;
+
+ head = g_queue_peek_head_link (&part->validities);
+
+ for (link = head; link != NULL; link = g_list_next (link)) {
+ EMailPartValidityPair *pair = link->data;
- for (lst = part->validities; lst; lst = lst->next) {
- EMailPartValidityPair *pair = lst->data;
+ if (pair == NULL)
+ continue;
- if (pair && (pair->validity_type & validity_type) == validity_type)
+ if ((pair->validity_type & validity_type) == validity_type)
return pair;
}
@@ -213,7 +218,7 @@ e_mail_part_update_validity (EMailPart *part,
g_return_if_fail (part != NULL);
pair = mail_part_find_validity_pair (part, validity_type & (E_MAIL_PART_VALIDITY_PGP | E_MAIL_PART_VALIDITY_SMIME));
- if (pair) {
+ if (pair != NULL) {
pair->validity_type |= validity_type;
camel_cipher_validity_envelope (pair->validity, validity);
} else {
@@ -221,7 +226,7 @@ e_mail_part_update_validity (EMailPart *part,
pair->validity_type = validity_type;
pair->validity = camel_cipher_validity_clone (validity);
- part->validities = g_slist_append (part->validities, pair);
+ g_queue_push_tail (&part->validities, pair);
}
}
diff --git a/em-format/e-mail-part.h b/em-format/e-mail-part.h
index 774828eb23..3d59d46087 100644
--- a/em-format/e-mail-part.h
+++ b/em-format/e-mail-part.h
@@ -36,7 +36,7 @@ typedef struct _EMailPartPrivate EMailPartPrivate;
typedef void (*EMailPartDOMBindFunc) (EMailPart *part,
WebKitDOMElement *element);
-enum {
+typedef enum {
E_MAIL_PART_VALIDITY_NONE = 0,
E_MAIL_PART_VALIDITY_PGP = 1 << 0,
E_MAIL_PART_VALIDITY_SMIME = 1 << 1,
@@ -47,7 +47,7 @@ enum {
typedef struct _EMailPartValidityPair EMailPartValidityPair;
struct _EMailPartValidityPair {
- guint32 validity_type; /* E_MAIL_PART_VALIDITY_ * flags */
+ EMailPartValidityFlags validity_type;
CamelCipherValidity *validity;
};
@@ -61,7 +61,7 @@ struct _EMailPart {
gchar *cid;
gchar *mime_type;
- GSList *validities; /* EMailPartValidityPair pointer */
+ GQueue validities; /* element-type: EMailPartValidityPair */
gint is_attachment: 1;
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 9ef55e022e..f495c664a1 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -1393,20 +1393,20 @@ e_mail_reader_reply_to_message (EMailReader *reader,
while (!g_queue_is_empty (&queue)) {
EMailPart *part = g_queue_pop_head (&queue);
+ GList *head, *link;
- if (part->validities) {
- GSList *viter;
+ head = g_queue_peek_head_link (&part->validities);
- for (viter = part->validities; viter; viter = viter->next) {
- EMailPartValidityPair *vpair = viter->data;
+ for (link = head; link != NULL; link = g_list_next (link)) {
+ EMailPartValidityPair *vpair = link->data;
- if (vpair) {
- if ((vpair->validity_type & E_MAIL_PART_VALIDITY_PGP) != 0)
- validity_pgp_sum |= vpair->validity_type;
- if ((vpair->validity_type & E_MAIL_PART_VALIDITY_SMIME) != 0)
- validity_smime_sum |= vpair->validity_type;
- }
- }
+ if (vpair == NULL)
+ continue;
+
+ if ((vpair->validity_type & E_MAIL_PART_VALIDITY_PGP) != 0)
+ validity_pgp_sum |= vpair->validity_type;
+ if ((vpair->validity_type & E_MAIL_PART_VALIDITY_SMIME) != 0)
+ validity_smime_sum |= vpair->validity_type;
}
e_mail_part_unref (part);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 011b49b883..470020415c 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1304,6 +1304,7 @@ em_utils_message_to_html (CamelSession *session,
for (link = head; link != NULL; link = g_list_next (link)) {
EMailPart *part = link->data;
+ GList *vhead, *vlink;
/* prefer-plain can hide HTML parts, even when it's the only
* text part in the email, thus show it (and hide again later) */
@@ -1315,15 +1316,15 @@ em_utils_message_to_html (CamelSession *session,
hidden_text_html_part = part;
}
- if (part->validities) {
- GSList *lst;
+ vhead = g_queue_peek_head_link (&part->validities);
- for (lst = part->validities; lst; lst = lst->next) {
- EMailPartValidityPair *pair = lst->data;
+ for (vlink = vhead; vlink != NULL; vlink = g_list_next (vlink)) {
+ EMailPartValidityPair *pair = vlink->data;
- if (pair)
- is_validity_found |= pair->validity_type;
- }
+ if (pair == NULL)
+ continue;
+
+ is_validity_found |= pair->validity_type;
}
}