Ejemplo n.º 1
0
/* 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;
	gint 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 (G_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);
	}
}
void
e_select_names_editable_set_address (ESelectNamesEditable *esne, const gchar *name, const gchar *email)
{
	EDestinationStore *destination_store;
	GList *destinations;
	EDestination *destination;

	g_return_if_fail (E_IS_SELECT_NAMES_EDITABLE (esne));

	destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (esne));
	destinations = e_destination_store_list_destinations (destination_store);

	if (!destinations)
		destination = e_destination_new ();
	else
		destination = g_object_ref (destinations->data);

	e_destination_set_name (destination, name);
	e_destination_set_email (destination, email);

	if (!destinations)
		e_destination_store_append_destination (destination_store, destination);
	g_object_unref (destination);
}