From 9507599a2586b17fc0e7b227d119e22613215506 Mon Sep 17 00:00:00 2001 From: Wang Xin Date: Fri, 7 Jul 2006 04:45:27 +0000 Subject: Fixes #345222 2006-07-07 Wang Xin Fixes #345222 * gui/dialogs/alarm-dialog.c: (alarm_to_dialog), (alarm_to_malarm_widgets); (populate_widgets_from_alarm): Handle mail alarm. svn path=/trunk/; revision=32248 --- calendar/gui/dialogs/alarm-dialog.c | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'calendar/gui') diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 3224d4a3d3..ad53c71668 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -228,6 +228,7 @@ alarm_to_dialog (Dialog *dialog) /* Set a default address if possible */ if (!e_cal_get_static_capability (dialog->ecal, CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS) + && !e_cal_component_alarm_has_attendees (dialog->alarm) && e_cal_get_alarm_email_address (dialog->ecal, &email, NULL)) { ECalComponentAttendee *a; GSList attendee_list; @@ -482,6 +483,52 @@ malarm_widgets_to_alarm (Dialog *dialog, ECalComponentAlarm *alarm) } } +/* Fills the widgets from mail alarm data */ +static void +alarm_to_malarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm ) +{ + ENameSelectorModel *name_selector_model; + EDestinationStore *destination_store; + ECalComponentText description; + GtkTextBuffer *text_buffer; + GSList *attendee_list, *l; + int len; + + /* Attendees */ + name_selector_model = e_name_selector_peek_model (dialog->name_selector); + e_name_selector_model_peek_section (name_selector_model, section_name, NULL, &destination_store); + + e_cal_component_alarm_get_attendee_list (alarm, &attendee_list); + len = g_slist_length (attendee_list); + if (len > 0) { + for (l = attendee_list; l; l = g_slist_next (l)) { + ECalComponentAttendee *a = l->data; + EDestination *dest; + + dest = e_destination_new (); + if (a->cn != NULL && *a->cn) + e_destination_set_name (dest, a->cn); + if (a->value != NULL && *a->value) { + if (!strncasecmp (a->value, "MAILTO:", 7)) + e_destination_set_email (dest, a->value + 7); + else + e_destination_set_email (dest, a->value); + } + e_destination_store_append_destination (destination_store, dest); + g_object_unref(GTK_OBJECT (dest)); + } + e_cal_component_free_attendee_list (attendee_list); + } + + /* Description */ + e_cal_component_alarm_get_description (alarm, &description); + if (description.value) { + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->malarm_message), TRUE); + text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->malarm_description)); + gtk_text_buffer_set_text (text_buffer, description.value, -1); + } +} + /* Fills the widgets from procedure alarm data */ static void alarm_to_palarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm) @@ -619,6 +666,7 @@ populate_widgets_from_alarm (Dialog *dialog) break; case E_CAL_COMPONENT_ALARM_EMAIL: + alarm_to_malarm_widgets (dialog, dialog->alarm); break; case E_CAL_COMPONENT_ALARM_PROCEDURE: -- cgit