diff options
author | Chenthill Palanisamy <pchen@src.gnome.org> | 2005-07-11 10:35:49 +0800 |
---|---|---|
committer | Chenthill Palanisamy <pchen@src.gnome.org> | 2005-07-11 10:35:49 +0800 |
commit | 24c212a1e2f400804387484b7515823dde4fce4b (patch) | |
tree | 192f1987c49aec88e54618e764c889abe167a49c | |
parent | d964dd2e8fe1add89fd6a4788501da6d4ae92375 (diff) | |
download | gsoc2013-evolution-24c212a1e2f400804387484b7515823dde4fce4b.tar.gz gsoc2013-evolution-24c212a1e2f400804387484b7515823dde4fce4b.tar.zst gsoc2013-evolution-24c212a1e2f400804387484b7515823dde4fce4b.zip |
Use e_cal_remove_object for non-recurring appointments. Fixed some memory leaks.
svn path=/trunk/; revision=29703
-rw-r--r-- | calendar/ChangeLog | 15 | ||||
-rw-r--r-- | calendar/conduits/calendar/calendar-conduit.c | 11 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 13 | ||||
-rw-r--r-- | calendar/gui/dialogs/meeting-page.c | 5 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.c | 19 | ||||
-rw-r--r-- | calendar/gui/e-itip-control.c | 5 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 10 | ||||
-rw-r--r-- | calendar/gui/itip-utils.c | 4 |
8 files changed, 67 insertions, 15 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index f380cb62f6..a74cb2cce1 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,18 @@ +2005-07-11 Chenthill Palanisamy <pchenthill@novell.com> + + * conduits/calendar/calendar-conduit.c: (process_multi_day), + (delete_record): + * gui/dialogs/comp-editor.c: (save_comp), (delete_comp): + * gui/e-calendar-view.c: (e_calendar_view_cut_clipboard), + (delete_event), (transfer_item_to): + * gui/e-itip-control.c: (remove_item): + * gui/gnome-cal.c: (gnome_calendar_purge): + * gui/dialogs/meeting-page.c: (meeting_page_construct): Use + e_cal_remove_with_mod for removing recurring apppointment and call + e_cal_remove_object for non-recurring ones. + * gui/itip-utils.c: (itip_organizer_is_user), + (itip_get_comp_attendee): Fixed some memory leaks. + 2005-07-06 Chenthill Palanisamy <pchenthill@novell.com> * gui/dialogs/event-page.c: (sensitize_widgets): Enable alarms diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index f67a6b6f1e..d84fb72e83 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -654,7 +654,11 @@ process_multi_day (ECalConduitContext *ctxt, ECalChange *ccc, GList **multi_comp e_cal_component_get_uid (ccc->comp, &uid); /* FIXME Error handling */ - e_cal_remove_object (ctxt->client, uid, NULL); + if (e_cal_component_is_instance (ccc->comp) || e_cal_component_has_recurrences (ccc->comp)) + e_cal_remove_object_with_mod (ctxt->client, uid, NULL, CALOBJ_MOD_ALL, NULL); + else + e_cal_remove_object (ctxt->client, uid, NULL); + ccc->type = E_CAL_CHANGE_DELETED; cleanup: @@ -1749,7 +1753,10 @@ delete_record (GnomePilotConduitSyncAbs *conduit, e_pilot_map_remove_by_uid (ctxt->map, uid); /* FIXME Error handling */ - e_cal_remove_object (ctxt->client, uid, NULL); + if (e_cal_component_is_instance (local->comp) || e_cal_component_has_recurrences (local->comp)) + e_cal_remove_object_with_mod (ctxt->client, uid, NULL, CALOBJ_MOD_ALL, NULL); + else + e_cal_remove_object (ctxt->client, uid, NULL); return 0; } diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index fe7cba9dfd..3e26effbb4 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -719,7 +719,12 @@ save_comp (CompEditor *editor) e_cal_get_source (priv->source_client)) && cal_comp_is_on_server (priv->comp, priv->source_client)) { /* Comp found a new home. Remove it from old one. */ - e_cal_remove_object (priv->source_client, orig_uid, NULL); + + if (e_cal_component_is_instance (priv->comp) || e_cal_component_has_recurrences (priv->comp)) + e_cal_remove_object_with_mod (priv->source_client, orig_uid, NULL, + CALOBJ_MOD_ALL, NULL); + else + e_cal_remove_object (priv->source_client, orig_uid, NULL); /* Let priv->source_client point to new home, so we can move it * again this session. */ @@ -1159,7 +1164,11 @@ delete_comp (CompEditor *editor) priv = editor->priv; e_cal_component_get_uid (priv->comp, &uid); - e_cal_remove_object (priv->client, uid, NULL); + if (e_cal_component_is_instance (priv->comp)|| e_cal_component_has_recurrences (priv->comp)) + e_cal_remove_object_with_mod (priv->client, uid, NULL, + CALOBJ_MOD_ALL, NULL); + else + e_cal_remove_object (priv->client, uid, NULL); close_dialog (editor); } diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index f7046853e1..17072c6a2c 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -955,7 +955,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems, ECal *client) { MeetingPagePrivate *priv; - char *backend_address; + char *backend_address = NULL; EIterator *it; EAccount *def_account; GList *address_strings = NULL, *l; @@ -1005,6 +1005,9 @@ meeting_page_construct (MeetingPage *mpage, EMeetingStore *ems, } } + if (backend_address) + g_free (backend_address); + g_object_unref(it); if (address_strings) diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 8d65a7808d..df35cccf4b 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -691,7 +691,8 @@ e_calendar_view_cut_clipboard (ECalendarView *cal_view) &error); icalcomponent_free (icalcomp); } else - e_cal_remove_object (event->comp_data->client, uid, &error); + e_cal_remove_object_with_mod (event->comp_data->client, uid, NULL, + CALOBJ_MOD_ALL, &error); } else e_cal_remove_object (event->comp_data->client, uid, &error); delete_error_dialog (error, E_CAL_COMPONENT_EVENT); @@ -864,7 +865,10 @@ delete_event (ECalendarView *cal_view, ECalendarViewEvent *event) return; } - e_cal_remove_object (event->comp_data->client, uid, &error); + if (e_cal_util_component_is_instance (event->comp_data->icalcomp) || e_cal_util_component_is_instance (event->comp_data->icalcomp)) + e_cal_remove_object_with_mod (event->comp_data->client, uid, NULL, CALOBJ_MOD_ALL, &error); + else + e_cal_remove_object (event->comp_data->client, uid, &error); delete_error_dialog (error, E_CAL_COMPONENT_EVENT); g_clear_error (&error); @@ -1178,8 +1182,13 @@ transfer_item_to (ECalendarViewEvent *event, ECal *dest_client, gboolean remove_ } /* remove the item from the source calendar */ - if (remove_item) - e_cal_remove_object (event->comp_data->client, uid, NULL); + if (remove_item) { + if (e_cal_util_component_is_instance (event->comp_data->icalcomp) || e_cal_util_component_is_instance (event->comp_data->icalcomp)) + e_cal_remove_object_with_mod (event->comp_data->client, uid, + NULL, CALOBJ_MOD_ALL, NULL); + else + e_cal_remove_object (event->comp_data->client, uid, NULL); + } } static void @@ -1326,9 +1335,7 @@ on_delegate (EPopup *ep, EPopupItem *pitem, void *data) selected = e_calendar_view_get_selected_events (cal_view); if (selected) { ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data; - char *address; - e_cal_get_cal_address (event->comp_data->client, &address, NULL); clone = icalcomponent_new_clone (event->comp_data->icalcomp); set_attendee_status_for_delegate (clone, event->comp_data->client); diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 77116834a1..3d3d08143c 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -2001,7 +2001,10 @@ remove_item (EItipControl *itip) return; e_cal_component_get_uid (priv->comp, &uid); - e_cal_remove_object (priv->current_ecal, uid, &error); + if (e_cal_component_has_recurrences (priv->comp)) + e_cal_remove_object_with_mod (priv->current_ecal, uid, NULL, CALOBJ_MOD_ALL, &error); + else + e_cal_remove_object (priv->current_ecal, uid, &error); if (!error || error->code == E_CALENDAR_STATUS_OBJECT_NOT_FOUND) { dialog = gnome_ok_dialog (_("Removal Complete")); gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 0a42ce13ee..a672b534ff 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -3326,8 +3326,14 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than) &remove); /* FIXME Better error handling */ - if (remove) - e_cal_remove_object (client, icalcomponent_get_uid (m->data), NULL); + if (remove) { + const char *uid = icalcomponent_get_uid (m->data); + + if (e_cal_util_component_is_instance (m->data) || e_cal_util_component_has_recurrences (m->data)) + e_cal_remove_object_with_mod (client, uid, NULL, CALOBJ_MOD_ALL, NULL); + else + e_cal_remove_object (client, uid, NULL); + } } g_list_foreach (objects, (GFunc) icalcomponent_free, NULL); diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 517e3cad97..d361815081 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -103,7 +103,7 @@ itip_organizer_is_user (ECalComponent *comp, ECal *client) strip = itip_strip_mailto (organizer.value); if (e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) { - char *email; + char *email = NULL; if (e_cal_get_cal_address (client, &email, NULL) && !g_strcasecmp (email, strip)) { g_free (email); @@ -111,6 +111,7 @@ itip_organizer_is_user (ECalComponent *comp, ECal *client) return TRUE; } + g_free (email); return FALSE; } @@ -181,6 +182,7 @@ itip_get_comp_attendee (ECalComponent *comp, ECal *client) g_free (address); return user_email; } + g_free (address); } for (it = e_list_get_iterator((EList *)al); |