[evolution/wip/camel-more-gobject] Rename camel_medium_get_headers() to camel_medium_dup_headers()
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/camel-more-gobject] Rename camel_medium_get_headers() to camel_medium_dup_headers()
- Date: Tue, 1 Nov 2016 11:41:36 +0000 (UTC)
commit ee004ad6b769e9bbbbedeaef6e5ca9ddcbf8a8c5
Author: Milan Crha <mcrha redhat com>
Date: Tue Nov 1 12:41:46 2016 +0100
Rename camel_medium_get_headers() to camel_medium_dup_headers()
src/composer/e-msg-composer.c | 17 ++++++++++-------
src/em-format/e-mail-part-headers.c | 29 ++++++++++++++++-------------
2 files changed, 26 insertions(+), 20 deletions(-)
---
diff --git a/src/composer/e-msg-composer.c b/src/composer/e-msg-composer.c
index cb89c25..84fe5a5 100644
--- a/src/composer/e-msg-composer.c
+++ b/src/composer/e-msg-composer.c
@@ -1517,7 +1517,7 @@ composer_build_message_finish (EMsgComposer *composer,
CAMEL_IS_MIME_PART (context->top_level_part)) {
CamelDataWrapper *content;
CamelMedium *imedium, *omedium;
- GArray *headers;
+ CamelNameValueArray *headers;
imedium = CAMEL_MEDIUM (context->top_level_part);
omedium = CAMEL_MEDIUM (context->message);
@@ -1526,17 +1526,20 @@ composer_build_message_finish (EMsgComposer *composer,
camel_medium_set_content (omedium, content);
omedium->parent.encoding = imedium->parent.encoding;
- headers = camel_medium_get_headers (imedium);
+ headers = camel_medium_dup_headers (imedium);
if (headers) {
- gint ii;
+ gint ii, length;
+ length = camel_name_value_array_get_length (headers);
- for (ii = 0; ii < headers->len; ii++) {
- CamelMediumHeader *hdr = &g_array_index (headers, CamelMediumHeader,
ii);
+ for (ii = 0; ii < length; ii++) {
+ const gchar *header_name = NULL;
+ const gchar *header_value = NULL;
- camel_medium_set_header (omedium, hdr->name, hdr->value);
+ if (camel_name_value_array_get (headers, ii, &header_name,
&header_value))
+ camel_medium_set_header (omedium, header_name, header_value);
}
- camel_medium_free_headers (imedium, headers);
+ camel_name_value_array_free (headers);
}
} else {
camel_medium_set_content (
diff --git a/src/em-format/e-mail-part-headers.c b/src/em-format/e-mail-part-headers.c
index da37b81..fd53d79 100644
--- a/src/em-format/e-mail-part-headers.c
+++ b/src/em-format/e-mail-part-headers.c
@@ -61,7 +61,7 @@ mail_part_headers_build_print_model (EMailPartHeaders *part)
GtkListStore *list_store;
EMailPartList *part_list;
CamelMimeMessage *message;
- GArray *array;
+ CamelNameValueArray *headers;
gint default_position = 0;
guint ii, length = 0;
@@ -78,34 +78,37 @@ mail_part_headers_build_print_model (EMailPartHeaders *part)
G_TYPE_STRING); /* HEADER_VALUE */
message = e_mail_part_list_get_message (part_list);
- array = camel_medium_get_headers (CAMEL_MEDIUM (message));
+ headers = camel_medium_dup_headers (CAMEL_MEDIUM (message));
- if (array != NULL)
- length = array->len;
+ if (headers != NULL)
+ length = camel_name_value_array_get_length (headers);
for (ii = 0; ii < length; ii++) {
- CamelMediumHeader *header;
GtkTreeIter iter;
gboolean include = FALSE;
gint position = -1;
+ const gchar *header_name = NULL;
+ const gchar *header_value = NULL;
- header = &g_array_index (array, CamelMediumHeader, ii);
+ if (!camel_name_value_array_get (headers, ii, &header_name, &header_value) ||
+ !header_name || !header_value)
+ continue;
/* EMailFormatterPrintHeaders excludes "Subject" from
* its header table (because it puts it in an <h1> tag
* at the top of the page), so we'll exclude it too. */
- if (g_ascii_strncasecmp (header->name, "Subject", 7) == 0)
+ if (g_ascii_strncasecmp (header_name, "Subject", 7) == 0)
continue;
/* Also skip the 'Face' header, which includes only
base64 encoded data anyway. */
- if (g_ascii_strcasecmp (header->name, "Face") == 0)
+ if (g_ascii_strcasecmp (header_value, "Face") == 0)
continue;
/* Arrange default headers first and select them to be
* included in the final printout. All other headers
* are excluded by default in the final printout. */
- if (e_mail_part_headers_is_default (part, header->name)) {
+ if (e_mail_part_headers_is_default (part, header_name)) {
position = default_position++;
include = TRUE;
}
@@ -117,14 +120,14 @@ mail_part_headers_build_print_model (EMailPartHeaders *part)
E_MAIL_PART_HEADERS_PRINT_MODEL_COLUMN_INCLUDE,
include,
E_MAIL_PART_HEADERS_PRINT_MODEL_COLUMN_HEADER_NAME,
- header->name,
+ header_name,
E_MAIL_PART_HEADERS_PRINT_MODEL_COLUMN_HEADER_VALUE,
- header->value,
+ header_value,
-1);
}
- if (array != NULL)
- camel_medium_free_headers (CAMEL_MEDIUM (message), array);
+ if (headers != NULL)
+ camel_name_value_array_free (headers);
g_object_unref (part_list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]