aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorMilan Crha <mcrha@src.gnome.org>2007-07-30 18:01:20 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-07-30 18:01:20 +0800
commita37c55760048564773e65bc3b94e9c52406ca403 (patch)
treefa002c2f29e9d63a80f600c119ee70e1f6a30f51 /calendar/gui
parent67a110f6f99c02bb8b7ccb46495525843923fef0 (diff)
downloadgsoc2013-evolution-a37c55760048564773e65bc3b94e9c52406ca403.tar.gz
gsoc2013-evolution-a37c55760048564773e65bc3b94e9c52406ca403.tar.zst
gsoc2013-evolution-a37c55760048564773e65bc3b94e9c52406ca403.zip
2007-07-30 mcrha Fix for bug #343716
svn path=/trunk/; revision=33898
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/dialogs/memo-page.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index 6f2d1af20f..816144042c 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -634,32 +634,30 @@ memo_page_fill_component (CompEditorPage *page, ECalComponent *comp)
e_cal_component_set_description_list (comp, NULL);
}
else {
- int idxToUse = -1, nstr = strlen(str);
- gboolean foundNL = FALSE;
+ int idxToUse = 1;
GSList l;
ECalComponentText text, sumText;
- char *txt;
-
- for(i = 0; i<nstr && i<50; i++){
- if(str[i] == '\n'){
- idxToUse = i;
- foundNL = TRUE;
+ char *txt, *p;
+ gunichar uc;
+
+ for(i = 0, p = str, uc = g_utf8_get_char_validated (p, -1);
+ i < 50 && p && uc < (gunichar)-2;
+ i++, p = g_utf8_next_char (p), uc = g_utf8_get_char_validated (p, -1)) {
+ idxToUse = p - str;
+ if (uc == '\n' || !uc) {
+ p = NULL;
break;
}
}
-
- if(foundNL == FALSE){
- if(nstr > 50){
- sumText.value = txt = g_strndup(str, 50);
- }
- else{
- sumText.value = txt = g_strdup(str);
- }
- }
- else{
- sumText.value = txt = g_strndup(str, idxToUse); /* cuts off '\n' */
- }
-
+
+ if (p)
+ idxToUse = p - str;
+
+ if (i == 50 && uc && uc < (gunichar)-2)
+ sumText.value = txt = g_strdup_printf ("%.*s...", idxToUse, str);
+ else
+ sumText.value = txt = g_strndup(str, idxToUse);
+
sumText.altrep = NULL;
text.value = str;