*end = range_end;
}
+gchar *
+modest_text_utils_address_with_standard_length (const gchar *recipients_list)
+{
+ gchar ** splitted;
+ gchar ** current;
+ GString *buffer = g_string_new ("");
+
+ splitted = g_strsplit (recipients_list, "\n", 0);
+ current = splitted;
+ while (*current) {
+ gchar *line;
+ if (current != splitted)
+ buffer = g_string_append_c (buffer, '\n');
+ line = g_strndup (*splitted, 1000);
+ buffer = g_string_append (buffer, line);
+ g_free (line);
+ current++;
+ }
+
+ g_strfreev (splitted);
+
+ return g_string_free (buffer, FALSE);
+}
+
/* ******************************************************************* */
/* ************************* UTILIY FUNCTIONS ************************ */
void modest_text_utils_get_addresses_indexes (const gchar *addresses, GSList **start_indexes, GSList **end_indexes);
/**
+ * modest_text_utils_address_with_standard_length:
+ * @recipients_list: a string
+ *
+ * obtains the list of recipients, but making sure that lines are not longer than 1000 chars
+ *
+ * Returns: a newly allocated string
+ */
+gchar * modest_text_utils_address_with_standard_length (const gchar *recipients_list);
+
+/**
* modest_text_utils_get_color_string:
* @color: a #GdkColor
*
{
const GtkWidget *text_view = NULL;
GtkTextBuffer *buffer = NULL;
+ gchar *std_recipients;
text_view = modest_scroll_text_get_text_view (MODEST_SCROLL_TEXT (recpt_view));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
- gtk_text_buffer_set_text (buffer, recipients, -1);
+ if (recipients == NULL) {
+ std_recipients = NULL;
+ } else {
+ std_recipients = modest_text_utils_address_with_standard_length (recipients);
+ }
+
+ gtk_text_buffer_set_text (buffer, std_recipients, -1);
+ g_free (std_recipients);
if (GTK_WIDGET_REALIZED (recpt_view))
gtk_widget_queue_resize (GTK_WIDGET (recpt_view));