[evolution-patches] patch for setting categories string in EContact



pretty simple patch.

Chris
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/ChangeLog,v
retrieving revision 1.100
diff -u -r1.100 ChangeLog
--- ChangeLog	12 Mar 2004 22:10:22 -0000	1.100
+++ ChangeLog	12 Mar 2004 22:13:22 -0000
@@ -1,5 +1,13 @@
 2004-03-12  Chris Toshok  <toshok ximian com>
 
+	* libebook/e-contact.c (e_contact_set_property): in the CATEGORIES
+	case when we're adding a new attribute to the vcard, make sure to
+	call e_vcard_add_attribute after creating it.  also, use
+	EVC_CATEGORIES instead of hardcoding the string.
+	(e_contact_get_property): use EVC_CATEGORIES.
+	
+2004-03-12  Chris Toshok  <toshok ximian com>
+
 	* tests/ebook/test-categories.c (main): test setting CATEGORIES as
 	well as CATEGORY_LIST.
 
Index: libebook/e-contact.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-contact.c,v
retrieving revision 1.26
diff -u -r1.26 e-contact.c
--- libebook/e-contact.c	26 Feb 2004 20:12:28 -0000	1.26
+++ libebook/e-contact.c	12 Mar 2004 22:13:23 -0000
@@ -858,15 +858,17 @@
 		else {
 			switch (info->field_id) {
 			case E_CONTACT_CATEGORIES: {
-				EVCardAttribute *attr = e_contact_get_first_attr (contact, "CATEGORIES");
+				EVCardAttribute *attr = e_contact_get_first_attr (contact, EVC_CATEGORIES);
 				char **split, **s;
 				const char *str;
 
 				if (attr)
 					e_vcard_attribute_remove_values (attr);
-				else
+				else {
 					/* we didn't find it - add a new attribute */
-					attr = e_vcard_attribute_new (NULL, "CATEGORIES");
+					attr = e_vcard_attribute_new (NULL, EVC_CATEGORIES);
+					e_vcard_add_attribute (E_VCARD (contact), attr);
+				}
 
 				str = g_value_get_string (value);
 				if (str) {
@@ -1207,7 +1209,7 @@
 			break;
 		}
 		case E_CONTACT_CATEGORIES: {
-			EVCardAttribute *attr = e_contact_get_first_attr (contact, "CATEGORIES");
+			EVCardAttribute *attr = e_contact_get_first_attr (contact, EVC_CATEGORIES);
 			char *rv = NULL;
 
 			if (attr) {


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