diff options
author | Damon Chaplin <damon@helixcode.com> | 2000-05-07 00:47:27 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2000-05-07 00:47:27 +0800 |
commit | 9b57702d4d406955ce3ec2e841253ed3efe3bbb8 (patch) | |
tree | c2b1ad66aacbc7e4267485c5c34fcc8d0b122c91 /calendar/cal-util | |
parent | fc213a4931c274c8f269b21f168c12e728e45bf7 (diff) | |
download | gsoc2013-evolution-9b57702d4d406955ce3ec2e841253ed3efe3bbb8.tar gsoc2013-evolution-9b57702d4d406955ce3ec2e841253ed3efe3bbb8.tar.gz gsoc2013-evolution-9b57702d4d406955ce3ec2e841253ed3efe3bbb8.tar.bz2 gsoc2013-evolution-9b57702d4d406955ce3ec2e841253ed3efe3bbb8.tar.lz gsoc2013-evolution-9b57702d4d406955ce3ec2e841253ed3efe3bbb8.tar.xz gsoc2013-evolution-9b57702d4d406955ce3ec2e841253ed3efe3bbb8.tar.zst gsoc2013-evolution-9b57702d4d406955ce3ec2e841253ed3efe3bbb8.zip |
finish editing event when user hits Return key.
2000-05-06 Damon Chaplin <damon@helixcode.com>
* gui/e-day-view.c:
* gui/e-week-view.c: finish editing event when user hits Return key.
(e_week_view_on_text_item_event): stop event signals after doing any
other calls, since otherwise it will also stop any other resulting
event signals.
* gui/e-week-view-event-item.c (e_week_view_event_item_draw): don't
draw the start/end times while editing.
* gui/eventedit.c: changed the Summary field to a GtkEntry, since we
now only want a single line of text.
* cal-util/calobj.c (ical_object_normalize_summary): new function to
convert the summary field to a single line of text, by converting any
sequence of CR & LF characters to a single space.
(ical_object_create_from_vobject): call the above function. I think
all functions that load iCalObjects go through this.
(ical_new): called it here as well just in case.
svn path=/trunk/; revision=2827
Diffstat (limited to 'calendar/cal-util')
-rw-r--r-- | calendar/cal-util/calobj.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c index 9691d31c11..4ea3b495b0 100644 --- a/calendar/cal-util/calobj.c +++ b/calendar/cal-util/calobj.c @@ -22,6 +22,7 @@ #define PRODID "-//Helix Code//NONSGML Evolution Calendar//EN" static gint compare_exdates (gconstpointer a, gconstpointer b); +static void ical_object_normalize_summary (iCalObject *ico); @@ -90,6 +91,8 @@ ical_new (char *comment, char *organizer, char *summary) ico->malarm.type = ALARM_MAIL; ico->aalarm.type = ALARM_AUDIO; + ical_object_normalize_summary (ico); + return ico; } @@ -680,7 +683,11 @@ ical_object_create_from_vobject (VObject *o, const char *object_name) if (has (o, VCSummaryProp)){ ical->summary = g_strdup (str_val (vo)); free (the_str); - } else + + /* Convert any CR/LF/CRLF sequences in the summary field to + spaces so we just have a one-line field. */ + ical_object_normalize_summary (ical); + } else ical->summary = g_strdup (""); /* status */ @@ -1762,3 +1769,28 @@ compare_exdates (gconstpointer a, gconstpointer b) time_t diff = *ca - *cb; return (diff < 0) ? -1 : (diff > 0) ? 1 : 0; } + + +/* Converts any CR/LF sequences in the summary field to spaces so we just + have a one-line field. The iCalObjects summary field is changed. */ +static void +ical_object_normalize_summary (iCalObject *ico) +{ + gchar *src, *dest, ch; + gboolean just_output_space = FALSE; + + src = dest = ico->summary; + while ((ch = *src++)) { + if (ch == '\n' || ch == '\r') { + /* We only output 1 space for each sequence of CR & LF + characters. */ + if (!just_output_space) { + *dest++ = ' '; + just_output_space = TRUE; + } + } else { + *dest++ = ch; + just_output_space = FALSE; + } + } +} |