X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-text-utils.c;h=5906bb7de158bb02b940c971f4bb51d2ae80acd4;hp=f2ca84088c2f6d9eb20451cb4fee7cc67dfffc15;hb=33b5d84fbaaf8dd4eafe4176dba08213c046463f;hpb=d39a0b6738e86acb01327d641b6e78eb0afa8c63 diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index f2ca840..5906bb7 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -653,6 +653,30 @@ modest_text_utils_address_range_at_position (const gchar *recipients_list, *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 ************************ */ @@ -834,10 +858,15 @@ modest_text_utils_quote_plain_text (const gchar *text, gsize len; gchar *attachments_string = NULL; - /* remaining will store the rest of the line if we have to break it */ q = g_string_new ("\n"); + if (signature != NULL) { + q = g_string_append (q, signature); + q = g_string_append_c (q, '\n'); + } q = g_string_append (q, cite); q = g_string_append_c (q, '\n'); + + /* remaining will store the rest of the line if we have to break it */ remaining = g_string_new (""); iter = text; @@ -884,11 +913,6 @@ modest_text_utils_quote_plain_text (const gchar *text, q = g_string_append (q, attachments_string); g_free (attachments_string); - if (signature != NULL) { - q = g_string_append_c (q, '\n'); - q = g_string_append (q, signature); - } - return g_string_free (q, FALSE); } @@ -1687,3 +1711,23 @@ modest_text_utils_buffer_selection_is_valid (GtkTextBuffer *buffer) return result; } + +gchar * +modest_text_utils_escape_mnemonics (const gchar *text) +{ + const gchar *p; + GString *result = NULL; + + if (text == NULL) + return NULL; + + result = g_string_new (""); + for (p = text; *p != '\0'; p++) { + if (*p == '_') + result = g_string_append (result, "__"); + else + result = g_string_append_c (result, *p); + } + + return g_string_free (result, FALSE); +}