From 936f363f4fb199da202d9c3e07a68ee369536fb4 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Sun, 9 Sep 2001 04:10:54 +0000 Subject: Originally was corba_recipientlist_to_glist. (impl_Composer_set_headers): 2001-09-08 Jon Trowbridge * evolution-composer.c (corba_recipientlist_to_destv): Originally was corba_recipientlist_to_glist. (impl_Composer_set_headers): Use corba_recipientlist_to_destv, new destination-based api. * e-msg-composer.c (build_message): Get rid of that 'sending' stuff. That was a bad idea. (e_msg_composer_new_with_message): Apply the revised api and work with vectors of destinations rather than just lists. (e_msg_composer_get_recipients): Added. Returns the full set of recipient destinations in a vector. * e-msg-composer-hdrs.c: Removed free_destv function. We use e_destination_freev instead. (e_msg_composer_hdrs_get_to): Changed to return a vector of EDestinations. This function now works. (e_msg_composer_hdrs_get_cc): Ditto. (e_msg_composer_hdrs_get_bcc): Ditto. (e_msg_composer_hdrs_get_recipients): Added. Returns a vector of EDestinations that is the union of the to, cc and bcc lines. (e_msg_composer_hdrs_set_to): Changed to take a vector of EDestinations, rather than a GList. (e_msg_composer_hdrs_set_cc): Ditto. (e_msg_composer_hdrs_set_bcc): Ditto. (e_msg_composer_hdrs_to_message): Use our new, improved API, rather than a bunch of poking around in BonoboPropertyBags, etc. svn path=/trunk/; revision=12711 --- composer/evolution-composer.c | 57 +++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 34 deletions(-) (limited to 'composer/evolution-composer.c') diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c index 6dfddf1202..6a24186fa2 100644 --- a/composer/evolution-composer.c +++ b/composer/evolution-composer.c @@ -44,40 +44,30 @@ static void (*postpone_cb) (EMsgComposer *, gpointer); static POA_GNOME_Evolution_Composer__vepv Composer_vepv; -static GList * -corba_recipientlist_to_glist (const GNOME_Evolution_Composer_RecipientList *cl) +static EDestination ** +corba_recipientlist_to_destv (const GNOME_Evolution_Composer_RecipientList *cl) { GNOME_Evolution_Composer_Recipient *recip; - GList *gl = NULL; - char *str; + EDestination **destv; int i; - for (i = cl->_length - 1; i >= 0; i--) { - recip = &(cl->_buffer[i]); + if (cl->_length == 0) + return NULL; - /* Let's copy this code into yet another place! */ - if (*recip->name) { - str = camel_internet_address_format_address (recip->name, recip->address); - } else - str = g_strdup (recip->address); - - gl = g_list_prepend (gl, str); - } + destv = g_new (EDestination *, cl->_length+1); - return gl; -} + for (i = 0; i < cl->_length; ++i) { + recip = &(cl->_buffer[i]); -static void -free_recipient_glist (GList *gl) -{ - GList *tmp; + destv[i] = e_destination_new (); - while (gl) { - tmp = gl->next; - g_free (gl->data); - g_list_free_1 (gl); - gl = tmp; + if (*recip->name) + e_destination_set_name (destv[i], recip->name); + e_destination_set_email (destv[i], recip->address); + } + + return destv; } static void @@ -90,21 +80,20 @@ impl_Composer_set_headers (PortableServer_Servant servant, { BonoboObject *bonobo_object; EvolutionComposer *composer; - GList *gto, *gcc, *gbcc; + EDestination **tov, **ccv, **bccv; bonobo_object = bonobo_object_from_servant (servant); composer = EVOLUTION_COMPOSER (bonobo_object); - gto = corba_recipientlist_to_glist (to); - gcc = corba_recipientlist_to_glist (cc); - gbcc = corba_recipientlist_to_glist (bcc); + tov = corba_recipientlist_to_destv (to); + ccv = corba_recipientlist_to_destv (cc); + bccv = corba_recipientlist_to_destv (bcc); - e_msg_composer_set_headers (composer->composer, NULL, gto, gcc, gbcc, - subject); + e_msg_composer_set_headers (composer->composer, NULL, tov, ccv, bccv, subject); - free_recipient_glist (gto); - free_recipient_glist (gcc); - free_recipient_glist (gbcc); + e_destination_freev (tov); + e_destination_freev (ccv); + e_destination_freev (bccv); } static void -- cgit v1.2.3