Re: [evolution-patches] [Composer] code cleanup



Le lundi 06 février 2006 à 18:11 +0100, Frederic Crozat a écrit :
> Hi,
> 
> while investigating bug from one of our customers regarding Cc headers,
> I wrote this code cleanup patch, which factorize code used by
> e_msg_composer_hdrs_get_to/cc/bcc (so, if code need to be fixed in the
> future, it won't need to be fixed three times ;)

Oops, better patch, prevent crash if hdrs is NULL

-- 
Frederic Crozat <fcrozat mandriva com>
Mandriva
? evolution-composer-factorize.patch
? evolution-zip
? iconv-detect.h
? addressbook/addressbook.error
? calendar/calendar.error
? calendar/conduits/memo/Makefile
? calendar/conduits/memo/Makefile.in
? calendar/gui/apps_evolution_calendar-2.6.schemas
? composer/mail-composer.error
? e-util/e-system.error
? filter/filter.error
? help/C/evolution-2.6-C.omf
? help/C/evolution-2.6.xml
? mail/Evolution-Mail-common.c
? mail/Evolution-Mail-skels.c
? mail/Evolution-Mail-stubs.c
? mail/Evolution-Mail.h
? mail/evolution-mail-2.6.schemas
? mail/mail.error
? mail/default/zh_CN/Makefile
? mail/default/zh_CN/Makefile.in
? plugins/addressbook-file/org-gnome-addressbook-file.eplug
? plugins/default-mailer/org-gnome-default-mailer.eplug
? plugins/default-mailer/org-gnome-default-mailer.error
? plugins/default-source/org-gnome-default-source.eplug
? plugins/itip-formatter/org-gnome-itip-formatter.error
? plugins/mailing-list-actions/org-gnome-mailing-list-actions.error
? shell/shell.error
? views/memos/Makefile
? views/memos/Makefile.in
? win32/Makefile
? win32/Makefile.in
Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.732
diff -u -p -r1.732 ChangeLog
--- composer/ChangeLog	30 Jan 2006 09:51:17 -0000	1.732
+++ composer/ChangeLog	6 Feb 2006 17:52:16 -0000
@@ -1,3 +1,9 @@
+2006-02-06  Frederic Crozat  <fcrozat mandriva com>
+
+	* 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.
+
 2006-01-24  Kjartan Maraas  <kmaraas gnome org>
 
 	* e-msg-composer-hdrs.c: (account_removed_cb),
Index: composer/e-msg-composer-hdrs.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer-hdrs.c,v
retrieving revision 1.148
diff -u -p -r1.148 e-msg-composer-hdrs.c
--- composer/e-msg-composer-hdrs.c	30 Jan 2006 09:51:18 -0000	1.148
+++ composer/e-msg-composer-hdrs.c	6 Feb 2006 17:52:16 -0000
@@ -1446,17 +1446,14 @@ destination_list_to_destv (GList *destin
 	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 (EMsgComposer
 }
 
 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 **


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]