diff options
author | nobody <nobody@localhost> | 2003-09-26 23:53:23 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2003-09-26 23:53:23 +0800 |
commit | 911c3b9d4fe2f40bc34029ef798ed78fdf0fcb42 (patch) | |
tree | e3efa4958cf2cf6bfe50e2a15c729b9014efa5db /calendar | |
parent | 99c61843f0d1da7f9b3b73b99bab0e918ce99e5b (diff) | |
download | gsoc2013-evolution-new-calendar-branch-merge-end.tar gsoc2013-evolution-new-calendar-branch-merge-end.tar.gz gsoc2013-evolution-new-calendar-branch-merge-end.tar.bz2 gsoc2013-evolution-new-calendar-branch-merge-end.tar.lz gsoc2013-evolution-new-calendar-branch-merge-end.tar.xz gsoc2013-evolution-new-calendar-branch-merge-end.tar.zst gsoc2013-evolution-new-calendar-branch-merge-end.zip |
This commit was manufactured by cvs2svn to create tagnew-calendar-branch-merge-end
'new-calendar-branch-merge-end'.
svn path=/tags/new-calendar-branch-merge-end/; revision=22718
Diffstat (limited to 'calendar')
47 files changed, 2676 insertions, 2713 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 827b997321..0747082457 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,195 +1,1321 @@ -2003-09-22 Hans Petter Jansson <hpj@ximian.com> +2003-09-26 JP Rosevear <jpr@ximian.com> - * cal-util/Makefile.am (libical_util_la_LIBADD): - libical.la -> libical-evolution.la + * pcs/cal-backend.c (cal_backend_class_init): remove cal_added + signal - * importers/Makefile.am (libevolution_calendar_importers_la_LIBADD): - libicalvcal.la -> libicalvcal-evolution.la +2003-09-26 JP Rosevear <jpr@ximian.com> + + * pcs/cal.h: add protos + + * pcs/cal.c (cal_get_backend): accessor + (cal_get_listener): ditto + + * pcs/cal-factory.c (impl_CalFactory_getCal): update to new + routine name + + * pcs/cal-backend.h: add protos + + * pcs/cal-backend.c (cal_backend_init): init client mutex + (cal_backend_finalize): destroy client mutex + (cal_destroy_cb): just remove the client + (listener_died_cb): remove the client, the listener died so it + can't really do anything + (last_client_gone): signal the last client gone + (cal_backend_add_client): add a client with locking and listen for + the death of the listener + (cal_backend_remove_client): remove client + +2003-09-26 Rodrigo Moya <rodrigo@ximian.com> + + * pcs/cal-backend-sync.c (_cal_backend_create_object): only free the + returned UID if it's not NULL. + + * pcs/cal.c (cal_notify_object_created): dont send NULL strings to + ORBit code. + +2003-09-26 Rodrigo Moya <rodrigo@ximian.com> + + * gui/comp-util.c (cal_comp_is_on_server): free the icalcomponent + returned from cal_client_get_object, and return TRUE if we find + the component on the backend. + + * gui/e-day-view.c (process_component): + * gui/e-week-view.c (process_component): added missing case, so that + we also display recurrent meetings starting before the time range and + ending after the time range. + + * cal-client/cal-listener.c (impl_notifyReadOnly): pass the + 'read_only' argument to the signal callback correctly (a gboolean + not a 'gboolean *'). + + * gui/comp-editor-factory.c (resolve_pending_requests): removed + the g_assert on 'oc->pending != NULL', since there are now cases + (local calendar) where we get to call this function (cal_opened_cb) + with no pending requests yet. + +2003-09-25 JP Rosevear <jpr@ximian.com> + + * gui/calendar-commands.c (publish_freebusy_cmd): adapt to new + get_free_busy api + + * conduits/calendar/calendar-conduit.c (post_sync): ditto + (pre_sync): ditto + + * conduits/todo/todo-conduit.c (pre_sync): ditto + (post_sync): ditto + + * gui/e-meeting-model.c (refresh_busy_periods): ditto + + * gui/e-itip-control.c (send_freebusy): ditto + + * gui/e-cal-view.c (on_publish): ditto + + * cal-client/cal-listener.h: add signals + + * cal-client/cal-listener.c (build_change_list): move here from + cal-client.c + (impl_notifyChanges): implement + (build_free_busy_list): util to create the GList of free busy + objects + (impl_notifyFreeBusy): implement + (cal_listener_class_init): set free busy and changes epv methods, + add signals + + * cal-client/cal-client.h: update protos + + * cal-client/cal-client.c (cal_get_changes_cb): get changes call + back + (cal_get_free_busy_cb): get free busy call back + (cal_client_init): listen for free busy and changes signals + (cal_client_get_changes): convert to new threaded sync api + (cal_client_get_free_busy): ditto + + * pcs/cal.h: add protos + + * pcs/cal.c: remove dead type conversion function + (impl_Cal_getChanges): implement by just calling, no return stuff + (impl_Cal_getFreeBusy): ditto + (cal_notify_changes): do getChanges callback + (cal_notify_free_busy): do getFreeBusy callback + + * pcs/cal-backend.h: update protos, vmethods + + * pcs/cal-backend.c (cal_backend_get_free_busy): call through + (cal_backend_get_changes): ditto + + * pcs/cal-backend-sync.h: add vmethods, protos + + * pcs/cal-backend-sync.c (cal_backend_sync_get_changes): call + through + (cal_backend_sync_get_free_busy): ditto + (_cal_backend_get_changes): backend implementation, notify + (_cal_backend_get_free_busy): ditto + (cal_backend_sync_class_init): set free busy and changes + implementations + + * pcs/cal-backend-file.c (cal_backend_file_get_free_busy): convert + to sync backend method + (cal_backend_file_compute_changes_foreach_key): remove from the + hash here + (cal_backend_file_compute_changes): no need to build the sequence + here + (cal_backend_file_get_changes): convert to sync backend method + (cal_backend_file_class_init): set sync backend methods for free + busy and changes + + * idl/evolution-calendar.idl: convert getChanges and getFreeBusy + to new async api + +2003-09-25 JP Rosevear <jpr@ximian.com> + + * pcs/cal-backend.h: remove dead result enums + + * pcs/cal-backend.c: fix comments + + * idl/evolution-calendar.idl: remove dead exceptions + +2003-09-25 JP Rosevear <jpr@ximian.com> + + * pcs/cal.c (cal_notify_default_object): send back the empty + string if the object is NULL + (cal_notify_object): ditto + +2003-09-25 JP Rosevear <jpr@ximian.com> + + * gui/comp-editor-factory.c (edit_existing): convert to api + changes + + * conduits/todo/todo-conduit.c (local_record_from_uid): ditto + (pre_sync): ditto + + * conduits/calendar/calendar-conduit.c (local_record_from_uid): + ditto + (pre_sync): ditto + + * importers/icalendar-importer.c (update_single_object): ditto + + * gui/dialogs/comp-editor.c (obj_updated_cb): ditto + + * gui/e-itip-control.c (get_real_item): ditto + (find_server): ditto + + * gui/comp-util.c (cal_comp_is_on_server): ditto + (cal_comp_event_new_with_defaults): ditto + (cal_comp_task_new_with_defaults): ditto + + * cal-client/cal-listener.h: add signals + + * cal-client/cal-listener.c (impl_notifyDefaultObjectRequested): + implement + (impl_notifyObjectRequested): ditto + (cal_listener_class_init): set above epv implementations, add signals + + * cal-client/cal-client.h: update protos + + * cal-client/cal-client.c (cal_default_object_requested_cb): get + default object callback + (cal_object_requested_cb): get object callback + (cal_client_init): listen for get and get default object signals + (cal_client_get_default_object): convert to new sync api + (cal_client_get_object): ditto + + * pcs/cal.h: add protos + + * pcs/cal.c (impl_Cal_getDefaultObject): just call the backend, it + does the notification now + (impl_Cal_getObject): ditto + (cal_notify_default_object): do getDefaultObject response + (cal_notify_object): do getObject response + + * pcs/cal-backend.h: remove vmethods, protos + + * pcs/cal-backend.c: remove a couple of dead functions + (cal_backend_class_init): get_object_component is no longer a + vmethod + (cal_backend_get_default_object): call through + (cal_backend_get_object): ditto + + * pcs/cal-backend-sync.h: add protos, vmethods + + * pcs/cal-backend-sync.c (cal_backend_sync_get_default_object): + call through + (cal_backend_sync_get_object): ditto + (_cal_backend_discard_alarm): pass correct params to + cal_notify_discard_alarm + (_cal_backend_get_default_object): call through and notify + (_cal_backend_get_object): ditto + (cal_backend_sync_class_init): set backend implementations + + * pcs/cal-backend-file.c (cal_backend_file_get_default_object): + convert to sync backend method + (cal_backend_file_get_object): ditto + (cal_backend_file_compute_changes_foreach_key): just look up the + component rather than using the backend vmethod + (cal_backend_file_remove_object): return valid sync status codes + (cal_backend_file_class_init): move get_object, get_default_object + to sync class + + * idl/evolution-calendar.idl: convert getObject and + getDefaultObject to new async idl + +2003-09-25 JP Rosevear <jpr@ximian.com> + + * pcs/cal.c (impl_Cal_discardAlarm): just call the backend + function, it does the notification + (cal_notify_alarm_discarded): notify of discard alarm call + + * pcs/cal-backend.h: update proto + + * pcs/cal-backend.c (cal_backend_discard_alarm): call through + + * pcs/cal-backend-sync.h: add proto, vmethod + + * pcs/cal-backend-sync.c (cal_backend_sync_discard_alarm): call + through + (_cal_backend_discard_alarm): call through and notify + (cal_backend_sync_class_init): set discard alarm implementation + + * pcs/cal-backend-file.c (cal_backend_file_discard_alarm): match + sync backend vmethod + (cal_backend_file_class_init): set alarm vmethod implementation + + * idl/evolution-calendar.idl: switch discardAlarm to new api + + * gui/alarm-notify/alarm-queue.c (remove_queued_alarm): match new + api + + * cal-client/cal-listener.h: add signal + + * cal-client/cal-listener.c (impl_notifyAlarmDiscarded): implement + (cal_listener_class_init): add alarm, send, receive epv functions, + alarm signal + + * cal-client/cal-client.h: update proto + + * cal-client/cal-client.c (cal_alarm_discarded_cb): discardAlarm + callback + (cal_client_init): listen to discard alarm signal + (cal_client_discard_alarm): implement with new threaded sync api + +2003-09-25 JP Rosevear <jpr@ximian.com> + + * idl/evolution-calendar.idl: remove unused user exceptions + +2003-09-24 Rodrigo Moya <rodrigo@ximian.com> + + * pcs/cal-backend-util.[ch] (cal_backend_util_fill_alarm_instances_seq): + removed unneeded function. + +2003-09-24 JP Rosevear <jpr@ximian.com> + + * conduits/*/*.c: adjust to new timezone api calls + + * gui/*.c: ditto + + * gui/dialogs/*.c: ditto + + * cal-client/cal-listener.h: add new signals + + * cal-client/cal-listener.c (convert_status): convert invalid + object as well + (impl_notifyTimezoneRequested): implement + (impl_notifyDefaultTimezoneSet): ditto + (cal_listener_class_init): set epv implementations for timezone + functions + (cal_listener_class_init): create timezone response signals + + * cal-client/cal-client.h: update protos + + * cal-client/cal-client.c: fix return values all over the place + (cal_get_timezone_cb): getTimezone response + (cal_query_cb): setDefaultTimezone response + (cal_client_init): listen for new response signals + (cal_client_get_timezone): implement using new thread sync api + (cal_client_ensure_timezone_on_server): use add timezone call + (cal_client_set_default_timezone): oimplement using new thread sync + api + + * cal-client/cal-client-types.h: add invalid object status code + + * idl/evolution-calendar.idl: getQuery no longer raises any user + exceptions, remove dead types and exceptions + +2003-09-24 JP Rosevear <jpr@ximian.com> + + * pcs/cal.h: new protos + + * pcs/cal.c (impl_Cal_getTimezone): call backend implementation + (impl_Cal_addTimezone): ditto + (impl_Cal_setDefaultTimezone): ditto + (cal_class_init): set epv implementations of timezone functions + (cal_notify_timezone_requested): notify of get timezone response + (cal_notify_default_timezone_set): notify of default timezone + being set + + * pcs/cal-backend.h: new vmethods, protos + + * pcs/cal-backend.c (cal_backend_class_init): init new timezone + vmethods + (cal_backend_get_timezone): call through + (cal_backend_set_default_timezone): ditto + (cal_backend_add_timezone): ditto + (cal_backend_internal_get_default_timezone): ditto + (cal_backend_internal_get_timezone): ditto + + * pcs/cal-backend-sync.h: add vmethods, protos + + * pcs/cal-backend-sync.c (cal_backend_sync_get_timezone): call + through + (cal_backend_sync_set_default_timezone): ditto + (_cal_backend_set_default_timezone): call through and notify + (_cal_backend_get_timezone): ditto + (cal_backend_sync_class_init): set backend implementations for new + funcs + + * pcs/cal-backend-object-sexp.c (func_occur_in_time_range): get + time_t values based on the zone + + * pcs/cal-backend-file.c: reorg so we don't have to prototype + everything + (cal_backend_file_get_timezone): implement the sync backend way + (cal_backend_file_add_timezone): ditto + (cal_backend_file_set_default_timezone): ditto + (cal_backend_file_internal_get_default_timezone): internal method, + for sexp comparison + (cal_backend_file_internal_get_timezone): ditto + + * idl/evolution-calendar.idl: convert timezone routines to async + api + +2003-09-23 Rodrigo Moya <rodrigo@ximian.com> + + * pcs/cal-backend-object-sexp.c (func_occur_in_time_range): dont expand + recurrences, since they are supposed to be expanded in the backends. + (instance_occur_cb, resolve_tzid): removed unneeded functions. + + * pcs/cal-backend-file.c (cal_backend_file_add_timezone): guard against + adding the timezone if it's already there. + +2003-09-23 JP Rosevear <jpr@ximian.com> + + * pcs/cal.c (cal_notify_object_created): notify with the object, + not the uid + + * gui/e-cal-model.c (add_new_client): don't listen for + non-existent signal + +2003-09-23 JP Rosevear <jpr@ximian.com> + + * cal-client/cal-client.h: remove dead proto + +2003-09-23 JP Rosevear <jpr@ximian.com> + + * cal-client/cal-client.h: remove send result enum + + * gui/itip-utils.c (comp_server_send): use the new send_objects + routine + +2003-09-23 JP Rosevear <jpr@ximian.com> + + * cal-client/cal-client.h: remove send result enum + +2003-09-23 JP Rosevear <jpr@ximian.com> + + * cal-client/cal-client.h: remove enum, protos + + * cal-client/cal-client.c: remove remove status enum typing + +2003-09-23 Rodrigo Moya <rodrigo@ximian.com> + + * importers/icalendar-importer.c (update_objects): new function + to manage the update of components, taking into account + VTIMEZONE components. + (process_item_fn, gnome_calendar_import_data_fn): use + update_objects instead of cal_client_update_objects. + +2003-09-23 JP Rosevear <jpr@ximian.com> + + * pcs/cal.h: update proto + + * pcs/cal.c (impl_Cal_addTimezone): just call add_timezone, it + does the notification + (cal_notify_object_created): only notify the query if the object + matches + (cal_notify_object_removed): ditto + + * pcs/cal-backend.h: update proto, vmethod + + * pcs/cal-backend.c (cal_backend_add_timezone): returns void + + * pcs/cal-backend-sync.h: update proto, vmethod + + * pcs/cal-backend-sync.c (cal_backend_sync_remove_object): add the + object as an out param + (_cal_backend_remove_object): get the object and pass it in the + notification + + * pcs/cal-backend-file.c (cal_backend_file_create_object): kill + cal_backend_file_update_objects call, its more efficient to create + the comp ourselves; stamp the creation time, add the component to + the toplevel + (cal_backend_file_modify_object): kill the + cal_backend_file_update_objects call, add the component to the + toplevel + (cal_backend_file_remove_object): pass back the object when + removing + +2003-09-23 JP Rosevear <jpr@ximian.com> + + * cal-client/cal-query.c (cal_query_finalize): disconnect the + signal handlers + + * cal-client/cal-client.c (cal_client_get_query): unref the + listener when done + +2003-09-23 Rodrigo Moya <rodrigo@ximian.com> + + * gui/e-cal-view.c (selection_received): add VTIMEZONE components + contained in the clipboard data to the backend. + +2003-09-22 JP Rosevear <jpr@ximian.com> + + * gui/dialogs/comp-editor.c (save_comp): modify and create instead + of update, simplify mod code + +2003-09-22 JP Rosevear <jpr@ximian.com> + + * gui/e-day-view.c (e_day_view_finish_long_event_resize): modify + the object instead of update, simplify the instance handling + (e_day_view_finish_resize): ditto + (e_day_view_on_top_canvas_drag_data_received): ditto + (e_day_view_on_main_canvas_drag_data_received): ditto + +2003-09-22 Rodrigo Moya <rodrigo@ximian.com> + + * cal-client/cal-client.c (cal_client_get_alarms_in_range): use + 'has-alarms' function in the search expression. + + * pcs/cal-backend-object-sexp.c (func_has_alarms): new SExp function. + +2003-09-22 JP Rosevear <jpr@ximian.com> + + * gui/e-day-view.c (e_day_view_on_editing_stopped): create the + object if its not on the server or modify it if it is + + * gui/e-week-view.c (e_week_view_on_editing_stopped): we return if + there is no text and it *not* on the server + +2003-09-22 JP Rosevear <jpr@ximian.com> + + * gui/e-week-view.c (e_week_view_on_editing_stopped): create the + object if its not on the server or modify it if it is + +2003-09-22 JP Rosevear <jpr@ximian.com> + + * gui/gnome-cal.h: remove proto + + * gui/gnome-cal.c: remove gnome_calendar_unrecur_selection + + * gui/e-week-view.h: remove proto + + * gui/e-week-view.c: remove e_week_view_unrecur_appointment + + * gui/e-day-view.h: remove proto + + * gui/e-day-view.c: remove e_day_view_unrecur_appointment + + * gui/e-cal-view.c: remove on_unrecur_appointment (this is handled + better via recurrence id's now) + +2003-09-22 JP Rosevear <jpr@ximian.com> + + * gui/e-itip-control.c (update_attendee_status): ifdef out, leave + temporarily for reference, but otherwise it shouldn't be needed + (update_item): switch to using receive objects + (ok_clicked_cb): update item when receiving a reply + + * gui/e-calendar-table.c (selection_received): switch to using + create object from update_objects + + * gui/e-cal-view.c (selection_received_add_event): util routine to + prevent duplication + (selection_received): use above + + * gui/e-cal-model.c (ecm_set_value_at): switch to using modify + object from update_objects + (ecm_append_row): switch to using create object from + update_objects + + * gui/e-cal-model-calendar.c (ecmc_set_value_at): switch to using + modify object from update_objects + + * gui/e-cal-model-tasks.c (ecmt_set_value_at): ditto + +2003-09-19 Rodrigo Moya <rodrigo@ximian.com> + + * idl/evolution-calendar.idl: removed getAlarmsInRange and + getAlarmsForObject methods. + + * pcs/cal.c (impl_Cal_getAlarmsInRange, impl_Cal_getAlarmsForObject): + removed unneeded CORBA methods. + (cal_class_init): dont set removed methods in the epv. + + * pcs/cal-backend.[ch]: removed get_alarms_in_range and + get_alarms_for_object virtual methods. + (cal_backend_get_alarms_in_range, cal_backend_get_alarms_for_object): + removed. + (cal_backend_class_init): dont set removed virtual methods. + + * pcs/cal-backend-file.c (cal_backend_file_get_alarms_in_range, + cal_backend_file_get_alarms_for_object): removed. + (cal_backend_file_class_init): dont set removed virtual methods. + +2003-09-19 Rodrigo Moya <rodrigo@ximian.com> + + * cal-client/cal-client.c (cal_client_get_alarms_in_range): changed + to use queries. + (build_component_alarms_list): create the alarm list from a list + of iCalendar strings. + (build_alarm_instance_list): removed. + (cal_client_get_alarms_for_object): dont call the CORBA methods, + just get alarms by itself. + +2003-09-18 Rodrigo Moya <rodrigo@ximian.com> + + * cal-client/cal-listener.[ch]: added "add_timezone" signal. + (impl_notifyTimezoneAdded): implemented new CalListener method. + (cal_listener_class_init): create "add_timezone" signal for the class. + + * cal-client/cal-client.[ch] (cal_client_add_timezone): new function. + (cal_client_init): connect to "add_timezone" signal on the + CalListener. + (cal_add_timezone_cb): callback for the "add_timezone" signal. + +2003-09-18 Rodrigo Moya <rodrigo@ximian.com> + + * idl/evolution-calendar.idl: added 'notifyTimezoneAdded' method + to the Calendar::Listener interface. + + * pcs/cal-backend-sync.[ch] (cal_backend_sync_add_timezone): + (_cal_backend_add_timezone): new functions for the new virtual + method implementation. + + * pcs/cal.[ch] (cal_notify_timezone_added): new function. + + * pcs/cal-backend-file.c (cal_backend_add_timezone): converted to + return a CalBackendSyncStatus. + (cal_backend_file_class_init): the 'add_timezone' method we implement + is the one in the CalBackendSync class. + (cancel_receive_object): added missing 'return'. + (free_cal_component): removed unused function. + +2003-09-17 Rodrigo Moya <rodrigo@ximian.com> + + * pcs/cal-backend-file.c (cal_backend_add_timezone): added new + virtual method implementation. + + * pcs/cal.c (impl_Cal_addTimezone): check return value from + cal_backend_add_timezone, and set an exception if an error is + returned. 2003-09-16 Rodrigo Moya <rodrigo@ximian.com> - * conduits/todo/Makefile.am: removed libwombat reference. + * idl/evolution-calendar.idl: added addTimezone method. + + * pcs/cal.c (impl_Cal_addTimezone): implemented new method. + (cal_class_init): set new method on the epv. + + * pcs/cal-backend.[ch]: added 'add_timezone' virtual method. + (cal_backend_add_timezone): implemented new virtual method. + + * pcs/cal-backend-file.c (cal_backend_file_modify_object): it's + cal_component_get_as_string, not cal_component_as_string. + + * cal-client/cal-client.c (cal_client_ensure_timezone_on_server): + dont use anymore updateObjects method, use addTimezone instead. + +2003-09-15 Rodrigo Moya <rodrigo@ximian.com> + + * pcs/cal-backend-file.c (cal_backend_file_create_object): return + the UID of the added object. + (cal_backend_file_remove_object): ditto for old_object. + +2003-09-15 <jpr@ximian.com> + + * conduits/todo/todo-conduit.c (replace_record): switch to modify + object + (add_record): switch to using create object + + * conduits/calendar/calendar-conduit.c (process_multi_day): switch + to using create object + (add_record): switch to using create object + (replace_record): switch to modify object + + * cal-client/cal-listener.h: add signals + + * cal-client/cal-listener.c (impl_notifyObjectsReceived): + implement listener method + (build_object_list): ditto + (cal_listener_class_init): create receive_objects and send_objects + signals + + * cal-client/cal-client.h: add, update protos + + * cal-client/cal-client.c (cal_objects_received_cb): + receive_objects callback + (cal_objects_sent_cb): send_objects callback + (cal_client_init): listen for above signals + (cal_client_create_object): pass back uid + (cal_client_receive_objects): implement + (cal_client_send_objects): ditto + + * idl/evolution-calendar.idl: add receive/send objects methods and + yank updateObjects + + * pcs/cal.h: add protos + + * pcs/cal.c (impl_Cal_receiveObjects): implement + (impl_Cal_sendObjects): ditto + (cal_class_init): add epv methods + (cal_notify_objects_received): notify of objects received call, + updating queries + (cal_notify_objects_sent): notify of objects sent + + * pcs/cal-backend.h: remove proto + + * pcs/cal-backend.c (cal_backend_class_init): remove obj_updated + signal + (cal_backend_class_init): init vmethods properly + (cal_backend_receive_objects): call through + (cal_backend_send_objects): ditto + + * pcs/cal-backend-sync.h: add protos, vmethods + + * pcs/cal-backend-sync.c (cal_backend_sync_receive_objects): call + through + (cal_backend_sync_send_objects): ditto + (_cal_backend_receive_objects): call backend method and notify + (_cal_backend_send_objects): ditto + (cal_backend_sync_class_init): override send/receive object + vmethods + + * pcs/cal-backend-file.c (cal_backend_file_class_init): set + remove/send objects sync vmethods + (cal_backend_file_create_object): remove call to dead method + (cal_backend_file_remove_object): ditto + (cal_backend_file_modify_object): ditto + (cancel_received_object): cancel an object + (check_tzids): check we have all the tzid's for the object + (cal_backend_file_receive_objects): receive a bunch of objects via + itip + (cal_backend_file_send_objects): skeleton implementation + +2003-09-15 Rodrigo Moya <rodrigo@ximian.com> + + * idl/evolution-calendar.idl: added InvalidObject CallStatus. + + * pcs/cal-backend-file.c (cal_backend_file_create_object): implemented. + (cal_backend_file_modify_object): implemented. + +2003-09-12 Rodrigo Moya <rodrigo@ximian.com> + + * pcs/cal.c (cal_notify_cal_address, cal_notify_alarm_email_address, + cal_notify_ldap_attribute, cal_notify_static_capability): + make sure we always notify listeners, regardless of whether the + string is empty or not. + + * cal-client/cal-client.c (check_capability): guard against using + NULL strings with strstr. + +2003-09-12 JP Rosevear <jpr@ximian.com> + + * cal-client/client-test.c (cal_opened_cb): listen for other query + signals + + * cal-client/cal-listener.h: add signals + + * cal-client/cal-listener.c (impl_notifyObjectCreated): implement + (impl_notifyObjectModified): implement + (cal_listener_class_init): assign epv implementations + (cal_listener_class_init): add create/modify object signals + + * cal-client/cal-client.h: add protos + + * cal-client/cal-client.c (cal_object_created_cb): object created + callback + (cal_object_modified_cb): object modified callback + (cal_client_init): listen for create/modify object signals from + the listener + (cal_client_create_object): call the create object method + (cal_client_modify_object): call the modify object method + + * cal-client/client-test.c (cal_opened_cb): listen for all the + query signals, tidy + +2003-09-12 JP Rosevear <jpr@ximian.com> + + * pcs/cal.c (impl_Cal_createObject): implement + (impl_Cal_modifyObject): ditto + (cal_class_init): set epv methods for create/modify + + * pcs/cal-backend.h: add protos, vmethod + + * pcs/cal-backend.c (cal_backend_class_init): init new vmethods + (cal_backend_create_object): call through + (cal_backend_modify_object): ditto + + * pcs/cal-backend-sync.h: add protos, vmethods + + * pcs/cal-backend-sync.c (cal_backend_sync_create_object): call + through + (cal_backend_sync_modify_object): ditto + (_cal_backend_create_object): create object and notify + (_cal_backend_modify_object): modify object and notify + + * pcs/cal-backend-file.c (cal_backend_file_create_object): + skeleton routine for creating objects + (cal_backend_file_modify_object): ditto for modifying + + * idl/evolution-calendar.idl: add createObject and modifyObject + calls + +2003-09-12 JP Rosevear <jpr@ximian.com> + + * pcs/cal.c (cal_notify_object_removed): its uid, not uids + +2003-09-12 JP Rosevear <jpr@ximian.com> + + * pcs/query.h: add protos + + * pcs/query.c (query_object_matches): use the sexp to check for a + match + (query_notify_objects_added_1): notify of one object added to + query + (query_notify_objects_modified_1): ditto for modification + (query_notify_objects_removed_1): ditto for removal + + * pcs/cal.h: add protos + + * pcs/cal.c (cal_notify_object_created): notify of object creation + (cal_notify_object_modified): notify of object modification + (cal_notify_object_removed): use the _1 routines + + * pcs/cal-backend-file.c (match_recurrence_sexp): this returns a + boolean + (cal_backend_file_update_objects): don't signal removals here now + + * idl/evolution-calendar.idl: add object created and modified + responses + +2003-09-11 JP Rosevear <jpr@ximian.com> + + * pcs/cal.h: update proto + + * pcs/cal.c (cal_notify_object_removed): notify relevant queries + of removal + + * pcs/cal-backend.c (cal_backend_get_queries): ref the list before + passing it back + + * pcs/cal-backend-sync.c (_cal_backend_remove_object): pass uid to + notification + +2003-09-11 JP Rosevear <jpr@ximian.com> + + * pcs/cal-backend-file.c (match_recurrence_sexp): don't unref the + component + + * cal-client/client-test.c (cal_opened_cb): listen to objects + added signal + (objects_added_cb): print the object uid + +2003-09-11 JP Rosevear <jpr@ximian.com> + + * pcs/cal-backend-object-sexp.c (cal_backend_object_sexp_text): + return the base text + +2003-09-11 JP Rosevear <jpr@ximian.com> + + * gui/gnome-cal.c (update_query): fix c/p typo -2003-09-15 Harry Lu <harry.lu@sun.com> +2003-09-11 JP Rosevear <jpr@ximian.com> - * gui/apps_evolution_calendar.schemas: change last_notification_time's - type from string to int. + * gui/gnome-cal.c (update_query): start the query -2003-09-12 Bolian Yin <bolian.yin@sun.com> + * gui/e-cal-model.c (update_query_for_client): ditto - * e-week-view.c (e_week_view_focus): make jump button focusable - (e_week_view_on_jump_button_event): key_press and focus event for jump button - (e_week_view_jump_to_button_item): new function, jump to the day view. - (e_week_view_is_jump_button_visible): new function. + * cal-client/client-test.c (cal_opened_cb): ditto + +2003-09-11 JP Rosevear <jpr@ximian.com> + + * cal-client/cal-query.h: add proto + + * cal-client/cal-query.c (cal_query_start): start the query + +2003-09-11 JP Rosevear <jpr@ximian.com> + + * gui/dialogs/delete-error.c (delete_error_dialog): accept GError + and base error messages on that + + * gui/dialogs/delete-error.h: update proto + + * gui/e-tasks.c (e_tasks_delete_completed): pass extra param to + cal_client_remove_object + + * conduits/todo/todo-conduit.c (delete_record): ditto + + * conduits/calendar/calendar-conduit.c (process_multi_day): ditto + (delete_record): ditto + + * gui/gnome-cal.c (gnome_calendar_purge): ditto + + * gui/dialogs/comp-editor.c (delete_comp): ditto + + * gui/e-cal-view.c (e_cal_view_cut_clipboard): pass the error to + delete_error_dialog + (delete_event): ditto + (e_cal_view_delete_selected_occurrence): ditto + + * gui/e-itip-control.c (remove_item): ditto + + * gui/e-calendar-table.c (delete_selected_components): ditto + + * cal-client/cal-listener.h: add signal + + * cal-client/cal-listener.c (impl_notifyObjectRemoved): implement + (cal_listener_class_init): set object removed implementation and + create signal + + * cal-client/cal-client.h: update protos + + * cal-client/cal-client.c (cal_object_removed_cb): object removal + callback + (cal_client_init): listen for object removal signal + (cal_client_remove_object_with_mod): make call synchronous + (cal_client_remove_object): pass new params + + * pcs/cal.h: add proto + + * pcs/cal.c (impl_Cal_removeObject): just call the backend + function + (cal_notify_object_removed): notify of removal + + * pcs/cal-backend.h: remove and update protos, remove signal + + * pcs/cal-backend.c (cal_backend_class_init): kill obj_removed + signal + (cal_backend_remove_object): there is no return value now + + * pcs/cal-backend-sync.h: add vmethod, proto + + * pcs/cal-backend-sync.c (cal_backend_sync_remove_object): call + through + (_cal_backend_remove_object): remove the object and then do the + notification + + * pcs/cal-backend-file.c (cal_backend_file_class_init): remove + object is not part of the sync class + (cal_backend_file_update_objects): there is no more removed signal + (cal_backend_file_remove_object): return sync status codes + + * idl/evolution-calendar.idl: make removeObject oneway and and a + notification method in the listener + +2003-09-11 Rodrigo Moya <rodrigo@ximian.com> + + * pcs/query.[ch] (query_get_text): new function. + (query_get_object_sexp): new function. + + * pcs/cal-backend-file.c (cal_backend_file_start_query): implemented. + +2003-09-10 JP Rosevear <jpr@ximian.com> + + * pcs/cal.h: update proto + + * pcs/cal.c (impl_Cal_getObjectList): just call the backend, it + will do the notification now + (cal_notify_object_list): the list is a list of strings + + * pcs/cal-backend.h: update vmethod, proto + + * pcs/cal-backend.c (cal_backend_get_object_list): call through + + * pcs/cal-backend-sync.h: add proto, vmethod + + * pcs/cal-backend-sync.c (cal_backend_sync_get_object_list): call + through + (_cal_backend_get_object_list): get the list of objects from the + sync backend and do the notification + (cal_backend_sync_class_init): set vmethod implementation + + * pcs/cal-backend-file.c (cal_backend_file_class_init): the get + object list call is now part of the sync backend + (cal_backend_file_get_object_list): return a status and put the + object list in the passed in param + +2003-09-10 JP Rosevear <jpr@ximian.com> + + * pcs/cal-backend.c (cal_backend_finalize): unref the elist + (cal_backend_init): init the query elist -2003-09-11 Hans Petter Jansson <hpj@ximian.com> +2003-09-10 JP Rosevear <jpr@ximian.com> - * cal-util/Makefile.am (libcal_util_la_LIBADD): - libical-evolution.la -> libical.la + * gui/gnome-cal.c (dn_query_objects_added_cb): match new query + signals - just tag here + (dn_query_objects_modified_cb): always retag + (dn_query_objects_removed_cb): ditto + (update_query): connect to new signals + (gnome_calendar_destroy): we don't keep a list of expunging + queries + (gnome_calendar_purge): no need to do the + expunge async, just get the object list immediately - * cal-util/cal-component.c (cal_component_get_classification) - (cal_component_set_classification) - (get_text_list) - (get_icaltimetype) - (get_datetime) - (get_period_list) - (get_recur_list) - (cal_component_get_transparency) - (cal_component_set_transparency): Adapt to new libical. + * gui/e-tasks.c (e_tasks_delete_completed): no need to do the + expunge async, just get the object list immediately - * cal-util/cal-util.c (cal_util_event_dates_match): Ditto. + * gui/e-cal-model.c (query_objects_added_cb): callback for objects + added to the query + (query_objects_modified_cb): ditto for modifications + (query_objects_removed_cb): ditto for removed + (query_progress_cb): progress of the query + (query_done_cb): query is done + (update_query_for_client): connect to the new signals - * pcs/cal-backend-file.c (create_user_free_busy): Ditto. + * cal-client/client-test.c (cal_opened_cb): run a query - * gui/e-cal-model-tasks.c (get_completed) - (get_due) - (get_due_status): Ditto. + * cal-client/cal-query.c: we are given the listener now - listen + for signals from the listener and emit signals matching the api + changes - * gui/e-cal-model.c (get_dtstart) - (set_classification): Ditto. + * cal-client/query-listener.[hc]: rewrite to match new query + listener methods and emit signals rather than using function + callbacks - * gui/e-cal-model-calendar.c (get_dtend) - (get_transparency) - (set_transparency): Adapt to new libical and fix a comparison bug. + * cal-client/cal-marshal.list: add to marshallers - * importers/Makefile.am (libevolution_calendar_importers_la_LIBADD): - libical-evolution.la -> libical.la + * cal-client/cal-listener.h: add query signal -2003-09-11 Dan Winship <danw@ximian.com> + * cal-client/cal-listener.c (impl_notifyQuery): implement + (cal_listener_class_init): set notifyQuery method + (cal_listener_class_init): add query signal - * cal-util/Makefile.am (privlib_LTLIBRARIES): Remove - libcal-util-static.la + * cal-client/cal-client.h: update protos - * cal-client/Makefile.am (noinst_LTLIBRARIES): Remove - libcal-client-static.la + * cal-client/cal-client.c (cal_query_cb): handle response to + getQuery + (cal_client_init): listen for query signal + (cal_client_get_query): get a query from the calendar - * conduits/calendar/Makefile.am (libecalendar_conduit_la_LIBADD): - use non-static libraries. The static ones were only needed for - libtool 1.3. + * pcs/query.h: update protos - * conduits/todo/Makefile.am (libetodo_conduit_la_LIBADD): Likewise + * pcs/query.c: rewrite to implement the query start method and + provide notification calls - * gui/Makefile.am (IDL_GENERATED): Don't compile the calendar idl - here. It's already in libcal-client. + * pcs/cal.h: add proto -2003-09-11 Frederic Crozat <fcrozat@mandrakesoft.com> + * pcs/cal.c (impl_Cal_getQuery): re-implement so the backend + doesn't create the query for us + (cal_notify_query): respond with the query - * conduits/todo/Makefile.am: - Statically link with wombat. Fix ETodo conduit. - (Mdk bug #5348) + * pcs/cal-factory.c: re-order includes -2003-09-01 Andrew Wu <Yang.Wu@sun.com> - * gui/e-day-view.c: - (e_day_view_change_event_end_time_up): - (e_day_view_change_event_end_time_down): - Use "ctrl+shift+alt+Up/Down" to change the end time of the editing event. + * pcs/cal-common.h: add types -2003-08-28 Hans Petter Jansson <hpj@ximian.com> + * pcs/cal-backend.h: update protos, vmethods - * gui/alarm-notify/alarm-queue.c (tray_icon_blink_cb) - (display_notification): Use images that come with Evolution instead - of unreleased stock, for now. + * pcs/cal-backend.c (cal_backend_class_init): init start_query + vmethod + (cal_backend_finalize): free mutex + (cal_backend_start_query): call through + (cal_backend_add_query): add a query to the list the backend is + running + (cal_backend_get_queries): get the query list -2003-08-28 Hans Petter Jansson <hpj@ximian.com> + * pcs/cal-backend-object-sexp.h: add proto - * gui/alarm-notify/util.[ch]: Added alarm-notify utils. + * pcs/cal-backend-file.c (cal_backend_file_start_query): skeleton + for new backend implementation - * gui/alarm-notify/Makefile.am: Added alarm-notify utils. + * pcs/Makefile.am: don't build dead files - * gui/alarm-notify/alarm-notify-dialog.c (timet_to_str_with_zone): - Move to util.c. + * idl/evolution-calendar.idl: make the getQuery call async, make + the query listener calls oneway and match the addressbook - * gui/alarm-notify/alarm-queue.c (notify_dialog_cb) - (on_dialog_removed_cb) - (notify_dialog_cb) - (tray_icon_destroyed_cb) - (tray_icon_clicked_cb) - (tray_icon_blink_cb) - (display_notification): Add Rodrigo Moya's code for tray icon - notification of appointments, with some fixes and blink code by me. - Requires HEAD gnome-icon-theme for now. +2003-09-09 Rodrigo Moya <rodrigo@ximian.com> -2003-08-27 Hans Petter Jansson <hpj@ximian.com> + * pcs/cal-backend-file.c (cal_backend_file_get_object_component): + added case for getting the individual recurrences if 'rid' is + not NULL, - Fixes #29032. +2003-09-09 Rodrigo Moya <rodrigo@ximian.com> - * gui/dialogs/task-details-page.c (status_changed): When task status - is set to "In Progress", set percent complete to 50% only if it was - previously set to 0% or 100%. + * pcs/cal-backend-file.c (match_object_sexp): expand recurrences + for recurrent objects. + (match_recurrence_sexp): add the recurrences that match the query + expression to the object list. -2003-08-27 Bolian Yin <bolian.yin@sun.com> +2003-09-08 Rodrigo Moya <rodrigo@ximian.com> - * gui/Makefile.am use libevolution-calendar-a11y instead of libevolution-a11y. + * pcs/cal-backend-file.c: don't store all recurrences in the + private structure. + +2003-09-04 Rodrigo Moya <rodrigo@ximian.com> + + * gui/e-day-view.c (process_component): + * gui/e-week-view.c (process_component): dont expand recurrences, + since they are now expanded by the backends. + +2003-09-02 JP Rosevear <jpr@ximian.com> + + * gui/tasks-control.c (sensitize_commands): adapt to cal-client + threaded sync api changes + + * gui/itip-utils.c (itip_organizer_is_user): ditto + + * gui/gnome-cal.c (gnome_calendar_purge): ditto + + * gui/e-meeting-model.c (process_section): ditto + + * gui/e-calendar-table.c (e_calendar_table_show_popup_menu): ditto + + * gui/e-cal-view.c (e_cal_view_create_popup_menu): ditto + + * gui/calendar-commands.c (sensitize_calendar_commands): ditto + (sensitize_taskpad_commands): ditto -2003-08-26 Jack Jia <jack.jia@sun.com> + * gui/dialogs/task-editor.c (set_menu_sens): ditto - ** Fixes #47863. + * gui/dialogs/meeting-page.c (meeting_page_construct): ditto - * gui/alarm-notify/alarm-notify.c (AlarmNotify_removeCalendar): set - the initial value of lc_ptr and orig_str_ptr to NULL to avoid crash. + * gui/dialogs/event-editor.c (set_menu_sens): ditto -2003-08-22 Frederic Crozat <fcrozat@mandrakesoft.com> + * gui/dialogs/alarm-page.c (add_clicked_cb): ditto - * gui/alarm-notify/notify-main.c: (main): - Ensure we get UTF-8 strings from gettext. + * conduits/calendar/calendar-conduit.c (pre_sync): convert to + cal_client api changes -2003-08-22 Bolian Yin <bolian.yin@sun.com> + * conduits/todo/todo-conduit.c (pre_sync): ditto + + * cal-client/client-test.c (list_uids): match new error handling + + * cal-client/cal-marshal.list: marshallers + + * cal-client/cal-listener.[hc]: emit signals for corba listener + callbacks - start with is_read_only, get_static_capabilities, + get_cal_address, get_ldap_attribute, open, remove and object_list + + * cal-client/cal-client.h: move the status enum away from here, + update protos to new thread sync api standard + + * cal-client/cal-client.c: the listener emits signals instead of + using callback functions now and we return booleans + GError in + outs for results + (e_calendar_error_quark): for GError handling + (cal_read_only_cb): handle listener op callback + (cal_cal_address_cb): ditto + (cal_alarm_address_cb): ditto + (cal_ldap_attribute_cb): ditto + (cal_static_capabilities_cb): ditto + (cal_opened_cb): ditto + (cal_removed_cb): ditto + (cal_object_list_cb): ditto + + * cal-client/cal-client-types.h: add GError stuff + + * cal-client/Makefile.am: build glib marshal stuff + + * pcs/query.c (backend_opened_cb): comment out some break + temporarily + + * pcs/cal.h: add protos + + * pcs/cal.c (impl_Cal_open): just call the backend method, it will + handle the notification + (impl_Cal_remove): ditto + (impl_Cal_isReadOnly): ditto + (impl_Cal_getCalAddress): ditto + (impl_Cal_getAlarmEmailAddress): ditto + (impl_Cal_getLdapAttribute): ditto + (impl_Cal_getStaticCapabilities): ditto + (impl_Cal_getObjectList): simplify + (cal_new): set poa to be threaded + (cal_notify_read_only): notification utils + (cal_notify_cal_address): ditto + (cal_notify_alarm_email_address): ditto + (cal_notify_ldap_attribute): ditto + (cal_notify_static_capabilities): ditto + (cal_notify_open): ditto + (cal_notify_remove): ditto + (cal_notify_object_list): ditto + + * pcs/cal-factory.c (impl_CalFactory_getCal): dup the key and the + object + (cal_factory_new): set poa to be threaded + + * pcs/cal-backend.h: update vmethods and protos + + * pcs/cal-backend.c (cal_backend_get_cal_address): we no longer + return anything - the callee is responsible for notification + (cal_backend_get_alarm_email_address): ditto + (cal_backend_get_ldap_attribute): ditto + (cal_backend_get_static_capabilities): ditto + (cal_backend_open): ditto + (cal_backend_remove): ditto + + * pcs/cal-backend-file.h: update inheritance + + * pcs/cal-backend-file.c: inherit from CalBackendSync and make + is_read_only, get_static_capabilities, get_cal_address, get_ldap_attribute, open and + remove match + + * pcs/Makefile.am: build new files + +2003-09-02 JP Rosevear <jpr@ximian.com> + + * idl/evolution-calendar.idl: make all listener callbacks one ways + +2003-09-02 Rodrigo Moya <rodrigo@ximian.com> + + * pcs/cal-backend-file.c (match_recurrence_sexp, match_object_sexp): + new callbacks for g_hash_table_foreach in get_object_list. + (cal_backend_file_get_object_list): don't use the priv->comp list + to check the components, use the hash table, which contains all + the recurrences already expanded. + (add_component): only expand recurrences for recurrent components. + +2003-08-29 Rodrigo Moya <rodrigo@ximian.com> + + * pcs/cal-backend-file.c (lookup_component): take into account the 'rid' + argument. + (get_rid_string): new function to convert the recurrence ID to string. + (add_recurrence_to_object): callback for cal_recur_generate_instances. + (add_component): expand recurrences and g_strdup the hash's key. + (free_cal_component): free also the hash's key. + +2003-08-26 Rodrigo Moya <rodrigo@ximian.com> + + * idl/evolution-calendar.idl: QueryListener::notifyObjUpdated now gets + a sequence of CalObj's. + + * pcs/query.c (add_component): send the whole object to the listener, + not just the UID. Improved the way the listeners are notified, by allocating + a CORBA sequence to be used for all listeners, not one for each. + (match_component): pass the CalComponent to add_component, not only the UID. + (start_cached_query_cb): send the whole object to the listener. + + * cal-client/cal-query.[ch]: changed argument names for "obj_updated" + signal. + (obj_updated_cb): pass the calobj's, not uid's. + + * gui/e-tasks.c (query_obj_updated_cb): + * gui/gnome-cal.c (dn_query_obj_updated_cb, purging_obj_updated_cb): + * gui/e-cal-model.c (query_obj_updated_cb): we now get the object's + string representation instead of the UID. + +2003-08-25 Rodrigo Moya <rodrigo@ximian.com> + + * cal-client/cal-client.c (cal_client_get_object): added a 'rid' argument + to match the IDL method. + + * conduits/calendar/calendar-conduit.c (local_record_from_uid): + * conduits/todo/todo-conduit.c (local_record_from_uid): + * gui/comp-editor-factory.c (edit_existing): + * gui/comp-util.c (cal_comp_is_on_server): + * gui/e-cal-model.c (query_obj_updated_cb): + * gui/e-itip-control.c (find_server, get_real_item, update_attendee_status): + * gui/gnome-cal.c (dn_query_obj_updated_cb, purging_obj_updated_cb): + * gui/dialogs/comp-editor.c (obj_updated_cb): adapted to changes in + cal_client_get_object(). + +2003-08-23 Rodrigo Moya <rodrigo@ximian.com> - Fixes #47779 + * pcs/query-backend.c (object_updated_cb): + * pcs/cal-backend.c (cal_backend_get_type_by_uid): use 'rid' parameter + where appropriate. - * gnome-cal.c (gnome_calendar_get_visible_time_range): fix the return value bug. + * pcs/cal-backend-file.c (check_dup_uid): removed unused variables. + (cal_backend_file_compute_changes_foreach_key): pass a NULL 'rid' + to cal_backend_get_object(). + (lookup_component): get a 'rid' argument also. + (cal_backend_file_cancel_object, cal_backend_file_remove_object): + pass correct number of parameters to lookup_component(). -2003-08-21 Rodrigo Moya <rodrigo@ximian.com> +2003-08-22 Rodrigo Moya <rodrigo@ximian.com> - * cal-client/cal-client.[ch] (cal_client_send_object): use a 'char **' - for the 'error_msg' argument, instead of a fixed size string. + * idl/evolution-calendar.idl: use UID/RID pairs to identify objects. - * gui/itip-utils.c (comp_server_send): pass the correct parameter to - cal_client_send_object. + * pcs/cal.c (impl_Cal_getObject): added 'rid' parameter. -2002-08-20 Hans Petter Jansson <hpj@ximian.com> + * pcs/cal-backend.c (cal_backend_get_object): added 'rid' parameter. + (cal_backend_get_object_component): ditto. + (get_object): ditto. - * gui/e-itip-control.c (start_defalt_server): Rename to - start_default_server_async () and don't run a nested main loop. Let - the caller deal with the client object and signals. - (default_server_started_cb): Implement. Async signal handler for - 'cal_opened' signal, does the embedding. - (object_requested_cb): Rewritten to work asynchronously, and finish - the embedding when default_server_started_cb() is called. + * pcs/cal-backend-file.c (cal_backend_file_get_object_component): + added 'rid' parameter. + (lookup_component): added 'rid' parameter and made it search for the + recurrence when that parameter is not NULL. + (cal_backend_file_get_alarms_for_object, cal_backend_file_update_object): + adapted to changes in lookup_component(). 2003-08-20 Rodrigo Moya <rodrigo@ximian.com> - * gui/e-calendar-table.c (setup_popup_icons): new function to set icons - on the popup menu items. - (e_calendar_table_show_popup_menu): call setup_popup_icons. - - * gui/e-cal-view.c (setup_popup_icons): set more icons for the - popup menu. - -2003-08-20 Bolian Yin <bolian.yin@sun.com> - - * gui/Makefile.am : Add a11y dependency. - * gui/calendar-commands.c (calendar_get_text_for_folder_bar_label) - * gui/e-cal-view.c: Add two new events: "event_changed" and "event_added" - * gui/e-day-view.c (e_day_view_class_init): init a11y. - (e_day_view_find_event_from_item): make it public from private - (e_day_view_update_event_cb): emit "event_changed" signal - (e_day_view_reshape_day_event): emit "event_added" signal - (e_day_view_reshape_long_event): emit "event_added" signal - * gui/e-week-view.c (e_week_view_class_init): init a11y. - (e_week_view_find_event_from_item): make it public from private - (e_week_view_update_event_cb): emit "event_changed" signal - (e_week_view_reshape_event_span): emit "event_added" signal - * gui/gnome-cal.c (gnome_calendar_class_init): init a11y. - (gnome_calendar_get_e_calendar_widget), - (gnome_calendar_get_search_bar_widget), - (gnome_calendar_get_view_notebook_widget): new functions + * pcs/query-backend.c (foreach_uid_cb): use the icalcomponent + to call icalcomponent_get_uid, not the string. -2003-08-19 Rodrigo Moya <rodrigo@ximian.com> +2003-08-20 Rodrigo Moya <rodrigo@ximian.com> - * gui/e-cal-model-tasks.c (ecmt_get_color_for_component): use - "black" for normal tasks, since the light colors from the palette - are too light. + * pcs/cal-backend-file.c: store objects by UID and RID. + (free_object): new function to free the CalBackendFileObject structure. + (cal_backend_file_dispose): use free_object callback to remove the + objects in the comp_uid_hash. + (lookup_component): search correctly the component in the new hash + table organizarion. + (check_dup_uid): ditto. + (add_component): ditto. + (remove_component): ditto. + +2003-08-19 JP Rosevear <jpr@ximian.com> + + * gui/gnome-cal.c (setup_widgets): set up models here + (gnome_calendar_construct): not here + + * conduits/calendar/calendar-conduit.c + (e_calendar_context_destroy): we have a list of calcomponents + rather than uids now + (process_multi_day): build a list of components rather than uids + (pre_sync): use get_object_list instead of getting uids + (for_each): create local records from calcomponents + + * conduits/todo/todo-conduit.c: as above + + * gui/print.c (instance_cb): mark as true if we found an instance + (print_month_small): see if atleast one instance exists in a + slight different way + + * cal-client/client-test.c (list_uids): use get_object_list + + * cal-client/cal-listener.h: update protos + + * cal-client/cal-listener.c (cal_listener_class_init): set object + list callback implementation + (impl_notifyObjectListRequested): implement + (cal_listener_construct): take object list callback function + (cal_listener_new): ditto + + * cal-client/cal-client.h: update protos, add status + + * cal-client/cal-client.c (e_calendar_new_op): create new op + (e_calendar_get_op): retrieve current op + (e_calendar_free_op): free the op + (e_calendar_remove_op): clear current op + (cal_client_init): create new mutex + (cal_client_finalize): destroy mutex + (build_object_list): build list of icalcomponents + (cal_object_list_cb): handle getObjectList response + (real_open_calendar): pass extra listener arg + (cal_client_get_object_list): implement using thread safe mutex + locking + (cal_client_get_object_list_as_comp): return calcomponents instead + of icalcomponents + (cal_client_generate_instances): just get the object list - no + need to make it atomic since get_object_list is already atomic + + * pcs/query.c (query_finalize): free new sexp class + (parse_sexp): use new sexp class + (match_component): ditto + + * pcs/query-backend.c (foreach_uid_cb): use icalcomponent to + extract uid + (query_backend_new): get all objects using object list call + + * pcs/cal.c (impl_Cal_getObjectList): implement + (cal_class_init): adjust for idl method changes + + * pcs/cal-backend.h: update vmethods, add proto + + * pcs/cal-backend.c (cal_backend_class_init): remove get_uids and + get_objects_in_range vmethods, add get_object_list vmethod + (cal_backend_get_object_list): call through to vmethod implementation + + * pcs/cal-backend-object-sexp.[hc]: nice class to represent a sexp + and search cal components + + * pcs/cal-backend-file.c (cal_backend_file_class_init): remove + get_uids and get_objects_in_range calls and set get_object_list + call + (cal_backend_file_get_object_list): implement + (create_user_free_busy): use sexp ops to implement + (cal_backend_file_compute_changes): just iterate over the + component list rather than fetching uids + + * pcs/Makefile.am: build new files + + * idl/evolution-calendar.idl: make opening a oneway call, add + getObjectList call, remove getUIDS and getObjectsInRange call - + both can be done with getObjectList; make listener callbacks + oneway + +2003-08-19 Rodrigo Moya <rodrigo@ximian.com> * gui/gnome-cal.c (gnome_calendar_purge): don't leak the client list. (gnome_calendar_destroy): disconnect from all callbacks on all @@ -254,6 +1380,21 @@ 2003-08-13 Rodrigo Moya <rodrigo@ximian.com> + * gui/e-cal-model.c (ecm_append_row, ecm_get_color_for_component): + * gui/e-cal-model-tasks.c (ecmt_get_color_for_component): merged + missing bith from calendar-views-with-model branch. + +2003-08-13 JP Rosevear <jpr@ximian.com> + + * cal-client/cal-client.c (real_open_calendar): set the priv->cal + pointer in a slightly different spot so we have it in the call + back + + * gui/e-cal-model.c (e_cal_model_get_client_list): merge this in + properly + +2003-08-13 Rodrigo Moya <rodrigo@ximian.com> + * gui/e-cal-model.c (ecm_get_color_for_component): assign the colors based on the URI, which is stored in a common place for all models. Thus different views will use the same color for the same calendar. @@ -278,55 +1419,117 @@ * gui/e-week-view-event-item.c (e_week_view_event_item_draw): colorize the background for multiple days events. + +2003-08-13 JP Rosevear <jpr@ximian.com> -2003-08-12 Hans Petter Jansson <hpj@ximian.com> - - * gui/calendar-offline-handler.c (impl_dispose): Chain. Prevent - double unrefs. - (impl_finalize): Chain. - - * gui/e-alarm-list.c (finalize): Chain. - - * gui/e-comp-editor-registry.c (destroy): Chain. Prevent double frees. - (editor_destroy_cb): Don't crash if we get the destroy signal twice. - - * gui/e-date-time-list.c (e_date_time_list_finalize): Chain. - - * gui/e-meeting-attendee.c (finalize): Chain. - - * gui/e-meeting-model.c (finalize): Chain. - -2003-08-12 Andrew Wu <Yang.Wu@sun.com> - - * gui/e-day-view.c - (e_day_view_change_duration_to_start_of_work_day): - In DayView, Shift+Home, Change the duration to the time - that begins the current work day. - (e_day_view_change_duration_to_end_of_work_day): - In DayView, Shift+End, Change the duration to the time - that ends the current work day + * cal-client/client-test.c (create_client): there is no more + object updated signal -2003-08-12 Hans Petter Jansson <hpj@ximian.com> + * cal-client/cal-listener.c: clean up comment - * gui/e-itip-control.c (html_destroyed): - (init): - (write_html): Add destroy chaining. + * cal-client/cal-client.c (cal_client_class_init): remove + obj_updated and obj_removed signals -2003-08-12 Andrew Wu <Yang.Wu@sun.com> + * cal-client/cal-client.h: ditto + +2003-08-12 JP Rosevear <jpr@ximian.com> - * gui/e-week-view.c - (e_week_view_on_key_up): - (e_week_view_on_key_down): - (e_week_view_on_key_left): - (e_week_view_on_key_right): - In the WeekView, Navigation through days with arrow keys. + * pcs/cal-backend.h: remove get_uri vmethod -2003-08-12 Harry Lu <harry.lu@sun.com> + * pcs/cal-backend.c (cal_backend_class_init): remove get_uri + vmethod init - ** fixes #47464. + * pcs/cal-backend-file.c (cal_backend_file_class_init): no longer + a get uri vmethod + (cal_backend_file_get_uri): remove implementation of above - * gui/dialogs/meeting-page.c: (get_widgets): The Organizer's value - need not match one of the values in the list. +2003-08-12 JP Rosevear <jpr@ximian.com> + + * cal-client/client-test.c (main): use tmp uris + + * cal-client/cal-listener.h: update protos + + * cal-client/cal-listener.c (cal_listener_init): init removed + function + (cal_listener_finalize): clear removed function + (impl_notifyCalOpened): take file status + (impl_notifyCalRemoved): implement + (cal_listener_construct): take remove function arg + (cal_listener_new): ditto + + * cal-client/cal-client.h: update protos, add remove status + + * cal-client/cal-client.c + (cal_client_remove_status_enum_get_type): add remove status type + (cal_client_class_init): add removed signal + (cal_opened_cb): can no longer get unsupported exception here + (cal_removed_cb): emit removed status + (real_open_calendar): pass removed callback function to listener + (get_fall_back_uri): no longer append tasks.ics or calendar.ics + (cal_client_remove_calendar): new c wrapper for corba function - + calendar must be open currently + + * pcs/query.c (backend_opened_cb): only disconnect the open + callback + (backend_removed_cb): handle calendar removal + (query_construct): listen for remove signal as well + + * pcs/cal.h: cal no longer takes uri during construction + + * pcs/cal.c (backend_to_listener_status): convert backend to corba + status code + (impl_Cal_open): backend open no longer takes uri, use above to + send back status + (impl_Cal_remove): implement + (cal_construct): we no longer track the uri + (cal_finalize): ditto + (cal_class_init): set remove epv method + + * pcs/cal-factory.c (impl_CalFactory_getCal): instantiate backend + with uri and kind properties + + * pcs/cal-backend.h: list file status enum, add protos + + * pcs/cal-backend.c (cal_backend_set_property): implement object + properties + (cal_backend_get_property): ditto + (cal_backend_class_init): add properties vmethods and uri, kind + properties, removed signal + (cal_backend_get_uri): don't get the uri from the backend + (cal_backend_get_kind): get the kind from the backend + (cal_backend_open): adapt to new open call, no uri passed in + (cal_backend_remove): call through to remove implementation + (cal_backend_opened): use new file status + (cal_backend_removed): emit removed signal + + * pcs/cal-backend-file.h: update protos + + * pcs/cal-backend-file.c (cal_backend_file_class_init): override + remove vmethod + (cal_backend_file_init): default file name to calendar.ics + (cal_backend_file_set_file_name): accessor for filename tacked on + to uri + (cal_backend_file_get_file_name): ditto + (open_cal): return "file" type status codes + (create_cal): ditto + (get_uri_string): construct the full uri string + (cal_backend_file_open): use above + (cal_backend_file_remove): implement + + * pcs/cal-backend-file-todos.c (cal_backend_file_todos_init): set + the file name to tasks.ics + + * pcs/cal-backend-file-events.c (cal_backend_file_events_init): + set the file name to calendar.ics + + * cal-util/cal-util.c (cal_util_expand_uri): just return a copy of + the uri now + + * idl/evolution-calendar.idl: convert OpenStatus to FileStatus so + remove() can use it as well + + * gui/gnome-cal.c (gnome_calendar_open): just open the default + folder in all cases 2003-08-12 Rodrigo Moya <rodrigo@ximian.com> @@ -511,6 +1714,94 @@ (ecm_finalize): don't call e_cal_model_remove_all_clients, since that function triggers notifications on the model. (query_obj_updated_cb): free all the date fields. + +2003-08-08 JP Rosevear <jpr@ximian.com> + + * pcs/cal.c (impl_Cal_open): implement + (cal_new): take uri as arg + (cal_construct): ditto + + * pcs/cal.h: update protos + + * idl/evolution-calendar.idl: add open and remove methods to + calendar idl and remove countObjects method; remove + updated/removed listener methods; add getCal method to factory and + remove uriList and open methods + + * pcs/cal-factory.c (calobjtype_to_icalkind): convert to a libical + enum + (get_backend_type): use kind to determine type as well + (impl_CalFactory_getCal): new method to access the calendar + + * pcs/cal-factory.h: you know register both a method and an ical + type you support + + * pcs/cal-backend.c (cal_backend_class_init): add removed signal + (cal_backend_class_init): don't init deleted vmethod + (cal_backend_get_n_objects): remove + (cal_backend_notify_update): remove + (cal_backend_notify_remove): remove + + * pcs/cal-backend.h: add "remove" vmethod and "removed" signal, + remove get_n_objects vmethod + + * pcs/cal-backend-file.c (cal_backend_file_get_n_objects): remove + (cal_backend_file_init): we only have a single list of components + now + (cal_backend_file_dispose): ditto + (add_component): ditto + (remove_component): ditto + (cal_backend_file_open): use e-uri to process uri + (cal_backend_file_get_uids): we only have a single list of + components now + (cal_backend_file_get_objects_in_range): ditto + (cal_backend_file_compute_changes): convert to exmlhash instead of + db hash + (cal_backend_file_get_alarms_in_range): we only have a single list + of components now + (cal_backend_file_update_objects): just emit removed/updated + signals (for the queries) + + * pcs/cal-backend-file-todos.[hc]: subclass of cal-backend-file + for todos + + * pcs/cal-backend-file-events.[hc]: subclass of cal-backend-file + for events + + * pcs/Makefile.am: don't build deleted sources + + * pcs/job.[hc]: remove, queueing will be done by poa policy + + * conduits/calendar/calendar-conduit.c (pre_sync): just get the + number from the list length + + * conduits/todo/todo-conduit.c (pre_sync): ditto + + * cal-client/cal-listener.h: update protos and method signatures + + * cal-client/cal-listener.c (cal_listener_finalize): don't cleanup + deleted struct members + (impl_notifyCalOpened): we don't get a calendar to pass back now + (impl_notifyObjUpdated): idl listener method removed + (impl_notifyObjRemoved): ditto + (cal_listener_construct): no more updated/removed callbacks + (cal_listener_new): ditto + + * cal-client/cal-client.h: update protos + + * cal-client/cal-client.c (cal_opened_cb): we don't get the object + in the signal, we already obtained it + (obj_updated_cb): remove, the idl no longer supports this (use + queries) + (obj_removed_cb): ditto + (get_factories): determine available factories based on oaf + properties in the .server file like the addressbook does + (cal_client_construct): remove, its useless now + (real_open_calendar): get the factories here and both obtain the + cal from the factory and then open it + (cal_client_uri_list): comment out most of this as it will be + going away + (cal_client_get_n_objects): remove useless call 2003-08-07 Rodrigo Moya <rodrigo@ximian.com> diff --git a/calendar/cal-util/cal-util.c b/calendar/cal-util/cal-util.c index 1e03c86d75..400207ab0a 100644 --- a/calendar/cal-util/cal-util.c +++ b/calendar/cal-util/cal-util.c @@ -584,29 +584,7 @@ cal_util_priority_from_string (const char *string) char * cal_util_expand_uri (char *uri, gboolean tasks) { - char *file_uri, *file_name; - - if (!strncmp (uri, "file://", 7)) { - file_uri = uri + 7; - if (strlen (file_uri) > 4 - && !strcmp (file_uri + strlen (file_uri) - 4, ".ics")) { - - /* it's a .ics file */ - return g_strdup (uri); - } - - /* we assume it's a dir and glom <type>.ics onto the end. */ - if (tasks) - file_name = g_concat_dir_and_file (file_uri, "tasks.ics"); - else - file_name = g_concat_dir_and_file (file_uri, "calendar.ics"); - file_uri = g_strdup_printf("file://%s", file_name); - g_free(file_name); - } else { - file_uri = g_strdup (uri); - } - - return file_uri; + return g_strdup (uri); } /* callback for icalcomponent_foreach_tzid */ @@ -755,19 +733,13 @@ cal_util_event_dates_match (icalcomponent *icalcomp1, icalcomponent *icalcomp2) return FALSE; } - - /* now match the timezones */ if (!(!c1_dtstart.zone && !c2_dtstart.zone) || - (c1_dtstart.zone && c2_dtstart.zone && - !strcmp (icaltimezone_get_tzid ((icaltimezone *) c1_dtstart.zone), - icaltimezone_get_tzid ((icaltimezone *) c2_dtstart.zone)))) + (c1_dtstart.zone && c2_dtstart.zone && !strcmp (c1_dtstart.zone, c2_dtstart.zone))) return FALSE; if (!(!c1_dtend.zone && !c2_dtend.zone) || - (c1_dtend.zone && c2_dtend.zone && - !strcmp (icaltimezone_get_tzid ((icaltimezone *) c1_dtend.zone), - icaltimezone_get_tzid ((icaltimezone *) c2_dtend.zone)))) + (c1_dtend.zone && c2_dtend.zone && !strcmp (c1_dtend.zone, c2_dtend.zone))) return FALSE; return TRUE; diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index 1893e6b34c..39d341cfb5 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -253,7 +253,7 @@ struct _ECalConduitContext { icaltimezone *timezone; CalComponent *default_comp; - GList *uids; + GList *comps; GList *changed; GHashTable *changed_hash; GList *locals; @@ -276,7 +276,7 @@ e_calendar_context_new (guint32 pilot_id) ctxt->client = NULL; ctxt->timezone = NULL; ctxt->default_comp = NULL; - ctxt->uids = NULL; + ctxt->comps = NULL; ctxt->changed = NULL; ctxt->changed_hash = NULL; ctxt->locals = NULL; @@ -311,8 +311,11 @@ e_calendar_context_destroy (ECalConduitContext *ctxt) g_object_unref (ctxt->client); if (ctxt->default_comp != NULL) g_object_unref (ctxt->default_comp); - if (ctxt->uids != NULL) - cal_obj_uid_list_free (ctxt->uids); + if (ctxt->comps != NULL) { + for (l = ctxt->comps; l; l = l->next) + g_object_unref (l->data); + g_list_free (ctxt->comps); + } if (ctxt->changed != NULL) cal_client_change_list_free (ctxt->changed); @@ -433,8 +436,8 @@ get_timezone (CalClient *client, const char *tzid) icaltimezone *timezone = NULL; timezone = icaltimezone_get_builtin_timezone_from_tzid (tzid); - if (timezone == NULL) - cal_client_get_timezone (client, tzid, &timezone); + if (timezone == NULL) + cal_client_get_timezone (client, tzid, &timezone, NULL); return timezone; } @@ -550,7 +553,7 @@ is_all_day (CalClient *client, CalComponentDateTime *dt_start, CalComponentDateT } static gboolean -process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi_uid, GList **multi_ccc) +process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi_comp, GList **multi_ccc) { CalComponentDateTime dt_start, dt_end; icaltimezone *tz_start, *tz_end; @@ -562,7 +565,7 @@ process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi gboolean ret = TRUE; *multi_ccc = NULL; - *multi_uid = NULL; + *multi_comp = NULL; if (ccc->type == CAL_CLIENT_CHANGE_DELETED) return FALSE; @@ -617,13 +620,14 @@ process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi dt_end.value = &end_value; cal_component_set_dtend (clone, &dt_end); - cal_client_update_object (ctxt->client, clone); + /* FIXME Error handling */ + cal_client_create_object (ctxt->client, cal_component_get_icalcomponent (clone), NULL, NULL); c->comp = clone; c->type = CAL_CLIENT_CHANGE_ADDED; *multi_ccc = g_list_prepend (*multi_ccc, c); - *multi_uid = g_list_prepend (*multi_uid, new_uid); + *multi_comp = g_list_prepend (*multi_comp, g_object_ref (c->comp)); event_start = day_end; day_end = time_day_end_with_zone (event_start, ctxt->timezone); @@ -632,7 +636,8 @@ process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi dt_end.value = old_end_value; cal_component_get_uid (ccc->comp, &uid); - cal_client_remove_object (ctxt->client, uid); + /* FIXME Error handling */ + cal_client_remove_object (ctxt->client, uid, NULL); ccc->type = CAL_CLIENT_CHANGE_DELETED; cleanup: @@ -1007,13 +1012,11 @@ local_record_from_uid (ECalLocalRecord *local, { CalComponent *comp; icalcomponent *icalcomp; - CalClientGetStatus status; + GError *error = NULL; g_assert(local!=NULL); - status = cal_client_get_object (ctxt->client, uid, &icalcomp); - - if (status == CAL_CLIENT_GET_SUCCESS) { + if (cal_client_get_object (ctxt->client, uid, NULL, &icalcomp, &error)) { comp = cal_component_new (); if (!cal_component_set_icalcomponent (comp, icalcomp)) { g_object_unref (comp); @@ -1023,7 +1026,7 @@ local_record_from_uid (ECalLocalRecord *local, local_record_from_comp (local, comp, ctxt); g_object_unref (comp); - } else if (status == CAL_CLIENT_GET_NOT_FOUND) { + } else if (error->code == E_CALENDAR_STATUS_OBJECT_NOT_FOUND) { comp = cal_component_new (); cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT); cal_component_set_uid (comp, uid); @@ -1031,7 +1034,9 @@ local_record_from_uid (ECalLocalRecord *local, g_object_unref (comp); } else { INFO ("Object did not exist"); - } + } + + g_clear_error (&error); } static CalComponent * @@ -1283,21 +1288,6 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, } static void -update_comp (GnomePilotConduitSyncAbs *conduit, CalComponent *comp, - ECalConduitContext *ctxt) -{ - CalClientResult success; - - g_return_if_fail (conduit != NULL); - g_return_if_fail (comp != NULL); - - success = cal_client_update_object (ctxt->client, comp); - - if (success != CAL_CLIENT_RESULT_SUCCESS) - WARN (_("Error while communicating with calendar server")); -} - -static void check_for_slow_setting (GnomePilotConduit *c, ECalConduitContext *ctxt) { GnomePilotConduitStandard *conduit = GNOME_PILOT_CONDUIT_STANDARD (c); @@ -1360,11 +1350,13 @@ pre_sync (GnomePilotConduit *conduit, LOG (g_message ( " Using timezone: %s", icaltimezone_get_tzid (ctxt->timezone) )); /* Set the default timezone on the backend. */ - if (ctxt->timezone) - cal_client_set_default_timezone (ctxt->client, ctxt->timezone); + if (ctxt->timezone) { + if (!cal_client_set_default_timezone (ctxt->client, ctxt->timezone, NULL)) + return -1; + } /* Get the default component */ - if (cal_client_get_default_object (ctxt->client, CALOBJ_TYPE_EVENT, &icalcomp) != CAL_CLIENT_GET_SUCCESS) + if (!cal_client_get_default_object (ctxt->client, CALOBJ_TYPE_EVENT, &icalcomp, NULL)) return -1; ctxt->default_comp = cal_component_new (); @@ -1380,21 +1372,23 @@ pre_sync (GnomePilotConduit *conduit, g_free (filename); /* Get the local database */ - ctxt->uids = cal_client_get_uids (ctxt->client, CALOBJ_TYPE_EVENT); + if (!cal_client_get_object_list_as_comp (ctxt->client, "(#t)", &ctxt->comps, NULL)) + return -1; /* Find the added, modified and deleted items */ change_id = g_strdup_printf ("pilot-sync-evolution-calendar-%d", ctxt->cfg->pilot_id); - ctxt->changed = cal_client_get_changes (ctxt->client, CALOBJ_TYPE_EVENT, change_id); + if (!cal_client_get_changes (ctxt->client, CALOBJ_TYPE_EVENT, change_id, &ctxt->changed, NULL)) + return -1; ctxt->changed_hash = g_hash_table_new (g_str_hash, g_str_equal); g_free (change_id); /* See if we need to split up any events */ for (l = ctxt->changed; l != NULL; l = l->next) { CalClientChange *ccc = l->data; - GList *multi_uid = NULL, *multi_ccc = NULL; + GList *multi_comp = NULL, *multi_ccc = NULL; - if (process_multi_day (ctxt, ccc, &multi_uid, &multi_ccc)) { - ctxt->uids = g_list_concat (ctxt->uids, multi_uid); + if (process_multi_day (ctxt, ccc, &multi_comp, &multi_ccc)) { + ctxt->comps = g_list_concat (ctxt->comps, multi_comp); added = g_list_concat (added, multi_ccc); removed = g_list_prepend (removed, ccc); @@ -1442,7 +1436,7 @@ pre_sync (GnomePilotConduit *conduit, } /* Set the count information */ - num_records = cal_client_get_n_objects (ctxt->client, CALOBJ_TYPE_EVENT); + num_records = g_list_length (ctxt->comps); gnome_pilot_conduit_sync_abs_set_num_local_records(abs_conduit, num_records); gnome_pilot_conduit_sync_abs_set_num_new_local_records (abs_conduit, add_records); gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records); @@ -1492,8 +1486,8 @@ post_sync (GnomePilotConduit *conduit, * a race condition if anyone changes a record elsewhere during sycnc */ change_id = g_strdup_printf ("pilot-sync-evolution-calendar-%d", ctxt->cfg->pilot_id); - changed = cal_client_get_changes (ctxt->client, CALOBJ_TYPE_EVENT, change_id); - cal_client_change_list_free (changed); + if (cal_client_get_changes (ctxt->client, CALOBJ_TYPE_EVENT, change_id, &changed, NULL)) + cal_client_change_list_free (changed); g_free (change_id); LOG (g_message ( "---------------------------------------------------------\n" )); @@ -1537,7 +1531,7 @@ for_each (GnomePilotConduitSyncAbs *conduit, ECalLocalRecord **local, ECalConduitContext *ctxt) { - static GList *uids, *iterator; + static GList *comps, *iterator; static int count; g_return_val_if_fail (local != NULL, -1); @@ -1545,17 +1539,17 @@ for_each (GnomePilotConduitSyncAbs *conduit, if (*local == NULL) { LOG (g_message ( "beginning for_each" )); - uids = ctxt->uids; + comps = ctxt->comps; count = 0; - if (uids != NULL) { - LOG (g_message ( "iterating over %d records", g_list_length (uids) )); + if (comps != NULL) { + LOG (g_message ( "iterating over %d records", g_list_length (comps))); *local = g_new0 (ECalLocalRecord, 1); - local_record_from_uid (*local, uids->data, ctxt); + local_record_from_comp (*local, comps->data, ctxt); g_list_prepend (ctxt->locals, *local); - iterator = uids; + iterator = comps; } else { LOG (g_message ( "no events" )); (*local) = NULL; @@ -1681,8 +1675,10 @@ add_record (GnomePilotConduitSyncAbs *conduit, /* Give it a new UID otherwise it will be the uid of the default comp */ uid = cal_component_gen_uid (); cal_component_set_uid (comp, uid); + + if (!cal_client_create_object (ctxt->client, cal_component_get_icalcomponent (comp), NULL, NULL)) + return -1; - update_comp (conduit, comp, ctxt); e_pilot_map_insert (ctxt->map, remote->ID, uid, FALSE); g_free (uid); @@ -1709,7 +1705,10 @@ replace_record (GnomePilotConduitSyncAbs *conduit, new_comp = comp_from_remote_record (conduit, remote, local->comp, ctxt->client, ctxt->timezone); g_object_unref (local->comp); local->comp = new_comp; - update_comp (conduit, local->comp, ctxt); + + if (!cal_client_modify_object (ctxt->client, cal_component_get_icalcomponent (new_comp), + CALOBJ_MOD_ALL, NULL)) + return -1; return retval; } @@ -1729,7 +1728,8 @@ delete_record (GnomePilotConduitSyncAbs *conduit, LOG (g_message ( "delete_record: deleting %s\n", uid )); e_pilot_map_remove_by_uid (ctxt->map, uid); - cal_client_remove_object (ctxt->client, uid); + /* FIXME Error handling */ + cal_client_remove_object (ctxt->client, uid, NULL); return 0; } diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index 6868368129..d44b8688f1 100644 --- a/calendar/conduits/todo/todo-conduit.c +++ b/calendar/conduits/todo/todo-conduit.c @@ -255,7 +255,7 @@ struct _EToDoConduitContext { icaltimezone *timezone; CalComponent *default_comp; - GList *uids; + GList *comps; GList *changed; GHashTable *changed_hash; GList *locals; @@ -275,7 +275,7 @@ e_todo_context_new (guint32 pilot_id) ctxt->client = NULL; ctxt->timezone = NULL; ctxt->default_comp = NULL; - ctxt->uids = NULL; + ctxt->comps = NULL; ctxt->changed_hash = NULL; ctxt->changed = NULL; ctxt->locals = NULL; @@ -311,8 +311,11 @@ e_todo_context_destroy (EToDoConduitContext *ctxt) if (ctxt->default_comp != NULL) g_object_unref (ctxt->default_comp); - if (ctxt->uids != NULL) - cal_obj_uid_list_free (ctxt->uids); + if (ctxt->comps != NULL) { + for (l = ctxt->comps; l; l = l->next) + g_object_unref (l->data); + g_list_free (ctxt->comps); + } if (ctxt->changed_hash != NULL) { g_hash_table_foreach_remove (ctxt->changed_hash, e_todo_context_foreach_change, NULL); @@ -441,7 +444,7 @@ get_timezone (CalClient *client, const char *tzid) timezone = icaltimezone_get_builtin_timezone_from_tzid (tzid); if (timezone == NULL) - cal_client_get_timezone (client, tzid, &timezone); + cal_client_get_timezone (client, tzid, &timezone, NULL); return timezone; } @@ -676,13 +679,11 @@ local_record_from_uid (EToDoLocalRecord *local, { CalComponent *comp; icalcomponent *icalcomp; - CalClientGetStatus status; + GError *error = NULL; g_assert(local!=NULL); - status = cal_client_get_object (ctxt->client, uid, &icalcomp); - - if (status == CAL_CLIENT_GET_SUCCESS) { + if (cal_client_get_object (ctxt->client, uid, NULL, &icalcomp, &error)) { comp = cal_component_new (); if (!cal_component_set_icalcomponent (comp, icalcomp)) { g_object_unref (comp); @@ -692,7 +693,7 @@ local_record_from_uid (EToDoLocalRecord *local, local_record_from_comp (local, comp, ctxt); g_object_unref (comp); - } else if (status == CAL_CLIENT_GET_NOT_FOUND) { + } else if (error->code == E_CALENDAR_STATUS_OBJECT_NOT_FOUND) { comp = cal_component_new (); cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO); cal_component_set_uid (comp, uid); @@ -702,7 +703,7 @@ local_record_from_uid (EToDoLocalRecord *local, INFO ("Object did not exist"); } - + g_clear_error (&error); } @@ -824,21 +825,6 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, } static void -update_comp (GnomePilotConduitSyncAbs *conduit, CalComponent *comp, - EToDoConduitContext *ctxt) -{ - CalClientResult success; - - g_return_if_fail (conduit != NULL); - g_return_if_fail (comp != NULL); - - success = cal_client_update_object (ctxt->client, comp); - - if (success != CAL_CLIENT_RESULT_SUCCESS) - WARN (_("Error while communicating with calendar server")); -} - -static void check_for_slow_setting (GnomePilotConduit *c, EToDoConduitContext *ctxt) { GnomePilotConduitStandard *conduit = GNOME_PILOT_CONDUIT_STANDARD (c); @@ -902,11 +888,13 @@ pre_sync (GnomePilotConduit *conduit, LOG (g_message ( " Using timezone: %s", icaltimezone_get_tzid (ctxt->timezone) )); /* Set the default timezone on the backend. */ - if (ctxt->timezone) - cal_client_set_default_timezone (ctxt->client, ctxt->timezone); + if (ctxt->timezone) { + if (!cal_client_set_default_timezone (ctxt->client, ctxt->timezone, NULL)) + return -1; + } /* Get the default component */ - if (cal_client_get_default_object (ctxt->client, CALOBJ_TYPE_TODO, &icalcomp) != CAL_CLIENT_GET_SUCCESS) + if (!cal_client_get_default_object (ctxt->client, CALOBJ_TYPE_TODO, &icalcomp, NULL)) return -1; ctxt->default_comp = cal_component_new (); @@ -922,11 +910,13 @@ pre_sync (GnomePilotConduit *conduit, g_free (filename); /* Get the local database */ - ctxt->uids = cal_client_get_uids (ctxt->client, CALOBJ_TYPE_TODO); + if (!cal_client_get_object_list_as_comp (ctxt->client, "(#t)", &ctxt->comps, NULL)) + return -1; /* Count and hash the changes */ change_id = g_strdup_printf ("pilot-sync-evolution-todo-%d", ctxt->cfg->pilot_id); - ctxt->changed = cal_client_get_changes (ctxt->client, CALOBJ_TYPE_TODO, change_id); + if (!cal_client_get_changes (ctxt->client, CALOBJ_TYPE_TODO, change_id, &ctxt->changed, NULL)) + return -1; ctxt->changed_hash = g_hash_table_new (g_str_hash, g_str_equal); g_free (change_id); @@ -956,7 +946,7 @@ pre_sync (GnomePilotConduit *conduit, } /* Set the count information */ - num_records = cal_client_get_n_objects (ctxt->client, CALOBJ_TYPE_TODO); + num_records = g_list_length (ctxt->comps); gnome_pilot_conduit_sync_abs_set_num_local_records(abs_conduit, num_records); gnome_pilot_conduit_sync_abs_set_num_new_local_records (abs_conduit, add_records); gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records); @@ -1006,8 +996,8 @@ post_sync (GnomePilotConduit *conduit, * a race condition if anyone changes a record elsewhere during sycnc */ change_id = g_strdup_printf ("pilot-sync-evolution-todo-%d", ctxt->cfg->pilot_id); - changed = cal_client_get_changes (ctxt->client, CALOBJ_TYPE_TODO, change_id); - cal_client_change_list_free (changed); + if (cal_client_get_changes (ctxt->client, CALOBJ_TYPE_TODO, change_id, &changed, NULL)) + cal_client_change_list_free (changed); g_free (change_id); LOG (g_message ( "---------------------------------------------------------\n" )); @@ -1051,7 +1041,7 @@ for_each (GnomePilotConduitSyncAbs *conduit, EToDoLocalRecord **local, EToDoConduitContext *ctxt) { - static GList *uids, *iterator; + static GList *comps, *iterator; static int count; g_return_val_if_fail (local != NULL, -1); @@ -1059,17 +1049,17 @@ for_each (GnomePilotConduitSyncAbs *conduit, if (*local == NULL) { LOG (g_message ( "beginning for_each" )); - uids = ctxt->uids; + comps = ctxt->comps; count = 0; - if (uids != NULL) { - LOG (g_message ( "iterating over %d records", g_list_length (uids) )); + if (comps != NULL) { + LOG (g_message ( "iterating over %d records", g_list_length (comps))); *local = g_new0 (EToDoLocalRecord, 1); - local_record_from_uid (*local, uids->data, ctxt); + local_record_from_comp (*local, comps->data, ctxt); g_list_prepend (ctxt->locals, *local); - iterator = uids; + iterator = comps; } else { LOG (g_message ( "no events" )); (*local) = NULL; @@ -1196,7 +1186,9 @@ add_record (GnomePilotConduitSyncAbs *conduit, uid = cal_component_gen_uid (); cal_component_set_uid (comp, uid); - update_comp (conduit, comp, ctxt); + if (!cal_client_create_object (ctxt->client, cal_component_get_icalcomponent (comp), NULL, NULL)) + return -1; + e_pilot_map_insert (ctxt->map, remote->ID, uid, FALSE); g_object_unref (comp); @@ -1221,7 +1213,10 @@ replace_record (GnomePilotConduitSyncAbs *conduit, new_comp = comp_from_remote_record (conduit, remote, local->comp, ctxt->timezone); g_object_unref (local->comp); local->comp = new_comp; - update_comp (conduit, local->comp, ctxt); + + if (!cal_client_modify_object (ctxt->client, cal_component_get_icalcomponent (new_comp), + CALOBJ_MOD_ALL, NULL)) + return -1; return retval; } @@ -1241,7 +1236,8 @@ delete_record (GnomePilotConduitSyncAbs *conduit, LOG (g_message ( "delete_record: deleting %s\n", uid )); e_pilot_map_remove_by_uid (ctxt->map, uid); - cal_client_remove_object (ctxt->client, uid); + /* FIXME Error handling */ + cal_client_remove_object (ctxt->client, uid, NULL); return 0; } diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 5cee4ae0e3..eef7821858 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -37,7 +37,23 @@ $(SELECT_NAMES_IDL_GENERATED_H): $(IDLS) $(SELECT_NAMES_IDL_GENERATED_C): $(SELECT_NAMES_IDL_GENERATED_H) -IDL_GENERATED = $(COMPOSER_IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED) +# Calendar IDL files + +CALENDAR_IDL_GENERATED_H = \ + evolution-calendar.h +CALENDAR_IDL_GENERATED_C = \ + evolution-calendar-common.c \ + evolution-calendar-skels.c \ + evolution-calendar-stubs.c +CALENDAR_IDL_GENERATED = $(CALENDAR_IDL_GENERATED_C) $(CALENDAR_IDL_GENERATED_H) + +$(CALENDAR_IDL_GENERATED_H): $(IDLS) + $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \ + $(top_srcdir)/calendar/idl/evolution-calendar.idl +$(CALENDAR_IDL_GENERATED_C): $(CALENDAR_IDL_GENERATED_H) + + +IDL_GENERATED = $(COMPOSER_IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED) $(CALENDAR_IDL_GENERATED) SUBDIRS = alarm-notify dialogs @@ -57,7 +73,6 @@ INCLUDES = \ -I$(top_srcdir)/addressbook/backend \ -I$(top_builddir)/addressbook/backend \ -I$(top_srcdir)/widgets \ - -I$(top_srcdir)/a11y/calendar \ -DEVOLUTION_DATADIR=\""$(datadir)"\" \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ @@ -179,7 +194,6 @@ libevolution_calendar_la_LIBADD = \ $(top_builddir)/calendar/gui/dialogs/libcal-dialogs.la \ $(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ - $(top_builddir)/a11y/calendar/libevolution-calendar-a11y.la \ $(EVOLUTION_CALENDAR_LIBS) libevolution_calendar_la_LDFLAGS = -avoid-version -module diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 133448e7cd..800eeb80f6 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -297,9 +297,6 @@ AlarmNotify_removeCalendar (PortableServer_Servant servant, gpointer lc_ptr, orig_str_ptr; gboolean found; - lc_ptr = NULL; - orig_str_ptr = NULL; - an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); priv = an->priv; diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index cb792e466f..c6c30f9511 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -29,25 +29,20 @@ #include <gtk/gtksignal.h> #include <gtk/gtkbox.h> #include <gtk/gtkdialog.h> -#include <gtk/gtkeventbox.h> -#include <gtk/gtkimage.h> #include <gtk/gtklabel.h> #include <gtk/gtkcheckbutton.h> #include <gtk/gtkstock.h> -#include <gtk/gtktooltips.h> #include <libgnome/gnome-i18n.h> #include <libgnome/gnome-exec.h> #include <libgnome/gnome-sound.h> #include <libgnomeui/gnome-dialog-util.h> #include <libgnomeui/gnome-uidefs.h> -#include <e-util/eggtrayicon.h> #include <cal-util/timeutil.h> #include "alarm.h" #include "alarm-notify-dialog.h" #include "alarm-queue.h" #include "config-data.h" #include "save.h" -#include "util.h" @@ -227,7 +222,7 @@ remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id, if (remove_alarm) { cqa->expecting_update = TRUE; cal_client_discard_alarm (cqa->parent_client->client, cqa->alarms->comp, - qa->instance->auid); + qa->instance->auid, NULL); cqa->expecting_update = FALSE; } @@ -654,53 +649,13 @@ edit_component (CalClient *client, CalComponent *comp) CORBA_exception_free (&ev); } - -/* /\* Callback used from the alarm notify dialog *\/ */ -/* static void */ -/* notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data) */ -/* { */ - -/* switch (result) { */ -/* case ALARM_NOTIFY_SNOOZE: */ -/* create_snooze (c->cqa, c->alarm_id, snooze_mins); */ - -/* g_object_unref (c->comp); */ -/* g_object_unref (c->client); */ -/* g_free (c); */ -/* return; */ - -/* case ALARM_NOTIFY_EDIT: */ -/* edit_component (c->client, c->comp); */ -/* break; */ - -/* case ALARM_NOTIFY_CLOSE: */ -/* /\* Do nothing *\/ */ -/* break; */ - -/* default: */ -/* g_assert_not_reached (); */ -/* } */ - -/* if (c->cqa != NULL) */ -/* remove_queued_alarm (c->cqa, c->alarm_id, TRUE, TRUE); */ -/* g_object_unref (c->comp); */ -/* g_object_unref (c->client); */ -/* g_free (c); */ -/* } */ - -typedef struct { - char *message; - gboolean blink_state; - gint blink_id; - time_t trigger; +struct notify_dialog_closure { CompQueuedAlarms *cqa; gpointer alarm_id; - CalComponent *comp; CalClient *client; - GtkWidget *tray_icon; - GtkWidget *image; - GtkWidget *alarm_dialog; -} TrayIconData; + CalComponent *comp; + gpointer dialog; +}; static void on_dialog_obj_updated_cb (CalClient *client, const char *uid, gpointer data) @@ -714,15 +669,15 @@ static void on_dialog_obj_removed_cb (CalClient *client, const char *uid, gpointer data) { const char *our_uid; - TrayIconData *tray_data = data; + struct notify_dialog_closure *c = data; - cal_component_get_uid (tray_data->comp, &our_uid); + cal_component_get_uid (c->comp, &our_uid); g_return_if_fail (our_uid && *our_uid); if (!strcmp (uid, our_uid)) { - alarm_notify_dialog_disable_buttons (tray_data->alarm_dialog); - tray_data->cqa = NULL; - tray_data->alarm_id = NULL; + alarm_notify_dialog_disable_buttons (c->dialog); + c->cqa = NULL; + c->alarm_id = NULL; } } @@ -730,19 +685,26 @@ on_dialog_obj_removed_cb (CalClient *client, const char *uid, gpointer data) static void notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data) { - TrayIconData *tray_data = data; + struct notify_dialog_closure *c; - g_signal_handlers_disconnect_matched (tray_data->client, G_SIGNAL_MATCH_FUNC, + c = data; + + g_signal_handlers_disconnect_matched (c->client, G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, on_dialog_obj_updated_cb, NULL); + g_signal_handlers_disconnect_matched (c->client, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, on_dialog_obj_removed_cb, NULL); switch (result) { case ALARM_NOTIFY_SNOOZE: - create_snooze (tray_data->cqa, tray_data->alarm_id, snooze_mins); - tray_data->cqa = NULL; + create_snooze (c->cqa, c->alarm_id, snooze_mins); + + g_object_unref (c->comp); + g_object_unref (c->client); + g_free (c); return; case ALARM_NOTIFY_EDIT: - edit_component (tray_data->client, tray_data->comp); + edit_component (c->client, c->comp); break; case ALARM_NOTIFY_CLOSE: @@ -753,83 +715,11 @@ notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data) g_assert_not_reached (); } - tray_data->alarm_dialog = NULL; - gtk_widget_destroy (tray_data->tray_icon); -} - -static gint -tray_icon_destroyed_cb (GtkWidget *tray, gpointer user_data) -{ - TrayIconData *tray_data = user_data; - - if (tray_data->cqa != NULL) - remove_queued_alarm (tray_data->cqa, tray_data->alarm_id, TRUE, TRUE); - - if (tray_data->message != NULL) { - g_free (tray_data->message); - tray_data->message = NULL; - } - - g_source_remove (tray_data->blink_id); - - g_object_unref (tray_data->comp); - g_object_unref (tray_data->client); - g_free (tray_data); - - return TRUE; -} - -static gint -tray_icon_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data) -{ - TrayIconData *tray_data = user_data; - - if (event->type == GDK_BUTTON_PRESS) { - if (event->button == 1) { - QueuedAlarm *qa; - - if (tray_data->alarm_dialog != NULL) - return FALSE; - - qa = lookup_queued_alarm (tray_data->cqa, tray_data->alarm_id); - if (qa) { - gtk_widget_hide (tray_data->tray_icon); - tray_data->alarm_dialog = alarm_notify_dialog ( - tray_data->trigger, - qa->instance->occur_start, - qa->instance->occur_end, - cal_component_get_vtype (tray_data->comp), - tray_data->message, - notify_dialog_cb, tray_data); - if (tray_data->alarm_dialog) { - g_signal_connect (G_OBJECT (tray_data->client), "obj_removed", - G_CALLBACK (on_dialog_obj_removed_cb), tray_data); - } - } - - return TRUE; - } else if (event->button == 2) { - return TRUE; - } - } - - return FALSE; -} - -static gboolean -tray_icon_blink_cb (gpointer data) -{ - TrayIconData *tray_data = data; - - /* FIXME: Use stock image equivalents when they become available */ - - tray_data->blink_state = tray_data->blink_state == TRUE ? FALSE : TRUE; - gtk_image_set_from_file (GTK_IMAGE (tray_data->image), - tray_data->blink_state == TRUE ? - EVOLUTION_IMAGESDIR "/appointment-reminder-excl.png" : - EVOLUTION_IMAGESDIR "/appointment-reminder.png"); - - return TRUE; + if (c->cqa != NULL) + remove_queued_alarm (c->cqa, c->alarm_id, TRUE, TRUE); + g_object_unref (c->comp); + g_object_unref (c->client); + g_free (c); } /* Performs notification of a display alarm */ @@ -837,18 +727,13 @@ static void display_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id, gboolean use_description) { - QueuedAlarm *qa; CalComponent *comp; - CalClient *client; CalComponentVType vtype; - const char *message; - CalComponentAlarm *alarm; - GtkWidget *tray_icon, *image, *ebox; - GtkTooltips *tooltips; - TrayIconData *tray_data; CalComponentText text; - char *str, *start_str, *end_str, *alarm_str; - icaltimezone *current_zone; + QueuedAlarm *qa; + const char *message; + struct notify_dialog_closure *c; + gboolean use_summary; comp = cqa->alarms->comp; qa = lookup_queued_alarm (cqa, alarm_id); @@ -857,73 +742,54 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa, vtype = cal_component_get_vtype (comp); - /* get a sensible description for the event */ - alarm = cal_component_get_alarm (comp, qa->instance->auid); - g_assert (alarm != NULL); + /* Pick a sensible notification message. First we try the DESCRIPTION + * from the alarm, then the SUMMARY of the component. + */ - cal_component_alarm_get_description (alarm, &text); - cal_component_alarm_free (alarm); + use_summary = TRUE; + message = NULL; - if (text.value) - message = text.value; - else { - cal_component_get_summary (comp, &text); - if (text.value) - message = text.value; - else - message = _("No description available."); + if (use_description) { + CalComponentAlarm *alarm; + + alarm = cal_component_get_alarm (comp, qa->instance->auid); + g_assert (alarm != NULL); + + cal_component_alarm_get_description (alarm, &text); + cal_component_alarm_free (alarm); + + if (text.value) { + message = text.value; + use_summary = FALSE; + } } - /* create the tray icon */ - tooltips = gtk_tooltips_new (); - - /* FIXME: Use stock image equivalent when it becomes available */ - tray_icon = egg_tray_icon_new (qa->instance->auid); - image = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/appointment-reminder.png"); - ebox = gtk_event_box_new (); - - gtk_widget_show (image); - gtk_widget_show (ebox); - - current_zone = config_data_get_timezone (); - alarm_str = timet_to_str_with_zone (trigger, current_zone); - start_str = timet_to_str_with_zone (qa->instance->occur_start, current_zone); - end_str = timet_to_str_with_zone (qa->instance->occur_end, current_zone); - str = g_strdup_printf (_("Alarm on %s\n%s\nStarting at %s\nEnding at %s"), - alarm_str, message, start_str, end_str); - gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), ebox, str, str); - g_free (start_str); - g_free (end_str); - g_free (alarm_str); - g_free (str); - - g_object_set_data (G_OBJECT (tray_icon), "image", image); - g_object_set_data (G_OBJECT (tray_icon), "available", GINT_TO_POINTER (1)); - - gtk_container_add (GTK_CONTAINER (ebox), image); - gtk_container_add (GTK_CONTAINER (tray_icon), ebox); - - /* create the private structure */ - tray_data = g_new0 (TrayIconData, 1); - tray_data->message = g_strdup (message); - tray_data->trigger = trigger; - tray_data->cqa = cqa; - tray_data->alarm_id = alarm_id; - tray_data->comp = cal_component_clone (comp); - tray_data->client = cqa->parent_client->client; - tray_data->image = image; - tray_data->blink_state = FALSE; - g_object_ref (tray_data->client); - tray_data->tray_icon = tray_icon; - - g_signal_connect (G_OBJECT (tray_icon), "destroy", - G_CALLBACK (tray_icon_destroyed_cb), tray_data); - g_signal_connect (G_OBJECT (ebox), "button_press_event", - G_CALLBACK (tray_icon_clicked_cb), tray_data); - - tray_data->blink_id = g_timeout_add (500, tray_icon_blink_cb, tray_data); - - gtk_widget_show (tray_icon); + if (use_summary) { + cal_component_get_summary (comp, &text); + if (text.value) + message = text.value; + else + message = _("No description available."); + } + + c = g_new (struct notify_dialog_closure, 1); + c->cqa = cqa; + c->alarm_id = alarm_id; + c->comp = cal_component_clone (comp); + c->client = c->cqa->parent_client->client; + g_object_ref (c->client); + + if (!(c->dialog = alarm_notify_dialog (trigger, + qa->instance->occur_start, qa->instance->occur_end, + vtype, message, + notify_dialog_cb, c))) + g_message ("display_notification(): Could not create the alarm notify dialog"); + else { + g_signal_connect (c->client, "obj_updated", + G_CALLBACK (on_dialog_obj_updated_cb), c); + g_signal_connect (c->client, "obj_removed", + G_CALLBACK (on_dialog_obj_removed_cb), c); + } } /* Performs notification of an audio alarm */ diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index 38206a66b9..279e9ad11d 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -325,12 +325,10 @@ publish_freebusy_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path) start = time_day_begin_with_zone (start, utc); end = time_add_week_with_zone (start, 6, utc); + /* FIXME Should we aggregate the data? */ client_list = e_cal_model_get_client_list (gnome_calendar_get_calendar_model (gcal)); for (cl = client_list; cl != NULL; cl = cl->next) { - GList *tmp_comp_list; - - tmp_comp_list = cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end); - if (tmp_comp_list) { + if (cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end, &comp_list, NULL)) { GList *l; for (l = comp_list; l; l = l->next) { @@ -425,15 +423,16 @@ get_shell_view_interface (BonoboControl *control) return shell_view; } -const gchar * -calendar_get_text_for_folder_bar_label (GnomeCalendar *gcal) +/* Displays the currently displayed time range in the folder bar label on the + shell view, according to which view we are showing. */ +void +calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control) { icaltimezone *zone; struct icaltimetype start_tt, end_tt; time_t start_time, end_time; struct tm start_tm, end_tm; - static char buffer[512]; - char end_buffer[256]; + char buffer[512], end_buffer[256]; GnomeCalendarViewType view; gnome_calendar_get_visible_time_range (gcal, &start_time, &end_time); @@ -517,17 +516,8 @@ calendar_get_text_for_folder_bar_label (GnomeCalendar *gcal) break; default: g_assert_not_reached (); - return NULL; } - return buffer; -} -/* Displays the currently displayed time range in the folder bar label on the - shell view, according to which view we are showing. */ -void -calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control) -{ - char *buffer = (char *)calendar_get_text_for_folder_bar_label (gcal); control_util_set_folder_bar_label (control, buffer); } @@ -589,13 +579,15 @@ sensitize_calendar_commands (GnomeCalendar *gcal, BonoboControl *control, gboole { BonoboUIComponent *uic; int n_selected; - gboolean read_only, has_recurrences; + gboolean read_only = FALSE, has_recurrences; uic = bonobo_control_get_ui_component (control); g_assert (uic != NULL); n_selected = enable ? gnome_calendar_get_num_events_selected (gcal) : 0; - read_only = cal_client_is_read_only (e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal))); + + cal_client_is_read_only (e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal)), + &read_only, NULL); bonobo_ui_component_set_prop (uic, "/commands/Cut", "sensitive", n_selected == 0 || read_only ? "0" : "1", @@ -648,13 +640,13 @@ sensitize_taskpad_commands (GnomeCalendar *gcal, BonoboControl *control, gboolea { BonoboUIComponent *uic; int n_selected; - gboolean read_only; + gboolean read_only = TRUE; uic = bonobo_control_get_ui_component (control); g_assert (uic != NULL); n_selected = enable ? gnome_calendar_get_num_tasks_selected (gcal) : 0; - read_only = cal_client_is_read_only (gnome_calendar_get_task_pad_cal_client (gcal)); + cal_client_is_read_only (gnome_calendar_get_task_pad_cal_client (gcal), &read_only, NULL); bonobo_ui_component_set_prop (uic, "/commands/Cut", "sensitive", n_selected == 0 || read_only ? "0" : "1", diff --git a/calendar/gui/calendar-offline-handler.c b/calendar/gui/calendar-offline-handler.c index 458f951d9a..ab1454bb0a 100644 --- a/calendar/gui/calendar-offline-handler.c +++ b/calendar/gui/calendar-offline-handler.c @@ -256,10 +256,7 @@ impl_dispose (GObject *object) offline_handler = CALENDAR_OFFLINE_HANDLER (object); priv = offline_handler->priv; - if (priv->client) { - g_object_unref (priv->client); - priv->client = NULL; - } + g_object_unref (priv->client); if (priv->listener_interface != CORBA_OBJECT_NIL) { CORBA_Environment ev; @@ -271,8 +268,6 @@ impl_dispose (GObject *object) priv->listener_interface = CORBA_OBJECT_NIL; } - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); } static void @@ -285,9 +280,6 @@ impl_finalize (GObject *object) priv = offline_handler->priv; g_free (priv); - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); } /* GTK+ type initialization. */ diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c index f76e0d4f03..f5c6c97416 100644 --- a/calendar/gui/comp-editor-factory.c +++ b/calendar/gui/comp-editor-factory.c @@ -241,7 +241,6 @@ edit_existing (OpenClient *oc, const char *uid) { CalComponent *comp; icalcomponent *icalcomp; - CalClientGetStatus status; CompEditor *editor; CalComponentVType vtype; @@ -249,31 +248,20 @@ edit_existing (OpenClient *oc, const char *uid) /* Get the object */ - status = cal_client_get_object (oc->client, uid, &icalcomp); - - switch (status) { - case CAL_CLIENT_GET_SUCCESS: - comp = cal_component_new (); - if (!cal_component_set_icalcomponent (comp, icalcomp)) { - g_object_unref (comp); - icalcomponent_free (icalcomp); - return; - } - break; - - case CAL_CLIENT_GET_NOT_FOUND: - /* The object disappeared from the server */ - return; - - case CAL_CLIENT_GET_SYNTAX_ERROR: - g_message ("edit_exiting(): Syntax error while getting component `%s'", uid); + if (!cal_client_get_object (oc->client, uid, NULL, &icalcomp, NULL)) { + /* FIXME Better error handling */ + g_warning (G_STRLOC ": Syntax error while getting component `%s'", uid); + return; - - default: - g_assert_not_reached (); + } + + comp = cal_component_new (); + if (!cal_component_set_icalcomponent (comp, icalcomp)) { + g_object_unref (comp); + icalcomponent_free (icalcomp); return; } - + /* Create the appropriate type of editor */ vtype = cal_component_get_vtype (comp); @@ -405,13 +393,15 @@ resolve_pending_requests (OpenClient *oc) factory = oc->factory; priv = factory->priv; - g_assert (oc->pending != NULL); + if (!oc->pending) + return; /* Set the default timezone in the backend. */ location = calendar_config_get_timezone (); zone = icaltimezone_get_builtin_timezone (location); if (zone) - cal_client_set_default_timezone (oc->client, zone); + /* FIXME Error handling? */ + cal_client_set_default_timezone (oc->client, zone, NULL); for (l = oc->pending; l; l = l->next) { Request *request; diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c index 28bc66bd54..9c8b8b2e6c 100644 --- a/calendar/gui/comp-util.c +++ b/calendar/gui/comp-util.c @@ -95,7 +95,6 @@ cal_comp_util_compare_event_timezones (CalComponent *comp, CalClient *client, icaltimezone *zone) { - CalClientGetStatus status; CalComponentDateTime start_datetime, end_datetime; const char *tzid; gboolean retval = FALSE; @@ -143,10 +142,8 @@ cal_comp_util_compare_event_timezones (CalComponent *comp, /* If the TZIDs differ, we have to compare the UTC offsets of the start and end times, using their own timezones and the given timezone. */ - status = cal_client_get_timezone (client, - start_datetime.tzid, - &start_zone); - if (status != CAL_CLIENT_GET_SUCCESS) + if (!cal_client_get_timezone (client, start_datetime.tzid, + &start_zone, NULL)) goto out; if (start_datetime.value) { @@ -160,10 +157,8 @@ cal_comp_util_compare_event_timezones (CalComponent *comp, goto out; } - status = cal_client_get_timezone (client, - end_datetime.tzid, - &end_zone); - if (status != CAL_CLIENT_GET_SUCCESS) + if (!cal_client_get_timezone (client, end_datetime.tzid, + &end_zone, NULL)) goto out; if (end_datetime.value) { @@ -210,7 +205,6 @@ gboolean cal_comp_is_on_server (CalComponent *comp, CalClient *client) { const char *uid; - CalClientGetStatus status; icalcomponent *icalcomp; g_return_val_if_fail (comp != NULL, FALSE); @@ -226,25 +220,12 @@ cal_comp_is_on_server (CalComponent *comp, CalClient *client) */ cal_component_get_uid (comp, &uid); - status = cal_client_get_object (client, uid, &icalcomp); - - switch (status) { - case CAL_CLIENT_GET_SUCCESS: + if (cal_client_get_object (client, uid, NULL, &icalcomp, NULL)) { icalcomponent_free (icalcomp); return TRUE; - - case CAL_CLIENT_GET_SYNTAX_ERROR: - g_message ("confirm_delete_empty_appointment(): Syntax error when getting " - "object `%s'", - uid); - return TRUE; - - case CAL_CLIENT_GET_NOT_FOUND: - return FALSE; - - default: - g_assert_not_reached (); } + + /* FIXME Better error handling */ return FALSE; } @@ -268,7 +249,7 @@ cal_comp_event_new_with_defaults (CalClient *client) icalproperty *icalprop; CalAlarmTrigger trigger; - if (cal_client_get_default_object (client, CALOBJ_TYPE_EVENT, &icalcomp) != CAL_CLIENT_GET_SUCCESS) + if (!cal_client_get_default_object (client, CALOBJ_TYPE_EVENT, &icalcomp, NULL)) return NULL; comp = cal_component_new (); @@ -334,7 +315,7 @@ cal_comp_task_new_with_defaults (CalClient *client) CalComponent *comp; icalcomponent *icalcomp; - if (cal_client_get_default_object (client, CALOBJ_TYPE_TODO, &icalcomp) != CAL_CLIENT_GET_SUCCESS) + if (!cal_client_get_default_object (client, CALOBJ_TYPE_TODO, &icalcomp, NULL)) return NULL; comp = cal_component_new (); diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c index 785734ad8c..919ed9a2c8 100644 --- a/calendar/gui/dialogs/alarm-page.c +++ b/calendar/gui/dialogs/alarm-page.c @@ -677,10 +677,9 @@ add_clicked_cb (GtkButton *button, gpointer data) action = e_dialog_option_menu_get (priv->action, action_map); cal_component_alarm_set_action (alarm, action); if (action == CAL_ALARM_EMAIL && !cal_component_alarm_has_attendees (alarm)) { - const char *email; + char *email; - email = cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client); - if (email != NULL) { + if (!cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client, &email, NULL)) { CalComponentAttendee *a; GSList attendee_list; @@ -689,6 +688,7 @@ add_clicked_cb (GtkButton *button, gpointer data) attendee_list.data = a; attendee_list.next = NULL; cal_component_alarm_set_attendee_list (alarm, &attendee_list); + g_free (email); g_free (a); } } @@ -741,7 +741,7 @@ button_options_clicked_cb (GtkWidget *widget, gpointer data) AlarmPage *apage; AlarmPagePrivate *priv; gboolean repeat; - const char *email; + char *email; apage = ALARM_PAGE (data); priv = apage->priv; @@ -751,9 +751,11 @@ button_options_clicked_cb (GtkWidget *widget, gpointer data) repeat = !cal_client_get_static_capability (COMP_EDITOR_PAGE (apage)->client, CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT); - email = cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client); - if (!alarm_options_dialog_run (priv->alarm, email, repeat)) - g_message ("button_options_clicked_cb(): Could not create the alarm options dialog"); + + if (cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client, &email, NULL)) { + if (!alarm_options_dialog_run (priv->alarm, email, repeat)) + g_message ("button_options_clicked_cb(): Could not create the alarm options dialog"); + } } /* Hooks the widget signals */ diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index f9c9919338..183be702ab 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -41,6 +41,7 @@ #include <e-util/e-dialog-utils.h> #include <evolution-shell-component-utils.h> #include "../print.h" +#include "../comp-util.h" #include "save-comp.h" #include "delete-comp.h" #include "send-comp.h" @@ -294,7 +295,7 @@ save_comp (CompEditor *editor) CompEditorPrivate *priv; CalComponent *clone; GList *l; - CalClientResult result; + gboolean result; priv = editor->priv; @@ -321,28 +322,19 @@ save_comp (CompEditor *editor) priv->updating = TRUE; - if (cal_component_is_instance (priv->comp)) - result = cal_client_update_object_with_mod (priv->client, priv->comp, priv->mod); - else - result = cal_client_update_object (priv->client, priv->comp); - if (result != CAL_CLIENT_RESULT_SUCCESS) { + if (!cal_comp_is_on_server (priv->comp, priv->client)) { + /* FIXME Better error handling */ + result = cal_client_create_object (priv->client, cal_component_get_icalcomponent (priv->comp), NULL, NULL); + } else { + /* FIXME Better error handling */ + result = cal_client_modify_object (priv->client, cal_component_get_icalcomponent (priv->comp), priv->mod, NULL); + } + + if (!result) { GtkWidget *dlg; char *msg; - switch (result) { - case CAL_CLIENT_RESULT_INVALID_OBJECT : - msg = g_strdup (_("Could not update invalid object")); - break; - case CAL_CLIENT_RESULT_NOT_FOUND : - msg = g_strdup (_("Object not found, not updated")); - break; - case CAL_CLIENT_RESULT_PERMISSION_DENIED : - msg = g_strdup (_("You don't have permissions to update this object")); - break; - default : - msg = g_strdup (_("Could not update object")); - break; - } + msg = g_strdup (_("Could not update object")); dlg = gnome_error_dialog (msg); gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); @@ -391,7 +383,7 @@ delete_comp (CompEditor *editor) cal_component_get_uid (priv->comp, &uid); priv->updating = TRUE; - cal_client_remove_object (priv->client, uid); + cal_client_remove_object (priv->client, uid, NULL); priv->updating = FALSE; close_dialog (editor); } @@ -1442,7 +1434,6 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data) CompEditor *editor = COMP_EDITOR (data); CompEditorPrivate *priv; CalComponent *comp = NULL; - CalClientGetStatus status; const char *edit_uid; priv = editor->priv; @@ -1453,8 +1444,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data) if (changed_component_dialog ((GtkWindow *) editor, priv->comp, FALSE, priv->changed)) { icalcomponent *icalcomp; - status = cal_client_get_object (priv->client, uid, &icalcomp); - if (status == CAL_CLIENT_GET_SUCCESS) { + if (!cal_client_get_object (priv->client, uid, NULL, &icalcomp, NULL)) { comp = cal_component_new (); if (cal_component_set_icalcomponent (comp, icalcomp)) comp_editor_edit_comp (editor, comp); diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c index 947aab1e97..edbcaf9880 100644 --- a/calendar/gui/dialogs/delete-error.c +++ b/calendar/gui/dialogs/delete-error.c @@ -38,13 +38,16 @@ * **/ void -delete_error_dialog (CalClientResult result, CalComponentVType vtype) +delete_error_dialog (GError *error, CalComponentVType vtype) { GtkWidget *dialog; const char *str; - switch (result) { - case CAL_CLIENT_RESULT_CORBA_ERROR: + if (!error) + return; + + switch (error->code) { + case E_CALENDAR_STATUS_CORBA_EXCEPTION: switch (vtype) { case CAL_COMPONENT_EVENT: str = _("The event could not be deleted due to a corba error"); @@ -60,7 +63,7 @@ delete_error_dialog (CalClientResult result, CalComponentVType vtype) break; } break; - case CAL_CLIENT_RESULT_PERMISSION_DENIED: + case E_CALENDAR_STATUS_PERMISSION_DENIED: switch (vtype) { case CAL_COMPONENT_EVENT: str = _("The event could not be deleted because permission was denied"); @@ -76,24 +79,24 @@ delete_error_dialog (CalClientResult result, CalComponentVType vtype) break; } break; - case CAL_CLIENT_RESULT_INVALID_OBJECT: + case E_CALENDAR_STATUS_OTHER_ERROR: switch (vtype) { case CAL_COMPONENT_EVENT: - str = _("The event could not be deleted because it was invalid"); + str = _("The event could not be deleted due to an error"); break; case CAL_COMPONENT_TODO: - str = _("The task could not be deleted because it was invalid"); + str = _("The task could not be deleted due to an error"); break; case CAL_COMPONENT_JOURNAL: - str = _("The journal entry could not be deleted because it was invalid"); + str = _("The journal entry could not be deleted due to an error"); break; default: - str = _("The item could not be deleted because it was invalid"); + str = _("The item could not be deleted due to an error"); break; } break; - case CAL_CLIENT_RESULT_SUCCESS: - case CAL_CLIENT_RESULT_NOT_FOUND: + case E_CALENDAR_STATUS_OK: + case E_CALENDAR_STATUS_OBJECT_NOT_FOUND: default: /* If not found, we don't care - its gone anyhow */ return; diff --git a/calendar/gui/dialogs/delete-error.h b/calendar/gui/dialogs/delete-error.h index dcef2fa3be..4ac8cf4515 100644 --- a/calendar/gui/dialogs/delete-error.h +++ b/calendar/gui/dialogs/delete-error.h @@ -25,6 +25,6 @@ #include <cal-client/cal-client.h> #include <cal-util/cal-component.h> -void delete_error_dialog (CalClientResult result, CalComponentVType vtype); +void delete_error_dialog (GError *error, CalComponentVType vtype); #endif diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index a67f2b14f9..18a30db63e 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -121,13 +121,14 @@ static void set_menu_sens (EventEditor *ee) { EventEditorPrivate *priv; - gboolean sens, existing, user, read_only; + gboolean sens, existing, user, read_only = TRUE; priv = ee->priv; existing = comp_editor_get_existing_org (COMP_EDITOR (ee)); user = comp_editor_get_user_org (COMP_EDITOR (ee)); - read_only = cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (ee))); + + cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (ee)), &read_only, NULL); sens = priv->meeting_shown; comp_editor_set_ui_prop (COMP_EDITOR (ee), diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index b55e67dedd..8813081f4d 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -270,7 +270,6 @@ update_time (EventPage *epage, CalComponentDateTime *start_date, CalComponentDat EventPagePrivate *priv; struct icaltimetype *start_tt, *end_tt, implied_tt; icaltimezone *start_zone = NULL, *end_zone = NULL; - CalClientGetStatus status; gboolean all_day_event; priv = epage->priv; @@ -280,24 +279,22 @@ update_time (EventPage *epage, CalComponentDateTime *start_date, CalComponentDat first. */ start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid); if (!start_zone) { - status = cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client, - start_date->tzid, - &start_zone); /* FIXME: Handle error better. */ - if (status != CAL_CLIENT_GET_SUCCESS) + if (!cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client, + start_date->tzid, &start_zone, NULL)) { g_warning ("Couldn't get timezone from server: %s", - start_date->tzid ? start_date->tzid : ""); + start_date->tzid ? start_date->tzid : ""); + } } end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date->tzid); if (!end_zone) { - status = cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client, - end_date->tzid, - &end_zone); - /* FIXME: Handle error better. */ - if (status != CAL_CLIENT_GET_SUCCESS) - g_warning ("Couldn't get timezone from server: %s", - end_date->tzid ? end_date->tzid : ""); + if (!cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client, + end_date->tzid, &end_zone, NULL)) { + /* FIXME: Handle error better. */ + g_warning ("Couldn't get timezone from server: %s", + end_date->tzid ? end_date->tzid : ""); + } } /* If both times are DATE values, we set the 'All Day Event' checkbox. diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c index e603978520..cab0f3df8a 100644 --- a/calendar/gui/dialogs/meeting-page.c +++ b/calendar/gui/dialogs/meeting-page.c @@ -497,7 +497,7 @@ get_widgets (MeetingPage *mpage) /* For making the user the organizer */ priv->organizer_table = GW ("organizer-table"); priv->organizer = GW ("organizer"); - gtk_combo_set_value_in_list (GTK_COMBO (priv->organizer), FALSE, FALSE); + gtk_combo_set_value_in_list (GTK_COMBO (priv->organizer), TRUE, FALSE); /* For showing existing organizers */ priv->existing_organizer_table = GW ("existing-organizer-table"); @@ -790,7 +790,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm, MeetingPagePrivate *priv; ETable *real_table; gchar *filename; - const char *backend_address; + char *backend_address; EIterator *it; EAccount *def_account; GList *address_strings = NULL, *l; @@ -812,7 +812,8 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm, } /* Address information */ - backend_address = cal_client_get_cal_address (client); + if (!cal_client_get_cal_address (client, &backend_address, NULL)) + return NULL; priv->accounts = itip_addresses_get (); def_account = itip_addresses_get_default(); @@ -839,6 +840,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm, } } g_object_unref(it); + g_free (backend_address); if (address_strings) gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), address_strings); diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 275ba26c44..4599001c27 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -852,7 +852,8 @@ preview_recur (RecurrencePage *rpage) cal_component_get_dtstart (priv->comp, &cdt); if (cdt.tzid != NULL) { - if (cal_client_get_timezone (COMP_EDITOR_PAGE (rpage)->client, cdt.tzid, &zone) != CAL_CLIENT_GET_SUCCESS) + /* FIXME Will cal_client_get_timezone really not return builtin zones? */ + if (!cal_client_get_timezone (COMP_EDITOR_PAGE (rpage)->client, cdt.tzid, &zone, NULL)) zone = icaltimezone_get_builtin_timezone_from_tzid (cdt.tzid); } cal_component_set_dtstart (comp, &cdt); @@ -1448,7 +1449,8 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) else if (dt.tzid == NULL) to_zone = icaltimezone_get_utc_timezone (); else - cal_client_get_timezone (client, dt.tzid, &to_zone); + /* FIXME Error checking? */ + cal_client_get_timezone (client, dt.tzid, &to_zone, NULL); from_zone = icaltimezone_get_utc_timezone (); icaltimezone_convert_time (&r->until, from_zone, to_zone); diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index 2163d51f1e..eb1813195c 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -208,7 +208,6 @@ update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponent SchedulePagePrivate *priv; struct icaltimetype start_tt, end_tt; icaltimezone *start_zone = NULL, *end_zone = NULL; - CalClientGetStatus status; gboolean all_day; priv = spage->priv; @@ -218,24 +217,22 @@ update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponent first. */ start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid); if (!start_zone) { - status = cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client, - start_date->tzid, - &start_zone); - /* FIXME: Handle error better. */ - if (status != CAL_CLIENT_GET_SUCCESS) + if (!cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client, + start_date->tzid, &start_zone, NULL)) { + /* FIXME: Handle error better. */ g_warning ("Couldn't get timezone from server: %s", start_date->tzid ? start_date->tzid : ""); + } } end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date->tzid); if (!end_zone) { - status = cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client, - end_date->tzid, - &end_zone); - /* FIXME: Handle error better. */ - if (status != CAL_CLIENT_GET_SUCCESS) - g_warning ("Couldn't get timezone from server: %s", - end_date->tzid ? end_date->tzid : ""); + if (!cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client, + end_date->tzid, &end_zone, NULL)) { + /* FIXME: Handle error better. */ + g_warning ("Couldn't get timezone from server: %s", + end_date->tzid ? end_date->tzid : ""); + } } start_tt = *start_date->value; diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index eaf4c2eaca..2e1b4745d8 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -111,13 +111,14 @@ static void set_menu_sens (TaskEditor *te) { TaskEditorPrivate *priv; - gboolean sens, existing, user, read_only; + gboolean sens, existing, user, read_only = TRUE; priv = te->priv; existing = comp_editor_get_existing_org (COMP_EDITOR (te)); user = comp_editor_get_user_org (COMP_EDITOR (te)); - read_only = cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (te))); + + cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (te)), &read_only, NULL); sens = cal_client_get_static_capability (comp_editor_get_cal_client (COMP_EDITOR (te)), CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT) diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 760b3e6f9e..fb7558ce5a 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -253,7 +253,6 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp) CalComponentText text; CalComponentDateTime d; CalComponentClassification cl; - CalClientGetStatus get_tz_status; GSList *l; const char *categories; icaltimezone *zone, *default_zone; @@ -317,12 +316,10 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp) if (!zone) zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid); if (!zone) { - get_tz_status = cal_client_get_timezone (page->client, d.tzid, - &zone); - /* FIXME: Handle error better. */ - if (get_tz_status != CAL_CLIENT_GET_SUCCESS) - g_warning ("Couldn't get timezone from server: %s", - d.tzid ? d.tzid : ""); + if (!cal_client_get_timezone (page->client, d.tzid, &zone, NULL)) + /* FIXME: Handle error better. */ + g_warning ("Couldn't get timezone from server: %s", + d.tzid ? d.tzid : ""); } e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->due_timezone), zone); @@ -359,10 +356,8 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp) if (!zone) zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid); if (!zone) { - get_tz_status = cal_client_get_timezone (page->client, d.tzid, - &zone); - /* FIXME: Handle error better. */ - if (get_tz_status != CAL_CLIENT_GET_SUCCESS) + if (!cal_client_get_timezone (page->client, d.tzid, &zone, NULL)) + /* FIXME: Handle error better. */ g_warning ("Couldn't get timezone from server: %s", d.tzid ? d.tzid : ""); } diff --git a/calendar/gui/e-alarm-list.c b/calendar/gui/e-alarm-list.c index 534a8c9449..56cce73e2f 100644 --- a/calendar/gui/e-alarm-list.c +++ b/calendar/gui/e-alarm-list.c @@ -224,10 +224,6 @@ row_updated (EAlarmList *alarm_list, gint n) static void e_alarm_list_finalize (GObject *object) { - EAlarmList *alarm_list = E_ALARM_LIST (object); - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); } /* Fulfill the GtkTreeModel requirements */ diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c index 82de4e6d5a..7a10894ed4 100644 --- a/calendar/gui/e-cal-model-calendar.c +++ b/calendar/gui/e-cal-model-calendar.c @@ -128,8 +128,8 @@ get_dtend (ECalModelComponent *comp_data) /* FIXME: handle errors */ cal_client_get_timezone (comp_data->client, - icaltime_get_tzid (tt_end), - &zone); + icaltimezone_get_tzid (icaltimezone_get_builtin_timezone (tt_end.zone)), + &zone, NULL); comp_data->dtend->zone = zone; } @@ -155,14 +155,12 @@ get_transparency (ECalModelComponent *comp_data) prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_TRANSP_PROPERTY); if (prop) { - icalproperty_transp transp; + const char *transp; transp = icalproperty_get_transp (prop); - if (transp == ICAL_TRANSP_TRANSPARENT || - transp == ICAL_TRANSP_TRANSPARENTNOCONFLICT) + if (strcasecmp (transp, "TRANSPARENT") == 0) return _("Free"); - else if (transp == ICAL_TRANSP_OPAQUE || - transp == ICAL_TRANSP_OPAQUENOCONFLICT) + else if (strcasecmp (transp, "OPAQUE") == 0) return _("Busy"); } @@ -253,12 +251,12 @@ set_transparency (ECalModelComponent *comp_data, const void *value) icalproperty_free (prop); } } else { - icalproperty_transp transp; + const char *transp; - if (!strcasecmp (value, "FREE")) - transp = ICAL_TRANSP_TRANSPARENT; - else if (!strcasecmp (value, "OPAQUE")) - transp = ICAL_TRANSP_OPAQUE; + if (strcasecmp (value, "FREE")) + transp = "TRANSPARENT"; + else if (strcasecmp (value, "OPAQUE")) + transp = "OPAQUE"; else { if (prop) { icalcomponent_remove_property (comp_data->icalcomp, prop); @@ -308,8 +306,12 @@ ecmc_set_value_at (ETableModel *etm, int col, int row, const void *value) break; } - if (cal_client_update_objects (comp_data->client, comp_data->icalcomp) != CAL_CLIENT_RESULT_SUCCESS) - g_message ("ecmc_set_value_at(): Could not update the object!"); + /* FIXME ask about mod type */ + if (!cal_client_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) { + g_warning (G_STRLOC ": Could not modify the object!"); + + /* FIXME Show error dialog */ + } } static gboolean diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c index 6bca52586c..75d0d1c928 100644 --- a/calendar/gui/e-cal-model-tasks.c +++ b/calendar/gui/e-cal-model-tasks.c @@ -222,8 +222,8 @@ get_completed (ECalModelComponent *comp_data) /* FIXME: handle errors */ cal_client_get_timezone (comp_data->client, - icaltime_get_tzid (tt_completed), - &zone); + icaltimezone_get_tzid (icaltimezone_get_builtin_timezone (tt_completed.zone)), + &zone, NULL); comp_data->completed->zone = zone; } @@ -252,8 +252,8 @@ get_due (ECalModelComponent *comp_data) /* FIXME: handle errors */ cal_client_get_timezone (comp_data->client, - icaltime_get_tzid (tt_due), - &zone); + icaltimezone_get_tzid (icaltimezone_get_builtin_timezone (tt_due.zone)), + &zone, NULL); comp_data->due->zone = zone; } @@ -374,7 +374,6 @@ get_due_status (ECalModelTasks *model, ECalModelComponent *comp_data) return E_CAL_MODEL_TASKS_DUE_NEVER; else { struct icaltimetype now_tt, due_tt; - CalClientGetStatus status; icaltimezone *zone; /* Second, is it already completed? */ @@ -397,10 +396,9 @@ get_due_status (ECalModelTasks *model, ECalModelComponent *comp_data) return E_CAL_MODEL_TASKS_DUE_FUTURE; } else { /* Get the current time in the same timezone as the DUE date.*/ - status = cal_client_get_timezone (comp_data->client, - icaltime_get_tzid (due_tt), - &zone); - if (status != CAL_CLIENT_GET_SUCCESS) + if (!cal_client_get_timezone (comp_data->client, + icaltimezone_get_tzid (icaltimezone_get_builtin_timezone (due_tt.zone)), + &zone, NULL)) return E_CAL_MODEL_TASKS_DUE_FUTURE; now_tt = icaltime_current_time_with_zone (zone); @@ -756,8 +754,12 @@ ecmt_set_value_at (ETableModel *etm, int col, int row, const void *value) break; } - if (cal_client_update_objects (comp_data->client, comp_data->icalcomp) != CAL_CLIENT_RESULT_SUCCESS) - g_message ("ecmt_set_value_at(): Could not update the object!"); + /* FIXME ask about mod type */ + if (!cal_client_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) { + g_warning (G_STRLOC ": Could not modify the object!"); + + /* FIXME Show error dialog */ + } } static gboolean @@ -960,8 +962,7 @@ ecmt_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data) break; } - return "black"; - /* return E_CAL_MODEL_CLASS (parent_class)->get_color_for_component (model, comp_data); */ + return E_CAL_MODEL_CLASS (parent_class)->get_color_for_component (model, comp_data); } static void diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 8a68cd07e5..9dd75d559a 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -336,8 +336,8 @@ get_dtstart (ECalModel *model, ECalModelComponent *comp_data) /* FIXME: handle errors */ cal_client_get_timezone (comp_data->client, - icaltime_get_tzid (tt_start), - &zone); + icaltimezone_get_tzid (icaltimezone_get_builtin_timezone (tt_start.zone)), + &zone, NULL); comp_data->dtstart->zone = zone; } @@ -476,22 +476,11 @@ set_classification (ECalModelComponent *comp_data, const char *value) icalproperty_free (prop); } } else { - icalproperty_class ical_class; - - if (!strcasecmp (value, "PUBLIC")) - ical_class = ICAL_CLASS_PUBLIC; - else if (!strcasecmp (value, "PRIVATE")) - ical_class = ICAL_CLASS_PRIVATE; - else if (!strcasecmp (value, "CONFIDENTIAL")) - ical_class = ICAL_CLASS_CONFIDENTIAL; - else - ical_class = ICAL_CLASS_NONE; - if (!prop) { - prop = icalproperty_new_class (ical_class); + prop = icalproperty_new_class (value); icalcomponent_add_property (comp_data->icalcomp, prop); } else - icalproperty_set_class (prop, ical_class); + icalproperty_set_class (prop, value); } } @@ -589,8 +578,12 @@ ecm_set_value_at (ETableModel *etm, int col, int row, const void *value) set_summary (comp_data, value); } - if (cal_client_update_objects (comp_data->client, comp_data->icalcomp) != CAL_CLIENT_RESULT_SUCCESS) - g_message ("ecm_set_value_at(): Could not update the object!"); + /* FIXME ask about mod type */ + if (!cal_client_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) { + g_warning (G_STRLOC ": Could not modify the object!"); + + /* FIXME Show error dialog */ + } } static gboolean @@ -653,7 +646,10 @@ ecm_append_row (ETableModel *etm, ETableModel *source, int row) model_class->fill_component_from_model (model, &comp_data, source_model, row); } - if (cal_client_update_objects (comp_data.client, comp_data.icalcomp) != CAL_CLIENT_RESULT_SUCCESS) { + + if (!cal_client_create_object (comp_data.client, comp_data.icalcomp, NULL, NULL)) { + g_warning (G_STRLOC ": Could not create the object!"); + /* FIXME: show error dialog */ } @@ -1062,124 +1058,119 @@ get_position_in_array (GPtrArray *objects, gpointer item) } static void -query_obj_updated_cb (CalQuery *query, const char *uid, - gboolean query_in_progress, - int n_scanned, int total, - gpointer user_data) +query_objects_added_cb (CalQuery *query, GList *objects, gpointer user_data) { - ECalModelPrivate *priv; - icalcomponent *new_icalcomp; - CalClientGetStatus status; - ECalModelComponent *comp_data; - gint pos; ECalModel *model = (ECalModel *) user_data; - - g_return_if_fail (E_IS_CAL_MODEL (model)); - + ECalModelPrivate *priv; + GList *l; + int start_row; + priv = model->priv; e_table_model_pre_change (E_TABLE_MODEL (model)); - comp_data = search_by_uid_and_client (priv, cal_query_get_client (query), uid); - status = cal_client_get_object (cal_query_get_client (query), uid, &new_icalcomp); - switch (status) { - case CAL_CLIENT_GET_SUCCESS : - if (comp_data) { - if (comp_data->icalcomp) - icalcomponent_free (comp_data->icalcomp); - if (comp_data->dtstart) { - g_free (comp_data->dtstart); - comp_data->dtstart = NULL; - } - if (comp_data->dtend) { - g_free (comp_data->dtend); - comp_data->dtend = NULL; - } - if (comp_data->due) { - g_free (comp_data->due); - comp_data->due = NULL; - } - if (comp_data->completed) { - g_free (comp_data->completed); - comp_data->completed = NULL; - } + start_row = priv->objects->len ? priv->objects->len - 1 : 0; + + for (l = objects; l; l = l->next) { + ECalModelComponent *comp_data; - comp_data->icalcomp = new_icalcomp; + comp_data = g_new0 (ECalModelComponent, 1); + comp_data->client = cal_query_get_client (query); + comp_data->icalcomp = icalcomponent_new_clone (l->data); - e_table_model_row_changed (E_TABLE_MODEL (model), get_position_in_array (priv->objects, comp_data)); - } else { - comp_data = g_new0 (ECalModelComponent, 1); - comp_data->client = cal_query_get_client (query); - comp_data->icalcomp = new_icalcomp; + g_ptr_array_add (priv->objects, comp_data); + } - g_ptr_array_add (priv->objects, comp_data); - e_table_model_row_inserted (E_TABLE_MODEL (model), priv->objects->len - 1); - } - break; - case CAL_CLIENT_GET_NOT_FOUND : - case CAL_CLIENT_GET_SYNTAX_ERROR : - if (comp_data) { - /* Nothing; the object may have been removed from the server. We just - notify that the old object was deleted. - */ - pos = get_position_in_array (priv->objects, comp_data); + e_table_model_rows_inserted (E_TABLE_MODEL (model), start_row, priv->objects->len - start_row); +} - g_ptr_array_remove (priv->objects, comp_data); - free_comp_data (comp_data); +static void +query_objects_modified_cb (CalQuery *query, GList *objects, gpointer user_data) +{ + ECalModelPrivate *priv; + ECalModel *model = (ECalModel *) user_data; + GList *l; + + priv = model->priv; - e_table_model_row_deleted (E_TABLE_MODEL (model), pos); - } else - e_table_model_no_change (E_TABLE_MODEL (model)); - break; - default : - g_assert_not_reached (); + for (l = objects; l; l = l->next) { + ECalModelComponent *comp_data; + + e_table_model_pre_change (E_TABLE_MODEL (model)); + + comp_data = search_by_uid_and_client (priv, cal_query_get_client (query), icalcomponent_get_uid (l->data)); + g_assert (comp_data); + + if (comp_data->icalcomp) + icalcomponent_free (comp_data->icalcomp); + if (comp_data->dtstart) { + g_free (comp_data->dtstart); + comp_data->dtstart = NULL; + } + if (comp_data->dtend) { + g_free (comp_data->dtend); + comp_data->dtend = NULL; + } + if (comp_data->due) { + g_free (comp_data->due); + comp_data->due = NULL; + } + if (comp_data->completed) { + g_free (comp_data->completed); + comp_data->completed = NULL; + } + + comp_data->icalcomp = icalcomponent_new_clone (l->data); + + e_table_model_row_changed (E_TABLE_MODEL (model), get_position_in_array (priv->objects, comp_data)); } } static void -query_obj_removed_cb (CalQuery *query, const char *uid, gpointer user_data) +query_objects_removed_cb (CalQuery *query, GList *uids, gpointer user_data) { - ECalModelComponent *comp_data; ECalModelPrivate *priv; ECalModel *model = (ECalModel *) user_data; - - g_return_if_fail (E_IS_CAL_MODEL (model)); - + GList *l; + priv = model->priv; - e_table_model_pre_change (E_TABLE_MODEL (model)); - - comp_data = search_by_uid_and_client (priv, cal_query_get_client (query), uid); - if (comp_data) { - gint pos = get_position_in_array (priv->objects, comp_data); + for (l = uids; l; l = l->next) { + ECalModelComponent *comp_data; + int pos; + e_table_model_pre_change (E_TABLE_MODEL (model)); + + comp_data = search_by_uid_and_client (priv, cal_query_get_client (query), l->data); + g_assert (comp_data); + + pos = get_position_in_array (priv->objects, comp_data); + g_ptr_array_remove (priv->objects, comp_data); free_comp_data (comp_data); - + e_table_model_row_deleted (E_TABLE_MODEL (model), pos); - } else - e_table_model_no_change (E_TABLE_MODEL (model)); + } } static void -query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *error_str, gpointer user_data) +query_progress_cb (CalQuery *query, const char *message, int percent, gpointer user_data) { ECalModel *model = (ECalModel *) user_data; g_return_if_fail (E_IS_CAL_MODEL (model)); - if (status != CAL_QUERY_DONE_SUCCESS) - g_warning ("query done: %s\n", error_str); + /* FIXME Update status bar */ } static void -query_eval_error_cb (CalQuery *query, const char *error_str, gpointer user_data) +query_done_cb (CalQuery *query, ECalendarStatus status, gpointer user_data) { - ECalModel *model = (ECalModel *) user_data; + ECalModel *model = (ECalModel *) user_data; g_return_if_fail (E_IS_CAL_MODEL (model)); - g_warning ("eval error: %s\n", error_str); + /* FIXME Clear status bar */ } /* Builds a complete query sexp for the calendar model by adding the predicates @@ -1226,24 +1217,28 @@ update_query_for_client (ECalModel *model, ECalModelClient *client_data) g_signal_handlers_disconnect_matched (client_data->query, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, model); g_object_unref (client_data->query); + client_data->query = NULL; } /* prepare the query */ g_assert (priv->sexp != NULL); real_sexp = adjust_query_sexp (model, priv->sexp); - client_data->query = cal_client_get_query (client_data->client, real_sexp); - g_free (real_sexp); + if (!cal_client_get_query (client_data->client, real_sexp, &client_data->query, NULL)) { + g_warning (G_STRLOC ": Unable to get query"); + g_free (real_sexp); - if (!client_data->query) { - g_message ("update_query_for_client(): Could not create the query"); return; - } + } + g_free (real_sexp); - g_signal_connect (client_data->query, "obj_updated", G_CALLBACK (query_obj_updated_cb), model); - g_signal_connect (client_data->query, "obj_removed", G_CALLBACK (query_obj_removed_cb), model); + g_signal_connect (client_data->query, "objects_added", G_CALLBACK (query_objects_added_cb), model); + g_signal_connect (client_data->query, "objects_modified", G_CALLBACK (query_objects_modified_cb), model); + g_signal_connect (client_data->query, "objects_removed", G_CALLBACK (query_objects_removed_cb), model); + g_signal_connect (client_data->query, "query_progress", G_CALLBACK (query_progress_cb), model); g_signal_connect (client_data->query, "query_done", G_CALLBACK (query_done_cb), model); - g_signal_connect (client_data->query, "eval_error", G_CALLBACK (query_eval_error_cb), model); + + cal_query_start (client_data->query); } static void @@ -1271,6 +1266,8 @@ add_new_client (ECalModel *model, CalClient *client) priv->clients = g_list_append (priv->clients, client_data); + /* FIXME Listen for removals? */ + g_signal_connect (G_OBJECT (client_data->client), "backend_died", G_CALLBACK (backend_died_cb), model); diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c index 381dca2542..7e47d4f59a 100644 --- a/calendar/gui/e-cal-view.c +++ b/calendar/gui/e-cal-view.c @@ -45,7 +45,6 @@ #include "dialogs/recur-comp.h" #include "print.h" #include "goto.h" -#include "ea-calendar.h" /* Used for the status bar messages */ #define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png" @@ -83,8 +82,6 @@ static GdkAtom clipboard_atom = GDK_NONE; enum { SELECTION_CHANGED, TIMEZONE_CHANGED, - EVENT_CHANGED, - EVENT_ADDED, LAST_SIGNAL }; @@ -115,33 +112,10 @@ e_cal_view_class_init (ECalViewClass *klass) cal_util_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); - e_cal_view_signals[EVENT_CHANGED] = - g_signal_new ("event_changed", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (ECalViewClass, event_changed), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, - G_TYPE_POINTER); - - e_cal_view_signals[EVENT_ADDED] = - g_signal_new ("event_added", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (ECalViewClass, event_added), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, - G_TYPE_POINTER); - /* Method override */ object_class->destroy = e_cal_view_destroy; klass->selection_changed = NULL; - klass->event_changed = NULL; - klass->event_added = NULL; - klass->get_selected_events = NULL; klass->get_selected_time_range = NULL; klass->set_selected_time_range = NULL; @@ -151,9 +125,6 @@ e_cal_view_class_init (ECalViewClass *klass) /* clipboard atom */ if (!clipboard_atom) clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); - - /* init the accessibility support for e_day_view */ - e_cal_view_a11y_init (); } static void @@ -208,6 +179,45 @@ selection_clear_event (GtkWidget *invisible, } static void +selection_received_add_event (ECalView *cal_view, CalClient *client, time_t selected_time_start, + icaltimezone *default_zone, icalcomponent *icalcomp) +{ + CalComponent *comp; + struct icaltimetype itime; + time_t tt_start, tt_end; + struct icaldurationtype ic_dur; + char *uid; + + tt_start = icaltime_as_timet (icalcomponent_get_dtstart (icalcomp)); + tt_end = icaltime_as_timet (icalcomponent_get_dtend (icalcomp)); + ic_dur = icaldurationtype_from_int (tt_end - tt_start); + itime = icaltime_from_timet_with_zone (selected_time_start, FALSE, default_zone); + + icalcomponent_set_dtstart (icalcomp, itime); + itime = icaltime_add (itime, ic_dur); + icalcomponent_set_dtend (icalcomp, itime); + + /* FIXME The new uid stuff can go away once we actually set it in the backend */ + uid = cal_component_gen_uid (); + comp = cal_component_new (); + cal_component_set_icalcomponent ( + comp, icalcomponent_new_clone (icalcomp)); + cal_component_set_uid (comp, uid); + + /* FIXME Error handling */ + cal_client_create_object (client, cal_component_get_icalcomponent (comp), NULL, NULL); + if (itip_organizer_is_user (comp, client) && + send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), + client, comp, TRUE)) { + itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, + client, NULL); + } + + free (uid); + g_object_unref (comp); +} + +static void selection_received (GtkWidget *invisible, GtkSelectionData *selection_data, guint time, @@ -216,12 +226,7 @@ selection_received (GtkWidget *invisible, char *comp_str, *default_tzid; icalcomponent *icalcomp; icalcomponent_kind kind; - CalComponent *comp; time_t selected_time_start, selected_time_end; - struct icaltimetype itime; - time_t tt_start, tt_end; - struct icaldurationtype ic_dur; - char *uid; icaltimezone *default_zone; CalClient *client; @@ -239,20 +244,19 @@ selection_received (GtkWidget *invisible, default_tzid = calendar_config_get_timezone (); client = e_cal_model_get_default_client (cal_view->priv->model); - cal_client_get_timezone (client, default_tzid, &default_zone); + /* FIXME Error checking */ + cal_client_get_timezone (client, default_tzid, &default_zone, NULL); /* check the type of the component */ + /* FIXME An error dialog if we return? */ kind = icalcomponent_isa (icalcomp); - if (kind != ICAL_VCALENDAR_COMPONENT && - kind != ICAL_VEVENT_COMPONENT && - kind != ICAL_VTODO_COMPONENT && - kind != ICAL_VJOURNAL_COMPONENT) { + if (kind != ICAL_VCALENDAR_COMPONENT && kind != ICAL_VEVENT_COMPONENT) return; - } e_cal_view_set_status_message (cal_view, _("Updating objects")); e_cal_view_get_selected_time_range (cal_view, &selected_time_start, &selected_time_end); + /* FIXME Timezone handling */ if (kind == ICAL_VCALENDAR_COMPONENT) { icalcomponent_kind child_kind; icalcomponent *subcomp; @@ -260,69 +264,27 @@ selection_received (GtkWidget *invisible, subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT); while (subcomp) { child_kind = icalcomponent_isa (subcomp); - if (child_kind == ICAL_VEVENT_COMPONENT || - child_kind == ICAL_VTODO_COMPONENT || - child_kind == ICAL_VJOURNAL_COMPONENT) { - tt_start = icaltime_as_timet (icalcomponent_get_dtstart (subcomp)); - tt_end = icaltime_as_timet (icalcomponent_get_dtend (subcomp)); - ic_dur = icaldurationtype_from_int (tt_end - tt_start); - itime = icaltime_from_timet_with_zone (selected_time_start, - FALSE, default_zone); - - icalcomponent_set_dtstart (subcomp, itime); - itime = icaltime_add (itime, ic_dur); - icalcomponent_set_dtend (subcomp, itime); - - uid = cal_component_gen_uid (); - comp = cal_component_new (); - cal_component_set_icalcomponent ( - comp, icalcomponent_new_clone (subcomp)); - cal_component_set_uid (comp, uid); - - cal_client_update_object (client, comp); - if (itip_organizer_is_user (comp, client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), - client, comp, TRUE)) { - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, - client, NULL); - } - - free (uid); - g_object_unref (comp); + if (child_kind == ICAL_VEVENT_COMPONENT) + selection_received_add_event (cal_view, client, selected_time_start, + default_zone, subcomp); + else if (child_kind == ICAL_VTIMEZONE_COMPONENT) { + icaltimezone *zone; + + zone = icaltimezone_new (); + icaltimezone_set_component (zone, subcomp); + cal_client_add_timezone (client, zone, NULL); + + icaltimezone_free (zone, 1); } + subcomp = icalcomponent_get_next_component ( icalcomp, ICAL_ANY_COMPONENT); } icalcomponent_free (icalcomp); - } - else { - tt_start = icaltime_as_timet (icalcomponent_get_dtstart (icalcomp)); - tt_end = icaltime_as_timet (icalcomponent_get_dtend (icalcomp)); - ic_dur = icaldurationtype_from_int (tt_end - tt_start); - itime = icaltime_from_timet_with_zone (selected_time_start, FALSE, default_zone); - - icalcomponent_set_dtstart (icalcomp, itime); - itime = icaltime_add (itime, ic_dur); - icalcomponent_set_dtend (icalcomp, itime); - - uid = cal_component_gen_uid (); - comp = cal_component_new (); - cal_component_set_icalcomponent ( - comp, icalcomponent_new_clone (icalcomp)); - cal_component_set_uid (comp, uid); - - cal_client_update_object (client, comp); - if (itip_organizer_is_user (comp, client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), - client, comp, TRUE)) { - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, - client, NULL); - } - - free (uid); - g_object_unref (comp); + } else { + selection_received_add_event (cal_view, client, selected_time_start, default_zone, icalcomp); } e_cal_view_set_status_message (cal_view, NULL); @@ -538,13 +500,9 @@ e_cal_view_update_query (ECalView *cal_view) { g_return_if_fail (E_IS_CAL_VIEW (cal_view)); - e_cal_view_set_status_message (cal_view, _("Searching")); - if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query) { E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query (cal_view); } - - e_cal_view_set_status_message (cal_view, NULL); } void @@ -564,9 +522,9 @@ e_cal_view_cut_clipboard (ECalView *cal_view) e_cal_view_copy_clipboard (cal_view); for (l = selected; l != NULL; l = l->next) { CalComponent *comp; - ECalViewEvent *event = (ECalViewEvent *) l->data; - + GError *error = NULL; + if (!event) continue; @@ -580,8 +538,8 @@ e_cal_view_cut_clipboard (ECalView *cal_view) event->comp_data->client, NULL); cal_component_get_uid (comp, &uid); - delete_error_dialog (cal_client_remove_object (event->comp_data->client, uid), - CAL_COMPONENT_EVENT); + cal_client_remove_object (event->comp_data->client, uid, &error); + delete_error_dialog (error, CAL_COMPONENT_EVENT); g_object_unref (comp); } @@ -657,7 +615,8 @@ delete_event (ECalView *cal_view, ECalViewEvent *event) if (delete_component_dialog (comp, FALSE, 1, vtype, GTK_WIDGET (cal_view))) { const char *uid; - + GError *error = NULL; + if (itip_organizer_is_user (comp, event->comp_data->client) && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), event->comp_data->client, @@ -670,9 +629,10 @@ delete_event (ECalView *cal_view, ECalViewEvent *event) g_object_unref (comp); return; } - - delete_error_dialog ( - cal_client_remove_object (event->comp_data->client, uid), CAL_COMPONENT_EVENT); + + cal_client_remove_object (event->comp_data->client, uid, &error); + delete_error_dialog (error, CAL_COMPONENT_EVENT); + g_clear_error (&error); } g_object_unref (comp); @@ -719,35 +679,20 @@ e_cal_view_delete_selected_occurrence (ECalView *cal_view) { ECalViewEvent *event; GList *selected; - + const char *uid; + GError *error = NULL; + selected = e_cal_view_get_selected_events (cal_view); if (!selected) return; event = (ECalViewEvent *) selected->data; - if (cal_util_component_is_instance (event->comp_data->icalcomp)) { - const char *uid; - - uid = icalcomponent_get_uid (event->comp_data->icalcomp); - delete_error_dialog ( - cal_client_remove_object_with_mod (event->comp_data->client, uid, CALOBJ_MOD_THIS), - CAL_COMPONENT_EVENT); - } else { - CalComponent *comp; - - /* we must duplicate the CalComponent, or we won't know it has changed - when we get the "update_event" signal */ - comp = cal_component_new (); - cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - cal_comp_util_add_exdate (comp, event->start, cal_view->priv->zone); - - if (cal_client_update_object (event->comp_data->client, comp) - != CAL_CLIENT_RESULT_SUCCESS) - g_message ("e_cal_view_delete_selected_occurrence(): Could not update the object!"); + uid = icalcomponent_get_uid (event->comp_data->icalcomp); + cal_client_remove_object_with_mod (event->comp_data->client, uid, CALOBJ_MOD_THIS, &error); - g_object_unref (comp); - } + delete_error_dialog (error, CAL_COMPONENT_EVENT); + g_clear_error (&error); /* free memory */ g_list_free (selected); @@ -962,7 +907,7 @@ on_publish (GtkWidget *widget, gpointer user_data) ECalView *cal_view; icaltimezone *utc; time_t start = time (NULL), end; - GList *comp_list, *client_list, *cl; + GList *comp_list = NULL, *client_list, *cl; cal_view = E_CAL_VIEW (user_data); @@ -972,8 +917,7 @@ on_publish (GtkWidget *widget, gpointer user_data) client_list = e_cal_model_get_client_list (cal_view->priv->model); for (cl = client_list; cl != NULL; cl = cl->next) { - comp_list = cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end); - if (comp_list) { + if (cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end, &comp_list, NULL)) { GList *l; for (l = comp_list; l; l = l->next) { @@ -1041,14 +985,6 @@ on_paste (GtkWidget *widget, gpointer user_data) e_cal_view_paste_clipboard (cal_view); } -static void -on_unrecur_appointment (GtkWidget *widget, gpointer user_data) -{ - ECalView *cal_view = E_CAL_VIEW (user_data); - - gnome_calendar_unrecur_selection (cal_view->priv->calendar); -} - enum { /* * This is used to "flag" events that can not be editted @@ -1142,7 +1078,6 @@ static EPopupMenu child_items [] = { E_POPUP_SEPARATOR, E_POPUP_ITEM (N_("_Delete"), GTK_SIGNAL_FUNC (on_delete_appointment), MASK_EDITABLE | MASK_SINGLE | MASK_EDITING), - E_POPUP_ITEM (N_("Make this Occurrence _Movable"), GTK_SIGNAL_FUNC (on_unrecur_appointment), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE | MASK_INSTANCE), E_POPUP_ITEM (N_("Delete this _Occurrence"), GTK_SIGNAL_FUNC (on_delete_occurrence), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE), E_POPUP_ITEM (N_("Delete _All Occurrences"), GTK_SIGNAL_FUNC (on_delete_appointment), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE), @@ -1169,36 +1104,8 @@ setup_popup_icons (EPopupMenu *context_menu) for (i = 0; context_menu[i].name; i++) { GtkWidget *pixmap_widget = NULL; - if (!strcmp (context_menu[i].name, _("_Copy"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_COPY, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("C_ut"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_CUT, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Delete")) || - !strcmp (context_menu[i].name, _("Delete this _Occurrence")) || - !strcmp (context_menu[i].name, _("Delete _All Occurrences"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("Go to _Today"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_HOME, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Go to Date..."))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("New _Appointment..."))) - pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_appointment.xpm"); - else if (!strcmp (context_menu[i].name, _("New All Day _Event"))) - pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_all_day_event.png"); - else if (!strcmp (context_menu[i].name, _("New Meeting"))) - pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/meeting-request-16.png"); - else if (!strcmp (context_menu[i].name, _("New Task"))) - pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_task-16.png"); - else if (!strcmp (context_menu[i].name, _("_Open"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Paste"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PASTE, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Print..."))) + if (!strcmp (context_menu[i].name, _("_Print..."))) pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Save As..."))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Settings..."))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU); if (pixmap_widget) gtk_widget_show (pixmap_widget); @@ -1215,7 +1122,8 @@ e_cal_view_create_popup_menu (ECalView *cal_view) guint32 disable_mask = 0, hide_mask = 0; GtkMenu *popup; CalClient *client = NULL; - + gboolean read_only = TRUE; + g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL); /* get the selection */ @@ -1260,7 +1168,8 @@ e_cal_view_create_popup_menu (ECalView *cal_view) client = event->comp_data->client; } - if (cal_client_is_read_only (client)) + cal_client_is_read_only (client, &read_only, NULL); + if (!read_only) disable_mask |= MASK_EDITABLE; if (being_edited) diff --git a/calendar/gui/e-cal-view.h b/calendar/gui/e-cal-view.h index ea7c11a00d..6fac862ded 100644 --- a/calendar/gui/e-cal-view.h +++ b/calendar/gui/e-cal-view.h @@ -77,8 +77,6 @@ struct _ECalViewClass { /* Notification signals */ void (* selection_changed) (ECalView *cal_view); void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone); - void (* event_changed) (ECalView *day_view, ECalViewEvent *event); - void (* event_added) (ECalView *day_view, ECalViewEvent *event); /* Virtual methods */ GList * (* get_selected_events) (ECalView *cal_view); /* a GList of ECalViewEvent's */ diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 5b3f98f373..bbda572984 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -725,10 +725,12 @@ delete_selected_components (ECalendarTable *cal_table) for (l = objs; l; l = l->next) { ECalModelComponent *comp_data = (ECalModelComponent *) l->data; - - delete_error_dialog (cal_client_remove_object (comp_data->client, - icalcomponent_get_uid (comp_data->icalcomp)), - CAL_COMPONENT_TODO); + GError *error = NULL; + + cal_client_remove_object (comp_data->client, + icalcomponent_get_uid (comp_data->icalcomp), &error); + delete_error_dialog (error, CAL_COMPONENT_TODO); + g_clear_error (&error); } e_calendar_table_set_status_message (cal_table, NULL); @@ -987,7 +989,7 @@ enum { static EPopupMenu tasks_popup_menu [] = { E_POPUP_ITEM (N_("_Open"), GTK_SIGNAL_FUNC (e_calendar_table_on_open_task), MASK_SINGLE), E_POPUP_ITEM (N_("Open _Web Page"), GTK_SIGNAL_FUNC (open_url_cb), MASK_SINGLE | MASK_LACKS_URL), - E_POPUP_ITEM (N_("_Save As..."), GTK_SIGNAL_FUNC (e_calendar_table_on_save_as), MASK_SINGLE), + E_POPUP_ITEM (N_("_Save as..."), GTK_SIGNAL_FUNC (e_calendar_table_on_save_as), MASK_SINGLE), E_POPUP_ITEM (N_("_Print..."), GTK_SIGNAL_FUNC (e_calendar_table_on_print_task), MASK_SINGLE), E_POPUP_SEPARATOR, @@ -1011,36 +1013,6 @@ static EPopupMenu tasks_popup_menu [] = { E_POPUP_TERMINATOR }; -static void -setup_popup_icons (EPopupMenu *context_menu) -{ - gint i; - - for (i = 0; context_menu[i].name; i++) { - GtkWidget *pixmap_widget = NULL; - - if (!strcmp (context_menu[i].name, _("_Copy"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_COPY, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("C_ut"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_CUT, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Delete")) || - !strcmp (context_menu[i].name, _("_Delete Selected Tasks"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Open"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Paste"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PASTE, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Print..."))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Save As..."))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU); - - if (pixmap_widget) - gtk_widget_show (pixmap_widget); - context_menu[i].pixmap_widget = pixmap_widget; - } -} - static gint e_calendar_table_show_popup_menu (ETable *table, GdkEvent *gdk_event, @@ -1052,7 +1024,8 @@ e_calendar_table_show_popup_menu (ETable *table, GtkMenu *gtk_menu; icalproperty *prop; ECalModelComponent *comp_data; - + gboolean read_only = TRUE; + n_selected = e_table_selected_count (table); if (n_selected <= 0) return TRUE; @@ -1071,13 +1044,13 @@ e_calendar_table_show_popup_menu (ETable *table, } else hide_mask = MASK_SINGLE; - if (cal_client_is_read_only (comp_data->client)) + cal_client_is_read_only (comp_data->client, &read_only, NULL); + if (!read_only) disable_mask |= MASK_EDITABLE; if (cal_client_get_static_capability (comp_data->client, CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)) disable_mask |= MASK_ASSIGNABLE; - setup_popup_icons (tasks_popup_menu); gtk_menu = e_popup_menu_create (tasks_popup_menu, disable_mask, hide_mask, cal_table); @@ -1315,6 +1288,7 @@ selection_received (GtkWidget *invisible, icalcomponent *icalcomp; char *uid; CalComponent *comp; + CalClient *client; icalcomponent_kind kind; g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); @@ -1338,6 +1312,8 @@ selection_received (GtkWidget *invisible, return; } + client = e_cal_model_get_default_client (cal_table->model); + e_calendar_table_set_status_message (cal_table, _("Updating objects")); if (kind == ICAL_VCALENDAR_COMPONENT) { @@ -1360,11 +1336,12 @@ selection_received (GtkWidget *invisible, cal_component_set_icalcomponent ( tmp_comp, icalcomponent_new_clone (subcomp)); cal_component_set_uid (tmp_comp, uid); - - cal_client_update_object ( - e_cal_model_get_default_client (cal_table->model), - tmp_comp); free (uid); + + /* FIXME should we convert start/due/complete times? */ + /* FIXME Error handling */ + cal_client_create_object (client, cal_component_get_icalcomponent (tmp_comp), NULL, NULL); + g_object_unref (tmp_comp); } subcomp = icalcomponent_get_next_component ( @@ -1378,9 +1355,8 @@ selection_received (GtkWidget *invisible, cal_component_set_uid (comp, (const char *) uid); free (uid); - cal_client_update_object ( - e_cal_model_get_default_client (cal_table->model), - comp); + cal_client_create_object (client, cal_component_get_icalcomponent (comp), NULL, NULL); + g_object_unref (comp); } diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 381dca2542..7e47d4f59a 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -45,7 +45,6 @@ #include "dialogs/recur-comp.h" #include "print.h" #include "goto.h" -#include "ea-calendar.h" /* Used for the status bar messages */ #define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png" @@ -83,8 +82,6 @@ static GdkAtom clipboard_atom = GDK_NONE; enum { SELECTION_CHANGED, TIMEZONE_CHANGED, - EVENT_CHANGED, - EVENT_ADDED, LAST_SIGNAL }; @@ -115,33 +112,10 @@ e_cal_view_class_init (ECalViewClass *klass) cal_util_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); - e_cal_view_signals[EVENT_CHANGED] = - g_signal_new ("event_changed", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (ECalViewClass, event_changed), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, - G_TYPE_POINTER); - - e_cal_view_signals[EVENT_ADDED] = - g_signal_new ("event_added", - G_TYPE_FROM_CLASS (object_class), - G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (ECalViewClass, event_added), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, - G_TYPE_POINTER); - /* Method override */ object_class->destroy = e_cal_view_destroy; klass->selection_changed = NULL; - klass->event_changed = NULL; - klass->event_added = NULL; - klass->get_selected_events = NULL; klass->get_selected_time_range = NULL; klass->set_selected_time_range = NULL; @@ -151,9 +125,6 @@ e_cal_view_class_init (ECalViewClass *klass) /* clipboard atom */ if (!clipboard_atom) clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE); - - /* init the accessibility support for e_day_view */ - e_cal_view_a11y_init (); } static void @@ -208,6 +179,45 @@ selection_clear_event (GtkWidget *invisible, } static void +selection_received_add_event (ECalView *cal_view, CalClient *client, time_t selected_time_start, + icaltimezone *default_zone, icalcomponent *icalcomp) +{ + CalComponent *comp; + struct icaltimetype itime; + time_t tt_start, tt_end; + struct icaldurationtype ic_dur; + char *uid; + + tt_start = icaltime_as_timet (icalcomponent_get_dtstart (icalcomp)); + tt_end = icaltime_as_timet (icalcomponent_get_dtend (icalcomp)); + ic_dur = icaldurationtype_from_int (tt_end - tt_start); + itime = icaltime_from_timet_with_zone (selected_time_start, FALSE, default_zone); + + icalcomponent_set_dtstart (icalcomp, itime); + itime = icaltime_add (itime, ic_dur); + icalcomponent_set_dtend (icalcomp, itime); + + /* FIXME The new uid stuff can go away once we actually set it in the backend */ + uid = cal_component_gen_uid (); + comp = cal_component_new (); + cal_component_set_icalcomponent ( + comp, icalcomponent_new_clone (icalcomp)); + cal_component_set_uid (comp, uid); + + /* FIXME Error handling */ + cal_client_create_object (client, cal_component_get_icalcomponent (comp), NULL, NULL); + if (itip_organizer_is_user (comp, client) && + send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), + client, comp, TRUE)) { + itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, + client, NULL); + } + + free (uid); + g_object_unref (comp); +} + +static void selection_received (GtkWidget *invisible, GtkSelectionData *selection_data, guint time, @@ -216,12 +226,7 @@ selection_received (GtkWidget *invisible, char *comp_str, *default_tzid; icalcomponent *icalcomp; icalcomponent_kind kind; - CalComponent *comp; time_t selected_time_start, selected_time_end; - struct icaltimetype itime; - time_t tt_start, tt_end; - struct icaldurationtype ic_dur; - char *uid; icaltimezone *default_zone; CalClient *client; @@ -239,20 +244,19 @@ selection_received (GtkWidget *invisible, default_tzid = calendar_config_get_timezone (); client = e_cal_model_get_default_client (cal_view->priv->model); - cal_client_get_timezone (client, default_tzid, &default_zone); + /* FIXME Error checking */ + cal_client_get_timezone (client, default_tzid, &default_zone, NULL); /* check the type of the component */ + /* FIXME An error dialog if we return? */ kind = icalcomponent_isa (icalcomp); - if (kind != ICAL_VCALENDAR_COMPONENT && - kind != ICAL_VEVENT_COMPONENT && - kind != ICAL_VTODO_COMPONENT && - kind != ICAL_VJOURNAL_COMPONENT) { + if (kind != ICAL_VCALENDAR_COMPONENT && kind != ICAL_VEVENT_COMPONENT) return; - } e_cal_view_set_status_message (cal_view, _("Updating objects")); e_cal_view_get_selected_time_range (cal_view, &selected_time_start, &selected_time_end); + /* FIXME Timezone handling */ if (kind == ICAL_VCALENDAR_COMPONENT) { icalcomponent_kind child_kind; icalcomponent *subcomp; @@ -260,69 +264,27 @@ selection_received (GtkWidget *invisible, subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT); while (subcomp) { child_kind = icalcomponent_isa (subcomp); - if (child_kind == ICAL_VEVENT_COMPONENT || - child_kind == ICAL_VTODO_COMPONENT || - child_kind == ICAL_VJOURNAL_COMPONENT) { - tt_start = icaltime_as_timet (icalcomponent_get_dtstart (subcomp)); - tt_end = icaltime_as_timet (icalcomponent_get_dtend (subcomp)); - ic_dur = icaldurationtype_from_int (tt_end - tt_start); - itime = icaltime_from_timet_with_zone (selected_time_start, - FALSE, default_zone); - - icalcomponent_set_dtstart (subcomp, itime); - itime = icaltime_add (itime, ic_dur); - icalcomponent_set_dtend (subcomp, itime); - - uid = cal_component_gen_uid (); - comp = cal_component_new (); - cal_component_set_icalcomponent ( - comp, icalcomponent_new_clone (subcomp)); - cal_component_set_uid (comp, uid); - - cal_client_update_object (client, comp); - if (itip_organizer_is_user (comp, client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), - client, comp, TRUE)) { - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, - client, NULL); - } - - free (uid); - g_object_unref (comp); + if (child_kind == ICAL_VEVENT_COMPONENT) + selection_received_add_event (cal_view, client, selected_time_start, + default_zone, subcomp); + else if (child_kind == ICAL_VTIMEZONE_COMPONENT) { + icaltimezone *zone; + + zone = icaltimezone_new (); + icaltimezone_set_component (zone, subcomp); + cal_client_add_timezone (client, zone, NULL); + + icaltimezone_free (zone, 1); } + subcomp = icalcomponent_get_next_component ( icalcomp, ICAL_ANY_COMPONENT); } icalcomponent_free (icalcomp); - } - else { - tt_start = icaltime_as_timet (icalcomponent_get_dtstart (icalcomp)); - tt_end = icaltime_as_timet (icalcomponent_get_dtend (icalcomp)); - ic_dur = icaldurationtype_from_int (tt_end - tt_start); - itime = icaltime_from_timet_with_zone (selected_time_start, FALSE, default_zone); - - icalcomponent_set_dtstart (icalcomp, itime); - itime = icaltime_add (itime, ic_dur); - icalcomponent_set_dtend (icalcomp, itime); - - uid = cal_component_gen_uid (); - comp = cal_component_new (); - cal_component_set_icalcomponent ( - comp, icalcomponent_new_clone (icalcomp)); - cal_component_set_uid (comp, uid); - - cal_client_update_object (client, comp); - if (itip_organizer_is_user (comp, client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), - client, comp, TRUE)) { - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, - client, NULL); - } - - free (uid); - g_object_unref (comp); + } else { + selection_received_add_event (cal_view, client, selected_time_start, default_zone, icalcomp); } e_cal_view_set_status_message (cal_view, NULL); @@ -538,13 +500,9 @@ e_cal_view_update_query (ECalView *cal_view) { g_return_if_fail (E_IS_CAL_VIEW (cal_view)); - e_cal_view_set_status_message (cal_view, _("Searching")); - if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query) { E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query (cal_view); } - - e_cal_view_set_status_message (cal_view, NULL); } void @@ -564,9 +522,9 @@ e_cal_view_cut_clipboard (ECalView *cal_view) e_cal_view_copy_clipboard (cal_view); for (l = selected; l != NULL; l = l->next) { CalComponent *comp; - ECalViewEvent *event = (ECalViewEvent *) l->data; - + GError *error = NULL; + if (!event) continue; @@ -580,8 +538,8 @@ e_cal_view_cut_clipboard (ECalView *cal_view) event->comp_data->client, NULL); cal_component_get_uid (comp, &uid); - delete_error_dialog (cal_client_remove_object (event->comp_data->client, uid), - CAL_COMPONENT_EVENT); + cal_client_remove_object (event->comp_data->client, uid, &error); + delete_error_dialog (error, CAL_COMPONENT_EVENT); g_object_unref (comp); } @@ -657,7 +615,8 @@ delete_event (ECalView *cal_view, ECalViewEvent *event) if (delete_component_dialog (comp, FALSE, 1, vtype, GTK_WIDGET (cal_view))) { const char *uid; - + GError *error = NULL; + if (itip_organizer_is_user (comp, event->comp_data->client) && cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)), event->comp_data->client, @@ -670,9 +629,10 @@ delete_event (ECalView *cal_view, ECalViewEvent *event) g_object_unref (comp); return; } - - delete_error_dialog ( - cal_client_remove_object (event->comp_data->client, uid), CAL_COMPONENT_EVENT); + + cal_client_remove_object (event->comp_data->client, uid, &error); + delete_error_dialog (error, CAL_COMPONENT_EVENT); + g_clear_error (&error); } g_object_unref (comp); @@ -719,35 +679,20 @@ e_cal_view_delete_selected_occurrence (ECalView *cal_view) { ECalViewEvent *event; GList *selected; - + const char *uid; + GError *error = NULL; + selected = e_cal_view_get_selected_events (cal_view); if (!selected) return; event = (ECalViewEvent *) selected->data; - if (cal_util_component_is_instance (event->comp_data->icalcomp)) { - const char *uid; - - uid = icalcomponent_get_uid (event->comp_data->icalcomp); - delete_error_dialog ( - cal_client_remove_object_with_mod (event->comp_data->client, uid, CALOBJ_MOD_THIS), - CAL_COMPONENT_EVENT); - } else { - CalComponent *comp; - - /* we must duplicate the CalComponent, or we won't know it has changed - when we get the "update_event" signal */ - comp = cal_component_new (); - cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - cal_comp_util_add_exdate (comp, event->start, cal_view->priv->zone); - - if (cal_client_update_object (event->comp_data->client, comp) - != CAL_CLIENT_RESULT_SUCCESS) - g_message ("e_cal_view_delete_selected_occurrence(): Could not update the object!"); + uid = icalcomponent_get_uid (event->comp_data->icalcomp); + cal_client_remove_object_with_mod (event->comp_data->client, uid, CALOBJ_MOD_THIS, &error); - g_object_unref (comp); - } + delete_error_dialog (error, CAL_COMPONENT_EVENT); + g_clear_error (&error); /* free memory */ g_list_free (selected); @@ -962,7 +907,7 @@ on_publish (GtkWidget *widget, gpointer user_data) ECalView *cal_view; icaltimezone *utc; time_t start = time (NULL), end; - GList *comp_list, *client_list, *cl; + GList *comp_list = NULL, *client_list, *cl; cal_view = E_CAL_VIEW (user_data); @@ -972,8 +917,7 @@ on_publish (GtkWidget *widget, gpointer user_data) client_list = e_cal_model_get_client_list (cal_view->priv->model); for (cl = client_list; cl != NULL; cl = cl->next) { - comp_list = cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end); - if (comp_list) { + if (cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end, &comp_list, NULL)) { GList *l; for (l = comp_list; l; l = l->next) { @@ -1041,14 +985,6 @@ on_paste (GtkWidget *widget, gpointer user_data) e_cal_view_paste_clipboard (cal_view); } -static void -on_unrecur_appointment (GtkWidget *widget, gpointer user_data) -{ - ECalView *cal_view = E_CAL_VIEW (user_data); - - gnome_calendar_unrecur_selection (cal_view->priv->calendar); -} - enum { /* * This is used to "flag" events that can not be editted @@ -1142,7 +1078,6 @@ static EPopupMenu child_items [] = { E_POPUP_SEPARATOR, E_POPUP_ITEM (N_("_Delete"), GTK_SIGNAL_FUNC (on_delete_appointment), MASK_EDITABLE | MASK_SINGLE | MASK_EDITING), - E_POPUP_ITEM (N_("Make this Occurrence _Movable"), GTK_SIGNAL_FUNC (on_unrecur_appointment), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE | MASK_INSTANCE), E_POPUP_ITEM (N_("Delete this _Occurrence"), GTK_SIGNAL_FUNC (on_delete_occurrence), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE), E_POPUP_ITEM (N_("Delete _All Occurrences"), GTK_SIGNAL_FUNC (on_delete_appointment), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE), @@ -1169,36 +1104,8 @@ setup_popup_icons (EPopupMenu *context_menu) for (i = 0; context_menu[i].name; i++) { GtkWidget *pixmap_widget = NULL; - if (!strcmp (context_menu[i].name, _("_Copy"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_COPY, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("C_ut"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_CUT, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Delete")) || - !strcmp (context_menu[i].name, _("Delete this _Occurrence")) || - !strcmp (context_menu[i].name, _("Delete _All Occurrences"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("Go to _Today"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_HOME, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Go to Date..."))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("New _Appointment..."))) - pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_appointment.xpm"); - else if (!strcmp (context_menu[i].name, _("New All Day _Event"))) - pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_all_day_event.png"); - else if (!strcmp (context_menu[i].name, _("New Meeting"))) - pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/meeting-request-16.png"); - else if (!strcmp (context_menu[i].name, _("New Task"))) - pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_task-16.png"); - else if (!strcmp (context_menu[i].name, _("_Open"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Paste"))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PASTE, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Print..."))) + if (!strcmp (context_menu[i].name, _("_Print..."))) pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Save As..."))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU); - else if (!strcmp (context_menu[i].name, _("_Settings..."))) - pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU); if (pixmap_widget) gtk_widget_show (pixmap_widget); @@ -1215,7 +1122,8 @@ e_cal_view_create_popup_menu (ECalView *cal_view) guint32 disable_mask = 0, hide_mask = 0; GtkMenu *popup; CalClient *client = NULL; - + gboolean read_only = TRUE; + g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL); /* get the selection */ @@ -1260,7 +1168,8 @@ e_cal_view_create_popup_menu (ECalView *cal_view) client = event->comp_data->client; } - if (cal_client_is_read_only (client)) + cal_client_is_read_only (client, &read_only, NULL); + if (!read_only) disable_mask |= MASK_EDITABLE; if (being_edited) diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h index ea7c11a00d..6fac862ded 100644 --- a/calendar/gui/e-calendar-view.h +++ b/calendar/gui/e-calendar-view.h @@ -77,8 +77,6 @@ struct _ECalViewClass { /* Notification signals */ void (* selection_changed) (ECalView *cal_view); void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone); - void (* event_changed) (ECalView *day_view, ECalViewEvent *event); - void (* event_added) (ECalView *day_view, ECalViewEvent *event); /* Virtual methods */ GList * (* get_selected_events) (ECalView *cal_view); /* a GList of ECalViewEvent's */ diff --git a/calendar/gui/e-date-time-list.c b/calendar/gui/e-date-time-list.c index 5aef6f9c51..83b4632adf 100644 --- a/calendar/gui/e-date-time-list.c +++ b/calendar/gui/e-date-time-list.c @@ -222,10 +222,6 @@ row_updated (EDateTimeList *date_time_list, gint n) static void e_date_time_list_finalize (GObject *object) { - EDateTimeList *date_time_list = E_DATE_TIME_LIST (object); - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); } /* Fulfill the GtkTreeModel requirements */ diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index a2a4f09d56..01a6e890eb 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -29,7 +29,6 @@ #include <config.h> #include "e-day-view.h" -#include "ea-calendar.h" #include <math.h> #include <time.h> @@ -164,8 +163,6 @@ static gboolean e_day_view_get_visible_time_range (ECalView *cal_view, time_t *s static void e_day_view_update_query (ECalView *cal_view); static void e_day_view_goto_start_of_work_day (EDayView *day_view); static void e_day_view_goto_end_of_work_day (EDayView *day_view); -static void e_day_view_change_duration_to_start_of_work_day (EDayView *day_view); -static void e_day_view_change_duration_to_end_of_work_day (EDayView *day_view); static void e_day_view_cursor_key_up_shifted (EDayView *day_view, GdkEventKey *event); static void e_day_view_cursor_key_down_shifted (EDayView *day_view, @@ -291,6 +288,10 @@ static ECalViewPosition e_day_view_convert_position_in_main_canvas (EDayView *da gint *day_return, gint *row_return, gint *event_num_return); +static gboolean e_day_view_find_event_from_item (EDayView *day_view, + GnomeCanvasItem *item, + gint *day_return, + gint *event_num_return); static gboolean e_day_view_find_event_from_uid (EDayView *day_view, const gchar *uid, gint *day_return, @@ -344,8 +345,6 @@ static void e_day_view_stop_editing_event (EDayView *day_view); static gboolean e_day_view_on_text_item_event (GnomeCanvasItem *item, GdkEvent *event, EDayView *day_view); -static void e_day_view_change_event_end_time_up (EDayView *day_view); -static void e_day_view_change_event_end_time_down (EDayView *day_view); static void e_day_view_on_editing_started (EDayView *day_view, GnomeCanvasItem *item); static void e_day_view_on_editing_stopped (EDayView *day_view, @@ -443,6 +442,7 @@ static void e_day_view_queue_layout (EDayView *day_view); static void e_day_view_cancel_layout (EDayView *day_view); static gboolean e_day_view_layout_timeout_cb (gpointer data); + static GtkTableClass *parent_class; E_MAKE_TYPE (e_day_view, "EDayView", EDayView, e_day_view_class_init, @@ -478,9 +478,6 @@ e_day_view_class_init (EDayViewClass *class) view_class->set_selected_time_range = e_day_view_set_selected_time_range; view_class->get_visible_time_range = e_day_view_get_visible_time_range; view_class->update_query = e_day_view_update_query; - - /* init the accessibility support for e_day_view */ - e_day_view_a11y_init (); } static void @@ -571,7 +568,6 @@ e_day_view_init (EDayView *day_view) day_view->editing_event_day = -1; day_view->editing_event_num = -1; - day_view->resize_event_num = -1; day_view->resize_bars_event_day = -1; day_view->resize_bars_event_num = -1; @@ -1483,10 +1479,6 @@ e_day_view_update_event_cb (EDayView *day_view, e_day_view_update_event_label (day_view, day, event_num); e_day_view_reshape_day_event (day_view, day, event_num); } - - g_signal_emit_by_name (G_OBJECT(day_view), - "event_changed", event); - return TRUE; } @@ -1740,7 +1732,7 @@ e_day_view_update_long_event_label (EDayView *day_view, /* Finds the day and index of the event with the given canvas item. If is is a long event, -1 is returned as the day. Returns TRUE if the event was found. */ -gboolean +static gboolean e_day_view_find_event_from_item (EDayView *day_view, GnomeCanvasItem *item, gint *day_return, @@ -3188,6 +3180,7 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data) const char *uid; CalComponent *comp; AddEventData add_event_data; + CalComponentDateTime dt_start, dt_end; /* If our time hasn't been set yet, just return. */ if (day_view->lower == 0 && day_view->upper == 0) @@ -3228,17 +3221,27 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data) NULL); } - /* Add the occurrences of the event. */ + /* Add the event if it's on the time range */ comp = cal_component_new (); cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp)); - add_event_data.day_view = day_view; - add_event_data.comp_data = comp_data; - cal_recur_generate_instances (comp, day_view->lower, - day_view->upper, - e_day_view_add_event, &add_event_data, - cal_client_resolve_tzid_cb, - comp_data->client, - e_cal_view_get_timezone (E_CAL_VIEW (day_view))); + cal_component_get_dtstart (comp, &dt_start); + cal_component_get_dtend (comp, &dt_end); + + if (dt_start.value && dt_end.value) { + time_t tt_start, tt_end; + + tt_start = icaltime_as_timet (*dt_start.value); + tt_end = icaltime_as_timet (*dt_end.value); + + if ((tt_start >= day_view->lower && tt_start <= day_view->upper) + || (tt_end >= day_view->lower && tt_end <= day_view->upper) + || (tt_start <= day_view->lower && tt_end >= day_view->upper)) { + add_event_data.day_view = day_view; + add_event_data.comp_data = comp_data; + e_day_view_add_event (comp, tt_start, tt_end, &add_event_data); + } + } + g_object_unref (comp); e_day_view_queue_layout (day_view); @@ -3282,67 +3285,6 @@ e_day_view_on_event_right_click (EDayView *day_view, day, event_num); } -void -e_day_view_unrecur_appointment (EDayView *day_view) -{ - EDayViewEvent *event; - CalComponent *comp, *new_comp; - CalComponentDateTime date; - struct icaltimetype itt; - - event = e_day_view_get_popup_menu_event (day_view); - if (event == NULL) - return; - - date.value = &itt; - date.tzid = NULL; - - /* For the recurring object, we add an exception to get rid of the - instance. */ - - comp = cal_component_new (); - cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - cal_comp_util_add_exdate (comp, event->start, e_cal_view_get_timezone (E_CAL_VIEW (day_view))); - - /* For the unrecurred instance we duplicate the original object, - create a new uid for it, get rid of the recurrence rules, and set - the start & end times to the instances times. */ - new_comp = cal_component_new (); - cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - cal_component_set_uid (new_comp, cal_component_gen_uid ()); - cal_component_set_rdate_list (new_comp, NULL); - cal_component_set_rrule_list (new_comp, NULL); - cal_component_set_exdate_list (new_comp, NULL); - cal_component_set_exrule_list (new_comp, NULL); - - date.value = &itt; - date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view))); - - *date.value = icaltime_from_timet_with_zone (event->start, FALSE, - e_cal_view_get_timezone (E_CAL_VIEW (day_view))); - cal_component_set_dtstart (new_comp, &date); - *date.value = icaltime_from_timet_with_zone (event->end, FALSE, - e_cal_view_get_timezone (E_CAL_VIEW (day_view))); - cal_component_set_dtend (new_comp, &date); - - - /* Now update both CalComponents. Note that we do this last since at - * present the updates happen synchronously so our event may disappear. - */ - if (cal_client_update_object (event->comp_data->client, comp) - != CAL_CLIENT_RESULT_SUCCESS) - g_message ("e_day_view_on_unrecur_appointment(): Could not update the object!"); - - g_object_unref (comp); - - if (cal_client_update_object (event->comp_data->client, new_comp) - != CAL_CLIENT_RESULT_SUCCESS) - g_message ("e_day_view_on_unrecur_appointment(): Could not update the object!"); - - g_object_unref (new_comp); -} - - static EDayViewEvent* e_day_view_get_popup_menu_event (EDayView *day_view) { @@ -3841,7 +3783,9 @@ e_day_view_finish_long_event_resize (EDayView *day_view) struct icaltimetype itt; time_t dt; CalClient *client; - + CalObjModType mod = CALOBJ_MOD_ALL; + GtkWindow *toplevel; + event_num = day_view->resize_event_num; event = &g_array_index (day_view->long_events, EDayViewEvent, event_num); @@ -3870,31 +3814,26 @@ e_day_view_finish_long_event_resize (EDayView *day_view) e_cal_view_get_timezone (E_CAL_VIEW (day_view))); cal_component_set_dtend (comp, &date); } - - if (cal_component_is_instance (comp)) { - CalObjModType mod; - - if (recur_component_dialog (comp, &mod, NULL)) { - if (cal_client_update_object_with_mod (client, comp, mod) == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)), - client, comp, FALSE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL); - } else { - g_message ("e_day_view_finish_resize(): Could not update the object!"); - } - } else { + + if (cal_component_has_recurrences (comp)) { + if (!recur_component_dialog (comp, &mod, NULL)) { gtk_widget_queue_draw (day_view->top_canvas); - } - } else if (cal_client_update_object (client, comp) == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)), - client, comp, TRUE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL); - } else { - g_message ("e_day_view_finish_long_event_resize(): Could not update the object!"); - } - + goto out; + } + } + + toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); + + if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) { + if (itip_organizer_is_user (comp, client) && + send_component_dialog (toplevel, client, comp, TRUE)) { + itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL); + } else { + g_message (G_STRLOC ": Could not update the object!"); + } + } + + out: gnome_canvas_item_hide (day_view->resize_long_event_rect_item); day_view->resize_drag_pos = E_CAL_VIEW_POS_NONE; @@ -3915,6 +3854,8 @@ e_day_view_finish_resize (EDayView *day_view) struct icaltimetype itt; time_t dt; CalClient *client; + CalObjModType mod = CALOBJ_MOD_ALL; + GtkWindow *toplevel; day = day_view->resize_event_day; event_num = day_view->resize_event_num; @@ -3957,29 +3898,25 @@ e_day_view_finish_resize (EDayView *day_view) day_view->resize_drag_pos = E_CAL_VIEW_POS_NONE; - if (cal_component_is_instance (comp)) { - CalObjModType mod; - - if (recur_component_dialog (comp, &mod, NULL)) { - if (cal_client_update_object_with_mod (client, comp, mod) == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)), - client, comp, FALSE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL); - } else { - g_message ("e_day_view_finish_resize(): Could not update the object!"); - } - } else { - gtk_widget_queue_draw (day_view->main_canvas); - } - } else if (cal_client_update_object (client, comp) == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)), client, comp, FALSE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL); - } else { - g_message ("e_day_view_finish_resize(): Could not update the object!"); + if (cal_component_has_recurrences (comp)) { + if (!recur_component_dialog (comp, &mod, NULL)) { + gtk_widget_queue_draw (day_view->top_canvas); + goto out; + } } + toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); + + if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) { + if (itip_organizer_is_user (comp, client) && + send_component_dialog (toplevel, client, comp, TRUE)) { + itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL); + } else { + g_message (G_STRLOC ": Could not update the object!"); + } + } + + out: g_object_unref (comp); } @@ -4343,9 +4280,6 @@ e_day_view_reshape_long_event (EDayView *day_view, NULL); g_signal_connect (event->canvas_item, "event", G_CALLBACK (e_day_view_on_text_item_event), day_view); - g_signal_emit_by_name (G_OBJECT(day_view), - "event_added", event); - e_day_view_update_long_event_label (day_view, event_num); } @@ -4418,12 +4352,6 @@ e_day_view_reshape_day_events (EDayView *day_view, for (event_num = 0; event_num < day_view->events[day]->len; event_num++) { e_day_view_reshape_day_event (day_view, day, event_num); - if (event_num == day_view->resize_event_num) { - EDayViewEvent *event; - event = &g_array_index (day_view->events[day], EDayViewEvent, - event_num); - e_canvas_item_grab_focus (event->canvas_item, TRUE); - } } } @@ -4512,9 +4440,6 @@ e_day_view_reshape_day_event (EDayView *day_view, NULL); g_signal_connect (event->canvas_item, "event", G_CALLBACK (e_day_view_on_text_item_event), day_view); - g_signal_emit_by_name (G_OBJECT(day_view), - "event_added", event); - e_day_view_update_event_label (day_view, day, event_num); } @@ -4682,23 +4607,6 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event) return TRUE; } - /* In DayView, Shift+Home/End, Change the duration to the time that begins/ends the current work day */ - if ((keyval == GDK_Home) - &&((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) - &&((event->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK) - &&((event->state & GDK_MOD1_MASK) != GDK_MOD1_MASK)) { - e_day_view_change_duration_to_start_of_work_day (day_view); - return TRUE; - } - if ((keyval == GDK_End) - &&((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) - &&((event->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK) - &&((event->state & GDK_MOD1_MASK) != GDK_MOD1_MASK)) { - e_day_view_change_duration_to_end_of_work_day (day_view); - return TRUE; - } - - /* Handle the cursor keys for moving & extending the selection. */ stop_emission = TRUE; if (event->state & GDK_SHIFT_MASK) { @@ -4888,80 +4796,6 @@ e_day_view_goto_end_of_work_day (EDayView *day_view) gtk_widget_queue_draw (day_view->main_canvas); } -/* Change the duration to the time that begins the current work day */ -static void -e_day_view_change_duration_to_start_of_work_day (EDayView *day_view) -{ - g_return_if_fail(day_view != NULL); - - if (day_view->selection_in_top_canvas) - return; - else { - gint work_start_row,work_end_row,selection_start_row,selection_end_row; - - work_start_row = - e_day_view_convert_time_to_row (day_view, - day_view->work_day_start_hour, - day_view->work_day_start_minute); - work_end_row = - e_day_view_convert_time_to_row (day_view, - day_view->work_day_end_hour - 1, - day_view->work_day_end_minute + 30); - selection_start_row = day_view->selection_start_row; - selection_end_row = day_view->selection_end_row; - if (selection_start_row < work_start_row) - day_view->selection_end_row = work_start_row - 1; - else day_view->selection_start_row = work_start_row; - } - - e_day_view_ensure_rows_visible (day_view, - day_view->selection_start_row, - day_view->selection_end_row); - - e_day_view_update_calendar_selection_time (day_view); - - gtk_widget_queue_draw (day_view->top_canvas); - gtk_widget_queue_draw (day_view->main_canvas); -} - -/* Change the duration to the time that ends the current work day */ -static void -e_day_view_change_duration_to_end_of_work_day (EDayView *day_view) -{ - g_return_if_fail(day_view != NULL); - - if (day_view->selection_in_top_canvas) - return; - else { - gint work_start_row,work_end_row,selection_start_row,selection_end_row; - work_start_row = - e_day_view_convert_time_to_row (day_view, - day_view->work_day_start_hour, - day_view->work_day_start_minute); - work_end_row = e_day_view_convert_time_to_row (day_view, - day_view->work_day_end_hour-1, - day_view->work_day_end_minute+30); - selection_start_row = day_view->selection_start_row; - selection_end_row = day_view->selection_end_row; - if (selection_start_row <= work_end_row) - day_view->selection_end_row = work_end_row; - else { - day_view->selection_start_row = work_end_row + 1; - day_view->selection_end_row = selection_start_row; - } - } - - e_day_view_ensure_rows_visible (day_view, - day_view->selection_start_row, - day_view->selection_end_row); - - e_day_view_update_calendar_selection_time (day_view); - - gtk_widget_queue_draw (day_view->top_canvas); - gtk_widget_queue_draw (day_view->main_canvas); -} - - static void e_day_view_cursor_key_up_shifted (EDayView *day_view, GdkEventKey *event) { @@ -5015,10 +4849,9 @@ e_day_view_focus (GtkWidget *widget, GtkDirectionType direction) } if (new_day != E_DAY_VIEW_LONG_EVENT && new_day != -1) { - if (e_day_view_get_event_rows (day_view, new_day, - new_event_num, + if (e_day_view_get_event_rows (day_view, new_day, new_event_num, &start_row, &end_row)) - /* ensure the event to be seen */ + /* ajust the scrollbar to ensure the event to be seen */ e_day_view_ensure_rows_visible (day_view, start_row, end_row); } @@ -5607,8 +5440,6 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item, switch (event->type) { case GDK_KEY_PRESS: if (event && event->key.keyval == GDK_Return) { - day_view->resize_event_num = -1; - /* We set the keyboard focus to the EDayView, so the EText item loses it and stops the edit. */ gtk_widget_grab_focus (GTK_WIDGET (day_view)); @@ -5624,18 +5455,6 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item, /* focus should go to day view when stop editing */ gtk_widget_grab_focus (GTK_WIDGET (day_view)); return TRUE; - } else if ((event->key.keyval == GDK_Up) - && (event->key.state & GDK_SHIFT_MASK) - && (event->key.state & GDK_CONTROL_MASK) - && (event->key.state & GDK_MOD1_MASK)) { - e_day_view_change_event_end_time_up (day_view); - return TRUE; - } else if ((event->key.keyval == GDK_Down) - && (event->key.state & GDK_SHIFT_MASK) - && (event->key.state & GDK_CONTROL_MASK) - && (event->key.state & GDK_MOD1_MASK)) { - e_day_view_change_event_end_time_down (day_view); - return TRUE; } break; case GDK_2BUTTON_PRESS: @@ -5665,67 +5484,6 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item, return FALSE; } -static void -e_day_view_change_event_end_time_up (EDayView *day_view) -{ - EDayViewEvent *event; - gint day, event_num, resize_start_row, resize_end_row; - - day = day_view->editing_event_day; - event_num = day_view->editing_event_num; - if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT)) - return; - event = &g_array_index (day_view->events[day], EDayViewEvent, - event_num); - day_view->resize_event_day = day; - day_view->resize_event_num = event_num; - day_view->resize_bars_event_day = day; - day_view->resize_bars_event_num = event_num; - resize_start_row = event->start_minute / day_view->mins_per_row; - resize_end_row = (event->end_minute - 1) / day_view->mins_per_row; - if (resize_end_row < resize_start_row) - resize_end_row = resize_start_row; - if (resize_end_row == resize_start_row) - return; - day_view->resize_drag_pos = E_CAL_VIEW_POS_BOTTOM_EDGE; - resize_end_row--; - day_view->resize_start_row = resize_start_row; - day_view->resize_end_row = resize_end_row; - e_day_view_finish_resize (day_view); - e_day_view_ensure_rows_visible (day_view, resize_start_row, resize_end_row); -} - - -static void -e_day_view_change_event_end_time_down (EDayView *day_view) -{ - EDayViewEvent *event; - gint day, event_num, resize_start_row, resize_end_row; - - day = day_view->editing_event_day; - event_num = day_view->editing_event_num; - if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT)) - return; - event = &g_array_index (day_view->events[day], EDayViewEvent, - event_num); - day_view->resize_event_day = day; - day_view->resize_event_num = event_num; - day_view->resize_bars_event_day = day; - day_view->resize_bars_event_num = event_num; - resize_start_row = event->start_minute / day_view->mins_per_row; - resize_end_row = (event->end_minute - 1) / day_view->mins_per_row; - if (resize_end_row < resize_start_row) - resize_end_row = resize_start_row; - if (resize_end_row == day_view->rows -1) - return; - day_view->resize_drag_pos = E_CAL_VIEW_POS_BOTTOM_EDGE; - resize_end_row++; - day_view->resize_start_row = resize_start_row; - day_view->resize_end_row = resize_end_row; - e_day_view_finish_resize (day_view); - e_day_view_ensure_rows_visible (day_view, resize_start_row, resize_end_row); -} - static void e_day_view_on_editing_started (EDayView *day_view, @@ -5777,7 +5535,8 @@ e_day_view_on_editing_stopped (EDayView *day_view, gchar *text = NULL; CalComponentText summary; CalComponent *comp; - + gboolean on_server; + /* Note: the item we are passed here isn't reliable, so we just stop the edit of whatever item was being edited. We also receive this event twice for some reason. */ @@ -5822,8 +5581,9 @@ e_day_view_on_editing_stopped (EDayView *day_view, comp = cal_component_new (); cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (string_is_empty (text) && - !cal_comp_is_on_server (comp, event->comp_data->client)) { + on_server = cal_comp_is_on_server (comp, event->comp_data->client); + + if (string_is_empty (text) && !on_server) { const char *uid; cal_component_get_uid (comp, &uid); @@ -5845,34 +5605,35 @@ e_day_view_on_editing_stopped (EDayView *day_view, e_day_view_update_event_label (day_view, day, event_num); } else if (summary.value || !string_is_empty (text)) { + icalcomponent *icalcomp = cal_component_get_icalcomponent (comp); + summary.value = text; summary.altrep = NULL; cal_component_set_summary (comp, &summary); - if (cal_component_is_instance (comp)) { - CalObjModType mod; + if (!on_server) { + if (!cal_client_create_object (event->comp_data->client, icalcomp, NULL, NULL)) + g_message (G_STRLOC ": Could not create the object!"); + } else { + CalObjModType mod = CALOBJ_MOD_ALL; + GtkWindow *toplevel; - if (recur_component_dialog (comp, &mod, NULL)) { - if (cal_client_update_object_with_mod (event->comp_data->client, comp, mod) - == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, event->comp_data->client) - && send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)), - event->comp_data->client, comp, FALSE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, - event->comp_data->client, NULL); - } else { - g_message ("e_day_view_on_editing_stopped(): Could not update the object!"); + if (cal_component_has_recurrences (comp)) { + if (!recur_component_dialog (comp, &mod, NULL)) { + goto out; } } - } else if (cal_client_update_object (event->comp_data->client, comp) == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, event->comp_data->client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)), - event->comp_data->client, comp, FALSE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, - event->comp_data->client, NULL); - } else { - g_message ("e_day_view_on_editing_stopped(): Could not update the object!"); + + /* FIXME When sending here, what exactly should we send? */ + toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); + if (cal_client_modify_object (event->comp_data->client, icalcomp, mod, NULL)) { + if (itip_organizer_is_user (comp, event->comp_data->client) + && send_component_dialog (toplevel, event->comp_data->client, comp, FALSE)) + itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, + event->comp_data->client, NULL); + } } + } out: @@ -6881,7 +6642,10 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, x, y, &day, NULL); if (pos != E_CAL_VIEW_POS_OUTSIDE) { + CalObjModType mod = CALOBJ_MOD_ALL; + GtkWindow *toplevel; const char *uid; + num_days = 1; start_offset = 0; end_offset = 0; @@ -6972,33 +6736,20 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget, if (event->canvas_item) gnome_canvas_item_show (event->canvas_item); - if (cal_component_is_instance (comp)) { - CalObjModType mod; - - if (recur_component_dialog (comp, &mod, NULL)) { - if (cal_client_update_object_with_mod (client, comp, mod) == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, client) - && send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)), - client, comp, FALSE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, - client, NULL); - } else { - g_message ("e_day_view_on_top_canvas_drag_data_received(): Could " - "not update the object!"); - } - } - } else if (cal_client_update_object (client, comp) - == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)), - client, comp, FALSE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, - client, NULL); - } else { - g_message ("e_day_view_on_top_canvas_drag_data_received(): Could " - "not update the object!"); + if (cal_component_has_recurrences (comp)) { + if (!recur_component_dialog (comp, &mod, NULL)) + return; } + toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); + + if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) { + if (itip_organizer_is_user (comp, client) + && send_component_dialog (toplevel, client, comp, FALSE)) + itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, + client, NULL); + } + g_object_unref (comp); return; @@ -7044,7 +6795,10 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, x, y, &day, &row, NULL); if (pos != E_CAL_VIEW_POS_OUTSIDE) { + CalObjModType mod = CALOBJ_MOD_ALL; + GtkWindow *toplevel; const char *uid; + num_rows = 1; start_offset = 0; end_offset = 0; @@ -7109,30 +6863,20 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget, if (event->canvas_item) gnome_canvas_item_show (event->canvas_item); - if (cal_component_is_instance (comp)) { - CalObjModType mod; - - if (recur_component_dialog (comp, &mod, NULL)) { - if (cal_client_update_object_with_mod (client, comp, mod) == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, client) - && send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)), - client, comp, FALSE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, - client, NULL); - } else { - g_message ("e_day_view_on_top_canvas_drag_data_received(): Could " - "not update the object!"); - } + if (cal_component_has_recurrences (comp)) { + if (!recur_component_dialog (comp, &mod, NULL)) { + g_object_unref (comp); + return; } - } else if (cal_client_update_object (client, comp) == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)), - client, comp, FALSE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, + } + + toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view))); + + if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) { + if (itip_organizer_is_user (comp, client) + && send_component_dialog (toplevel, client, comp, FALSE)) + itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL); - } else { - g_message ("e_day_view_on_main_canvas_drag_data_received(): " - "Could not update the object!"); } g_object_unref (comp); diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index 1c39fd5844..b85bd01d70 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -528,7 +528,6 @@ void e_day_view_set_week_start_day (EDayView *day_view, gint week_start_day); void e_day_view_delete_occurrence (EDayView *day_view); -void e_day_view_unrecur_appointment (EDayView *day_view); /* Returns the number of selected events (0 or 1 at present). */ gint e_day_view_get_num_events_selected (EDayView *day_view); @@ -588,11 +587,6 @@ gint e_day_view_get_time_string_width (EDayView *day_view); gint e_day_view_event_sort_func (const void *arg1, const void *arg2); -gboolean e_day_view_find_event_from_item (EDayView *day_view, - GnomeCanvasItem *item, - gint *day_return, - gint *event_num_return); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index ed15183552..154f23e170 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -58,12 +58,13 @@ struct _EItipControlPrivate { GtkWidget *html; + gboolean html_destroyed; GPtrArray *event_clients; CalClient *event_client; GPtrArray *task_clients; CalClient *task_client; - + char *vcalendar; CalComponent *comp; icalcomponent *main_comp; @@ -187,13 +188,43 @@ error: return NULL; } -static gboolean -start_default_server_async (EItipControl *itip, CalClient *client, gboolean tasks) +static CalClient * +start_default_server (EItipControl *itip, gboolean tasks) { - if (tasks) - return cal_client_open_default_tasks (client, FALSE); - else - return cal_client_open_default_calendar (client, FALSE); + CalClient *client; + gboolean success = FALSE; + + client = cal_client_new (); + + g_signal_connect (client, "cal_opened", G_CALLBACK (start_calendar_server_cb), &success); + + if (tasks) { + if (!cal_client_open_default_tasks (client, FALSE)) + goto error; + } else { + if (!cal_client_open_default_calendar (client, FALSE)) + goto error; + } + + /* run a sub event loop to turn cal-client's async load + notification into a synchronous call */ + if (!itip->priv->destroyed) { + gtk_signal_connect (GTK_OBJECT (itip), "destroy", + gtk_main_quit, NULL); + + gtk_main (); + + gtk_signal_disconnect_by_func (GTK_OBJECT (itip), + gtk_main_quit, NULL); + } + + if (success) + return client; + + error: + g_object_unref (client); + + return NULL; } static GPtrArray * @@ -274,11 +305,9 @@ find_server (GPtrArray *servers, CalComponent *comp) for (i = 0; i < servers->len; i++) { CalClient *client; icalcomponent *icalcomp; - CalClientGetStatus status; client = g_ptr_array_index (servers, i); - status = cal_client_get_object (client, uid, &icalcomp); - if (status == CAL_CLIENT_GET_SUCCESS) { + if (cal_client_get_object (client, uid, NULL, &icalcomp, NULL)) { icalcomponent_free (icalcomp); g_object_ref (client); @@ -297,7 +326,7 @@ html_destroyed (gpointer data) priv = itip->priv; - priv->html = NULL; + priv->html_destroyed = TRUE; } static void @@ -329,6 +358,7 @@ init (EItipControl *itip) /* Html Widget */ priv->html = gtk_html_new (); + priv->html_destroyed = FALSE; gtk_html_set_default_content_type (GTK_HTML (priv->html), "text/html; charset=utf-8"); gtk_html_load_from_string (GTK_HTML (priv->html), " ", 1); @@ -401,12 +431,10 @@ destroy (GtkObject *obj) { EItipControl *itip = E_ITIP_CONTROL (obj); EItipControlPrivate *priv; - + priv = itip->priv; - + priv->destroyed = TRUE; - - (* GTK_OBJECT_CLASS (parent_class)->destroy) (obj); } static void @@ -913,7 +941,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title, priv = itip->priv; - if (priv->html == NULL) + if (priv->html_destroyed) return; /* Html widget */ @@ -1220,7 +1248,7 @@ get_real_item (EItipControl *itip) CalComponent *comp; icalcomponent *icalcomp; CalComponentVType type; - CalClientGetStatus status = CAL_CLIENT_GET_NOT_FOUND; + gboolean found = FALSE; const char *uid; priv = itip->priv; @@ -1231,17 +1259,17 @@ get_real_item (EItipControl *itip) switch (type) { case CAL_COMPONENT_EVENT: if (priv->event_client != NULL) - status = cal_client_get_object (priv->event_client, uid, &icalcomp); + found = cal_client_get_object (priv->event_client, uid, NULL, &icalcomp, NULL); break; case CAL_COMPONENT_TODO: if (priv->task_client != NULL) - status = cal_client_get_object (priv->task_client, uid, &icalcomp); + found = cal_client_get_object (priv->task_client, uid, NULL, &icalcomp, NULL); break; default: - status = CAL_CLIENT_GET_NOT_FOUND; + found = FALSE; } - if (status != CAL_CLIENT_GET_SUCCESS) + if (!found) return NULL; comp = cal_component_new (); @@ -1853,7 +1881,6 @@ update_item (EItipControl *itip) CalClient *client; CalComponentVType type; GtkWidget *dialog; - CalClientResult result; priv = itip->priv; @@ -1881,32 +1908,18 @@ update_item (EItipControl *itip) icalcomponent_add_component (priv->top_level, clone); icalcomponent_set_method (priv->top_level, priv->method); - result = cal_client_update_objects (client, priv->top_level); - switch (result) { - case CAL_CLIENT_RESULT_INVALID_OBJECT : - dialog = gnome_warning_dialog (_("Object is invalid and cannot be updated\n")); - break; - case CAL_CLIENT_RESULT_CORBA_ERROR : - dialog = gnome_warning_dialog (_("There was an error on the CORBA system\n")); - break; - case CAL_CLIENT_RESULT_NOT_FOUND : - dialog = gnome_warning_dialog (_("Object could not be found\n")); - break; - case CAL_CLIENT_RESULT_PERMISSION_DENIED : - dialog = gnome_warning_dialog (_("You do not have the right permissions to update the calendar\n")); - break; - case CAL_CLIENT_RESULT_SUCCESS : - dialog = gnome_ok_dialog (_("Update complete\n")); - break; - default : + /* FIXME Better error dialog */ + if (!cal_client_receive_objects (client, priv->top_level, NULL)) { dialog = gnome_warning_dialog (_("Calendar file could not be updated!\n")); - break; + } else { + dialog = gnome_ok_dialog (_("Update complete\n")); } gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); icalcomponent_remove_component (priv->top_level, clone); } +#if 0 static void update_attendee_status (EItipControl *itip) { @@ -1936,7 +1949,7 @@ update_attendee_status (EItipControl *itip) /* Obtain our version */ cal_component_get_uid (priv->comp, &uid); - status = cal_client_get_object (client, uid, &icalcomp); + status = cal_client_get_object (client, uid, NULL, &icalcomp); if (status == CAL_CLIENT_GET_SUCCESS) { GSList *attendees; @@ -2010,6 +2023,7 @@ update_attendee_status (EItipControl *itip) g_object_unref (comp); gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); } +#endif static void remove_item (EItipControl *itip) @@ -2019,7 +2033,7 @@ remove_item (EItipControl *itip) CalComponentVType type; const char *uid; GtkWidget *dialog; - CalClientResult result; + GError *error = NULL; priv = itip->priv; @@ -2033,13 +2047,15 @@ remove_item (EItipControl *itip) return; cal_component_get_uid (priv->comp, &uid); - result = cal_client_remove_object (client, uid); - if (result == CAL_CLIENT_RESULT_SUCCESS || result == CAL_CLIENT_RESULT_NOT_FOUND) { + cal_client_remove_object (client, 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)); } else { - delete_error_dialog (result, type); - } + delete_error_dialog (error, type); + } + + g_clear_error (&error); } static void @@ -2081,7 +2097,7 @@ send_freebusy (EItipControl *itip) CalComponentDateTime datetime; time_t start, end; GtkWidget *dialog; - GList *comp_list; + GList *comp_list = NULL; icaltimezone *zone; priv = itip->priv; @@ -2106,9 +2122,7 @@ send_freebusy (EItipControl *itip) end = icaltime_as_timet_with_zone (*datetime.value, zone); cal_component_free_datetime (&datetime); - comp_list = cal_client_get_free_busy (priv->event_client, NULL, start, end); - - if (comp_list) { + if (cal_client_get_free_busy (priv->event_client, NULL, start, end, &comp_list, NULL)) { GList *l; for (l = comp_list; l; l = l->next) { @@ -2179,34 +2193,16 @@ url_requested_cb (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, gpoint g_free (path); } -typedef struct -{ - EItipControl *itip; - GtkHTMLEmbedded *eb; - CalClient *client; -} -ObjectRequestContext; - -static void -default_server_started_cb (CalClient *client, CalClientOpenStatus status, gpointer data) +static gboolean +object_requested_cb (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data) { - ObjectRequestContext *context = data; + EItipControl *itip = E_ITIP_CONTROL (data); EItipControlPrivate *priv; GtkWidget *button; CalComponentVType vtype; + + priv = itip->priv; - priv = context->itip->priv; - - if (status != CAL_CLIENT_OPEN_SUCCESS || - context->itip->priv->destroyed || - context->itip->priv->html == NULL) { - g_object_unref (context->client); - g_object_unref (context->itip); - g_free (context); - return; - } - - priv->event_client = client; vtype = cal_component_get_vtype (priv->comp); switch (vtype) { @@ -2215,65 +2211,24 @@ default_server_started_cb (CalClient *client, CalClientOpenStatus status, gpoint global_shell_client, _("Select Calendar Folder"), calendar_config_default_calendar_folder (), calendar_types); + priv->event_client = start_default_server (itip, FALSE); break; case CAL_COMPONENT_TODO: button = evolution_folder_selector_button_new ( global_shell_client, _("Select Tasks Folder"), calendar_config_default_tasks_folder (), tasks_types); + priv->task_client = start_default_server (itip, TRUE); break; default: button = NULL; } - g_signal_connect (button, "selected", G_CALLBACK (button_selected_cb), context->itip); + g_signal_connect (button, "selected", G_CALLBACK (button_selected_cb), itip); - gtk_container_add (GTK_CONTAINER (context->eb), button); + gtk_container_add (GTK_CONTAINER (eb), button); gtk_widget_show (button); - g_object_unref (context->itip); - g_free (context); - return; -} - -static gboolean -object_requested_cb (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data) -{ - EItipControl *itip = E_ITIP_CONTROL (data); - ObjectRequestContext *context; - EItipControlPrivate *priv; - CalComponentVType vtype; - gboolean success; - - priv = itip->priv; - vtype = cal_component_get_vtype (priv->comp); - - context = g_new0 (ObjectRequestContext, 1); - context->itip = itip; - context->eb = eb; - context->client = cal_client_new (); - - g_object_ref (itip); - g_signal_connect (context->client, "cal_opened", - G_CALLBACK (default_server_started_cb), context); - - switch (vtype) { - case CAL_COMPONENT_EVENT: - success = start_default_server_async (itip, context->client, FALSE); - break; - case CAL_COMPONENT_TODO: - success = start_default_server_async (itip, context->client, TRUE); - break; - default: - success = FALSE; - } - - if (!success) { - g_object_unref (itip); - g_object_unref (context->client); - g_free (context); - } - return TRUE; } @@ -2330,7 +2285,8 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar send_freebusy (itip); break; case 'R': - update_attendee_status (itip); + /* FIXME Make sure this does the right thing in the backend */ + update_item (itip); break; case 'S': send_item (itip); diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c index a7cd54fd85..1cbb789a9e 100644 --- a/calendar/gui/e-meeting-model.c +++ b/calendar/gui/e-meeting-model.c @@ -671,9 +671,6 @@ finalize (GObject *obj) g_source_remove (priv->refresh_idle_id); g_free (priv); - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (obj); } GtkObject * @@ -1388,7 +1385,7 @@ refresh_busy_periods (gpointer data) /* Check the server for free busy data */ if (priv->client) { - GList *fb_data, *users = NULL; + GList *fb_data = NULL, *users = NULL; struct icaltimetype itt; time_t startt, endt; const char *user; @@ -1411,7 +1408,9 @@ refresh_busy_periods (gpointer data) user = itip_strip_mailto (e_meeting_attendee_get_address (ia)); users = g_list_append (users, g_strdup (user)); - fb_data = cal_client_get_free_busy (priv->client, users, startt, endt); + + /* FIXME Error checking */ + cal_client_get_free_busy (priv->client, users, startt, endt, &fb_data, NULL); g_list_foreach (users, (GFunc)g_free, NULL); g_list_free (users); @@ -1650,7 +1649,8 @@ process_section (EMeetingModel *im, GNOME_Evolution_Addressbook_SimpleCardList * priv = im->priv; for (i = 0; i < cards->_length; i++) { EMeetingAttendee *ia; - const char *name, *attendee = NULL, *attr; + const char *name, *attendee = NULL; + char *attr; GNOME_Evolution_Addressbook_SimpleCard card; CORBA_Environment ev; @@ -1666,11 +1666,12 @@ process_section (EMeetingModel *im, GNOME_Evolution_Addressbook_SimpleCardList * } /* Get the field as attendee from the backend */ - attr = cal_client_get_ldap_attribute (priv->client); - if (attr) { + if (cal_client_get_ldap_attribute (priv->client, &attr, NULL) && attr) { /* FIXME this should be more general */ if (!strcmp (attr, "icscalendar")) attendee = GNOME_Evolution_Addressbook_SimpleCard_get (card, GNOME_Evolution_Addressbook_SimpleCard_Icscalendar, &ev); + + g_free (attr); } CORBA_exception_init (&ev); diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index b441aee09d..0b9c4ec3b9 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -787,7 +787,8 @@ cal_opened_cb (CalClient *client, location = calendar_config_get_timezone (); zone = icaltimezone_get_builtin_timezone (location); if (zone) - cal_client_set_default_timezone (client, zone); + /* FIXME Error checking */ + cal_client_set_default_timezone (client, zone, NULL); return; case CAL_CLIENT_OPEN_ERROR: @@ -937,60 +938,6 @@ create_sexp (void) return sexp; } -/* Callback used when a component is updated in the live query */ -static void -query_obj_updated_cb (CalQuery *query, const char *uid, - gboolean query_in_progress, int n_scanned, int total, - gpointer data) -{ - ETasks *tasks; - ETasksPrivate *priv; - - tasks = E_TASKS (data); - priv = tasks->priv; - - delete_error_dialog (cal_client_remove_object (priv->client, uid), CAL_COMPONENT_TODO); -} - -/* Callback used when an evaluation error occurs when running a query */ -static void -query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data) -{ - ETasks *tasks; - ETasksPrivate *priv; - - tasks = E_TASKS (data); - priv = tasks->priv; - - g_warning ("eval error: %s\n", error_str); - - set_status_message (tasks, NULL); - - g_signal_handlers_disconnect_matched (priv->query, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, tasks); - g_object_unref (priv->query); - priv->query = NULL; -} - -static void -query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *error_str, gpointer data) -{ - ETasks *tasks; - ETasksPrivate *priv; - - tasks = E_TASKS (data); - priv = tasks->priv; - - if (status != CAL_QUERY_DONE_SUCCESS) - g_warning ("query done: %s\n", error_str); - - set_status_message (tasks, NULL); - - g_signal_handlers_disconnect_matched (priv->query, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, tasks); - g_object_unref (priv->query); - priv->query = NULL; -} /** * e_tasks_expunge: * @tasks: A tasks control widget @@ -1002,31 +949,32 @@ e_tasks_delete_completed (ETasks *tasks) { ETasksPrivate *priv; char *sexp; + GList *objects, *l; g_return_if_fail (tasks != NULL); g_return_if_fail (E_IS_TASKS (tasks)); priv = tasks->priv; - /* If we have a query, we are already expunging */ - if (priv->query) - return; + /* FIXME Confirm expunge */ sexp = create_sexp (); set_status_message (tasks, _("Expunging")); - priv->query = cal_client_get_query (priv->client, sexp); - g_free (sexp); - - if (!priv->query) { + + if (!cal_client_get_object_list (priv->client, sexp, &objects, NULL)) { set_status_message (tasks, NULL); - g_message ("update_query(): Could not create the query"); + g_warning (G_STRLOC ": Could not get the objects"); + return; } + + for (l = objects; l; l = l->next) { + /* FIXME Better error handling */ + cal_client_remove_object (priv->client, icalcomponent_get_uid (l->data), NULL); + } - g_signal_connect (priv->query, "obj_updated", G_CALLBACK (query_obj_updated_cb), tasks); - g_signal_connect (priv->query, "query_done", G_CALLBACK (query_query_done_cb), tasks); - g_signal_connect (priv->query, "eval_error", G_CALLBACK (query_eval_error_cb), tasks); + set_status_message (tasks, NULL); } /* Callback used from the view collection when we need to display a new view */ @@ -1181,6 +1129,7 @@ e_tasks_update_all_config_settings (void) calendar_config_configure_e_calendar_table (E_CALENDAR_TABLE (priv->tasks_view)); if (zone) - cal_client_set_default_timezone (priv->client, zone); + /* FIXME Error checking */ + cal_client_set_default_timezone (priv->client, zone, NULL); } } diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 8028bf13e6..de85919532 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -30,7 +30,6 @@ #include <config.h> #include "e-week-view.h" -#include "ea-calendar.h" #include <math.h> #include <gdk/gdkkeysyms.h> @@ -82,8 +81,6 @@ #define E_WEEK_VIEW_JUMP_BUTTON_X_PAD 3 #define E_WEEK_VIEW_JUMP_BUTTON_Y_PAD 3 -#define E_WEEK_VIEW_JUMP_BUTTON_NO_FOCUS -1 - /* The timeout before we do a layout, so we don't do a layout for each event we get from the server. */ #define E_WEEK_VIEW_LAYOUT_TIMEOUT 100 @@ -162,6 +159,10 @@ static void e_week_view_on_editing_started (EWeekView *week_view, GnomeCanvasItem *item); static void e_week_view_on_editing_stopped (EWeekView *week_view, GnomeCanvasItem *item); +static gboolean e_week_view_find_event_from_item (EWeekView *week_view, + GnomeCanvasItem *item, + gint *event_num, + gint *span_num); static gboolean e_week_view_find_event_from_uid (EWeekView *week_view, const gchar *uid, gint *event_num_return); @@ -182,10 +183,6 @@ static gboolean e_week_view_on_jump_button_event (GnomeCanvasItem *item, static gboolean e_week_view_key_press (GtkWidget *widget, GdkEventKey *event); static gboolean e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event); -static void e_week_view_on_key_up (EWeekView *week_view, GdkEventKey *event); -static void e_week_view_on_key_down (EWeekView *week_view, GdkEventKey *event); -static void e_week_view_on_key_left (EWeekView *week_view, GdkEventKey *event); -static void e_week_view_on_key_right (EWeekView *week_view, GdkEventKey *event); static gboolean e_week_view_popup_menu (GtkWidget *widget); static gboolean e_week_view_update_event_cb (EWeekView *week_view, @@ -236,9 +233,6 @@ e_week_view_class_init (EWeekViewClass *class) view_class->set_selected_time_range = e_week_view_set_selected_time_range; view_class->get_visible_time_range = e_week_view_get_visible_time_range; view_class->update_query = e_week_view_update_query; - - /* init the accessibility support for e_week_view */ - e_week_view_a11y_init (); } static void @@ -384,8 +378,6 @@ e_week_view_init (EWeekView *week_view) g_signal_connect (week_view->jump_buttons[i], "event", G_CALLBACK (e_week_view_on_jump_button_event), week_view); } - week_view->focused_jump_button = E_WEEK_VIEW_JUMP_BUTTON_NO_FOCUS; - gdk_pixbuf_unref (pixbuf); /* @@ -1000,25 +992,22 @@ e_week_view_focus (GtkWidget *widget, GtkDirectionType direction) EWeekView *week_view; gint new_event_num; gint new_span_num; + gint current_event_num; + gint current_span_num; gint event_loop; gboolean editable = FALSE; - static gint last_focus_event_num = -1, last_focus_span_num = -1; g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (E_IS_WEEK_VIEW (widget), FALSE); week_view = E_WEEK_VIEW (widget); - - if (week_view->focused_jump_button == E_WEEK_VIEW_JUMP_BUTTON_NO_FOCUS) { - last_focus_event_num = week_view->editing_event_num; - last_focus_span_num = week_view->editing_span_num; - } - + current_event_num = week_view->editing_event_num; + current_span_num = week_view->editing_span_num; for (event_loop = 0; event_loop < week_view->events->len; ++event_loop) { if (!e_week_view_get_next_tab_event (week_view, direction, - last_focus_event_num, - last_focus_span_num, + current_event_num, + current_span_num, &new_event_num, &new_span_num)) return FALSE; @@ -1036,32 +1025,8 @@ e_week_view_focus (GtkWidget *widget, GtkDirectionType direction) NULL); if (editable) break; - else { - /* check if we should go to the jump button */ - - EWeekViewEvent *event; - EWeekViewEventSpan *span; - gint current_day; - - event = &g_array_index (week_view->events, - EWeekViewEvent, - new_event_num); - span = &g_array_index (week_view->spans, - EWeekViewEventSpan, - event->spans_index + new_span_num); - current_day = span->start_day; - - if ((week_view->focused_jump_button != current_day) && - e_week_view_is_jump_button_visible(week_view, current_day)) { - - /* focus go to the jump button */ - e_week_view_stop_editing_event (week_view); - gnome_canvas_item_grab_focus (week_view->jump_buttons[current_day]); - return TRUE; - } - } - last_focus_event_num = new_event_num; - last_focus_span_num = new_span_num; + current_event_num = new_event_num; + current_span_num = new_span_num; } return editable; } @@ -1098,6 +1063,7 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data) CalComponent *comp = NULL; AddEventData add_event_data; const char *uid; + CalComponentDateTime dt_start, dt_end; /* If we don't have a valid date set yet, just return. */ if (!g_date_valid (&week_view->first_day_shown)) @@ -1149,18 +1115,26 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data) g_object_unref (tmp_comp); } - /* Add the occurrences of the event. */ + /* Add the event if it's on the time range */ num_days = week_view->multi_week_view ? week_view->weeks_shown * 7 : 7; - add_event_data.week_view = week_view; - add_event_data.comp_data = comp_data; - cal_recur_generate_instances (comp, - week_view->day_starts[0], - week_view->day_starts[num_days], - e_week_view_add_event, &add_event_data, - cal_client_resolve_tzid_cb, - comp_data->client, - e_cal_view_get_timezone (E_CAL_VIEW (week_view))); + cal_component_get_dtstart (comp, &dt_start); + cal_component_get_dtend (comp, &dt_end); + + if (dt_start.value && dt_end.value) { + time_t tt_start, tt_end; + + tt_start = icaltime_as_timet (*dt_start.value); + tt_end = icaltime_as_timet (*dt_end.value); + + if ((tt_start >= week_view->day_starts[0] && tt_start <= week_view->day_starts[num_days]) + || (tt_end >= week_view->day_starts[0] && tt_end <= week_view->day_starts[num_days]) + || (tt_start <= week_view->day_starts[0] && tt_end >= week_view->day_starts[num_days])) { + add_event_data.week_view = week_view; + add_event_data.comp_data = comp_data; + e_week_view_add_event (comp, tt_start, tt_end, &add_event_data); + } + } g_object_unref (comp); @@ -1817,9 +1791,6 @@ e_week_view_update_event_cb (EWeekView *week_view, span_num); } } - g_signal_emit_by_name (G_OBJECT(week_view), - "event_changed", event); - return TRUE; } @@ -2302,6 +2273,7 @@ e_week_view_add_event (CalComponent *comp, add_event_data->week_view->day_starts[0], add_event_data->week_view->day_starts[num_days], start, end); #endif + g_return_val_if_fail (start <= end, TRUE); g_return_val_if_fail (start < add_event_data->week_view->day_starts[num_days], TRUE); g_return_val_if_fail (end > add_event_data->week_view->day_starts[0], TRUE); @@ -2582,9 +2554,6 @@ e_week_view_reshape_event_span (EWeekView *week_view, g_signal_connect (span->text_item, "event", G_CALLBACK (e_week_view_on_text_item_event), week_view); - g_signal_emit_by_name (G_OBJECT(week_view), - "event_added", event); - } /* Calculate the position of the text item. @@ -3049,7 +3018,8 @@ e_week_view_on_editing_stopped (EWeekView *week_view, CalComponent *comp; CalComponentText summary; const char *uid; - + gboolean on_server; + /* Note: the item we are passed here isn't reliable, so we just stop the edit of whatever item was being edited. We also receive this event twice for some reason. */ @@ -3079,8 +3049,9 @@ e_week_view_on_editing_stopped (EWeekView *week_view, comp = cal_component_new (); cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - if (string_is_empty (text) && - !cal_comp_is_on_server (comp, event->comp_data->client)) { + on_server = cal_comp_is_on_server (comp, event->comp_data->client); + + if (string_is_empty (text) && !on_server) { const char *uid; cal_component_get_uid (comp, &uid); @@ -3099,33 +3070,34 @@ e_week_view_on_editing_stopped (EWeekView *week_view, e_week_view_reshape_event_span (week_view, event_num, span_num); } else if (summary.value || !string_is_empty (text)) { + icalcomponent *icalcomp = cal_component_get_icalcomponent (comp); + summary.value = text; summary.altrep = NULL; cal_component_set_summary (comp, &summary); - if (cal_component_is_instance (comp)) { - CalObjModType mod; - - if (recur_component_dialog (comp, &mod, NULL)) { - if (cal_client_update_object_with_mod (event->comp_data->client, comp, mod) - == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, event->comp_data->client) - && send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (week_view)), - event->comp_data->client, comp, FALSE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, - event->comp_data->client, NULL); - } else { - g_message ("e_week_view_on_editing_stopped(): Could not update the object!"); + + if (!on_server) { + if (!cal_client_create_object (event->comp_data->client, icalcomp, NULL, NULL)) + g_message (G_STRLOC ": Could not create the object!"); + } else { + CalObjModType mod = CALOBJ_MOD_ALL; + GtkWindow *toplevel; + + if (cal_component_has_recurrences (comp)) { + if (!recur_component_dialog (comp, &mod, NULL)) { + goto out; } } - } else if (cal_client_update_object (event->comp_data->client, comp) == CAL_CLIENT_RESULT_SUCCESS) { - if (itip_organizer_is_user (comp, event->comp_data->client) && - send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (week_view)), - event->comp_data->client, comp, FALSE)) - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, - event->comp_data->client, NULL); - } else { - g_message ("e_week_view_on_editing_stopped(): Could not update the object!"); + + /* FIXME When sending here, what exactly should we send? */ + toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (week_view))); + if (cal_client_modify_object (event->comp_data->client, icalcomp, mod, NULL)) { + if (itip_organizer_is_user (comp, event->comp_data->client) + && send_component_dialog (toplevel, event->comp_data->client, comp, FALSE)) + itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, + event->comp_data->client, NULL); + } } } @@ -3138,7 +3110,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view, } -gboolean +static gboolean e_week_view_find_event_from_item (EWeekView *week_view, GnomeCanvasItem *item, gint *event_num_return, @@ -3256,24 +3228,6 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event) } #endif - /*Navigation through days with arrow keys*/ - switch (event->keyval) { - case GDK_Up: - e_week_view_on_key_up (week_view, event); - return TRUE; - case GDK_Down: - e_week_view_on_key_down (week_view, event); - return TRUE; - case GDK_Left: - e_week_view_on_key_left (week_view, event); - return TRUE; - case GDK_Right: - e_week_view_on_key_right (week_view, event); - return TRUE; - default: - break; - } - if (week_view->selection_start_day == -1) return FALSE; @@ -3338,179 +3292,6 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event) return TRUE; } -static void -e_week_view_on_key_up (EWeekView *week_view, GdkEventKey *event) -{ - gint selection_start_day, selection_end_day; - - selection_start_day = week_view->selection_start_day; - selection_end_day = week_view->selection_end_day; - - if (selection_start_day == -1) { - selection_start_day = 0; - selection_end_day = 0; - } - - if (week_view->multi_week_view) { - if (selection_end_day < 7) { - g_date_subtract_days (&(week_view->first_day_shown), 7); - } else - selection_end_day -= 7; - } - else { - if (selection_start_day == selection_end_day) { - if (selection_end_day == 0) { - g_date_subtract_days (&(week_view->first_day_shown), 7); - selection_end_day = 6; - } else - selection_end_day--; - } else { - selection_end_day = - (selection_start_day + selection_end_day)/2; - } - } - - week_view->selection_start_day = selection_end_day; - week_view->selection_end_day = selection_end_day; - - gtk_widget_queue_draw (week_view->main_canvas); -} - -static void -e_week_view_on_key_down (EWeekView *week_view, GdkEventKey *event) -{ - gint selection_start_day, selection_end_day; - - selection_start_day = week_view->selection_start_day; - selection_end_day = week_view->selection_end_day; - - if (selection_start_day == -1) { - selection_start_day = 0; - selection_end_day = 0; - } - - if (week_view->multi_week_view) { - if ((selection_end_day+7) / 7 >= week_view->weeks_shown) { - g_date_add_days (&(week_view->first_day_shown), 7); - } else - selection_end_day += 7; - } - else { - if (selection_start_day == selection_end_day) { - if (selection_end_day == 6) { - g_date_add_days (&(week_view->first_day_shown), 7); - selection_end_day = 0; - } else - selection_end_day++; - } else { - selection_end_day = - (selection_start_day + selection_end_day)/2; - } - } - - week_view->selection_start_day = selection_end_day; - week_view->selection_end_day = selection_end_day; - - gtk_widget_queue_draw (week_view->main_canvas); -} - -static void -e_week_view_on_key_left (EWeekView *week_view, GdkEventKey *event) -{ - gint selection_start_day, selection_end_day; - - selection_start_day = week_view->selection_start_day; - selection_end_day = week_view->selection_end_day; - - if (selection_start_day == -1) { - selection_start_day = 0; - selection_end_day = 0; - } - - if (week_view->multi_week_view) { - if (selection_end_day == 0) { - g_date_subtract_days (&(week_view->first_day_shown), 7); - selection_end_day = 6; - } else - selection_end_day -= 1; - } - else { - switch (selection_end_day) { - case 0: - case 1: - case 2: - g_date_subtract_days (&(week_view->first_day_shown), 7); - selection_end_day += 3; - break; - case 3: - case 4: - case 5: - selection_end_day -= 3; - break; - case 6: - selection_end_day -= 4; - break; - default: - break; - } - } - - week_view->selection_start_day = selection_end_day; - week_view->selection_end_day = selection_end_day; - - gtk_widget_queue_draw (week_view->main_canvas); - -} - -static void -e_week_view_on_key_right (EWeekView *week_view, GdkEventKey *event) -{ - - gint selection_start_day, selection_end_day; - - selection_start_day = week_view->selection_start_day; - selection_end_day = week_view->selection_end_day; - - if (selection_start_day == -1) { - selection_start_day = 0; - selection_end_day = 0; - } - - if (week_view->multi_week_view) { - if (selection_end_day == week_view->weeks_shown*7 -1 ) { - g_date_add_days (&(week_view->first_day_shown), 7); - selection_end_day -= 6; - } else - selection_end_day++; - } - else { - switch (selection_end_day) { - case 0: - case 1: - case 2: - selection_end_day += 3; - break; - case 3: - case 4: - case 5: - g_date_add_days (&(week_view->first_day_shown), 7); - selection_end_day -= 3; - break; - case 6: - g_date_add_days (&(week_view->first_day_shown), 7); - selection_end_day -= 4; - break; - default: - break; - } - } - - week_view->selection_start_day = selection_end_day; - week_view->selection_end_day = selection_end_day; - - gtk_widget_queue_draw (week_view->main_canvas); -} - static gboolean e_week_view_key_press (GtkWidget *widget, GdkEventKey *event) { @@ -3545,83 +3326,6 @@ e_week_view_popup_menu (GtkWidget *widget) return TRUE; } -void -e_week_view_unrecur_appointment (EWeekView *week_view) -{ - EWeekViewEvent *event; - CalComponent *comp, *new_comp; - CalComponentDateTime date; - struct icaltimetype itt; - - if (week_view->popup_event_num == -1) - return; - - event = &g_array_index (week_view->events, EWeekViewEvent, - week_view->popup_event_num); - - /* For the recurring object, we add a exception to get rid of the - instance. */ - comp = cal_component_new (); - cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - cal_comp_util_add_exdate (comp, event->start, e_cal_view_get_timezone (E_CAL_VIEW (week_view))); - - /* For the unrecurred instance we duplicate the original object, - create a new uid for it, get rid of the recurrence rules, and set - the start & end times to the instances times. */ - new_comp = cal_component_new (); - cal_component_set_icalcomponent (new_comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - cal_component_set_uid (new_comp, cal_component_gen_uid ()); - cal_component_set_rdate_list (new_comp, NULL); - cal_component_set_rrule_list (new_comp, NULL); - cal_component_set_exdate_list (new_comp, NULL); - cal_component_set_exrule_list (new_comp, NULL); - - date.value = &itt; - date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (week_view))); - - *date.value = icaltime_from_timet_with_zone (event->start, FALSE, - e_cal_view_get_timezone (E_CAL_VIEW (week_view))); - cal_component_set_dtstart (new_comp, &date); - *date.value = icaltime_from_timet_with_zone (event->end, FALSE, - e_cal_view_get_timezone (E_CAL_VIEW (week_view))); - cal_component_set_dtend (new_comp, &date); - - /* Now update both CalComponents. Note that we do this last since at - present the updates happen synchronously so our event may disappear. - */ - if (cal_client_update_object (event->comp_data->client, comp) - != CAL_CLIENT_RESULT_SUCCESS) - g_message ("e_week_view_on_unrecur_appointment(): Could not update the object!"); - - g_object_unref (comp); - - if (cal_client_update_object (event->comp_data->client, new_comp) - != CAL_CLIENT_RESULT_SUCCESS) - g_message ("e_week_view_on_unrecur_appointment(): Could not update the object!"); - - g_object_unref (new_comp); -} - -void -e_week_view_jump_to_button_item (EWeekView *week_view, GnomeCanvasItem *item) -{ - gint day; - GnomeCalendar *calendar; - - for (day = 0; day < E_WEEK_VIEW_MAX_WEEKS * 7; ++day) { - if (item == week_view->jump_buttons[day]) { - calendar = e_cal_view_get_calendar (E_CAL_VIEW (week_view)); - if (calendar) - gnome_calendar_dayjump - (calendar, - week_view->day_starts[day]); - else - g_warning ("Calendar not set"); - return; - } - } -} - static gboolean e_week_view_on_jump_button_event (GnomeCanvasItem *item, GdkEvent *event, @@ -3630,49 +3334,21 @@ e_week_view_on_jump_button_event (GnomeCanvasItem *item, gint day; if (event->type == GDK_BUTTON_PRESS) { - e_week_view_jump_to_button_item (week_view, item); - return TRUE; - } - else if (event->type == GDK_KEY_PRESS) { - /* return, if Tab, Control or Alt is pressed */ - if ((event->key.keyval == GDK_Tab) || - (event->key.state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))) - return FALSE; - /* with a return key or a simple character (from 0x20 to 0xff), - * jump to the day - */ - if ((event->key.keyval == GDK_Return) || - ((event->key.keyval >= 0x20) && - (event->key.keyval <= 0xFF))) { - e_week_view_jump_to_button_item (week_view, item); - return TRUE; - } - } - else if (event->type == GDK_FOCUS_CHANGE) { - GdkEventFocus *focus_event = (GdkEventFocus *)event; - GdkPixbuf *pixbuf = NULL; - for (day = 0; day < E_WEEK_VIEW_MAX_WEEKS * 7; day++) { - if (item == week_view->jump_buttons[day]) - break; + if (item == week_view->jump_buttons[day]) { + GnomeCalendar *calendar; + + calendar = e_cal_view_get_calendar (E_CAL_VIEW (week_view)); + if (calendar) + gnome_calendar_dayjump + (calendar, + week_view->day_starts[day]); + else + g_warning ("Calendar not set"); + return TRUE; + } } - if (focus_event->in) { - week_view->focused_jump_button = day; - pixbuf = gdk_pixbuf_new_from_xpm_data ((const char**) jump_xpm_focused); - gnome_canvas_item_set (week_view->jump_buttons[day], - "GnomeCanvasPixbuf::pixbuf", - pixbuf, NULL); - } - else { - week_view->focused_jump_button = E_WEEK_VIEW_JUMP_BUTTON_NO_FOCUS; - pixbuf = gdk_pixbuf_new_from_xpm_data ((const char**) jump_xpm); - gnome_canvas_item_set (week_view->jump_buttons[day], - "GnomeCanvasPixbuf::pixbuf", - pixbuf, NULL); - } - if (pixbuf) - gdk_pixbuf_unref (pixbuf); } return FALSE; @@ -3773,12 +3449,4 @@ e_week_view_get_num_events_selected (EWeekView *week_view) return (week_view->editing_event_num != -1) ? 1 : 0; } -gboolean -e_week_view_is_jump_button_visible (EWeekView *week_view, gint day) -{ - g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE); - if ((day >= 0) && (day < E_WEEK_VIEW_MAX_WEEKS * 7)) - return week_view->jump_buttons[day]->object.flags & GNOME_CANVAS_ITEM_VISIBLE; - return FALSE; -} diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h index c24470155d..3f93ddc084 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -170,7 +170,6 @@ struct _EWeekView GnomeCanvasItem *main_canvas_item; GnomeCanvasItem *jump_buttons[E_WEEK_VIEW_MAX_WEEKS * 7]; - gint focused_jump_button; GtkWidget *vscrollbar; @@ -396,7 +395,6 @@ void e_week_view_set_24_hour_format (EWeekView *week_view, void e_week_view_delete_occurrence (EWeekView *week_view); -void e_week_view_unrecur_appointment (EWeekView *week_view); /* Returns the number of selected events (0 or 1 at present). */ gint e_week_view_get_num_events_selected (EWeekView *week_view); @@ -438,15 +436,6 @@ gint e_week_view_get_time_string_width (EWeekView *week_view); gint e_week_view_event_sort_func (const void *arg1, const void *arg2); -gboolean e_week_view_find_event_from_item (EWeekView *week_view, - GnomeCanvasItem *item, - gint *event_num_return, - gint *span_num_return); - -gboolean e_week_view_is_jump_button_visible (EWeekView *week_view, - gint day); -void e_week_view_jump_to_button_item (EWeekView *week_view, GnomeCanvasItem *item); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 3ae8f4bde8..1f78968b34 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -58,7 +58,6 @@ #include "calendar-view-factory.h" #include "tag-calendar.h" #include "misc.h" -#include "ea-calendar.h" extern ECompEditorRegistry *comp_editor_registry; @@ -143,10 +142,6 @@ struct _GnomeCalendarPrivate { 'dates-shown-changed' signal.*/ time_t visible_start; time_t visible_end; - - /* Calendar query for purging old events */ - GList *exp_queries; - time_t exp_older_than; }; /* Signal IDs */ @@ -352,104 +347,74 @@ gnome_calendar_class_init (GnomeCalendarClass *class) "goto_date",1, G_TYPE_ENUM, GNOME_CAL_GOTO_SAME_DAY_OF_NEXT_WEEK); - /* init the accessibility support for gnome_calendar */ - gnome_calendar_a11y_init (); - } /* Callback used when the calendar query reports of an updated object */ static void -dn_query_obj_updated_cb (CalQuery *query, const char *uid, - gboolean query_in_progress, int n_scanned, int total, - gpointer data) +dn_query_objects_added_cb (CalQuery *query, GList *objects, gpointer data) { GnomeCalendar *gcal; GnomeCalendarPrivate *priv; - CalComponent *comp = NULL; - icalcomponent *icalcomp; - CalClientGetStatus status; - + GList *l; + gcal = GNOME_CALENDAR (data); priv = gcal->priv; - /* If this is an update that is not part of an ongoing query, we have to - * retag the whole thing: an event may change dates and the - * tag_calendar_by_comp() below would not know how to untag the old - * dates. - */ - if (!query_in_progress) { - update_query (gcal); - return; - } + for (l = objects; l; l = l->next) { + CalComponent *comp = NULL; - status = cal_client_get_object (cal_query_get_client (query), uid, &icalcomp); - - switch (status) { - case CAL_CLIENT_GET_SUCCESS: comp = cal_component_new (); - if (!cal_component_set_icalcomponent (comp, icalcomp)) { + if (!cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data))) { g_object_unref (comp); - icalcomponent_free (icalcomp); - return; + + continue; } - break; - - case CAL_CLIENT_GET_SYNTAX_ERROR: - g_message ("dn_query_obj_updated_cb(): Syntax error while getting object `%s'", uid); - return; - case CAL_CLIENT_GET_NOT_FOUND: - /* The object is no longer in the server, so do nothing */ - return; - - default: - g_assert_not_reached (); - return; + tag_calendar_by_comp (priv->date_navigator, comp, cal_query_get_client (query), NULL, + FALSE, TRUE); + g_object_unref (comp); } - - tag_calendar_by_comp (priv->date_navigator, comp, cal_query_get_client (query), NULL, - FALSE, TRUE); - g_object_unref (comp); } -/* Callback used when the calendar query reports of a removed object */ static void -dn_query_obj_removed_cb (CalQuery *query, const char *uid, gpointer data) +dn_query_objects_modified_cb (CalQuery *query, GList *objects, gpointer data) { GnomeCalendar *gcal; + GnomeCalendarPrivate *priv; gcal = GNOME_CALENDAR (data); + priv = gcal->priv; - /* Just retag the whole thing */ + /* We have to retag the whole thing: an event may change dates + * and the tag_calendar_by_comp() below would not know how to + * untag the old dates. + */ update_query (gcal); } -/* Callback used when the calendar query is done */ +/* Callback used when the calendar query reports of a removed object */ static void -dn_query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *error_str, - gpointer data) +dn_query_objects_removed_cb (CalQuery *query, GList *uids, gpointer data) { GnomeCalendar *gcal; gcal = GNOME_CALENDAR (data); - /* FIXME */ - - if (status != CAL_QUERY_DONE_SUCCESS) - fprintf (stderr, "query done: %s\n", error_str); + /* Just retag the whole thing */ + update_query (gcal); } -/* Callback used when the calendar query reports an evaluation error */ +/* Callback used when the calendar query is done */ static void -dn_query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data) +dn_query_done_cb (CalQuery *query, ECalendarStatus status, gpointer data) { GnomeCalendar *gcal; gcal = GNOME_CALENDAR (data); - /* FIXME */ - - fprintf (stderr, "eval error: %s\n", error_str); + /* FIXME Better error reporting */ + if (status != E_CALENDAR_STATUS_OK) + g_warning (G_STRLOC ": Query did not successfully complete"); } /* Returns the current view widget, a EDayView or EWeekView. */ @@ -635,22 +600,24 @@ update_query (GnomeCalendar *gcal) /* create queries for each loaded client */ client_list = e_cal_model_get_client_list (e_cal_view_get_model (E_CAL_VIEW (priv->day_view))); for (l = client_list; l != NULL; l = l->next) { - old_query = cal_client_get_query ((CalClient *) l->data, real_sexp); - if (!old_query) { - g_message ("update_query(): Could not create the query"); + if (!cal_client_get_query ((CalClient *) l->data, real_sexp, &old_query, NULL)) { + g_warning (G_STRLOC ": Could not create the query"); + continue; } - g_signal_connect (old_query, "obj_updated", - G_CALLBACK (dn_query_obj_updated_cb), gcal); - g_signal_connect (old_query, "obj_removed", - G_CALLBACK (dn_query_obj_removed_cb), gcal); + g_signal_connect (old_query, "objects_added", + G_CALLBACK (dn_query_objects_added_cb), gcal); + g_signal_connect (old_query, "objects_modified", + G_CALLBACK (dn_query_objects_modified_cb), gcal); + g_signal_connect (old_query, "objects_removed", + G_CALLBACK (dn_query_objects_removed_cb), gcal); g_signal_connect (old_query, "query_done", - G_CALLBACK (dn_query_query_done_cb), gcal); - g_signal_connect (old_query, "eval_error", - G_CALLBACK (dn_query_eval_error_cb), gcal); + G_CALLBACK (dn_query_done_cb), gcal); priv->dn_queries = g_list_append (priv->dn_queries, old_query); + + cal_query_start (old_query); } g_list_free (client_list); @@ -992,8 +959,6 @@ gnome_calendar_init (GnomeCalendar *gcal) priv->visible_start = -1; priv->visible_end = -1; - - priv->exp_queries = NULL; } /* Frees a set of categories */ @@ -1085,19 +1050,6 @@ gnome_calendar_destroy (GtkObject *object) priv->view_menus = NULL; } - if (priv->exp_queries) { - GList *l; - - for (l = priv->exp_queries; l != NULL; l = l->next) { - g_signal_handlers_disconnect_matched ((CalQuery *) l->data, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, gcal); - g_object_unref (l->data); - } - - g_list_free (priv->exp_queries); - priv->exp_queries = NULL; - } - g_free (priv); gcal->priv = NULL; } @@ -1718,7 +1670,8 @@ client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer da case CAL_CLIENT_OPEN_SUCCESS: /* Set the client's default timezone, if we have one. */ if (priv->zone) { - cal_client_set_default_timezone (client, priv->zone); + /* FIXME Error checking */ + cal_client_set_default_timezone (client, priv->zone, NULL); } /* add the alarms for this client */ @@ -2104,9 +2057,7 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri) { GnomeCalendarPrivate *priv; gboolean success; - EUri *uri; char *message; - char *real_uri; char *urinopwd; CalClient *client; @@ -2120,12 +2071,6 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri) cal_client_get_load_state (priv->task_pad_client) == CAL_CLIENT_LOAD_NOT_LOADED, FALSE); - uri = e_uri_new (str_uri); - if (!uri || !g_strncasecmp (uri->protocol, "file", 4)) - real_uri = g_concat_dir_and_file (str_uri, "calendar.ics"); - else - real_uri = g_strdup (str_uri); - urinopwd = get_uri_without_password (str_uri); message = g_strdup_printf (_("Opening calendar at %s"), urinopwd); g_free (urinopwd); @@ -2138,7 +2083,7 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri) g_signal_connect (G_OBJECT (client), "categories_changed", G_CALLBACK (client_categories_changed_cb), gcal); g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), gcal); - if (!cal_client_open_calendar (client, real_uri, FALSE)) { + if (!cal_client_open_calendar (client, str_uri, FALSE)) { g_warning (G_STRLOC ": Could not issue the request to open the calendar folder"); g_object_unref (client); e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL); @@ -2151,9 +2096,6 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri) _("Opening default tasks folder")); success = cal_client_open_default_tasks (priv->task_pad_client, FALSE); - g_free (real_uri); - e_uri_free (uri); - if (!success) { g_message ("gnome_calendar_open(): Could not issue the request to open the tasks folder"); e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL); @@ -2262,7 +2204,8 @@ gnome_calendar_update_config_settings (GnomeCalendar *gcal, CalClient *client = l->data; if (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED) - cal_client_set_default_timezone (client, priv->zone); + /* FIXME Error checking */ + cal_client_set_default_timezone (client, priv->zone, NULL); } g_list_free (client_list); @@ -2270,8 +2213,9 @@ gnome_calendar_update_config_settings (GnomeCalendar *gcal, if (priv->task_pad_client && cal_client_get_load_state (priv->task_pad_client) == CAL_CLIENT_LOAD_LOADED) { + /* FIXME Error Checking */ cal_client_set_default_timezone (priv->task_pad_client, - priv->zone); + priv->zone, NULL); } e_cal_view_set_timezone (E_CAL_VIEW (priv->day_view), priv->zone); @@ -2544,8 +2488,8 @@ gnome_calendar_get_visible_time_range (GnomeCalendar *gcal, priv = gcal->priv; - retval = e_cal_view_get_visible_time_range (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)), - start_time, end_time); + e_cal_view_get_visible_time_range (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)), + start_time, end_time); return retval; } @@ -2961,136 +2905,17 @@ gnome_calendar_delete_selected_occurrence (GnomeCalendar *gcal) } } -void -gnome_calendar_unrecur_selection (GnomeCalendar *gcal) -{ - GnomeCalendarPrivate *priv; - FocusLocation location; - GtkWidget *view; - - g_return_if_fail (GNOME_IS_CALENDAR (gcal)); - - priv = gcal->priv; - - location = get_focus_location (gcal); - - if (location == FOCUS_CALENDAR) { - - view = gnome_calendar_get_current_view_widget (gcal); - - if (E_IS_DAY_VIEW (view)) - e_day_view_unrecur_appointment (E_DAY_VIEW (view)); - else - e_week_view_unrecur_appointment (E_WEEK_VIEW (view)); - } -} - -typedef struct { - gboolean remove; - GnomeCalendar *gcal; -} obj_updated_closure; - static gboolean check_instance_cb (CalComponent *comp, time_t instance_start, time_t instance_end, gpointer data) { - obj_updated_closure *closure = data; + gboolean *remove = data; - if (instance_start >= closure->gcal->priv->exp_older_than || - instance_end >= closure->gcal->priv->exp_older_than) { - closure->remove = FALSE; - return FALSE; - } + *remove = FALSE; - closure->remove = TRUE; - return TRUE; -} - -static void -purging_obj_updated_cb (CalQuery *query, const char *uid, - gboolean query_in_progress, int n_scanned, int total, - gpointer data) -{ - GnomeCalendarPrivate *priv; - GnomeCalendar *gcal = data; - CalComponent *comp; - icalcomponent *icalcomp; - obj_updated_closure closure; - gchar *msg; - - priv = gcal->priv; - - if (cal_client_get_object (cal_query_get_client (query), uid, &icalcomp) != CAL_CLIENT_GET_SUCCESS) - return; - - comp = cal_component_new (); - if (!cal_component_set_icalcomponent (comp, icalcomp)) { - g_object_unref (comp); - icalcomponent_free (icalcomp); - return; - } - - msg = g_strdup_printf (_("Purging event %s"), uid); - - /* further filter the event, to check the last recurrence end date */ - if (cal_component_has_recurrences (comp)) { - closure.remove = TRUE; - closure.gcal = gcal; - - cal_recur_generate_instances (comp, priv->exp_older_than, -1, - (CalRecurInstanceFn) check_instance_cb, - &closure, - (CalRecurResolveTimezoneFn) cal_client_resolve_tzid_cb, - cal_query_get_client (query), priv->zone); - - if (closure.remove) { - e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), msg); - delete_error_dialog (cal_client_remove_object (cal_query_get_client (query), uid), - CAL_COMPONENT_EVENT); - } - } else { - e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), msg); - delete_error_dialog (cal_client_remove_object (cal_query_get_client (query), uid), CAL_COMPONENT_EVENT); - } - - g_object_unref (comp); - g_free (msg); -} - -static void -purging_eval_error_cb (CalQuery *query, const char *error_str, gpointer data) -{ - GnomeCalendarPrivate *priv; - GnomeCalendar *gcal = data; - - priv = gcal->priv; - - e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL); - - g_signal_handlers_disconnect_matched (query, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, gcal); - - priv->exp_queries = g_list_remove (priv->exp_queries, query); - g_object_unref (query); -} - -static void -purging_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *error_str, gpointer data) -{ - GnomeCalendarPrivate *priv; - GnomeCalendar *gcal = data; - - priv = gcal->priv; - - e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL); - - g_signal_handlers_disconnect_matched (query, G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, gcal); - - priv->exp_queries = g_list_remove (priv->exp_queries, query); - g_object_unref (query); + return FALSE; } void @@ -3104,11 +2929,6 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than) priv = gcal->priv; - /* if we have a query, we are already purging */ - if (priv->exp_queries) - return; - - priv->exp_older_than = older_than; start = isodate_from_time_t (0); end = isodate_from_time_t (older_than); sexp = g_strdup_printf ("(and (= (get-vtype) \"VEVENT\")" @@ -3118,27 +2938,47 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than) e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), _("Purging")); + /* FIXME Confirm expunge */ + client_list = e_cal_model_get_client_list (e_cal_view_get_model (E_CAL_VIEW (priv->week_view))); for (l = client_list; l != NULL; l = l->next) { - CalQuery *exp_query; - - if (cal_client_is_read_only ((CalClient *) l->data)) + CalClient *client = l->data; + GList *objects, *l; + gboolean read_only = TRUE; + + cal_client_is_read_only (client, &read_only, NULL); + if (!read_only) continue; - - exp_query = cal_client_get_query ((CalClient *) l->data, sexp); - if (!exp_query) { - e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL); - g_message ("gnome_calendar_purge(): Could not create the query"); + + if (!cal_client_get_object_list (client, sexp, &objects, NULL)) { + g_warning (G_STRLOC ": Could not get the objects"); + continue; } - - g_signal_connect (exp_query, "obj_updated", G_CALLBACK (purging_obj_updated_cb), gcal); - g_signal_connect (exp_query, "query_done", G_CALLBACK (purging_query_done_cb), gcal); - g_signal_connect (exp_query, "eval_error", G_CALLBACK (purging_eval_error_cb), gcal); - - priv->exp_queries = g_list_append (priv->exp_queries, exp_query); + + for (l = objects; l; l = l->next) { + CalComponent *comp; + gboolean remove = TRUE; + + comp = cal_component_new (); + cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data)); + + cal_recur_generate_instances (comp, older_than, -1, + (CalRecurInstanceFn) check_instance_cb, + &remove, + (CalRecurResolveTimezoneFn) cal_client_resolve_tzid_cb, + client, priv->zone); + + /* FIXME Better error handling */ + if (remove) + cal_client_remove_object (client, icalcomponent_get_uid (l->data), NULL); + + g_object_unref (comp); + } } + e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL); + g_list_free (client_list); g_free (sexp); g_free (start); @@ -3154,26 +2994,3 @@ gnome_calendar_get_task_pad (GnomeCalendar *gcal) return E_CALENDAR_TABLE (gcal->priv->todo); } -GtkWidget * -gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal) -{ - g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL); - - return GTK_WIDGET(gcal->priv->date_navigator); -} - -GtkWidget * -gnome_calendar_get_search_bar_widget (GnomeCalendar *gcal) -{ - g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL); - - return GTK_WIDGET(gcal->priv->search_bar); -} - -GtkWidget * -gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal) -{ - g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL); - - return GTK_WIDGET(gcal->priv->notebook); -} diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index ff5b1a6bd0..459bbbf667 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -87,7 +87,7 @@ struct _GnomeCalendarClass { void (* calendar_focus_change) (GnomeCalendar *gcal, gboolean in); void (* taskpad_focus_change) (GnomeCalendar *gcal, gboolean in); - void (* goto_date) (GnomeCalendar *gcal, + void (* goto_date) (GnomeCalendar *day_view, GnomeCalendarGotoDateType date); }; @@ -125,12 +125,6 @@ void gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_ty gboolean range_selected, gboolean grab_focus); GtkWidget *gnome_calendar_get_current_view_widget (GnomeCalendar *gcal); - -ECalendarTable *gnome_calendar_get_task_pad (GnomeCalendar *gcal); -GtkWidget *gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal); -GtkWidget *gnome_calendar_get_search_bar_widget (GnomeCalendar *gcal); -GtkWidget *gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal); - void gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic); void gnome_calendar_discard_view_menus (GnomeCalendar *gcal); @@ -192,7 +186,6 @@ void gnome_calendar_paste_clipboard (GnomeCalendar *gcal); void gnome_calendar_delete_selection (GnomeCalendar *gcal); void gnome_calendar_delete_selected_occurrence (GnomeCalendar *gcal); -void gnome_calendar_unrecur_selection (GnomeCalendar *gcal); void gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than); diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 366261ecff..f12c6c7202 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -98,12 +98,14 @@ itip_organizer_is_user (CalComponent *comp, CalClient *client) strip = itip_strip_mailto (organizer.value); if (cal_client_get_static_capability (client, CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) { - const char *email; + char *email; - email = cal_client_get_cal_address (client); - if (email && !g_strcasecmp (email, strip)) + if (cal_client_get_cal_address (client, &email, NULL) && !g_strcasecmp (email, strip)) { + g_free (email); + return TRUE; - + } + return FALSE; } @@ -185,8 +187,8 @@ foreach_tzid_callback (icalparameter *param, gpointer data) zone = icalcomponent_get_timezone (tz_data->zones, tzid); if (zone == NULL) zone = icaltimezone_get_builtin_timezone_from_tzid (tzid); - if (zone == NULL && tz_data->client != NULL) - cal_client_get_timezone (tz_data->client, tzid, &zone); + if (zone == NULL && tz_data->client != NULL) + cal_client_get_timezone (tz_data->client, tzid, &zone, NULL); if (zone == NULL) return; @@ -528,28 +530,23 @@ static gboolean comp_server_send (CalComponentItipMethod method, CalComponent *comp, CalClient *client, icalcomponent *zones, GList **users) { - CalClientSendResult result; - icalcomponent *top_level, *new_top_level = NULL; - char *error_msg; + icalcomponent *top_level; gboolean retval = TRUE; + GError *error = NULL; top_level = comp_toplevel_with_zones (method, comp, client, zones); - result = cal_client_send_object (client, top_level, &new_top_level, users, &error_msg); - - if (result == CAL_CLIENT_SEND_SUCCESS) { - icalcomponent *ical_comp; - - ical_comp = icalcomponent_get_inner (new_top_level); - icalcomponent_remove_component (new_top_level, ical_comp); - cal_component_set_icalcomponent (comp, ical_comp); - icalcomponent_free (new_top_level); - } else if (result == CAL_CLIENT_SEND_BUSY) { - e_notice (NULL, GTK_MESSAGE_ERROR, error_msg); - - g_free (error_msg); - retval = FALSE; + if (!cal_client_send_objects (client, top_level, &error)) { + /* FIXME Really need a book problem status code */ + if (error->code != E_CALENDAR_STATUS_OK) { + /* FIXME Better error message */ + e_notice (NULL, GTK_MESSAGE_ERROR, "Unable to book"); + + retval = FALSE; + } } + g_clear_error (&error); + icalcomponent_free (top_level); return retval; @@ -755,7 +752,8 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp, CalClient *cl if (from_zone == NULL) from_zone = icaltimezone_get_builtin_timezone_from_tzid (dt.tzid); if (from_zone == NULL && client != NULL) - cal_client_get_timezone (client, dt.tzid, &from_zone); + /* FIXME Error checking */ + cal_client_get_timezone (client, dt.tzid, &from_zone, NULL); } to_zone = icaltimezone_get_utc_timezone (); diff --git a/calendar/gui/print.c b/calendar/gui/print.c index 6aeb9f6566..9f6133c683 100644 --- a/calendar/gui/print.c +++ b/calendar/gui/print.c @@ -522,6 +522,16 @@ format_date(time_t time, int flags, char *buffer, int bufflen) return buffer; } +static gboolean +instance_cb (CalComponent *comp, time_t instance_start, time_t instance_end, gpointer data) +{ + gboolean *found = data; + + *found = TRUE; + + return FALSE; +} + /* print out the month small, embolden any days with events. @@ -625,16 +635,16 @@ print_month_small (GnomePrintContext *pc, GnomeCalendar *gcal, time_t month, day = days[y * 7 + x]; if (day != 0) { - GList *uids; + gboolean found = FALSE; sprintf (buf, "%d", day); /* this is a slow messy way to do this ... but easy ... */ - uids = cal_client_get_objects_in_range (client, - CALOBJ_TYPE_EVENT, - now, time_day_end_with_zone (now, zone)); - font = uids ? font_bold : font_normal; - cal_obj_uid_list_free (uids); + cal_client_generate_instances (client, now, CALOBJ_TYPE_EVENT, + time_day_end_with_zone (now, zone), + instance_cb, &found); + + font = found ? font_bold : font_normal; next = time_add_day_with_zone (now, 1, zone); if ((now >= greystart && now < greyend) @@ -2161,11 +2171,8 @@ get_zone_from_tzid (CalClient *client, const char *tzid) the builtin timezone with the TZID first. */ zone = icaltimezone_get_builtin_timezone_from_tzid (tzid); if (!zone) { - CalClientGetStatus status; - - status = cal_client_get_timezone (client, tzid, &zone); - /* FIXME: Handle error better. */ - if (status != CAL_CLIENT_GET_SUCCESS) + if (!cal_client_get_timezone (client, tzid, &zone, NULL)) + /* FIXME: Handle error better. */ g_warning ("Couldn't get timezone from server: %s", tzid ? tzid : ""); } diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c index 03e0b3dee4..147a69f246 100644 --- a/calendar/gui/tag-calendar.c +++ b/calendar/gui/tag-calendar.c @@ -162,7 +162,6 @@ resolve_tzid_cb (const char *tzid, gpointer data) { CalClient *client; icaltimezone *zone = NULL; - CalClientGetStatus status; g_return_val_if_fail (data != NULL, NULL); g_return_val_if_fail (IS_CAL_CLIENT (data), NULL); @@ -174,7 +173,7 @@ resolve_tzid_cb (const char *tzid, gpointer data) if (!zone) { /* FIXME: Handle errors. */ - status = cal_client_get_timezone (client, tzid, &zone); + cal_client_get_timezone (client, tzid, &zone, NULL); } return zone; diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index 5ed9faa0d6..d97ed2d585 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -235,12 +235,12 @@ static void sensitize_commands (ETasks *tasks, BonoboControl *control, int n_selected) { BonoboUIComponent *uic; - gboolean read_only; + gboolean read_only = TRUE; uic = bonobo_control_get_ui_component (control); g_assert (uic != NULL); - read_only = cal_client_is_read_only (e_tasks_get_cal_client (tasks)); + cal_client_is_read_only (e_tasks_get_cal_client (tasks), &read_only, NULL); bonobo_ui_component_set_prop (uic, "/commands/TasksCut", "sensitive", n_selected == 0 || read_only ? "0" : "1", diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl index 15b27e806a..44762fc086 100644 --- a/calendar/idl/evolution-calendar.idl +++ b/calendar/idl/evolution-calendar.idl @@ -23,9 +23,14 @@ module Calendar { typedef string CalObj; typedef sequence<CalObj> CalObjSeq; + typedef sequence<string> stringlist; + /* A unique identifier for a calendar component */ typedef string CalObjUID; + /* A unique identified for an event recurrence */ + typedef string CalRecurID; + /* Simple sequence of strings */ typedef sequence<string> StringSeq; @@ -66,14 +71,6 @@ module Calendar { const CalObjChangeType ADDED = 1 << 0; const CalObjChangeType MODIFIED = 1 << 1; const CalObjChangeType DELETED = 1 << 2; - - /* Types of alarms */ - enum AlarmType { - MAIL, - PROGRAM, - DISPLAY, - AUDIO - }; /* Used to store a time_t */ typedef unsigned long Time_t; @@ -102,30 +99,39 @@ module Calendar { /* Used to transfer a list of changed components */ typedef sequence<CalObjChange> CalObjChangeSeq; - /* An alarm trigger instance */ - struct CalAlarmInstance { - CalAlarmUID auid; - Time_t trigger; - Time_t occur_start; - Time_t occur_end; - }; - - /* Used to represent a list of alarm triggers for a single component */ - typedef sequence<CalAlarmInstance> CalAlarmInstanceSeq; - - /* Alarms for a component */ - struct CalComponentAlarms { - CalObj calobj; - CalAlarmInstanceSeq alarms; - }; - - /* Used to represent a list of components plus their triggers */ - typedef sequence<CalComponentAlarms> CalComponentAlarmsSeq; - /* Used to represent users and lists of users */ typedef string User; typedef sequence<User> UserList; + enum CallStatus { + Success, + RepositoryOffline, + PermissionDenied, + InvalidRange, + ObjectNotFound, + InvalidObject, + CardIdAlreadyExists, + AuthenticationFailed, + AuthenticationRequired, + UnsupportedField, + UnsupportedMethod, + UnsupportedAuthenticationMethod, + TLSNotAvailable, + NoSuchCal, + + /* These can be returned for successful searches, but + indicate the result set was truncated */ + SearchSizeLimitExceeded, + SearchTimeLimitExceeded, + + InvalidQuery, + QueryRefused, + + CouldNotCancel, + + OtherError + }; + interface Query; interface Listener; @@ -136,134 +142,68 @@ module Calendar { interface Cal : Bonobo::Unknown { exception NotFound {}; exception InvalidRange {}; - exception InvalidObject {}; - exception CouldNotCreate {}; - exception PermissionDenied {}; - exception Busy {string errorMsg;}; /* A calendar is identified by its URI */ readonly attribute string uri; + oneway void open (in boolean only_if_exists); + oneway void remove (); + /* Check write permissions for calendar */ - boolean isReadOnly (); + oneway void isReadOnly (); /* Information on the backend's capabilities */ - string getStaticCapabilities (); + oneway void getStaticCapabilities (); - /* Return the cal address associated with this calendar, - if any. */ - string getCalAddress () - raises (NotFound); + /* Return the cal address associated with this calendar, if any. */ + oneway void getCalAddress (); - string getAlarmEmailAddress () - raises (NotFound); + oneway void getAlarmEmailAddress (); /* Returns the LDAP attribute to get attendees from */ - string getLdapAttribute () - raises (NotFound); + oneway void getLdapAttribute (); /* For going online/offline */ void setMode (in CalMode mode); - - /* Gets the number of components of the specified types */ - long countObjects (in CalObjType type); /* Get a default object of a given type */ - CalObj getDefaultObject (in CalObjType type); + oneway void getDefaultObject (in CalObjType type); /* Gets a component based on its URI */ - CalObj getObject (in CalObjUID uid) - raises (NotFound); - - /* Sets the default timezone to be used for resolving DATE - and floating DATE-TIME values. */ - void setDefaultTimezone (in CalTimezoneObjUID tzid) - raises (NotFound); + oneway void getObject (in CalObjUID uid, in CalRecurID rid); - /* Gets a VTIMEZONE component based on its TZID */ - CalTimezoneObj getTimezoneObject (in CalTimezoneObjUID tzid) - raises (NotFound); + oneway void getObjectList (in string query); - /* Gets a list of UIDs based on component type */ - CalObjUIDSeq getUIDs (in CalObjType type); + /* Methods for manipulating timezones */ + oneway void getTimezone (in CalTimezoneObjUID tzid); + oneway void addTimezone (in CalTimezoneObj tz); + /* The timezone used to resolve DATE and floating DATE-TIME values. */ + oneway void setDefaultTimezone (in CalTimezoneObjUID tzid); /* Gets a list of components that changed based on object type */ - CalObjChangeSeq getChanges (in CalObjType type, in string change_id); - - /* Gets a list of components that occur or recur in the specified time range */ - CalObjUIDSeq getObjectsInRange (in CalObjType type, - in Time_t start, in Time_t end) - raises (InvalidRange); - - /* Gets a list of the components that have alarms that trigger - * in the specified range of time, and the trigger/occurrence - * structures themselves. - */ - CalComponentAlarmsSeq getAlarmsInRange (in Time_t start, in Time_t end) - raises (NotFound, InvalidRange); + oneway void getChanges (in CalObjType type, in string change_id); /* Returns free/busy objects for the given interval */ - CalObjSeq getFreeBusy (in UserList users, in Time_t start, in Time_t end) - raises (NotFound, InvalidRange); - - /* Gets the alarms for the specified component that trigger in - * the specified time range. - */ - CalComponentAlarms getAlarmsForObject (in CalObjUID uid, - in Time_t start, in Time_t end) - raises (NotFound, InvalidRange); - + oneway void getFreeBusy (in UserList users, in Time_t start, in Time_t end); /* Discards an alarm from a given component */ - void discardAlarm (in CalObjUID uid, in CalAlarmUID auid) - raises (NotFound); - - /* Adds or updates one or more VEVENT/VTODO/VTIMEZONE - * components. The calobj should be a string representation of - * a complete VCALENDAR object (we also support single - * VEVENT/VTODO strings, but that is deprecated). - * - * The VTIMEZONE data will be merged into the calendar, - * possibly by renaming TZIDs (though not for builtin - * VTIMEZONEs, which have unique TZIDs), so don't rely on the - * TZIDs being the same in the new object on the server. - * - * The client should probably immediately free its copy of the - * object after this call, and call getObject to get the - * updated version. - */ - void updateObjects (in CalObj calobj, in CalObjModType mod) - raises (NotFound, InvalidObject, PermissionDenied); + oneway void discardAlarm (in CalObjUID uid, in CalAlarmUID auid); - /* Removes a component */ - void removeObject (in CalObjUID uid, in CalObjModType mod) - raises (NotFound, PermissionDenied); + /* Methods for manipulating iCalendar objects */ + oneway void createObject (in CalObj calobj); + oneway void modifyObject (in CalObj calobj, in CalObjModType mod); + oneway void removeObject (in CalObjUID uid, in CalObjModType mod); - /* Sends a component */ - CalObj sendObject (in CalObj calobj, out UserList users) - raises (InvalidObject, PermissionDenied, Busy); + /* Methods for getting/sending iCalendar VCALENDARS via iTip/iMip */ + oneway void receiveObjects (in CalObj calobj); + oneway void sendObjects (in CalObj calobj); - /* Initiates a live query of the calendar. Returns a handle - * to the live query itself; changes to components that are - * present in the query are notified to the listener. - */ - Query getQuery (in string sexp, in QueryListener ql) - raises (CouldNotCreate); + /* Query methods */ + oneway void getQuery (in string sexp, in QueryListener ql); }; /* Listener for changes in a calendar */ interface Listener : Bonobo::Unknown { - /* Return status when opening a calendar */ - enum OpenStatus { - SUCCESS, /* All OK */ - ERROR, /* Generic error */ - NOT_FOUND, /* Requested opening in only_if_exists mode - * when the URI did not exist. - */ - METHOD_NOT_SUPPORTED, /* A method handler is not registered */ - PERMISSION_DENIED - }; - /* Return status when setting calendar mode */ enum SetModeStatus { MODE_SET, /* All OK */ @@ -271,62 +211,58 @@ module Calendar { MODE_NOT_SUPPORTED /* Mode not supported */ }; - /* Called from a CalFactory when a calendar is initially opened. - * The listener must remember the cal object. - */ - void notifyCalOpened (in OpenStatus status, in Cal cal); + oneway void notifyReadOnly (in CallStatus status, in boolean read_only); + oneway void notifyCalAddress (in CallStatus status, in string address); + oneway void notifyAlarmEmailAddress (in CallStatus status, in string address); + oneway void notifyLDAPAttribute (in CallStatus status, in string ldap_attribute); + oneway void notifyStaticCapabilities (in CallStatus status, in string capabilities); + + oneway void notifyCalOpened (in CallStatus status); + oneway void notifyCalRemoved (in CallStatus status); - /* Called from a Calendar when the mode is changed */ - void notifyCalSetMode (in SetModeStatus status, in CalMode mode); + oneway void notifyObjectCreated (in CallStatus status, in string uid); + oneway void notifyObjectModified (in CallStatus status); + oneway void notifyObjectRemoved (in CallStatus status); + + oneway void notifyAlarmDiscarded (in CallStatus status); + + oneway void notifyObjectsReceived (in CallStatus status); + oneway void notifyObjectsSent (in CallStatus status); - /* Called from a Calendar when a component is added or changed */ - void notifyObjUpdated (in CalObjUID uid); + oneway void notifyDefaultObjectRequested (in CallStatus status, in CalObj object); + oneway void notifyObjectRequested (in CallStatus status, in CalObj object); + oneway void notifyObjectListRequested (in CallStatus status, in stringlist objects); + oneway void notifyQuery (in CallStatus status, in Query query); + + oneway void notifyTimezoneRequested (in CallStatus status, in CalTimezoneObj tz); + oneway void notifyTimezoneAdded (in CallStatus status, in CalTimezoneObjUID tzid); + oneway void notifyDefaultTimezoneSet (in CallStatus status); - /* Called from a Calendar when a component is removed */ - void notifyObjRemoved (in CalObjUID uid); + oneway void notifyChanges (in CallStatus status, in CalObjChangeSeq changes); + oneway void notifyFreeBusy (in CallStatus status, in CalObjSeq freebusy); + + /* Called from a Calendar when the mode is changed */ + oneway void notifyCalSetMode (in SetModeStatus status, in CalMode mode); /* Called from a Calendar when the list of categories changes */ - void notifyCategoriesChanged (in StringSeq categories); + oneway void notifyCategoriesChanged (in StringSeq categories); /* Called from a Calendar when there is an error not notified otherwise */ - void notifyErrorOccurred (in string message); + oneway void notifyErrorOccurred (in string message); }; /* Handle to a live query on a calendar */ interface Query : Bonobo::Unknown { + oneway void start (); }; /* Listener for changes in a query of a calendar */ interface QueryListener : Bonobo::Unknown { - /* Called when components are added or changed. If - * query_in_progress is true, then the initial query results are - * being populated and the other arguments indicate the - * percentage of completion Otherwise, the percent value is - * unspecified. */ - void notifyObjUpdated (in CalObjUIDSeq uids, - in boolean query_in_progress, - in long n_scanned, - in long total); - - /* Called when a component is removed */ - void notifyObjRemoved (in CalObjUID uid); - - /* Reported when a query ends */ - enum QueryDoneStatus { - SUCCESS, - PARSE_ERROR - }; - - /* Called when the query finishes populating itself some time - * after it is created. Before this is called, - * notifyObjUpdated() may have been called several times to - * indicate which objects are actually in the query, unless the - * status result is a parse error. - */ - void notifyQueryDone (in QueryDoneStatus status, in string error_str); - - /* Called when an evaluation error occurs while performing a query */ - void notifyEvalError (in string error_str); + oneway void notifyObjectsAdded (in stringlist objects); + oneway void notifyObjectsModified (in stringlist objects); + oneway void notifyObjectsRemoved (in CalObjUIDSeq uids); + oneway void notifyQueryProgress (in string message, in short percent); + oneway void notifyQueryDone (in CallStatus status); }; /* A calendar factory, can load and create calendars */ @@ -334,14 +270,9 @@ module Calendar { exception NilListener {}; exception InvalidURI {}; exception UnsupportedMethod {}; - exception PermissionDenied {}; - - /* Open a calendar from an URI */ - void open (in string uri, in boolean only_if_exists, in Listener listener) - raises (NilListener, InvalidURI, UnsupportedMethod, PermissionDenied); - /* List of open URI's */ - StringSeq uriList (in CalMode mode); + Cal getCal (in string uri, in CalObjType type, in Listener listener) + raises (NilListener, InvalidURI, UnsupportedMethod); }; /* Interface to the alarm notification service */ diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 28068c11df..34e6845e02 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -179,6 +179,60 @@ prepare_tasks (icalcomponent *icalcomp, GList *vtodos) g_list_free (vtodos); } +static CalClientResult +update_single_object (CalClient *client, icalcomponent *icalcomp) +{ + const char *uid; + icalcomponent *tmp_icalcomp; + + uid = icalcomponent_get_uid (icalcomp); + + if (cal_client_get_object (client, uid, NULL, &tmp_icalcomp, NULL)) + return cal_client_modify_object (client, icalcomp, CALOBJ_MOD_ALL, NULL) + ? CAL_CLIENT_RESULT_SUCCESS : CAL_CLIENT_RESULT_CORBA_ERROR; + + return cal_client_create_object (client, icalcomp, &uid, NULL) + ? CAL_CLIENT_RESULT_SUCCESS : CAL_CLIENT_RESULT_CORBA_ERROR; +} + +static CalClientResult +update_objects (CalClient *client, icalcomponent *icalcomp) +{ + icalcomponent *subcomp; + icalcomponent_kind kind; + CalClientResult result; + + kind = icalcomponent_isa (icalcomp); + if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT) + return update_single_object (client, icalcomp); + else if (kind != ICAL_VCALENDAR_COMPONENT) + return CAL_CLIENT_RESULT_INVALID_OBJECT; + + subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT); + while (subcomp) { + kind = icalcomponent_isa (subcomp); + if (kind == ICAL_VTIMEZONE_COMPONENT) { + icaltimezone *zone; + + zone = icaltimezone_new (); + icaltimezone_set_component (zone, subcomp); + + result = cal_client_add_timezone (client, zone, NULL); + icaltimezone_free (zone, 1); + if (result != CAL_CLIENT_RESULT_SUCCESS) + return result; + } else if (kind == ICAL_VTODO_COMPONENT || + kind == ICAL_VEVENT_COMPONENT) { + result = update_single_object (client, subcomp); + if (result != CAL_CLIENT_RESULT_SUCCESS) + return result; + } + + subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT); + } + + return CAL_CLIENT_RESULT_SUCCESS; +} static void process_item_fn (EvolutionImporter *importer, @@ -220,20 +274,20 @@ process_item_fn (EvolutionImporter *importer, contains just tasks, we strip out the VEVENTs, which do not get imported at all. */ if (ici->folder_contains_events && ici->folder_contains_tasks) { - if (cal_client_update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS) + if (update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS) result = GNOME_Evolution_ImporterListener_BAD_DATA; } else if (ici->folder_contains_events) { GList *vtodos = prepare_events (ici->icalcomp); - if (cal_client_update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS) + if (update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS) result = GNOME_Evolution_ImporterListener_BAD_DATA; prepare_tasks (ici->icalcomp, vtodos); - if (cal_client_update_objects (ici->tasks_client, + if (update_objects (ici->tasks_client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS) result = GNOME_Evolution_ImporterListener_BAD_DATA; } else { prepare_tasks (ici->icalcomp, NULL); - if (cal_client_update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS) + if (update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS) result = GNOME_Evolution_ImporterListener_BAD_DATA; } @@ -598,7 +652,7 @@ gnome_calendar_import_data_fn (EvolutionIntelligentImporter *ii, /* Import the calendar events. */ /* FIXME: What do intelligent importers do about errors? */ if (ici->do_calendar) - cal_client_update_objects (calendar_client, icalcomp); + update_objects (calendar_client, icalcomp); /* @@ -606,7 +660,7 @@ gnome_calendar_import_data_fn (EvolutionIntelligentImporter *ii, */ prepare_tasks (icalcomp, vtodos); if (ici->do_tasks) - cal_client_update_objects (tasks_client, icalcomp); + update_objects (tasks_client, icalcomp); out: if (icalcomp) |