aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-12-18 04:07:22 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-12-18 04:07:22 +0800
commit95e875ecf4b48f84fe6b9dd475669396a9609e20 (patch)
tree616a66a004c74e4f5a81a3378a05020899af2a31 /calendar
parent4418d0b09aba4c26aa5cd41bbc75310a7aef1ba2 (diff)
downloadgsoc2013-evolution-95e875ecf4b48f84fe6b9dd475669396a9609e20.tar.gz
gsoc2013-evolution-95e875ecf4b48f84fe6b9dd475669396a9609e20.tar.zst
gsoc2013-evolution-95e875ecf4b48f84fe6b9dd475669396a9609e20.zip
use get_real_item (get_refresh_options): uncomment out (get_real_item):
2001-12-17 JP Rosevear <jpr@ximian.com> * gui/e-itip-control.c (send_item): use get_real_item (get_refresh_options): uncomment out (get_real_item): obtain the real object which has the uid of the item received (show_current_todo): use get_refresh_options for refresh method and provide the description and summary from the real component since its not in the reply (show_current_event): ditto (send_item): use get_real_item 2001-12-17 JP Rosevear <jpr@ximian.com> * gui/itip-utils.c (comp_limit_attendees): can't remove properties in an iteration loop, so remove them outside the loop (comp_minimal): don't set a recurid if there isn't one, add the x properties to the clone (comp_compliant): unref the clone for DECLINECOUNTER * gui/e-itip-control.c (get_refresh_options): make function available again (show_current_event): use it here (ok_clicked_cb): can't remove properties in an iteration loop, so remove them outside the loop * cal-util/cal-component.c (free_icalcomponent): properly free the attendee list (cal_component_rescan): don't destroy the alarm hash svn path=/trunk/; revision=15136
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog30
-rw-r--r--calendar/cal-util/cal-component.c11
-rw-r--r--calendar/gui/e-itip-control.c120
-rw-r--r--calendar/gui/itip-utils.c31
4 files changed, 151 insertions, 41 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 841ae1c1fe..b226ec65f2 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,33 @@
+2001-12-17 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-itip-control.c (send_item): use get_real_item
+ (get_refresh_options): uncomment out
+ (get_real_item): obtain the real object which has the uid of the
+ item received
+ (show_current_todo): use get_refresh_options for refresh method
+ and provide the description and summary from the real component
+ since its not in the reply
+ (show_current_event): ditto
+ (send_item): use get_real_item
+
+2001-12-17 JP Rosevear <jpr@ximian.com>
+
+ * gui/itip-utils.c (comp_limit_attendees): can't remove properties
+ in an iteration loop, so remove them outside the loop
+ (comp_minimal): don't set a recurid if there isn't one, add the x
+ properties to the clone
+ (comp_compliant): unref the clone for DECLINECOUNTER
+
+ * gui/e-itip-control.c (get_refresh_options): make function
+ available again
+ (show_current_event): use it here
+ (ok_clicked_cb): can't remove properties in an iteration loop, so
+ remove them outside the loop
+
+ * cal-util/cal-component.c (free_icalcomponent): properly free the
+ attendee list
+ (cal_component_rescan): don't destroy the alarm hash
+
2001-12-13 Damon Chaplin <damon@ximian.com>
* zones.h: new file to contain all timezone names for translation.
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index eeb51c79f6..513c98673e 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -275,7 +275,8 @@ static void
free_icalcomponent (CalComponent *comp, gboolean free)
{
CalComponentPrivate *priv;
-
+ GSList *l;
+
priv = comp->priv;
if (!priv->icalcomp)
@@ -294,6 +295,11 @@ free_icalcomponent (CalComponent *comp, gboolean free)
priv->status = NULL;
+ for (l = priv->attendee_list; l != NULL; l = l->next)
+ g_free (l->data);
+ g_slist_free (priv->attendee_list);
+ priv->attendee_list = NULL;
+
priv->categories = NULL;
priv->classification = NULL;
@@ -1078,9 +1084,8 @@ cal_component_rescan (CalComponent *comp)
/* Clear everything out */
free_icalcomponent (comp, FALSE);
- g_hash_table_destroy (priv->alarm_uid_hash);
- priv->alarm_uid_hash = NULL;
+ /* Rescan */
scan_icalcomponent (comp);
ensure_mandatory_properties (comp);
}
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index d34f609094..18991630a0 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -833,7 +833,6 @@ get_reply_options ()
U_("OK"));
}
-#if 0
static char*
get_refresh_options ()
{
@@ -846,7 +845,6 @@ get_refresh_options ()
U_("Send Latest Information"),
U_("OK"));
}
-#endif
static char*
get_cancel_options ()
@@ -861,10 +859,43 @@ get_cancel_options ()
U_("OK"));
}
+
+static CalComponent *
+get_real_item (EItipControl *itip)
+{
+ EItipControlPrivate *priv;
+ CalComponent *comp;
+ CalComponentVType type;
+ CalClientGetStatus status;
+ const char *uid;
+
+ priv = itip->priv;
+
+ type = cal_component_get_vtype (priv->comp);
+ cal_component_get_uid (priv->comp, &uid);
+
+ switch (type) {
+ case CAL_COMPONENT_EVENT:
+ status = cal_client_get_object (priv->event_client, uid, &comp);
+ break;
+ case CAL_COMPONENT_TODO:
+ status = cal_client_get_object (priv->task_client, uid, &comp);
+ break;
+ default:
+ status = CAL_CLIENT_GET_NOT_FOUND;
+ }
+
+ if (status != CAL_CLIENT_GET_SUCCESS)
+ return NULL;
+
+ return comp;
+}
+
static void
show_current_event (EItipControl *itip)
{
EItipControlPrivate *priv;
+ CalComponent *comp;
const gchar *itip_title, *itip_desc;
char *options;
@@ -889,7 +920,26 @@ show_current_event (EItipControl *itip)
case ICAL_METHOD_REFRESH:
itip_desc = U_("<b>%s</b> wishes to receive the latest meeting information.");
itip_title = U_("Meeting Update Request");
- options = get_publish_options ();
+ options = get_refresh_options ();
+
+ /* Provide extra info, since its not in the component */
+ comp = get_real_item (itip);
+ if (comp != NULL) {
+ CalComponentText text;
+ GSList *l;
+
+ cal_component_get_summary (comp, &text);
+ cal_component_set_summary (priv->comp, &text);
+ cal_component_get_description_list (comp, &l);
+ cal_component_set_description_list (priv->comp, l);
+ cal_component_free_text_list (l);
+
+ gtk_object_unref (GTK_OBJECT (comp));
+ } else {
+ CalComponentText text = {_("Unknown"), NULL};
+
+ cal_component_set_summary (priv->comp, &text);
+ }
break;
case ICAL_METHOD_REPLY:
itip_desc = U_("<b>%s</b> has replied to a meeting request.");
@@ -915,6 +965,7 @@ static void
show_current_todo (EItipControl *itip)
{
EItipControlPrivate *priv;
+ CalComponent *comp;
const gchar *itip_title, *itip_desc;
char *options;
@@ -939,7 +990,27 @@ show_current_todo (EItipControl *itip)
case ICAL_METHOD_REFRESH:
itip_desc = U_("<b>%s</b> wishes to receive the latest task information.");
itip_title = U_("Task Update Request");
- options = get_publish_options ();
+ options = get_refresh_options ();
+
+
+ /* Provide extra info, since its not in the component */
+ comp = get_real_item (itip);
+ if (comp != NULL) {
+ CalComponentText text;
+ GSList *l;
+
+ cal_component_get_summary (comp, &text);
+ cal_component_set_summary (priv->comp, &text);
+ cal_component_get_description_list (comp, &l);
+ cal_component_set_description_list (priv->comp, l);
+ cal_component_free_text_list (l);
+
+ gtk_object_unref (GTK_OBJECT (comp));
+ } else {
+ CalComponentText text = {_("Unknown"), NULL};
+
+ cal_component_set_summary (priv->comp, &text);
+ }
break;
case ICAL_METHOD_REPLY:
itip_desc = U_("<b>%s</b> has replied to a task assignment.");
@@ -1335,29 +1406,15 @@ send_item (EItipControl *itip)
{
EItipControlPrivate *priv;
CalComponent *comp;
- CalComponentVType type;
- const char *uid;
- CalClientGetStatus status;
GtkWidget *dialog;
priv = itip->priv;
- type = cal_component_get_vtype (priv->comp);
- cal_component_get_uid (priv->comp, &uid);
+ comp = get_real_item (itip);
- switch (type) {
- case CAL_COMPONENT_EVENT:
- status = cal_client_get_object (priv->event_client, uid, &comp);
- break;
- case CAL_COMPONENT_TODO:
- status = cal_client_get_object (priv->task_client, uid, &comp);
- break;
- default:
- status = CAL_CLIENT_GET_NOT_FOUND;
- }
-
- if (status == CAL_CLIENT_GET_SUCCESS) {
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp);
+ if (comp != NULL) {
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp);
+ gtk_object_unref (GTK_OBJECT (comp));
dialog = gnome_ok_dialog (_("Item sent!\n"));
} else {
dialog = gnome_warning_dialog (_("The item could not be sent!\n"));
@@ -1552,9 +1609,10 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
if (priv->my_address != NULL) {
icalcomponent *ical_comp;
icalproperty *prop;
- const char *attendee, *text;
icalvalue *value;
-
+ const char *attendee, *text;
+ GSList *l, *list = NULL;
+
ical_comp = cal_component_get_icalcomponent (comp);
for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
@@ -1568,11 +1626,17 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
attendee = icalvalue_get_string (value);
text = itip_strip_mailto (attendee);
- if (!strstr (text, priv->my_address)) {
- icalcomponent_remove_property (ical_comp, prop);
- icalproperty_free (prop);
- }
+ if (!strstr (text, priv->my_address))
+ list = g_slist_prepend (list, prop);
}
+
+ for (l = list; l; l = l->next) {
+ prop = l->data;
+ icalcomponent_remove_property (ical_comp, prop);
+ icalproperty_free (prop);
+ }
+ g_slist_free (list);
+
cal_component_rescan (comp);
itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp);
} else {
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 8eed74f42b..405240e9da 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -450,7 +450,8 @@ comp_limit_attendees (CalComponent *comp)
GList *addresses;
icalproperty *prop;
gboolean found = FALSE, match = FALSE;
-
+ GSList *l, *list = NULL;
+
icomp = cal_component_get_icalcomponent (comp);
addresses = itip_addresses_get ();
@@ -464,8 +465,7 @@ comp_limit_attendees (CalComponent *comp)
/* If we've already found something, just erase the rest */
if (found) {
- icalcomponent_remove_property (icomp, prop);
- icalproperty_free (prop);
+ list = g_slist_prepend (list, prop);
continue;
}
@@ -482,12 +482,20 @@ comp_limit_attendees (CalComponent *comp)
if (strstr (text, a->address))
found = match = TRUE;
}
- if (!match) {
- icalcomponent_remove_property (icomp, prop);
- icalproperty_free (prop);
- }
+
+ if (!match)
+ list = g_slist_prepend (list, prop);
match = FALSE;
}
+
+ for (l = list; l != NULL; l = l->next) {
+ prop = l->data;
+
+ icalcomponent_remove_property (icomp, prop);
+ icalproperty_free (prop);
+ }
+ g_slist_free (list);
+
itip_addresses_free (addresses);
return found;
@@ -551,7 +559,7 @@ static CalComponent *
comp_minimal (CalComponent *comp, gboolean attendee)
{
CalComponent *clone;
- icalcomponent *icomp;
+ icalcomponent *icomp, *icomp_clone;
icalproperty *prop;
CalComponentOrganizer organizer;
const char *uid;
@@ -600,9 +608,11 @@ comp_minimal (CalComponent *comp, gboolean attendee)
cal_component_free_text_list (comments);
cal_component_get_recurid (comp, &recur_id);
- cal_component_set_recurid (clone, recur_id);
+ if (recur_id->datetime->value != NULL)
+ cal_component_set_recurid (clone, recur_id);
icomp = cal_component_get_icalcomponent (comp);
+ icomp_clone = cal_component_get_icalcomponent (clone);
for (prop = icalcomponent_get_first_property (icomp, ICAL_X_PROPERTY);
prop != NULL;
prop = icalcomponent_get_next_property (icomp, ICAL_X_PROPERTY))
@@ -610,7 +620,7 @@ comp_minimal (CalComponent *comp, gboolean attendee)
icalproperty *p;
p = icalproperty_new_clone (prop);
- icalcomponent_add_property (icomp, p);
+ icalcomponent_add_property (icomp_clone, p);
}
cal_component_rescan (clone);
@@ -659,6 +669,7 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp)
case CAL_COMPONENT_METHOD_DECLINECOUNTER:
/* Need to remove almost everything */
temp_clone = comp_minimal (clone, FALSE);
+ gtk_object_unref (GTK_OBJECT (clone));
clone = temp_clone;
break;
default: