use "CATEORIES" instead of null vcard_field_name (e_contact_set_property):
authorRadek Doulik <rodo@ximian.com>
Thu, 29 Jan 2004 15:27:20 +0000 (15:27 +0000)
committerRadek Doulik <rodo@src.gnome.org>
Thu, 29 Jan 2004 15:27:20 +0000 (15:27 +0000)
2004-01-28  Radek Doulik  <rodo@ximian.com>

* libebook/e-contact.c (e_contact_set_property): use "CATEORIES"
instead of null vcard_field_name
(e_contact_set_property): check for NULL string value, test for
single category

addressbook/ChangeLog
addressbook/libebook/e-contact.c

index e8d80b2..1c1e2cc 100644 (file)
@@ -1,3 +1,10 @@
+2004-01-28  Radek Doulik  <rodo@ximian.com>
+
+       * libebook/e-contact.c (e_contact_set_property): use "CATEORIES"
+       instead of null vcard_field_name
+       (e_contact_set_property): check for NULL string value, test for
+       single category
+
 2004-01-27  Chris Toshok  <toshok@ximian.com>
 
        * libebook/e-book-async.h: nuke the prototype for
index 0a67dbe..99cf177 100644 (file)
@@ -816,20 +816,27 @@ e_contact_set_property (GObject *object,
                else {
                        switch (info->field_id) {
                        case E_CONTACT_CATEGORIES: {
-                               EVCardAttribute *attr = e_contact_get_first_attr (contact, info->vcard_field_name);
+                               EVCardAttribute *attr = e_contact_get_first_attr (contact, "CATEGORIES");
                                char **split, **s;
+                               const char *str;
 
                                if (attr)
                                        e_vcard_attribute_remove_values (attr);
                                else
                                        /* we didn't find it - add a new attribute */
-                                       attr = e_vcard_attribute_new (NULL, info->vcard_field_name);
-
-                               split = g_strsplit (g_value_get_string (value), ",", 0);
-                               for (s = split; *s; s++) {
-                                       e_vcard_attribute_add_value (attr, g_strstrip (*s));
+                                       attr = e_vcard_attribute_new (NULL, "CATEGORIES");
+
+                               str = g_value_get_string (value);
+                               if (str) {
+                                       split = g_strsplit (str, ",", 0);
+                                       if (split) {
+                                               for (s = split; *s; s++) {
+                                                       e_vcard_attribute_add_value (attr, g_strstrip (*s));
+                                               }
+                                               g_strfreev (split);
+                                       } else
+                                               e_vcard_attribute_add_value (attr, str);
                                }
-                               g_strfreev (split);
                                break;
                        }
                        default: