diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-08-29 06:15:22 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2000-08-29 06:15:22 +0800 |
commit | b807448dce5d356dcd1b4ea6133abf104564e44b (patch) | |
tree | 6b6bc7500e70d2f3bc2c79dc3ee2f93f8c1c1a20 /calendar | |
parent | 2a94d1f24390b767ff72b54ed183efec1a93cfe6 (diff) | |
download | gsoc2013-evolution-b807448dce5d356dcd1b4ea6133abf104564e44b.tar.gz gsoc2013-evolution-b807448dce5d356dcd1b4ea6133abf104564e44b.tar.zst gsoc2013-evolution-b807448dce5d356dcd1b4ea6133abf104564e44b.zip |
Remove the icalcomponent from the toplevel calendar here.
2000-08-28 Federico Mena Quintero <federico@helixcode.com>
* pcs/cal-backend-file.c (remove_component): Remove the
icalcomponent from the toplevel calendar here.
(cal_backend_file_update_object): Do not remove it here.
(cal_backend_file_remove_object): Do not remove it here.
(add_component): Add the icalcomponent to the toplevel calendar if
asked to.
(cal_backend_file_update_object): Do not add it here.
svn path=/trunk/; revision=5089
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 10 | ||||
-rw-r--r-- | calendar/pcs/cal-backend-file.c | 49 |
2 files changed, 38 insertions, 21 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 9c02231fc5..5b3ba7b04a 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,13 @@ +2000-08-28 Federico Mena Quintero <federico@helixcode.com> + + * pcs/cal-backend-file.c (remove_component): Remove the + icalcomponent from the toplevel calendar here. + (cal_backend_file_update_object): Do not remove it here. + (cal_backend_file_remove_object): Do not remove it here. + (add_component): Add the icalcomponent to the toplevel calendar if + asked to. + (cal_backend_file_update_object): Do not add it here. + 2000-08-28 JP Rosevear <jpr@helixcode.com> * gui/event-editor.c (dialog_to_comp_object): Initiliaze tzid to diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c index 6747280f38..c60c0c118a 100644 --- a/calendar/pcs/cal-backend-file.c +++ b/calendar/pcs/cal-backend-file.c @@ -440,7 +440,7 @@ check_dup_uid (CalBackendFile *cbfile, CalComponent *comp) * that we don't lose them. */ static void -add_component (CalBackendFile *cbfile, CalComponent *comp) +add_component (CalBackendFile *cbfile, CalComponent *comp, gboolean add_to_toplevel) { CalBackendFilePrivate *priv; GList **list; @@ -474,20 +474,42 @@ add_component (CalBackendFile *cbfile, CalComponent *comp) g_hash_table_insert (priv->comp_uid_hash, (char *) uid, comp); *list = g_list_prepend (*list, comp); + + /* Put the object in the toplevel component if required */ + + if (add_to_toplevel) { + icalcomponent *icalcomp; + + icalcomp = cal_component_get_icalcomponent (comp); + g_assert (icalcomp != NULL); + + icalcomponent_add_component (priv->icalcomp, icalcomp); + } } /* Removes a component from the backend's hash and lists. Does not perform - * notification on the clients. + * notification on the clients. Also removes the component from the toplevel + * icalcomponent. */ static void remove_component (CalBackendFile *cbfile, CalComponent *comp) { CalBackendFilePrivate *priv; + icalcomponent *icalcomp; const char *uid; GList **list, *l; priv = cbfile->priv; + /* Remove the icalcomp from the toplevel */ + + icalcomp = cal_component_get_icalcomponent (comp); + g_assert (icalcomp != NULL); + + icalcomponent_remove_component (priv->icalcomp, icalcomp); + + /* Remove it from our mapping */ + cal_component_get_uid (comp, &uid); g_hash_table_remove (priv->comp_uid_hash, uid); @@ -548,7 +570,7 @@ scan_vcalendar (CalBackendFile *cbfile) if (!cal_component_set_icalcomponent (comp, icalcomp)) continue; - add_component (cbfile, comp); + add_component (cbfile, comp, FALSE); } } @@ -950,7 +972,7 @@ cal_backend_file_update_object (CalBackend *backend, const char *uid, const char { CalBackendFile *cbfile; CalBackendFilePrivate *priv; - icalcomponent *icalcomp, *icalcomp2; + icalcomponent *icalcomp; icalcomponent_kind kind; CalComponent *old_comp; CalComponent *comp; @@ -1001,19 +1023,10 @@ cal_backend_file_update_object (CalBackend *backend, const char *uid, const char old_comp = lookup_component (cbfile, uid); - if (old_comp) { - /* Remove it from our calendar component */ - icalcomp2 = cal_component_get_icalcomponent (old_comp); - icalcomponent_remove_component (priv->icalcomp, icalcomp2); - + if (old_comp) remove_component (cbfile, old_comp); - } - - /* Add it to our calendar component */ - icalcomp2 = cal_component_get_icalcomponent (comp); - icalcomponent_add_component (priv->icalcomp, icalcomp2); - add_component (cbfile, comp); + add_component (cbfile, comp, TRUE); #if 0 /* FIXME */ new_ico->pilot_status = ICAL_PILOT_SYNC_MOD; @@ -1034,7 +1047,6 @@ cal_backend_file_remove_object (CalBackend *backend, const char *uid) CalBackendFile *cbfile; CalBackendFilePrivate *priv; CalComponent *comp; - icalcomponent *icalcomp; cbfile = CAL_BACKEND_FILE (backend); priv = cbfile->priv; @@ -1047,12 +1059,7 @@ cal_backend_file_remove_object (CalBackend *backend, const char *uid) if (!comp) return FALSE; - /* Remove it from our calendar component */ - icalcomp = cal_component_get_icalcomponent (comp); - icalcomponent_remove_component (priv->icalcomp, icalcomp); - remove_component (cbfile, comp); - mark_dirty (cbfile); /* FIXME: do the notification asynchronously */ |