balsa r8097 - in trunk: . libbalsa src
- From: PeterB svn gnome org
- To: svn-commits-list gnome org
- Subject: balsa r8097 - in trunk: . libbalsa src
- Date: Thu, 12 Mar 2009 02:32:27 +0000 (UTC)
Author: PeterB
Date: Thu Mar 12 02:32:27 2009
New Revision: 8097
URL: http://svn.gnome.org/viewvc/balsa?rev=8097&view=rev
Log:
handle calendar event descriptions better
Modified:
trunk/ChangeLog
trunk/libbalsa/rfc2445.c
trunk/src/balsa-mime-widget-vcalendar.c
Modified: trunk/libbalsa/rfc2445.c
==============================================================================
--- trunk/libbalsa/rfc2445.c (original)
+++ trunk/libbalsa/rfc2445.c Thu Mar 12 02:32:27 2009
@@ -256,6 +256,7 @@
gchar *p;
gchar **lines;
LibBalsaVEvent *event;
+ gboolean in_embedded;
int k;
g_return_val_if_fail(body != NULL, NULL);
@@ -305,6 +306,7 @@
/* scan lines to extract vevent(s) */
event = NULL;
method = NULL;
+ in_embedded = FALSE;
for (k = 0; lines[k]; k++) {
if (!event) {
if (!method && !g_ascii_strncasecmp("METHOD:", lines[k], 7))
@@ -319,33 +321,41 @@
*value++ = '\0';
entry = g_strsplit(lines[k], ";", -1);
if (!g_ascii_strcasecmp(entry[0], "END")) {
- retval->vevent = g_list_append(retval->vevent, event);
- event = NULL;
- } else if (!g_ascii_strcasecmp(entry[0], "DTSTART"))
- event->start = date_time_2445_to_time_t(value);
- else if (!g_ascii_strcasecmp(entry[0], "DTEND"))
- event->end = date_time_2445_to_time_t(value);
- else if (!g_ascii_strcasecmp(entry[0], "DTSTAMP"))
- event->stamp = date_time_2445_to_time_t(value);
- else if (!g_ascii_strcasecmp(entry[0], "UID"))
- STR_REPL_2445_TXT(event->uid, value);
- else if (!g_ascii_strcasecmp(entry[0], "SUMMARY"))
- STR_REPL_2445_TXT(event->summary, value);
- else if (!g_ascii_strcasecmp(entry[0], "LOCATION"))
- STR_REPL_2445_TXT(event->location, value);
- else if (!g_ascii_strcasecmp(entry[0], "DESCRIPTION"))
- STR_REPL_2445_TXT(event->description, value);
- else if (!g_ascii_strcasecmp(entry[0], "ORGANIZER")) {
- if (event->organizer)
- g_object_unref(event->organizer);
- event->organizer =
- cal_address_2445_to_lbaddress(value, entry + 1, TRUE);
- } else if (!g_ascii_strcasecmp(entry[0], "ATTENDEE"))
- event->attendee =
- g_list_prepend(event->attendee,
- cal_address_2445_to_lbaddress(value,
- entry + 1,
- FALSE));
+ if (!g_ascii_strcasecmp(entry[1], "VEVENT")) {
+ retval->vevent = g_list_append(retval->vevent, event);
+ event = NULL;
+ } else {
+ in_embedded = FALSE;
+ }
+ } else if (!g_ascii_strcasecmp(entry[0], "BEGIN"))
+ in_embedded = TRUE;
+ else if (!in_embedded) {
+ if (!g_ascii_strcasecmp(entry[0], "DTSTART"))
+ event->start = date_time_2445_to_time_t(value);
+ else if (!g_ascii_strcasecmp(entry[0], "DTEND"))
+ event->end = date_time_2445_to_time_t(value);
+ else if (!g_ascii_strcasecmp(entry[0], "DTSTAMP"))
+ event->stamp = date_time_2445_to_time_t(value);
+ else if (!g_ascii_strcasecmp(entry[0], "UID"))
+ STR_REPL_2445_TXT(event->uid, value);
+ else if (!g_ascii_strcasecmp(entry[0], "SUMMARY"))
+ STR_REPL_2445_TXT(event->summary, value);
+ else if (!g_ascii_strcasecmp(entry[0], "LOCATION"))
+ STR_REPL_2445_TXT(event->location, value);
+ else if (!g_ascii_strcasecmp(entry[0], "DESCRIPTION"))
+ STR_REPL_2445_TXT(event->description, value);
+ else if (!g_ascii_strcasecmp(entry[0], "ORGANIZER")) {
+ if (event->organizer)
+ g_object_unref(event->organizer);
+ event->organizer =
+ cal_address_2445_to_lbaddress(value, entry + 1, TRUE);
+ } else if (!g_ascii_strcasecmp(entry[0], "ATTENDEE"))
+ event->attendee =
+ g_list_prepend(event->attendee,
+ cal_address_2445_to_lbaddress(value,
+ entry + 1,
+ FALSE));
+ }
g_strfreev(entry);
}
}
Modified: trunk/src/balsa-mime-widget-vcalendar.c
==============================================================================
--- trunk/src/balsa-mime-widget-vcalendar.c (original)
+++ trunk/src/balsa-mime-widget-vcalendar.c Thu Mar 12 02:32:27 2009
@@ -133,6 +133,26 @@
} \
} while (0)
+#define TABLE_ATTACH_TEXT(t,text,label) \
+ do { \
+ if (text) { \
+ GtkWidget *lbl = gtk_label_new(label); \
+ GtkTextBuffer *tbuf = gtk_text_buffer_new(NULL); \
+ GtkWidget *tview; \
+ gtk_table_attach(t, lbl, 0, 1, row, row+1, \
+ GTK_FILL, GTK_FILL, 4, 2); \
+ gtk_misc_set_alignment(GTK_MISC(lbl), 1.0, 0.0); \
+ gtk_text_buffer_set_text(tbuf, text, -1); \
+ tview = gtk_text_view_new_with_buffer(tbuf); \
+ gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(tview), \
+ GTK_WRAP_WORD); \
+ gtk_table_attach(table, tview, 1, 2, row, row + 1, \
+ GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, \
+ 4, 2); \
+ row++; \
+ } \
+ } while (0)
+
static GtkWidget *
balsa_vevent_widget(LibBalsaVEvent * event, gboolean may_reply,
InternetAddress * sender)
@@ -180,7 +200,7 @@
event->attendee->next ? _("Attendees") : _("Attendee"));
g_string_free(all_atts, TRUE);
}
- TABLE_ATTACH(table, event->description, _("Description"));
+ TABLE_ATTACH_TEXT(table, event->description, _("Description"));
if (sender && vevent_ident) {
GtkWidget *box = gtk_vbox_new(FALSE, 6);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]