From f4a030d2fa7f74ff382996c15d15b5e2b6f2fb29 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 17 Jan 2003 23:32:07 +0000 Subject: Updated to use EAccountList and iterators. (evolution_composer_init): 2003-01-17 Jeffrey Stedfast * evolution-composer.c (impl_Composer_set_headers): Updated to use EAccountList and iterators. (evolution_composer_init): Updated to use EAccount. * e-msg-composer.c (from_changed_cb): Updated to use the EAccount object. (e_msg_composer_new_with_message): Same. (e_msg_composer_get_preferred_account): Updated to return an EAccount object. (set_editor_signature): Updated to use an EAccountIdentity pointer. (get_signature_html): Same. * e-msg-composer-hdrs.c (create_from_optionmenu): Updated to use EAccount and EAccountList foo. (destroy): Same here. (e_msg_composer_hdrs_set_from_account): Here too. (e_msg_composer_hdrs_get_from): Updated. svn path=/trunk/; revision=19511 --- composer/evolution-composer.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'composer/evolution-composer.c') diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c index cef0110413..851bf3c853 100644 --- a/composer/evolution-composer.c +++ b/composer/evolution-composer.c @@ -83,32 +83,42 @@ impl_Composer_set_headers (PortableServer_Servant servant, BonoboObject *bonobo_object; EvolutionComposer *composer; EDestination **tov, **ccv, **bccv; - const MailConfigAccount *account; - const GSList *accounts; - + EAccountList *accounts; + EAccount *account; + EIterator *iter; + int found = 0; + bonobo_object = bonobo_object_from_servant (servant); composer = EVOLUTION_COMPOSER (bonobo_object); - + account = mail_config_get_account_by_name (from); if (!account) { accounts = mail_config_get_accounts (); - while (accounts) { - account = accounts->data; - if (!strcasecmp (account->id->address, from)) + iter = e_list_get_iterator ((EList *) accounts); + while (e_iterator_is_valid (iter)) { + account = (EAccount *) e_iterator_get (iter); + + if (!strcasecmp (account->id->address, from)) { + found = TRUE; break; - accounts = accounts->next; + } + + e_iterator_next (iter); } - if (!accounts) + + g_object_unref (iter); + + if (!found) account = mail_config_get_default_account (); } - + 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, account->name, tov, ccv, bccv, subject); - + e_destination_freev (tov); e_destination_freev (ccv); e_destination_freev (bccv); @@ -300,12 +310,12 @@ evolution_composer_class_init (EvolutionComposerClass *klass) static void evolution_composer_init (EvolutionComposer *composer) { - const MailConfigAccount *account; BonoboObject *item_handler; - - account = mail_config_get_default_account (); + EAccount *account; + + account = mail_config_get_default_account (); composer->composer = e_msg_composer_new (); - + g_signal_connect (composer->composer, "send", G_CALLBACK (send_cb), NULL); g_signal_connect (composer->composer, "save-draft", -- cgit