[evolution-patches] [calendar] patch for #57142



Updated patch for this, which makes ECalComponent use the same mechanism
we use in the event editor to keep track of alarms that need a
description. Whenever we change the component's summary, all the alarms'
descriptions are updated if needed.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.296
diff -u -p -r1.296 ChangeLog
--- ChangeLog	14 Jul 2004 09:32:15 -0000	1.296
+++ ChangeLog	15 Jul 2004 12:29:51 -0000
@@ -1,10 +1,19 @@
+2004-07-15  Rodrigo Moya <rodrigo novell com>
+
+	Fixes #57142
+
+	* libecal/e-cal-component.c (ensure_alarm_properties_cb): add the
+	X-EVOLUTION-NEEDS-DESCRIPTION property to the alarms we create
+	with no description.
+	(e_cal_component_set_summary, set_alarm_description_cb): set the
+	description on the alarms with the above property.
+
 2004-07-14  Chenthill Palanisamy <pchenthill novell com>
 
        Fixes #60344
        * backends/groupwise/e-cal-backend-groupwise.c:
        (e_cal_backend_groupwise_internal_get_timezone):
        Send the timezone present in tzid instead of sending UTC timezone.
-
 
 2004-07-12  Harish Krishnaswamy  <kharish novell com>
 
Index: libecal/e-cal-component.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libecal/e-cal-component.c,v
retrieving revision 1.8
diff -u -p -r1.8 e-cal-component.c
--- libecal/e-cal-component.c	7 May 2004 16:04:17 -0000	1.8
+++ libecal/e-cal-component.c	15 Jul 2004 12:29:52 -0000
@@ -1214,9 +1214,14 @@ ensure_alarm_properties_cb (gpointer key
 		if (prop)
 			break;
 
-		if (!priv->summary.prop)
+		if (!priv->summary.prop) {
 			str = _("Untitled appointment");
-		else
+
+			/* add the X-EVOLUTION-NEEDS-DESCRIPTION property */
+			prop = icalproperty_new_x ("1");
+			icalproperty_set_x_name (prop, "X-EVOLUTION-NEEDS-DESCRIPTION");
+			icalcomponent_add_property (alarm, prop);
+		} else
 			str = icalproperty_get_summary (priv->summary.prop);
 
 		prop = icalproperty_new_description (str);
@@ -3802,6 +3807,40 @@ e_cal_component_get_summary (ECalCompone
 		summary->altrep = NULL;
 }
 
+static void
+set_alarm_description_cb (gpointer key, gpointer value, gpointer user_data)
+{
+	icalcomponent *alarm;
+	icalproperty *icalprop;
+	ECalComponentText *summary;
+
+	alarm = value;
+	summary = user_data;
+
+	icalprop = icalcomponent_get_first_property (alarm, ICAL_X_PROPERTY);
+	while (icalprop) {
+		const char *x_name;
+
+		x_name = icalproperty_get_x_name (icalprop);
+		if (!strcmp (x_name, "X-EVOLUTION-NEEDS-DESCRIPTION")) {
+			icalcomponent_remove_property (alarm, icalprop);
+			icalproperty_free (icalprop);
+
+			icalprop = icalcomponent_get_first_property (alarm, ICAL_DESCRIPTION_PROPERTY);
+			if (icalprop)
+				icalproperty_set_description (icalprop, summary->value);
+			else {
+				icalprop = icalproperty_new_description (summary->value);
+				icalcomponent_add_property (alarm, icalprop);
+			}
+
+			break;
+		}
+
+		icalprop = icalcomponent_get_next_property (alarm, ICAL_X_PROPERTY);
+	}
+}
+
 /**
  * e_cal_component_set_summary:
  * @comp: A calendar component object.
@@ -3857,6 +3896,9 @@ e_cal_component_set_summary (ECalCompone
  		icalproperty_remove_parameter (priv->summary.prop, ICAL_ALTREP_PARAMETER);
  		priv->summary.altrep_param = NULL; 
 	}
+
+	/* look for alarms that need a description */
+	g_hash_table_foreach (priv->alarm_uid_hash, set_alarm_description_cb, summary);
 }
 
 /**


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