[evolution/gnome-3-32] I#529 - [ECompEditor] Store multivalue properties as multiple properties



commit 9c6ae58afce0f32fe2945cc9f22f11880bb67acc
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jul 9 13:50:44 2019 +0200

    I#529 - [ECompEditor] Store multivalue properties as multiple properties
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/529

 src/calendar/gui/e-comp-editor-property-part.c | 45 +++++++++++++++++++-------
 1 file changed, 34 insertions(+), 11 deletions(-)
---
diff --git a/src/calendar/gui/e-comp-editor-property-part.c b/src/calendar/gui/e-comp-editor-property-part.c
index 3b661d7f43..8fe725be2d 100644
--- a/src/calendar/gui/e-comp-editor-property-part.c
+++ b/src/calendar/gui/e-comp-editor-property-part.c
@@ -493,20 +493,43 @@ ecepp_string_fill_component (ECompEditorPropertyPart *property_part,
                        icalcomponent_remove_property (component, prop);
                        icalproperty_free (prop);
                }
-       }
 
-       prop = icalcomponent_get_first_property (component, klass->ical_prop_kind);
+               if (value && *value) {
+                       gchar **split_value;
 
-       if (value && *value) {
-               if (prop) {
-                       klass->ical_set_func (prop, value);
-               } else {
-                       prop = klass->ical_new_func (value);
-                       icalcomponent_add_property (component, prop);
+                       split_value = g_strsplit (value, ",", -1);
+                       if (split_value) {
+                               gint ii;
+
+                               /* Store multivalue properties into multiple properties,
+                                  to workaround icalcomponent_new_clone() bug, which escapes
+                                  commas in such properties. */
+                               for (ii = 0; split_value[ii]; ii++) {
+                                       const gchar *item = split_value[ii];
+
+                                       if (*item) {
+                                               prop = klass->ical_new_func (item);
+                                               icalcomponent_add_property (component, prop);
+                                       }
+                               }
+
+                               g_strfreev (split_value);
+                       }
+               }
+       } else {
+               prop = icalcomponent_get_first_property (component, klass->ical_prop_kind);
+
+               if (value && *value) {
+                       if (prop) {
+                               klass->ical_set_func (prop, value);
+                       } else {
+                               prop = klass->ical_new_func (value);
+                               icalcomponent_add_property (component, prop);
+                       }
+               } else if (prop) {
+                       icalcomponent_remove_property (component, prop);
+                       icalproperty_free (prop);
                }
-       } else if (prop) {
-               icalcomponent_remove_property (component, prop);
-               icalproperty_free (prop);
        }
 
        g_free (value);


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