From 02f7d08e8af85a108e98935aa325b0e3ad6c38e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Crozat?= Date: Thu, 9 Feb 2006 17:35:43 +0000 Subject: Factorize some code. * e-msg-composer-hdrs.c: (e_msg_composer_hdrs_get_internal), (e_msg_composer_hdrs_get_to), (e_msg_composer_hdrs_get_cc), (e_msg_composer_hdrs_get_bcc): Factorize some code. svn path=/trunk/; revision=31465 --- composer/e-msg-composer-hdrs.c | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) (limited to 'composer/e-msg-composer-hdrs.c') diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c index 18bd8235ae..5e005269d7 100644 --- a/composer/e-msg-composer-hdrs.c +++ b/composer/e-msg-composer-hdrs.c @@ -1446,17 +1446,14 @@ destination_list_to_destv (GList *destinations) return destv; } -EDestination ** -e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs) +static EDestination ** +e_msg_composer_hdrs_get_internal (EMsgComposerHdrs *hdrs, ENameSelectorEntry *entry) { EDestinationStore *destination_store; GList *destinations; EDestination **destv = NULL; - g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - - destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY ( - hdrs->priv->to.entry)); + destination_store = e_name_selector_entry_peek_destination_store (entry); destinations = e_destination_store_list_destinations (destination_store); destv = destination_list_to_destv (destinations); @@ -1466,41 +1463,27 @@ e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs) } EDestination ** -e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs) +e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs) { - EDestinationStore *destination_store; - GList *destinations; - EDestination **destv = NULL; - g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY ( - hdrs->priv->cc.entry)); - destinations = e_destination_store_list_destinations (destination_store); + e_msg_composer_hdrs_get_internal (hdrs, E_NAME_SELECTOR_ENTRY (hdrs->priv->to.entry)); +} - destv = destination_list_to_destv (destinations); +EDestination ** +e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs) +{ + g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - g_list_free (destinations); - return destv; + e_msg_composer_hdrs_get_internal (hdrs, E_NAME_SELECTOR_ENTRY (hdrs->priv->cc.entry)); } EDestination ** e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs) { - EDestinationStore *destination_store; - GList *destinations; - EDestination **destv = NULL; - g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY ( - hdrs->priv->bcc.entry)); - destinations = e_destination_store_list_destinations (destination_store); - - destv = destination_list_to_destv (destinations); - - g_list_free (destinations); - return destv; + e_msg_composer_hdrs_get_internal (hdrs, E_NAME_SELECTOR_ENTRY (hdrs->priv->bcc.entry)); } EDestination ** -- cgit v1.2.3