示例#1
0
void
eab_send_as_to (EShell *shell,
                GSList *destinations)
{
	GPtrArray *to_array;
	GPtrArray *bcc_array;
	CreateComposerData *ccd;

	g_return_if_fail (E_IS_SHELL (shell));

	if (destinations == NULL)
		return;

	to_array = g_ptr_array_new ();
	bcc_array = g_ptr_array_new ();

	/* Sort contacts into "To" and "Bcc" destinations. */
	while (destinations != NULL) {
		EDestination *destination = destinations->data;

		if (e_destination_is_evolution_list (destination)) {
			if (e_destination_list_show_addresses (destination))
				g_ptr_array_add (to_array, e_destination_copy (destination));
			else
				g_ptr_array_add (bcc_array, e_destination_copy (destination));
		} else
			g_ptr_array_add (to_array, e_destination_copy (destination));

		destinations = g_slist_next (destinations);
	}

	/* Add sentinels to each array. */
	g_ptr_array_add (to_array, NULL);
	g_ptr_array_add (bcc_array, NULL);

	ccd = g_new0 (CreateComposerData, 1);
	ccd->to_destinations = (EDestination **) g_ptr_array_free (to_array, FALSE);
	ccd->bcc_destinations = (EDestination **) g_ptr_array_free (bcc_array, FALSE);
	ccd->attachment_destinations = NULL;

	e_msg_composer_new (shell, eab_composer_created_cb, ccd);
}
示例#2
0
void
eab_send_as_to (EShell *shell,
                GSList *destinations)
{
	EMsgComposer *composer;
	EComposerHeaderTable *table;
	GPtrArray *to_array;
	GPtrArray *bcc_array;

	union {
		gpointer *pdata;
		EDestination **destinations;
	} convert;

	g_return_if_fail (E_IS_SHELL (shell));

	if (destinations == NULL)
		return;

	composer = e_msg_composer_new (shell);
	table = e_msg_composer_get_header_table (composer);

	to_array = g_ptr_array_new ();
	bcc_array = g_ptr_array_new ();

	/* Sort contacts into "To" and "Bcc" destinations. */
	while (destinations != NULL) {
		EDestination *destination = destinations->data;

		if (e_destination_is_evolution_list (destination)) {
			if (e_destination_list_show_addresses (destination))
				g_ptr_array_add (to_array, destination);
			else
				g_ptr_array_add (bcc_array, destination);
		} else
			g_ptr_array_add (to_array, destination);

		destinations = g_slist_next (destinations);
	}

	/* Add sentinels to each array. */
	g_ptr_array_add (to_array, NULL);
	g_ptr_array_add (bcc_array, NULL);

	/* XXX Acrobatics like this make me question whether NULL-terminated
	 *     arrays are really the best argument type for passing a list of
	 *     destinations to the header table. */

	/* Set "To" destinations. */
	convert.pdata = to_array->pdata;
	e_composer_header_table_set_destinations_to (
		table, convert.destinations);
	g_ptr_array_free (to_array, FALSE);

	/* Add "Bcc" destinations. */
	convert.pdata = bcc_array->pdata;
	e_composer_header_table_add_destinations_bcc (
		table, convert.destinations);
	g_ptr_array_free (bcc_array, FALSE);

	gtk_widget_show (GTK_WIDGET (composer));
}