diff --git a/calendar/.cvsignore b/calendar/.cvsignore deleted file mode 100644 index b7f7dea650..0000000000 --- a/calendar/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile.in -Makefile -.deps -_libs -.libs -*.lo diff --git a/calendar/AUTHORS b/calendar/AUTHORS deleted file mode 100644 index e4fda3d3bc..0000000000 --- a/calendar/AUTHORS +++ /dev/null @@ -1,7 +0,0 @@ -Miguel de Icaza <miguel@kernel.org> -Federico Mena <federico@helixcode.com> -Arturo Esponosa <arturo@nuclecu.unam.mx> -Russell Steinthal <rms39@columbia.edu> -Rodrigo Moya <rodrigo@ximian.com> -JP Rosevear <jpr@ximian.com> -Damon Chaplin <damon@ximian.com> diff --git a/calendar/ChangeLog b/calendar/ChangeLog deleted file mode 100644 index 953642f7db..0000000000 --- a/calendar/ChangeLog +++ /dev/null @@ -1,18233 +0,0 @@ -2002-11-05 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend.c: use libxml2 headers. - - * gui/alarm-notify/Makefile.am: - * gui/dialogs/Makefile.am: - * gui/Makefile.am: s/XML_I18N/INTLTOOL. Fixed execution of - $(ORBIT_IDL). - - * gui/alarm-notify/alarm-notify.[ch]: converted to BonoboObject. - - * gui/alarm-notify/alarm-notify-dialog.c: compilation fixes. - (alarm_notify_dialog): adapted to new glade_xml_new signature. - - * gui/alarm-notify/alarm-queue.c: ported to BonoboActivation and - GtkStock and GtkDialog. - - * gui/alarm-notify/notify-main.c: ported to BonoboActivation and - use GObject functions instead of GtkObject ones. - - * gui/alarm-notify/save.h: removed BonoboConfig related functions. - - * gui/alarm-notify/config-data.c: use GObject functions instead of - GtkObject ones. - - * TODO.port: added file for keeping track of disabled things while we - port. - -2002-11-04 Rodrigo Moya <rodrigo@ximian.com> - - * cal-util/cal-util-marshal.list: added new marshallers. - - * cal-client/cal-client.c (get_objects_atomically): fixed calls to - g_signal_handler_disconnect_by_func. - (cal_client_class_init): fixed typos. - - * cal-client/cal-client-multi.[ch]: - * cal-client/cal-client-types.c: - * cal-client/cal-query.[ch]: ported to GObject. - - * cal-client/cal-listener.[ch]: converted to BonoboObject. - - * cal-client/Makefile.am: - * pcs/Makefile.am: fixed flags for orbit-idl - -2002-11-04 Rodrigo Moya <rodrigo@ximian.com> - - * cal-util/Makefile.am: - * cal-util/cal-util-marshal.list: added marshallers. - - * cal-client/cal-client.[ch]: ported to GObject. - -2002-11-04 Rodrigo Moya <rodrigo@ximian.com> - - * cal-util/cal-component.[ch]: ported to GObject. - - * cal-util/cal-util.c (cal_util_generate_alarms_for_comp): use - g_object_* instead of gtk_object_*. - -2002-11-03 Rodrigo Moya <rodrigo@ximian.com> - - * cal-client/cal-client.c (get_default_uri): use EConfigListener - instead of BonoboConfig. - - * cal-client/cal-client.c: - * cal-client/cal-listener.[ch]: - * cal-client/query-listener.c: warning free. - -2002-11-03 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-util.[ch]: don't use BonoboConfig, but - EConfigListener. - - * gui/calendar-config.c: use /apps/Evolution prefix for all - configuration keys. - -2002-10-31 Rodrigo Moya <rodrigo@ximian.com> - - * cal-util/cal-component.[ch]: - * cal-util/cal-recur.h: - * cal-util/cal-util.[ch]: - * cal-client/cal-client.h: - * cal-client/cal-client-multi.h: - * cal-client/cal-client-types.[ch]: - * cal-client/cal-listener.h - * cal-client/cal-query.[ch]: - * cal-client/query-listener.h: - * pcs/cal.h: - * pcs/cal-backend.[ch]: - * pcs/cal-backend-file.h: - * pcs/cal-backend-util.h: - * pcs/cal-common.h: - * pcs/cal-factory.h: - * pcs/query.[ch]: - * pcs/query-backend.[ch]: started GNOME 2 porting. - cal-util, cal-client and pcs compiled ok. - - * cal-client/cal-client.c (cal_client_construct): - * pcs/cal-factory.c: use b-a instead of OAF and bonobo-config - instead of bonobo-conf. - -2002-10-29 Rodrigo Moya <rodrigo@ximian.com> - - * gui/gnome-cal.c (backend_died_cb): cleaned up the status bar - messages for all widgets. - -2002-10-24 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (init): initialize new values - (clean_up): free new values - (find_my_address): if we have a delegator address, use it instead - (write_html): display delegator info to user - (show_current_event): if we have a calendar uri, use that and - describe the event differently - (show_current_todo): ditto - (show_current): search for delegator X properties - (e_itip_control_set_delegator_address): accessor - (e_itip_control_get_delegator_address): ditto - (e_itip_control_set_delegator_name): ditto - (e_itip_control_get_delegator_name): ditto - (e_itip_control_set_calendar_uri): ditto - (e_itip_control_get_calendar_uri): ditto - - * gui/e-itip-control.h: add protos - - * gui/itip-utils.c (comp_from): use the first attendee as the from - address for things other than request, cancel and add (use - organizer) and publish (use default address) - -2002-10-23 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #32613 - - * gui/component-factory.c (sc_user_create_new_item_cb): use the - default calendar/tasks folder to activate the component editor. - (get_data_uri): deal correctly with the URIs being used. - -2002-10-23 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (show_current): fix warning - -2002-10-22 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #32371 - - * pcs/query.c (start_cached_query_cb): CORBA_exception_init the - CORBA_Environment before using it. - -2002-10-22 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-factory.c (lookup_backend): use NULL for pointer instead of - FALSE. - -2002-10-22 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (get_address): use e_config_listener_* to get - values - (itip_addresses_get): ditto - (itip_addresses_get_default): ditto - - * gui/calendar-model.c (calendar_model_value_to_string): don't - send back a null string (affects if it is the group header) - (calendar_model_init): pre load config database info so we don't - do corba calls during draws - - Fixes #32276 - -2002-10-17 JP Rosevear <jpr@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_construct): fix c/p type - -2002-10-17 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/recurrence-page.c (fill_ending_date): if the value - is a datetime, convert it to a date - - * gui/itip-utils.c (comp_compliant): convert an UNTIL date value - to a datetime value - - * cal-util/cal-component.c (cal_component_has_simple_recurrence): - check to see if the component recurrences meet our definition of - "simple" - - * cal-util/cal-component.h: new proto - -2002-10-17 Rodrigo Moya <rodrigo@ximian.com> - - * gui/dialogs/recurrence-page.c (fill_component): changed to have a - gboolean return type, which is what it's supposed to do. - (recurrence_page_fill_component): return the result from - fill_component. - - * gui/dialogs/comp-editor-page.h: fixed typo in function prototype. - -2002-10-11 JP Rosevear <jpr@ximian.com> - - * gui/gnome-cal.c - (gnome_calendar_on_date_navigator_selection_changed): try to - preserve the work week view setting if it makes sense - (set_view): don't update the info again based on our view change - call - - Fixes #16036 - -2002-10-08 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #11434 - - * gui/dialogs/comp-editor-page.[ch] - (comp_editor_page_display_validation_error): new function. - - * gui/dialogs/event-page.c (event_page_fill_component): - * gui/dialogs/recurrence-page.c (fill_component): - * gui/dialogs/task-details-page.c (task_details_page_fill_component): - * gui/dialogs/task-page.c (task_page_fill_component): added - checks for all date values, and return FALSE if we find - some invalid date/times. - - * gui/dialogs/comp-editor.c (save_comp): activate the page that - returns error in fill_component. - -2002-10-08 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/cal-prefs-dialog.c - (cal_prefs_dialog_create_time_edit): set the 24 hour format - initially - - Fixes #31812 - -2002-10-08 JP Rosevear <jpr@ximian.com> - - * gui/e-week-view.c: remove pilot settings from contextual menu - - * gui/e-day-view.c: ditto - -2002-10-07 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #31774 - - * gui/dialogs/alarm-options.c (dalarm_widgets_to_alarm, - palarm_widgets_to_alarm): use correct pointer in loop. - -2002-10-07 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/cal-prefs-dialog.c (setup_changes): cast the correct - item - -2002-10-07 Rodrigo Moya <rodrigo@ximian.com> - - Fixes crash in #19159 - - * gui/alarm-notify/alarm-queue.c (lookup_queued_alarm): don't crash if - we don't find the queued alarm in the internal list. - (alarm_trigger_cb, create_snooze, display_notification, - audio_notification, procedure_notification, remove_queued_alarm): - check return value from lookup_queued_alarm. - -2002-10-04 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #15892 - - * idl/evolution-calendar.idl: added notifyErrorOccurred method to - the Listener interface, so that backends can notify clients of errors - that can't be reported otherwise. - - * pcs/cal.[ch] (cal_notify_error): new function. - - * pcs/cal-backend-file.c (save): made to save to temporary file and - then moved to the correct file, so that we don't lose any data if - there's a problem while saving. - (notify_error): new function for notifying error messages to clients. - - * cal-client/cal-listener.[ch]: added new callback function for getting - error messages from backends. - (impl_notifyErrorOccurred): new method implementation. - (cal_listener_class_init): initialize new epv member. - (cal_listener_init, cal_listener_destroy, cal_listener_construct, - cal_listener_new): initialize new function pointer. - - * cal-client/cal-client.[ch]: adapted to changes in CalListener class. - (cal_client_class_init): added "backend_error" signal to CalClient class. - (backend_error_cb): callback for "error_occurred" signal on the CalListener, - which just emits the "backend_error" signal of CalClient. - - * gui/gnome-cal.c (gnome_calendar_construct): connect to "backend_error" - signal on the CalClient's we create. - (backend_error_cb): display error message on error from backend. - - * gui/e-tasks.c: likewise. - -2002-10-02 Rodrigo Moya <rodrigo@ximian.com> - - * gui/alarm-notify/notify-main.c (alarm_notify_factory_fn): removed - unneeded g_assert which was preventing the alarm daemon to - start correctly in some cases. - -2002-10-02 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #30057 - - * cal-client/cal-client.c (cal_client_is_read_only): added check - of the status of the client before trying to make CORBA calls. - - * gui/calendar-commands.c (sensitize_calendar_commands, - sensitize_taskpad_commands): - * gui/tasks-control.c (sensitize_commands): - * gui/dialogs/event-editor.c (set_menu_sens): - * gui/dialogs/task-editor.c (set_menu_sens): - * gui/e-calendar-table.c (e_calendar_table_on_right_click): - * gui/e-day-view.c (e_day_view_on_event_right_click): - * gui/e-week-view.c (e_week_view_show_popup_menu): take into account - the read-onlyness of clients to disable/enable menu items. - -2002-10-01 Rodrigo Moya <rodrigo@ximian.com> - - * idl/evolution-calendar.idl: added isReadOnly method to Cal - interface. - - * pcs/cal.c (impl_Cal_is_read_only): new method implementation. - - * pcs/cal-backend.[ch]: added is_read_only method to CalBackend class. - (cal_backend_is_read_only): new function. - - * pcs/cal-backend-file.c (cal_backend_file_is_read_only): new method. - (cal_backend_file_class_init): set new signal's virtual method. - - * cal-client/cal-client.[ch] (cal_client_is_read_only): new function. - -2002-10-01 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #15710 - - * gui/dialogs/alarm-page.c (alarm_page_init): added a - X-EVOLUTION-NEEDS-DESCRIPTION property, so that we later set it - correctly if it hasn't been set in the meanwhile (editing options for - the alarm). - - * gui/dialogs/alarm-options.c (dalarm_widgets_to_alarm, - palarm_widgets_to_alarm): removed X-EVOLUTION-NEEDS-DESCRIPTION - property from alarms every time we set the description of the alarm. - -2002-10-01 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #30290 - - * importers/icalendar-importer.c (process_item_fn): return a status of - BUSY rather than NOT_READY, to avoid the display of the error message. - -2002-09-30 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c - (calconduit_load_configuration): load multi_day_split - (calconduit_save_configuration): save it - (calconduit_dupe_configuration): copy it - (e_cal_gui_new): create gui for it - (e_cal_gui_fill_widgets): fill gui with value - (e_cal_gui_fill_config): get value from gui and store in config - (e_calendar_context_destroy): destroy new_cfg and gui properly - (process_multi_day): skip item if its multi-day and we don't want - to split - (fill_widgets): fill local config widgets - (create_settings_window): create local config widgets - (save_settings): fill config from local widgets - - Fixes #23763 - -2002-09-30 Aaron Weber <aaron@ximian.com> - - * gui/e-itip-control.c (update_item): adjust string on line 1609 - and 1517. - - * gui/dialogs/alarm-options.glade: rephrase string on line 270 - -2002-09-27 Dan Winship <danw@ximian.com> - - * gui/calendar-commands.c (pixmaps): Remove "/Toolbar/New" and - "/Toolbar/NewTask" since they're not there any more. Kills some - bonobo-ui spewage. - -2002-09-26 Dan Winship <danw@ximian.com> - - Non-Connector part of #29334 (meeting created by a delegate in the - delegator's calendar should have the delegator as Organizer). - - * idl/evolution-calendar.idl: add Cal_getEmailAddress, to return - the email address associated with a backend (if any). - - * pcs/cal-backend.c (cal_backend_get_email_address): New. - - * pcs/cal-backend-file.c (cal_backend_file_get_email_address): - Return NULL (for now). - - * pcs/cal.c (impl_Cal_get_email_address): Implement this by - calling cal_backend_get_email_address and returning a NotFound - exception if it returns NULL. - - * cal-client/cal-client.c (cal_client_get_email_address): New. - (cal_client_init, cal_client_destroy, etc): initialize/free - email_address - - * gui/dialogs/event-editor.c (event_editor_construct): Split this - out of event_editor_init. Take and set a CalClient. - (event_editor_new): Take a CalClient. - - * gui/dialogs/task-editor.c (task_editor_construct, - task_editor_new): Likewise. - - * gui/dialogs/meeting-page.c (meeting_page_new, - meeting_page_construct): Take a CalClient and call - cal_client_get_email_address to find the default organizer - address. (Also fix a bug if the default account's name has - non-ASCII characters.) - - * gui/itip-utils.c (comp_from): New. When sending a REQUEST or - CANCEL, use the Organizer as the From address. - (itip_send_comp): Call comp_from and pass the result to - Composer_setHeaders. - - * gui/comp-editor-factory.c (edit_existing, edit_new): Pass the - CalClient to event_editor_new/task_editor_new - - * gui/e-calendar-table.c (open_task): Likewise. - - * gui/e-tasks.c (e_tasks_new_task): Likewise. - - * gui/gnome-cal.c (gnome_calendar_edit_object, - gnome_calendar_new_task): Likewise. - -2002-09-26 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.c (set_value_at): only change the attendee - value if it isn't empty - -2002-09-26 Rodrigo Moya <rodrigo@ximian.com> - - Should fix once for all #24210 - - * idl/evolution-calendar.idl: changed the notifyObjUpdated method - of the QueryListener interface accept a list of UIDs. - - * cal-client/query-listener.[ch] (impl_notifyObjUpdated): likewise for - the QueryListener class. - - * cal-client/cal-query.c (obj_updated_cb): changed to adapt the - multiple-id's received in the QueryListener class' signal to the - one-by-one update notification of the public CalQuery class, thus - keeping the changes needed for this minimal. - - * pcs/query.c (add_component, start_cached_query_cb): changed to - send sequences of UIDs. - -2002-09-25 Dan Winship <danw@ximian.com> - - * gui/component-factory.c (folder_types): Add "calendar/public" - and "tasks/public". - (type_is_calendar, type_is_tasks): New utility functions - (create_view, create_folder, remove_folder, xfer_folder, - sc_user_create_new_item_cb): Use type_is_calendar/type_is_tasks - - * importers/icalendar-importer.c (get_uri_from_folder_path): allow - importing into public calendar/task folders too. - - * gui/e-itip-control.c: Note that it's intentional that we use - "calendar" and "tasks" here instead of "calendar/*" and "tasks/*". - (31032) - -2002-09-25 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (itip_send_comp): if the item being sent is not - a meeting, send it as a mixed item with a description and the - calendar text in an attachment - - Fixes #30638 - -2002-09-25 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #27961 - - * pcs/cal-backend-file.c (cal_backend_file_update_object): set the - LAST-MODIFIED time of the components when we save them. - -2002-09-24 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-file.c (cal_backend_file_get_timezone_object, - cal_backend_file_get_timezone): return a builtin timezone if we - don't find the timezone in our component. - -2002-09-24 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (comp_from_remote_record): - make sure the start/end for no time palm events are DATE values, - tidy code slightly - - Fixes #21631 - -2002-09-24 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (process_multi_day): - convert to date values if the original start and end were both - dates - -2002-09-24 Rodrigo Moya <rodrigo@ximian.com> - - * cal-client/cal-query.c (cal_query_destroy): unref the query - since now the query object on the server keeps a copy of it and - must know when the listener is no longer valid. - - * pcs/query.c (listener_died_cb): unref the QueryListener object. - (query_construct): create an EComponentListener for the non-cached - queries' listeners also. - -2002-09-23 JP Rosevear <jpr@ximian.com> - - * conduits/todo/Makefile.am: add libeutil to the link - - * conduits/calendar/Makefile.am: ditto - -2002-09-23 Dan Winship <danw@ximian.com> - - * pcs/cal.c (imple_Cal_update_objects, impl_Cal_remove_object): - fix non-ANSI switch statements. - - * gui/e-meeting-model.c (is_cell_editable, value_is_empty, - process_free_busy_comp): Likewise - - * gui/itip-utils.c (comp_compliant): Likewise. - -2002-09-23 Rodrigo Moya <rodrigo@ximian.com> - - * gui/main.c (launch_alarm_daemon): install an idle callback that will - start the alarm daemon. - (launch_alarm_daemon_cb): actually activate the alarm daemon here. - - * pcs/query.c (start_cached_query_cb): remove timeout function always - and re-add it if the query is in progress. - -2002-09-23 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/query.c (start_cached_query_cb): move success notification code - to its own code block, since it was being run for parse errors also. - Also, remove all traces of the query from the cache if there is an - error. Also, use GINT_TO_POINTER instead of GPOINTER_TO_INT. - -2002-09-23 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #28310 - - * gui/alarm-notify/save.c (save_notification_time): only save the - new notification time if it is bigger than the already saved one. - This should avoid some reminders showing up twice. - -2002-09-20 JP Rosevear <jpr@ximian.com> - - * gui/comp-util.c (cal_comp_is_on_server): check to see if the - component is already on the server or not - - * gui/comp-util.h: change proto - - * gui/e-week-view.c (e_week_view_on_editing_stopped): only delete - the event if the summary is empty and the component is not already - on the server - - * gui/e-day-view.c (e_day_view_on_editing_stopped): same - - Fixes #14111 - -2002-09-20 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c (meeting_page_fill_widgets): set the - deleted attendees array to size 0 after we clean it up - - Fixes #30479 - -2002-09-20 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/query.c (parse_sexp): remove the query from the cache if it - failed. - (start_cached_query_cb): notify of errors in the query. - -2002-09-19 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/query.c: added a list of EComponentListener's to control the - lifetime of the listeners. - (query_init): initialize new member. - (query_destroy): free new member. - (start_cached_query_cb): create a EComponentListener for the new - listener being added. - -2002-09-19 Rodrigo Moya <rodrigo@ximian.com> - - More fixes for #24210 - - * pcs/query.c: added list of cached queries and changed the Query - class to work with several listeners, not only one. - (query_init): initialize new members. - (query_destroy): free new members. - (add_component, remove_component, parse_sexp, match_component, - process_components_cb): notify all listeners. - (notify_uid_cb, start_cached_query_cb): implemented integration of - cached queries. - (query_new): search the query in the cache before creating a new - one. And if we create a new one, store it in the cache. - -2002-09-19 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/recurrence-page.c (simple_recur_to_comp): bump the - month_num by 1 because it indexs at 0 - (recurrence_page_fill_widgets): lower the month_num by one as above - - Fixes #30381 - -2002-09-17 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #26362 - - * gui/e-itip-control.c (show current): add a default reminder if - default reminders are set in the configuration. - -2002-09-11 JP Rosevear <jpr@ximian.com> - - * gui/e-day-view.c (e_day_view_on_top_canvas_button_press): keep - the selection if we right click in it (but not on an appointment) - (e_day_view_on_main_canvas_button_press): ditto - - * gui/e-week-view.c (e_week_view_on_button_press): same - -2002-09-11 JP Rosevear <jpr@ximian.com> - - * gui/e-week-view.c (e_week_view_new_appointment): create a new - appointment based on the selection - (e_week_view_on_button_press): use above - (e_week_view_on_new_appointment): ditto - (e_week_view_on_new_meeting): ditto - - Fixes #18162 - -2002-09-10 JP Rosevear <jpr@ximian.com> - - * gui/comp-editor-factory.c (get_default_event): duh, don't - blindly increment the hour without adjusting for the day - boundaries - - Fixes #29983 - -2002-09-10 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #24032 - - * gui/e-itip-control.c (init): don't get servers here, since we don't - know the type of the component(s) to be loaded. - (show_current): get servers here. - (destroy): only free stuff that needs to be freed. - -2002-09-09 Rodrigo Moya <rodrigo@ximian.com> - - * gui/gnome-cal.c (client_cal_opened_cb): display status messages for - all operations we make, so that when using remote slow backends, so - that users have always indication of what's happening. - -2002-09-06 JP Rosevear <jpr@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_edit_object): kill warning - - * gui/e-week-view.h: new proto - - * gui/e-week-view.c (e_week_view_set_selected_time_range_visible): - select a range of time in the currently visible area, if out side - the visible area, select as much as possible - (e_week_view_on_text_item_event): call above - - * gui/e-week-view-event-item.c - (e_week_view_event_item_button_press): call above - - * gui/e-day-view.c - (e_day_view_set_selected_time_range_in_top_visible): select a - range of time in the currently visible area, if out side the - visible area, select as much as possible - (e_day_view_set_selected_time_range_visible): the same for the - main canvas - (e_day_view_on_long_event_button_press): call above - (e_day_view_on_event_button_press): ditto - -2002-09-05 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (itip_send_comp): don't try to send via the - server if we are publishing; don't bail out on a 0 length to list - if we are publishing - -2002-09-05 Anna Marie Dirks <anna@ximian.com> - - * gui/GNOME_Evolution_Calendar.oaf.in: Changed the description of - the calendar/tasks page of the settings dialog, to be hopefully - more descriptive and less awkwardly worded. - - -2002-09-05 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view.c (e_day_view_on_drag_data_get): added support for - text/x-calendar targets, in which case a VCALENDAR component, with - full timezone information is returned. - -2002-09-04 JP Rosevear <jpr@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_destroy): don't listen to client - signals after we get destroyed - - Fixes #17036 - -2002-09-04 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/event-editor.c (event_editor_send_comp): bail out if - we couldn't send the cancel - - * gui/dialogs/task-editor.c (task_editor_send_comp): ditto - - * gui/dialogs/comp-editor.c (save_comp_with_send): indicate send - status - (real_send_comp): return success/fail, only resave the component a - if we successfully sent - (comp_editor_send_comp): return success/fail - - * gui/itip-utils.h: update proto - - * gui/itip-utils.c (itip_send_comp): return true if we sent the - message - -2002-09-04 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (comp_server_send): provide error message - param, give a dialog with the message if we get a busy result; - return TRUE if we succeed - (itip_send_comp): bail out if we had a problem sending via the - server - - * cal-client/cal-client.c (cal_client_send_object): pass back - error message if we get the busy exception in the new param - - * cal-client/cal-client.h: update proto - - * pcs/cal.c (impl_Cal_send_object): dump backend error message - into Busy exception - - * pcs/cal-backend.h: update proto - - * pcs/cal-backend.c (cal_backend_send_object): take/pass new error - message parameter - - * pcs/cal-backend-file.c (cal_backend_file_send_object): take new param - - * idl/evolution-calendar.idl: add errorMsg to Busy exception - -2002-09-04 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (create_object): Pass NULL as - @unpopulate_folder_context_menu_fn to - evolution_shell_component_new(). - -2002-09-03 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (comp_compliant): don't make the reply - component minimal - - Fixes #28956 - -2002-08-30 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (itip_send_comp): make the sure to list is 0 - length before sending via imip - - Fixes #29624 - -2002-08-30 Mike Kestner <mkestner@ximian.com> - - * gui/dialogs/event-page.c: - * gui/dialogs/task-page.c: use bonobo_object_release_unref to release - the remote SelectNames component, not CORBA_Object_release. - -2002-08-29 JP Rosevear <jpr@ximian.com> - - * gui/e-day-view.c (e_day_view_on_top_canvas_button_press): select - the top canvas if the user right-clicks on it - (e_day_view_on_main_canvas_button_press): select the row the user - is right-clicking on - (e_day_view_on_long_event_button_press): select the top canvas if - the user right-clicks on an event there - (e_day_view_on_event_button_press): select the relevant rows if - the user right-clicks on an event - (e_day_view_set_selected_time_range_in_top): select a number of - days in the top canvas - - * gui/e-week-view.c (e_week_view_on_button_press): select the day - the user is right-clicking on - (e_week_view_on_text_item_event): select the corresponding time - range when showing the contextual menu for an event - - * gui/e-week-view-event-item.c - (e_week_view_event_item_button_press): select the corresponding - time range when showing the contextual menu for an event - - Fixes #14660 - -2002-08-28 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view.c: - * gui/e-week-view.c: added missing header file. - -2002-08-28 Dan Winship <danw@ximian.com> - - * gui/GNOME_Evolution_Calendar.oaf.in: Add an - evolution:shell_component_launch_order and rename - evolution:shell_component_icon. - -2002-08-27 Rodrigo Moya <rodrigo@ximian.com> - - * gui/calendar-config.c: use EConfigListener instead of direct access - to the bonobo-conf database. - (calendar_config_init): create the EConfigListener here, and install - an atexit function to unref the config listener object. - (config_read, property_change_cb, calendar_config_write, - calendar_config_write_on_exit): removed unneeded functions. - (calendar_config_get_*, calendar_config_set_*): changed to make use of - EConfigListener directly. - - * gui/main.c (main): removed call to calendar_config_write_on_exit. - - * gui/dialogs/cal-prefs-dialog.c (update_config): removed call to - calendar_config_write. - -2002-08-26 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #12326 - - * gui/alarm-notify/config-data.c (ensure_inited): create a - EConfigListener for configuration access. - (do_cleanup): g_atexit installed function, to clean up configuration - database resources. - (config_data_get_timezone): retrieve the configuration for the - EConfigListener object. - (config_data_get_listener): new function. - - * gui/alarm-notify/save.c (get_config_db, discard_config_db): removed. - Use EConfigListener instead. - (save_notification_time, get_saved_notification_time, - save_calendars_to_load, get_calendars_to_load, save_blessed_program, - is_blessed_program): use EConfigListener. - - * gui/alarm-notify/notify-main.c (init_alarm_notify_service): removed. - (alarm_notify_factory_fn): create here the alarm_notify_service if it - hasn't been created yet. - (load_calendars): likewise. - (main): don't call init_alarm_notify_service. - -2002-08-22 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.c (process_section): if its a - non-participant, add it as a resource to match dialog label - (set_value_at): if the type is set to be a resource, switch the - role to non-participant by default - -2002-08-22 JP Rosevear <jpr@ximian.com> - - * gui/calendar-model.c (set_completed): if the value given is a - date, convert to a time in the current zone - -2002-08-20 JP Rosevear <jpr@ximian.com> - - * gui/tasks-control.c (tasks_control_activate): don't set the - tasks ui component until the container is set, remove unused - pixmaps - -2002-08-19 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.c (destroy): disconnect destroy signal - callbacks on tables - - Fixes #28231 - -2002-08-19 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (comp_toplevel_with_zones): clone the ical - component before adding it - - Fixes #29061 - -2002-08-19 JP Rosevear <jpr@ximian.com> - - * gui/comp-editor-factory.c (get_default_event): make sure to get - the date in the current zone, not at UTC - - Fixes #17692 - -2002-08-19 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (set_date_label): stop adding redundant - information for start/end/due/complete times - (write_html): convert newlines properly and escape characters for - summary, location, description; put text information on separate - line from bolded title to make it look nicer when there are line - breaks - - Fixes #26964 - -2002-08-16 Rodrigo Moya <rodrigo@ximian.com> - - * cal-client/cal-client.[ch]: added internal EComponentListener - object, to listen for the activated Cal. - (cal_client_class_init): added "backend_died" signal. - (cal_client_destroy): clean up component listener. - (backend_died_cb): new callback for getting signals from the - EComponentListener. - (cal_opened_cb): setup component listener. - - * cal-client/Makefile.am: added libetuil to needed LIBS. - - * gui/gnome-cal.c (backend_died_cb): new callback. - (gnome_calendar_construct): connect to "backend_died" signal - on all CalClient's we create. - -2002-08-14 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/cal-prefs-dialog.c (init_widgets): listen for the - time editors to change - (cal_prefs_dialog_start_of_day_changed): make sure the start is - never after the end - (cal_prefs_dialog_end_of_day_changed): make sure the end is never - after the start - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_set_working_hours): make sure to show a - minimum of 1 hour for work day - - * gui/e-day-view-main-item.c (e_day_view_main_item_draw): - calculate the work/not working color boxes to the nearest pixel, - rather the the nearest time division - - Fixes #10286, #26285 - -2002-08-13 Dan Winship <danw@ximian.com> - - * gui/e-itip-control.c: Remove a bunch of old #if 0 code. - (update_item): Set X-MICROSOFT-CDO-REPLYTIME here. - - * gui/itip-utils.c (comp_toplevel_with_zones): Don't set it here. - - * cal-util/cal-component.c (ensure_mandatory_properties): Use - icaltime_current_time_with_zone rather than rolling our own. - (cal_component_strip_errors): Remove unused variable. - -2002-08-13 Rodrigo Moya <rodrigo@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_open): set status message on - ECalendarTable when opening the tasks. - (client_cal_opened_cb): set ECalendarTable status message to NULL - when we open the tasks folder. Also, clear up calendar status message - in all cases, not only if the folder was opened successfully. - -2002-08-13 Rodrigo Moya <rodrigo@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_open): set status message to NULL - if there is an error opening the calendar. - (client_cal_opened_cb): set status message to NULL only when we have - successfully opened the main CalClient. - -2002-08-09 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/comp-editor.c (real_send_comp): set the editor to - changed so the item actually gets saved - -2002-08-08 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (users_has_attendee): check for an attendee in - the list - (comp_to_list): only add the user if they aren't on the list - (comp_server_send): don't remove the users, pass back the list - (itip_send_comp): send to server before doing comp_minimal - - * gui/dialogs/comp-editor.c (real_send_comp): edit and save the - updated comp - - * pcs/cal.c (impl_Cal_send_object): copy the correct item to pass - back - -2002-08-08 Dan Winship <danw@ximian.com> - - * pcs/query-backend.c (query_backend_new): Initialize - loaded_backends before using it. (Just kills off a harmless - g_warning.) - -2002-08-08 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #15710 - - * cal-util/cal-component.[ch] - (cal_component_alarm_get_icalcomponent): new function for getting - the icalcomponent from a CalComponentAlarm. - - * gui/comp-util.c (cal_comp_event_new_with_defaults): added - X-EVOLUTION-NEEDS-DESCRIPTION property to the default reminder - alarm, so that we can identify it when saving the component. - - * gui/dialogs/alarm-page.c (alarm_page_fill_component): if the - alarm has the X-EVOLUTION-NEEDS-DESCRIPTION property, set the - description to be the same as of the component. - -2002-08-07 JP Rosevear <jpr@ximian.com> - - * pcs/cal-backend-file.c (cal_backend_file_send_object): just - return the object untouched since we don't send anything - - * pcs/cal-backend.c (cal_backend_remove_object): call virtual method - - * pcs/cal-backend.h: add send result codes, new proto - - * pcs/cal.c (impl_Cal_send_object): implement sendObject corba call - (cal_class_init): add to epv - - * gui/itip-utils.c (comp_toplevel_with_zones): utility function to - create icalcomponent with necessary timezone info - (comp_has_attendee): see if attendee is in the attendee list - (comp_server_send): use above and remove attendees if the server - sends them - - * gui/e-itip-control.c (show_current_todo): remove unused var - - * idl/evolution-calendar.idl: add Busy exception and - - * cal-client/cal-client.c (cal_client_send_object): send object - via the server (if the server can) - - * cal-client/cal-client.h: add send results and new proto - -2002-08-05 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/query-backend.[ch] (query_backend_get_object_component): new - function. - (query_backend_get_uids): new function. - (query_backend_new): create the static GHashTable if it hasn't been - created yet. - (query_backend_destroy): destroy the static GHashTable if empty. - (foreach_uid_cb): call object_updated_cb, which does everything. - - * pcs/query.c: make use of the new QueryBackend class. - (query_init): initialize new private structure member. - (query_destroy): clean up new member, without freeing it, since it is - managed internally in query-backend.c. - (query_construct): create a QueryBackend for the query. - -2002-08-04 Rodrigo Moya <rodrigo@ximian.com> - - Fixes the crash in #19159 - - * gui/alarm-notify/alarm-queue.c (create_snooze): check for NULL - pointers before using them. - -2002-08-02 JP Rosevear <jpr@ximian.com> - - * gui/e-week-view.c (e_week_view_init): don't warn if we can't use - the small font, just set use_small_font to FALSE - -2002-08-02 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (adjust_item): new util function to add - information to an itip message that might not already be there for - display purposes (summary, location, etc) - (show_current_event): use above - (show_current_todo): ditto - -2002-08-02 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.c (init): initialize value to corba nil - -2002-08-01 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (create_object): Use - meeting-request-16.png instead of meeting-request.png. - - * gui/calendar-commands.c (pixmaps): Remove pixmaps in - /menu/File/New/NewFirstItem/. - -2002-08-01 JP Rosevear <jpr@ximian.com> - - * gui/calendar-model.c (is_overdue): use get_due_status - (get_color): ditto - (get_due_status): utility function to reduce replicated code, - handle the case where the due date is just a date - -2002-07-31 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/query-backend.[ch]: new class for implementing a backend cache - for the calendar queries. - - * pcs/Makefile.am: added new files. - -2002-07-31 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (create_object): Change the order of the - user creatable items a bit so that "New Appointment" and "New - Meeting" are at the top when in a calendar folder. - -2002-07-31 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (add_creatable_item): New arg - @folder_type, pass it to - evolution_shell_component_add_user_creatable_item(). - (create_object): Set the right folder types for the various - user-creatable items. - -2002-07-31 JP Rosevear <jpr@ximian.com> - - * gui/e-tasks.c (e_tasks_destroy): we no longer need to manually - save the state - (e_tasks_open): we no longer need to manually load the state - (display_view_cb): attach the gal view to the table - - Fixes #27894 - -2002-07-29 JP Rosevear <jpr@ximian.com> - - * gui/e-day-view.c (e_day_view_find_work_week_start): make sure - that the work week view goes to the current work week if the day - selected is before the start of the work week - - Fixes #20317 - -2002-07-28 Rodrigo Moya <rodrigo@ximian.com> - - * gui/dialogs/task-details-page.c: fixed mapping of popdown menu - to ICAL_STATUS_ values. - (task_details_page_fill_widgets): when we can't set the status, - default to ICAL_STATUS_NONE, which maps to 'Not started'. Fixed - use of 'percent' variable, which was being used after being freed. - (percent_complete_changed): default to ICAL_STATUS_NONE (Not Started). - - * gui/dialogs/task-details-page.glade: added 'Needs Action' to - popdown menu values. - -2002-07-26 Rodrigo Moya <rodrigo@ximian.com> - - * cal-util/cal-util.[ch] (cal_util_add_timezones_from_component): - new function for adding VTIMEZONE components to a VCALENDAR - component. - - * gui/e-calendar-table.c (copy_row_cb): added VTIMEZONE components - to resulting VCALENDAR top-level component. - - * gui/e-week-view.c (e_week_view_copy_clipboard): copy to the - clipboard a top-level VCALENDAR component, with all the needed - VTIMEZONE components. - (e_week_view_on_copy): likewise. - - * gui/e-day-view.c (e_day_view_copy_clipboard): likewise. - (e_day_view_on_copy): likewise. - -2002-07-26 JP Rosevear <jpr@ximian.com> - - * cal-client/cal-client.c (cal_client_construct): remove useless - debug statement - - Probably fixes #19333 - -2002-07-26 JP Rosevear <jpr@ximian.com> - - * gui/comp-editor-factory.c (impl_editExisting): focus the editor - if it does exist, create a new one if it doesn't (not vice-versa) - - Fixes #23468 - -2002-07-25 JP Rosevear <jpr@ximian.com> - - * gui/e-day-view.c (e_day_view_init): set large_font to NULL - (e_day_view_style_set): calculate large font, fall back to the - style->font if necessary - - Fixes #11773 - -2002-07-24 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (write_html): display the location in the - itip information - - Fixes #24690 - -2002-07-24 JP Rosevear <jpr@ximian.com> - - * gui/calendar-model.c (set_percent): set status to in progress if - the percent is between 0 and 100 - (set_status): if the value is set to in process, change the - percent to 50 - - Fixes #1590 - -2002-07-24 JP Rosevear <jpr@ximian.com> - - * cal-util/timeutil.c (time_day_of_year): add a day for the leap - year only if we are currently counting Feb., not if the month - passed in is Feb. Fixes #23446. - -2002-07-23 JP Rosevear <jpr@ximian.com> - - * gui/e-day-view.c (e_day_view_realize): use proper meeting icon - -2002-07-22 Dan Winship <danw@ximian.com> - - * pcs/Makefile.am: Split pcs-backend-file out of libpcs and build - it as a separate (noinst) library libpcsfile.a. This gets the db3 - dependencies out of libpcs, and people trying to create a calendar - backend shouldn't be calling functions from the existing backends - anyway so there's no reason to install them. - - * cal-util/timeutil.c: Replace a bunch of old gnomecal functions - with the functionally identical ones from Connector. - -2002-07-18 Rodrigo Moya <rodrigo@ximian.com> - - * importers/icalendar-importer.c (get_uri_from_folder_path): if - there's an exception, continue with the next item. - -2002-07-08 Peter Williams <peterw@ximian.com> - - * cal-util/Makefile.am: Install libcal-util-static.la - and fix the -all-static flag to make it install statically. - - * pcs/Makefile.am: Install libpcs.a and its headers. - - * pcs/cal-backend-util.h: Same sort of include namespacing fix, - but for pcs. - - * pcs/cal.h: - * pcs/query.h: - * pcs/cal-factory.h: - * pcs/cal-backend.h: - * pcs/cal-backend-file.h: Same. - -2002-07-17 <jpr@ximian.com> - - * gui/calendar-model.c (calendar_model_value_at): use util - function to see if the user is the organizer - - * gui/dialogs/cancel-comp.c (cancel_component_dialog): add - deleting proto to indicate whether cancelling or deleting is the - primary operation - - * gui/dialogs/cancel-comp.h: update proto - - * gui/dialogs/comp-editor.c (delete_cmd): offer to cancel - - * gui/dialogs/task-editor.c (cancel_task_cmd): call - cancel_component_dialog with new param - - * gui/dialogs/event-editor.c (cancel_meeting_cmd): ditto - - * gui/e-week-view.c (e_week_view_on_editing_stopped): only update - request if user is organizer - (e_week_view_show_popup_menu): disable the meeting and meeting - organizer mask if appropriate - (e_week_view_delete_event_internal): offer to cancel the meeting - (e_week_view_on_cut): ditto - (selection_received): send request if its a meeting - - * gui/e-day-view.h: add meeting icon/mask - - * gui/e-day-view.c (e_day_view_on_event_right_click): disable the - meeting and meeting organizer mask if appropriate - (e_day_view_delete_event_internal): offer to cancel meeting - (e_day_view_on_cut): ditto - (e_day_view_finish_long_event_resize): only update request if user - is organizer - (e_day_view_reshape_long_event): add meeting icon to count - (e_day_view_reshape_day_event): ditto - (e_day_view_on_top_canvas_drag_data_received): only update request - if user is organizer - (e_day_view_on_main_canvas_drag_data_received): ditto - (selection_received): offer to send meeting info - - * gui/e-day-view-main-item.c - (e_day_view_main_item_draw_day_event): draw meeting icon if - appropriate (using dummy icon atm) - -2002-07-14 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #8001 - - * importers/icalendar-importer.c (connect_to_shell): new function for - connecting the importers (both iCal and vCal) to the shell, needed for - some information retrieval about the folders we're importing to. - (ical_importer_new, vcal_importer_new): call connect_to_shell. - (importer_destroy_cb): unref the shell client object. - (get_uri_from_folder_path): retrieve the uri from the storage - registry. - (check_folder_type): removed. - - * importers/Makefile.am: included libeshell to LIBS. - -2002-07-12 Peter Williams <peterw@ximian.com> - - * pcs/cal.c: Sigh, fix for the wombat.idl -> Evolution-Wombat.idl - rename here too. At least grep indicates that's all that needs to - be fixed. - -2002-07-08 Peter Williams <peterw@ximian.com> - - * gui/Makefile.am (INCLUDES): Change the -I flags to get - it to play nicely with the new Ebook header paradigm. - - * gui/dialogs/Makefile.am: Same. - - * gui/e-meeting-model.c: More of the same. - - * gui/dialogs/e-delegate-dialog.c: - * gui/dialogs/e-meeting-model.c: - * gui/dialogs/comp-editor-util.c: Fix include lines to get - ebook headers. - - * pcs/Makefile.am: Same. - -2002-07-02 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #16034 - - * gui/e-day-view.c (e_day_view_reshape_long_event): - (e_day_view_reshape_day_event): - * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): - * gui/e-week-view.c (e_week_view_reshape_event_span): - * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons): - Don't assume all categories have icons when allocating space for - the icons. - -2002-07-02 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (add_creatable_item): New arg @tooltip. - Pass it to evolution_shell_component_add_user_creatable_item(), - which now has a @tooltip arg. - (create_object): Added tooltips. - -2002-07-01 JP Rosevear <jpr@ximian.com> - - * gui/calendar-config.c (config_read): listen for timezone config - change - (property_change_cb): set the timezone if it changed elsewhere - - * gui/main.c (init_bonobo): call bonobo_activate because we make - bonobo related calls before the bonobo_main call - -2002-06-25 Rodrigo Moya <rodrigo@ximian.com> - - Fixes #25410 - - * gui/alarm-notify.c (AlarmNotify_removeCalendar): do proper - cleanup on removal of clients. - (alarm_notify_add_calendar): ditto. - -2002-06-27 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (comp_compliant): plug leak and actually use - the minimal comp we create - -2002-06-25 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/comp-editor-page.h: add back proto - - * gui/dialogs/comp-editor-page.c - (comp_editor_page_notify_needs_send): add page needs_send signal - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_on_invite_others_button_draw): check to - see if the button should be sensitive when drawing - (e_meeting_time_selector_construct): listen for the button draw - signal - - * cal-util/cal-component.c (cal_component_strip_errors): remove - X-LIC-ERROR x properties - - * cal-util/cal-component.h: new proto - - * gui/dialogs/meeting-page.c (change_clicked_cb): set needs_send - to true - (meeting_page_fill_widgets): set up gui based on if the user or - someone else is the organizer - (meeting_page_construct): read the addresses here for the combo - box - (get_widgets): explicitly set the value in list values - - * gui/dialogs/event-editor.c (set_menu_sens): base this on the - exist org and user org values of the comp editor - (event_editor_edit_comp): set up editable row restrictions on the - meeting model if the user is not an organizer, and don't set needs - send if we aren't the organizer initially - (model_row_changed_cb): set needs_send to true - (row_count_changed_cb): ditto - - * gui/dialogs/meeting-page.glade: update gui - - * gui/dialogs/comp-editor.c (save_comp_with_send): if the user is - not the organizer, REPLY rather than REQUEST - (comp_editor_set_existing_org): accessor - (comp_editor_get_existing_org): ditto - (comp_editor_set_user_org): ditto - (comp_editor_get_user_org): ditto - (real_edit_comp): determine if there is an existing organizer and - if the organizers is a user - (page_changed_cb): warn the user that changes may be discarded - (page_summary_changed_cb): ditto - (page_dates_changed_cb): ditto - - * gui/dialogs/comp-editor.h: new protos - - * gui/itip-utils.c (itip_organizer_is_user): determine if the - organizer of a component is a user - (itip_sentby_is_user): same for sentby field of organizer - (comp_sentby): use above routines instead - (comp_compliant): strip all X-LIC-ERROR fields generated by - libical - - * gui/e-meeting-model.c (is_cell_editable): if there is a list of - editable rows, allow only the status column of those rows to be - edited - (init): init edit_rows - (e_meeting_model_restricted_add): add an editable row to the model - (e_meeting_model_restricted_remove): remove an editable row - (e_meeting_model_restricted_clear): clear all editable rows - (e_meeting_model_etable_click_to_add): set the click to add arg on - all tables - (e_meeting_model_etable_from_model): track the tables - (table_destroy_list_cb): remove the table being destroyed from the - list - (table_destroy_state_cb): remove the table being destroyed from - the list - - * gui/e-meeting-model.h: new protos - - * gui/e-itip-control.c (update_attendee_status): kill warning - -2002-06-18 JP Rosevear <jpr@ximian.com> - - * zones.h: update for new zones - -2002-06-17 Rodrigo Moya <rodrigo@ximian.com> - - Fixes wombat crash (for JP and myself) - - * gui/gnome-cal.c (gnome_calendar_open): don't call add_alarms here, - since the client is not yet attached to the backend, and the alarm - daemon does unref the client before creating a new one. - (client_cal_opened_cb): call add_alarms here. - -2002-06-12 Rodrigo Moya <rodrigo@ximian.com> - - * gui/alarm-notify.c: added timeout_id to LoadedClient structure, to - keep track of the timeout function. - (retry_timeout_cb): don't use RetryData, but the LoadedClient. - (cal_opened_cb): ditto, and assigned lc->timeout_id to the return - value of g_timeout_add(). - (alarm_notify_add_calendar): destroy the timeout callback when - destroying the LoadedClient structure. - -2002-06-12 Jeffrey Stedfast <fejj@ximian.com> - - * pcs/cal-factory.c (open_fn): Free the uri_string once we're done - with it. - -2002-06-12 Kjartan Maraas <kmaraas@gnome.org> - - * gui/dialogs/cal-prefs-dialog.glade: Fix a typo. - -2002-06-10 Rodrigo Moya <rodrigo@ximian.com> - - * gui/alarm-notify/alarm-notify.c (alarm_notify_add_calendar): removed - already loaded client when asked to be opened again, and *really* - re-open it again. - -2002-06-04 Christopher James Lahey <clahey@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_setup_view_menus): - gal_view_menus_set_show_define_views (..., FALSE); - -2002-06-04 Christopher James Lahey <clahey@ximian.com> - - * gui/e-tasks.c (e_tasks_setup_view_menus), gui/gnome-cal.c - (gnome_calendar_setup_view_menus): Set the title of our - GalViewCollection. - -2002-06-03 Anna Marie Dirks <anna@ximian.com> - - * gui/dialogs/cal-prefs-dialog.glade: In an attempt to clean up the - config dialog (and to reduce its overall girth), I have re-laid-out the - calendar preferences dialog. It now conforms to standard Evolution - spacing and padding guidelines, and exhibits proper alignment, etc. - -2002-06-03 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/query.c: keep a reference to the Query object, to avoid - crashes when the queries are destroyed before finishing processing. - Fixes #25056. - -2002-05-26 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/comp-editor.h: update proto - - * gui/dialogs/comp-editor.c (comp_editor_get_comp): new function - to get base comp - - * gui/e-comp-editor-registry.c (e_comp_editor_registry_add): get - the base comp, not the current comp, don't unref it - (foreach_close_cb): block the signal, unblock it if the editor - could not be closed - (e_comp_editor_registry_close_all): fix preconditions - (editor_destroy_cb): get the base comp, not the current comp, - don't unref it - -2002-05-26 JP Rosevear <jpr@ximian.com> - - * gui/e-comp-editor-registry.c (e_comp_editor_registry_close_all): - if there are remaining items, return false - (foreach_close_cb): don't remove the item if it couldn't be closed - - * gui/e-comp-editor-registry.h: update proto - - * gui/component-factory.c (request_quit): return a boolean - indicating if everything was closed - - * gui/dialogs/comp-editor.h: update proto - - * gui/dialogs/comp-editor.c (comp_editor_close): return true if - the editor was closed, false otherwise - -2002-05-26 JP Rosevear <jpr@ximian.com> - - * gui/e-comp-editor-registry.[hc]: a registry of comp editors so - we can close them all centrally - - * gui/gnome-cal.c (gnome_calendar_init): there is no editor hash - now - (gnome_calendar_destroy): ditto - (gnome_calendar_edit_object): look for the event editor in the - registry, if it isn't there, create it and add it to the registry - - * gui/e-calendar-table.c (open_task): look for the task editor in - the registry, if it isn't there, create it and add it to the - registry - - * gui/component-factory.c (request_quit): close all open editors - (create_object): add a request_quit function to the shell - component - - * gui/comp-editor-factory.c (free_client): there is no - uid_comp_hash to free any more - (editor_destroy_cb): we get an OpenClient as callback data now, - reduce the editor count and destroy it if it is 0 - (edit_existing): don't create the Component, add the new editor to - the registry, increase the editor count - (edit_new): ditto - (open_client): set the editor count to 0 - (impl_editExisting): look in the registry for the editor - - * gui/Makefile.am: Build new sources - - * gui/main.c (main): create the registry - - * gui/dialogs/comp-editor.c (comp_editor_close): prompt to save - and then close dialog - - * gui/dialogs/comp-editor.h: new proto - - * gui/GNOME_Evolution_Calendar.oaf.in: remove dead summary stuff - -2002-05-24 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-file.c (save): check the value returned by - gnome_vfs_uri_to_string before using it. - (cal_backend_file_open): ditto. - -2002-05-20 Ettore Perazzoli <ettore@ximian.com> - - * gui/dialogs/event-editor.c (event_editor_init): Pass the - @component_pixmaps in so we give the new "Meeting" button an icon. - - * gui/dialogs/comp-editor.c (comp_editor_merge_ui): New arg - @component_pixmaps to pass in custom pixmaps. - -2002-05-20 Rodrigo Moya <rodrigo@ximian.com> - - * gui/alarm-notify/alarm-notify.c: - * gui/alarm-notify/notify-main.c: ported changes from evolution-1-0 - to make it work with reminders on remote backends. - - * pcs/cal-backend-file.c (cal_backend_file_open): check the string - returned by gnome_vfs_uri_to_string, which can be empty. If so, - return an error. - -2002-05-17 JP Rosevear <jpr@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_setup_view_menus): set the view - to the current view - -2002-05-16 Rodrigo Moya <rodrigo@ximian.com> - - * gui/gnome-cal.c (client_cal_opened_cb): added support for - CAL_CLIENT_OPEN_PERMISSION_DENIED error code. - (permission_error): new function to display 'Permission Denied' - error message when opening the calendar. - - * gui/e-tasks.c: likewise. - - * idl/evolution-calendar.idl: added PERMISSION_DENIED to Listener's - OpenStatus enumeration. - - * cal-client/cal-client.c (cal_opened_cb): added code for retrieving - 'Permission Denied' errors, and convert it to CalClientOpenStatus - values. - - * pcs/cal-factory.c (open_backend): added code for informing of - 'Permission Denied' errors. - -2002-05-16 Rodrigo Moya <rodrigo@ximian.com> - - * idl/evolution-calendar.idl: added PermissionDenied exception and - make it be raised in open, updateObjects and removeObject. - - * pcs/cal-backend.h: added CAL_BACKEND_OPEN_PERMISSION_DENIED to - CalBackendOpenStatus enumeration, added CalBackendResult enumeration. - - * pcs/cal.c: - * pcs/cal-backend.c: - * pcs/cal-backend-file.c: adapted to changes in update_objects and - remove_object methods. - - * cal-client/cal-client.[ch]: added CalClientResult enumeration. - (cal_client_update_object, cal_client_update_objects, - cal_client_remove_object): changed to return a CalClientResult. - - * conduits/calendar/calendar-conduit.c: - * calendar/conduits/todo/todo-conduit.c: - * importers/icalendar-importer.c: - * gui/dialogs/comp-editor.c: - * gui/calendar-model.c: - * gui/e-calendar-table.c: - * gui/e-day-view.c: - * gui/e-itip-control.c: - * gui/e-week-view.c: - * gui/comp-util.c: - * gui/e-tasks.c: - * gui/tasks-migrate.c: adapted to changes in cal_client_update_object(s) - and cal_client_remove_object. - -2002-05-15 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (create_object): Pass NULL as - @request_quit_fn. - -2002-05-14 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/schedule-page.c (schedule_page_construct): set the - working hours for the meeting time selector - -2002-05-14 JP Rosevear <jpr@ximian.com> - - * cal-util/cal-component.h: make the range datetime member a - struct not a pointer - - * cal-util/cal-component.c (cal_component_get_recurid): take a - pointer to a range - (cal_component_set_recurid): ditto - - * gui/itip-utils.c (comp_minimal): get/set the recurrence id - properly - -2002-05-09 Ettore Perazzoli <ettore@ximian.com> - - * gui/e-itip-control.c (get_servers): use - GNOME_Evolution_Storage__get_folderList instead of - GNOME_Evolution_Storage_getFolderList since I have now changed - that to be an attribute instead of a method. - -2002-05-07 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (start_calendar_server): start a server a - uri - (start_default_server): start a default server - (get_servers): get all clients for all folders of the given - type(s) - (find_server): locate a server for a particular uid - (init): get_servers, listen for object_requested signal - (destroy): destroy all clients - (write_html): put options is there own cell - (get_publish_options): place selector in if param is true - (get_request_options): ditto - (get_real_item): only try and look up the item if we know its in - the server - (show_current_event): find the server (if any) for the current - comp - (show_current_todo): ditto - (update_attendee_status): if there is no server for the comp, it - doesn't exist - (remove_item): ditto - (button_selected_cb): get a client for the selected folder - (object_requested_cb): draw the folder button in - - * gui/calendar-config.h: new protos - - * gui/calendar-config.c (calendar_config_default_tasks_folder): - get default tasks uri - (calendar_config_default_calendar_folder): get default calendar - uri - - * cal-client/cal-client.c (get_default_uri): use - cal_util_expand_uri - - * cal-util/cal-util.h: new proto - - * cal-util/cal-util.c (cal_util_expand_uri): tack on the file name - if its a file uri - -2002-05-03 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-tasks.c (e_tasks_delete_selected): - (e_tasks_complete_selected): show progress messages - on the status bar. - -2002-05-02 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/query.c: #include <gtk/gtkmain.h> to avoid warnings. - -2002-05-02 JP Rosevear <jpr@ximian.com> - - * gui/e-week-view.c (free_view_popup): only discard the popup if - we created one - -2002-05-02 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/query.c: refactored a bit, to not do things in idle loops. - -2002-05-01 JP Rosevear <jpr@ximian.com> - - * gui/print.c (print_day_details): modify the start and end hours - to accomodate all the events in the day - - * gui/e-day-view.c (free_view_popup): only discard the popup if we - created one - -2002-04-30 JP Rosevear <jpr@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_construct): remove setup_widgets - from here - (gnome_calendar_init): move setup_widgets back here - -2002-04-26 Jeffrey Stedfast <fejj@ximian.com> - - * gui/Makefile.am: Don't link to libibex anymore!! - -2002-04-24 JP Rosevear <jpr@ximian.com> - - * gui/e-day-view.c (e_day_view_on_pilot_settings): launch pilot - settings capplet - - * gui/e-week-view.c (e_week_view_on_pilot_settings): ditto - -2002-04-24 JP Rosevear <jpr@ximian.com> - - * gui/e-week-view.c (free_view_popup): free the view popup - (e_week_view_show_popup_menu): add the view popup to the - "main_item" menu and listen for destruction - - * gui/e-day-view.c (free_view_popup): as above - (e_day_view_on_event_right_click): as above - - * gui/e-week-view.h: add class member - - * gui/e-day-view.h: add a class member - - * gui/gnome-cal.h: new protos - - * gui/gnome-cal.c (set_view): set the instance view id properly - when switching views - (gnome_calendar_setup_view_popup): generate a view popup - (gnome_calendar_discard_view_popup): destroy a view popup - -2002-04-22 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal.c (impl_Cal_get_alarms_in_range): raise an exception if the - backend's method returns NULL, since we can't send a NULL pointer to - ORBit. - -2002-04-19 Anna Marie Dirks <anna@ximian.com> - - * gui/dialogs/cal-prefs-dialog.glade: Collapsed notebook into two pages - and added accelerators for everything, as part of my config dialog - polishing project - -2002-04-18 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/recurrence-page.c (simple_recur_to_comp): properly - handle -ve recurrence values - (month_num_submenu_selection_done_cb): track the current date in - use - (make_recur_month_num_submenu): make a submenu of dates - (make_recur_month_num_menu): make the date/relation option menu - (month_num_menu_selection_done_cb): update the date properly and - keep both option menus consistent - (month_day_menu_selection_done_cb): keep both option menus - consistent - (make_monthly_special): listen for selection done signal - (make_recurrence_special): destroy old month_num_menu - (recurrence_page_fill_widgets): properly handle -ve recurrence - values - -2002-04-18 JP Rosevear <jpr@ximian.com> - - * gui/e-day-view.c (e_day_view_on_settings): show the settings - - * gui/e-week-view.c (e_week_view_on_settings): ditto - - * gui/calendar-commands.c (control_util_show_settings): show the - settings dialog - - * gui/calendar-commands.h: new proto - - * gui/control-factory.c (control_factory_new_control): set the - control as object data on the calendar - -2002-04-17 Christopher James Lahey <clahey@ximian.com> - - * gui/e-calendar-table.c, gui/e-day-view.c, gui/e-week-view.c, - gui/dialogs/meeting-page.c: Updated these to match the new - EPopupMenu. - -2002-04-05 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend.[ch] (cal_backend_get_query): new method. - - * pcs/cal-backend-file.c (cal_backend_file_get_query): new method. - - * pcs/cal.c (impl_Cal_get_query): call the CalBackend's implementation - instead of calling query_new directly. - - * pcs/query.[ch]: fixed headers. - -2002-04-10 Dan Winship <danw@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_open): Fix this: Rodrigo's patch - used one of the functions I just removed. :) - -2002-04-10 Rodrigo Moya <rodrigo@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_open): use the default uri for - tasks (as stored in the configuration) when the calendar URI is not - a local one (connector, etc). - -2002-04-10 Dan Winship <danw@ximian.com> - - * cal-client/cal-client.c (get_default_uri): Use new-and-improved - default folder URI config paths. - - * gui/calendar-config.c (calendar_config_{get,set}_default_uri, - calendar_config_{get,set}_default_tasks_uri): Remove these. The - shell owns this information now. (Weren't being used anyway.) - - * gui/component-factory.c (get_data_uri): Fix another place that - hardcoded tacking foo.ics on to the end of URLs. - -2002-04-08 Dan Winship <danw@ximian.com> - - * gui/component-factory.c (create_view): Add view_info arg. If the - view_info is non-empty and this is a calendar folder, set the - "view" property on the control's propertybag. - - * gui/control-factory.c (calendar_properties_init): Set up the - "view" property. - (get_prop, set_prop): handle the "view" property by - getting/setting the GnomeCalendar's view. Unfortunately, this - doesn't actually work. See #23208. - - * gui/calendar-commands.c (calendar_control_activate): Set the UI - component's container before calling - gnome_calendar_set_ui_component so that the search bar - initialization will work. - -2002-04-06 JP Rosevear <jpr@ximian.com> - - * pcs/cal-backend-db.[hc]: Remove dead files. - -2002-04-06 JP Rosevear <jpr@ximian.com> - - * gui/GNOME_Evolution_Calendar.oaf.in: add config_item:type - -2002-04-01 Kjartan Maraas <kmaraas@gnome.org> - - * gui/e-itip-control.c: Fix a string. - -2002-04-01 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-db.c: simple fix for DB3 header inclusion in - Mac OS X, by Max Horn <max@quendi.de> - -2002-03-31 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (clean_up): free the my_address member - (find_my_address): fall back on a CN match if possible - (change_status): handle changing the status of a non-existent - address by adding a new attendee - (update_attendee_status): if the attendee response is not from a - user on the list of attendees, ask the user if they want to add - the attendee any how (as an optional participant) - (ok_clicked_cb): if we are suppose to rsvp and the status was ok, - but the attendee address is not known, find it - -2002-03-29 Ettore Perazzoli <ettore@ximian.com> - - * gui/GNOME_Evolution_Calendar.oaf.in: Set a priority for the - config item. Rename to "Calendar and Tasks". - -2002-03-29 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/Makefile.am: s/libversit.la/libversit.a/ - - * conduits/todo/Makefile.am: ditto - -2002-03-29 JP Rosevear <jpr@ximian.com> - - * gui/e-calendar-table.c: implement new pop up menu items for - "Save as", "Print", "Assign Task", "Forward as iCalendar" - - * gui/e-day-view.c: similarly, also "Publish Free/Busy - Information" and "New Meeting" and "New Task" - - * gui/e-week-view.c: ditto - - * gui/dialogs/task-editor.c (show_assignment): move the assignment - page stuff here - (task_editor_show_assignment): use it - (assign_task_cmd): ditto - - * gui/dialogs/task-editor.h: new proto - - * gui/dialogs/comp-editor.c (save_as_cmd): use new e-util file - selector function - - * meeting-mockup.glade: Remove old file - - * topic.dat - -2002-03-19 Dan Winship <danw@ximian.com> - - * cal-util/Makefile.am: s/libversit.la/libversit.a/ - - * cal-client/Makefile.am: Likewise - - * gui/Makefile.am: Likewise - -2002-03-18 Ettore Perazzoli <ettore@ximian.com> - - * gui/cal-search-bar.c: Removed `search_menu_items'. - (cal_search_bar_menu_activated): Removed. - (cal_search_bar_class_init): Don't install. - (cal_search_bar_construct): No menu items here. - -2002-03-15 Jeffrey Stedfast <fejj@ximian.com> - - * gui/e-day-view.c: Updated to use new EPopupMenu API. - - * gui/e-week-view.c: Updated to use new EPopupMenu API. - - * gui/e-calendar-table.c: Updated to use new EPopupMenu API. - -2002-03-15 Ettore Perazzoli <ettore@ximian.com> - - * gui/tasks-control.c (tasks_control_activate): Call - `e_tasks_set_ui_component()' here to give it the - BonoboUIComponent. - (tasks_control_deactivate): Likewise, call it here to unset the - BonoboUIComponent. - - * gui/e-tasks.c (e_tasks_set_ui_component): New. - - * gui/calendar-commands.c (calendar_control_activate): Call - gnome_calendar_set_ui_component() here. - (calendar_control_deactivate): ...And here, with a NULL - BonoboUIComponent. - - * gui/gnome-cal.c (gnome_calendar_set_ui_component): New. - -2002-03-15 JP Rosevear <jpr@ximian.com> - - * gui/main.c: use bonobo exception macros to tidy - - * gui/itip-control-factory.c: ditto - - * gui/gnome-cal.c: ditto - - * gui/comp-editor-factory.c: ditto - - * gui/calendar-commands.c: ditto - -2002-03-14 JP Rosevear <jpr@ximian.com> - - * idl/evolution-calendar.idl: add all day event editor mode - - * gui/component-factory.c: clean up exception handling - (sc_user_create_new_item_cb): support the all day event id - (create_object): add a user creatable all day appointment item - - * gui/comp-editor-factory.c (get_default_event): get a default - event either all day or starting at the top of the hour - (get_default_task): get a default task - (edit_new): support the all day event mode - - * gui/calendar-commands.c: remove unused functions/verbs - -2002-03-13 Ettore Perazzoli <ettore@ximian.com> - - * gui/GNOME_Evolution_Calendar.oaf.in: Add an - "evolution:config_item:icon_path" attribute so we get an icon for - the calendar preferences. - -2002-03-12 Ettore Perazzoli <ettore@ximian.com> - - * gui/dialogs/cal-prefs-dialog.glade: Add <visible>False</visible> - to cal-prefs-dialog so it doesn't get shown when we load the Glade - file with libglade. - - * gui/component-factory.c (owner_set_cb): Register the - ConfigControl factory. - - * gui/tasks-control.c: Removed verb "TaskSettings". - (tasks_control_settings_cmd): Removed. - - * gui/calendar-commands.c: Removed verb "CalendarSettings". - (settings_cmd): Removed. - - * gui/dialogs/cal-prefs-dialog.c: Renamed `CalPrefsDialogPrivate' - to `DialogData'. Replace `dialog' member with a `page' member. - Remove `toplevel_notebook' member. - (init_widgets): Renamed from `cal_prefs_dialog_init_widgets'. - Just get a DialogData. - (get_widgets): Get a DialogData pointer. - (cal_prefs_dialog_destroy): Removed. - (config_control_destroy_callback): New, signal handler for - ::destroy for ConfigControl. - (cal_prefs_dialog_new): Create a new DialogData, connect all the - signal handlers. - (create_time_edit): Renamed from - `cal_prefs_dialog_create_time_edit'. - (cal_prefs_dialog_show): Removed. - (cal_prefs_dialog_button_clicked): Removed. - (show_task_list_config): Get a DialogData. - (show_config): Renamed from `cal_prefs_dialog_show_config'. - Likewise. - (update_task_list_config): Likewise. - (update_config): Renamed from - `cal_prefs_dialog_update_config'. Likewise. - (color_set_callback): New callback, makes the dialog report - changes when the setting in any of the color widgets is changed. - (widget_changed_callback): New callback, makes the dialog report - changes when any of the widgets changes status. - (connect_changed): New utility function to connect this callback - to all the widgets. - (setup_widgets): Connect all the widgets. - (cal_prefs_dialog_new): Call `setup_widgets'. - - * gui/config-control-factory.c: New. - * gui/config-control-factory.h: New. - - * gui/GNOME_Evolution_Calendar.oaf.in: Add - OAFIID:GNOME_Evolution_Calendar_ConfigControl and - OAFIID:GNOME_Evolution_Calendar_ConfigControlFactory. - -2002-03-06 Rodrigo Moya <rodrigo@ximian.com> - - Should fix #21240 - - * gui/alarm-notify/alarm-notify.c: replaced use of GnomeVFSURI - with EUri, to allow non-registered methods. - -2002-03-05 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-itip-control.c (e_itip_control_set_data): reverted my last - change of adding the METHOD property to the incoming request. - - * gui/itip-utils.c (comp_string): added extra - X-MICROSOFT-CDO-REPLYTIME property for broken Outlook. Should fix - #20783. - -2002-03-04 Dan Winship <danw@ximian.com> - - * gui/itip-utils.c (comp_compliant): Reset the DTSTAMP of the new - component. (RFC2245 says DTSTAMP corresponds to the time the - particular iCalendar representation of the object was created.) - Fixes #21198. - -2002-03-05 JP Rosevear <jpr@ximian.com> - - * gui/print.c: remove unneeded parameter from print_text_size - everywhere - (get_font_for_size): calculate a font size based on the available - height - (print_text): calculate the top of where the font should be drawn - (print_text_size): use get_font_for_size - (print_day_background): use get_font_for_size - -2002-03-05 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-time-sel-item.c - (e_meeting_time_selector_item_draw): pass the real table - to e_meeting_model_etable_view_to_model_row - (e_meeting_time_selector_item_paint_busy_periods): ditto - - * gui/dialogs/meeting-page.c (right_click_cb): ditto - - * gui/e-meeting-model.h: update protos - - * gui/e-meeting-model.c - (e_meeting_model_etable_model_to_view_row): take in to account the - fact the table used the without model - (e_meeting_model_etable_view_to_model_row): ditto - -2002-03-04 Damon Chaplin <damon@ximian.com> - - * gui/tasks-control.c: added support for printing the Tasks table. - I hacked it a bit so the user could choose portrait or landscape mode. - This is bug #9677. ETable printing has a few issues, though, and it - isn't very pretty. - -2002-03-04 Dan Winship <danw@ximian.com> - - * gui/itip-utils.c (comp_subject): Prefix the subject with an - indicator like "Accepted" or "Cancelled" explaining what the - action is, since Outlook doesn't display any of that information - inline like we do. (20780) - -2002-02-28 Rodrigo Moya <rodrigo@ximian.com> - - * calendar/gui/e-itip-control.c (e_itip_control_set_data): added the - METHOD property to the top level component we create. - -2002-02-26 Rodrigo Moya <rodrigo@ximian.com> - - * gui/control-factory.c (set_prop): - * gui/tasks-control.c (tasks_control_set_property): display an error - message if the call to gnome_calendar_open or e_tasks_open does not - return TRUE. Fixes #20346. - -2002-02-25 Dan Winship <danw@ximian.com> - - * gui/itip-utils.c (itip_send_comp): use - GNOME_Evolution_Composer_setBody rather than _setMultipartType and - _attachData now, to send a message containing just a text/calendar - part. Fixes 14705. Mostly. - (comp_content_type): Include the filename here since we can't add - a Content-Disposition now. - -2002-02-24 Chris Toshok <toshok@ximian.com> - - * gui/cal-search-bar.c (cal_search_bar_class_init): change - query_changed to search_activated. - (cal_search_bar_search_activated): rename - cal_search_bar_query_changed to this. - -2002-02-21 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (add_creatable_item): New helper - function. - (create_object): Add icons for the various user creatable items. - -2002-02-19 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (send_item): pass extra itip_send_comp - params - (send_freebusy): ditto - (ok_clicked_cb): ditto, including the timezones culled from the - component - - * gui/e-week-view.c: pass extra itip_send_comp params - - * gui/calendar-commands.c: ditto - - * gui/e-day-view.c: ditto - - * gui/dialogs/task-editor.c: ditto - - * gui/dialogs/event-editor.c: ditto - - * gui/dialogs/comp-editor.c: ditto - - * gui/itip-utils.h (itip_send_comp): update proto - - * gui/itip-utils.c (foreach_tzid_callback): check the passed in - zones, then the builtin time zones then the client - -2002-02-19 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (find_my_address): strip the ical value and - do a case insensitive compare - (find_attendee): ditto - (change_status): put the error message here - (ok_clicked_cb): don't update the item or rsvp unless - change_status was successful, trip the ical value and do a case - insensitive compare - - * gui/itip-utils.c (get_address): strip the incoming address - (itip_strip_mailto): use g_strncasecmp - (comp_limit_attendees): strip the ical value and do a case - insensitive compare - -2002-02-14 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.c: use new column enums - (set_value_at): emit pre-change/cell change signals - (destroy): destroy refresh_queue and refresh_data - (init): init new elements - (refresh_queue_add): if the attendee is being refreshed already, - possibly update the start/end times to look for and update the - callback info, otherwise add it to the queue - (refresh_queue_remove): remove a refreshing attende from the queue - (process_callbacks): make all the callbacks and remove the - attendee from the queue - (process_free_busy): process the callbacks immediately if parsing - fails or on successful completion of processing - (async_close): process free busy - (cursor_cb): we're only looking for one at a time now - (refresh_busy_periods): idle callback to start processing the queue - (e_meeting_model_refresh_all_busy_periods): add every row to the queue - (e_meeting_model_refresh_busy_periods): add a single row to the queue - - * gui/e-meeting-model.h: new protos, enum the columns - - * gui/e-meeting-time-sel.c: use new compare time function - (e_meeting_time_selector_construct): listen for a cell changed - signal and use separate callbacks for rows_inserted and - rows_deleted - (e_meeting_time_selector_refresh_free_busy): util function to - refresh free busy info - (e_meeting_time_selector_on_update_free_busy): use above - (rows_inserted_cb): refresh free busy on the new rows - (cell_changed_cb): refresh free busy on the row when the address - changes - (rows_deleted_cb): redraw - - * gui/e-meeting-utils.[hc]: a holding spot for a meeting time - comparison function - - * gui/Makefile.am: compile new files - -2002-02-13 Rodrigo Moya <rodrigo@ximian.com> - - * gui/control-factory.c (set_prop): don't append 'calendar.ics' - to the URI. - (get_prop): finished. - - * gui/tasks-control.c (tasks_control_set_property): don't append - 'tasks.ics' to the URI. - (tasks_control_get_property): finished. - - * gui/gnome-cal.c (gnome_calendar_open): - * gui/e-tasks.c (e_tasks_open): append $filename.ics to the uri to be - opened if the uri is local. Leave intact in other cases. - -2002-02-08 Damon Chaplin <damon@ximian.com> - - * gui/comp-util.c (cal_comp_util_compare_event_timezones): check if - the CalComponentDateTime values are set before trying to use them. - Possibly fixes bug #18529. - - * importers/icalendar-importer.c: added vCalendar importer and - intelligent GnomeCalendar importer code here, as it shares a lot of - code with the iCalendar importer. - - NOTE: check_folder_type() needs to be finished at some point. - It needs a new shell Corba call so it can decide whether to import - events or tasks into the folder. Currently it just imports both. - - * importers/main.c (importer_factory_fn): create vCalendar importer - or GnomeCalendar importer if required. - - * importers/evolution-calendar-importer.h: added declarations for - creating a vCalendar importer and intelligent Gnome Calendar importer. - - * importers/Makefile.am: added -DEVOLUTION_SOUNDDIR so the importer - knows what filename to use for audio alarms in vCalendar files. - Added libicalvcal-evolution to LDADD. - - * importers/GNOME_Evolution_Calendar_Importer.oaf.in: added vCalendar - importer and intelligent Gnome Calendar importer. - - * gui/comp-util.c (cal_comp_util_compare_event_timezones): return TRUE - if the event uses UTC. We don't want to flag all events from Outlook, - which use UTC. - -2002-02-08 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-details-page.glade: change custom widget - creator to e_url_entry_new - - * gui/dialogs/task-details-page.c (get_widgets): get the url entry - and its entry - -2002-02-08 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-details-page.glade: add a custom widget created - with e_url_button_new - - * gui/dialogs/task-details-page.c (task_details_page_init): init - url_button member to NULL - (init_widgets): set the url button entry - (get_widgets): get the url button - - * gui/calendar-commands.c (pixmaps): use new all day event icon - -2002-02-07 JP Rosevear <jpr@ximian.com> - - * gui/e-day-view.c: pass meeting boolean for - gnome_calendar_edit_object and gnome_calendar_new_appointment_for - - * gui/e-week-view-event-item.c: ditto - - * gui/e-week-view.c: ditto - - * gui/tasks-control.c (confirm_expunge): kill warning - - * gui/calendar-commands.c (new_meeting_cb): show a new meeting - dialog - (new_event_cb): pass new param - - * gui/gnome-cal.c (gnome_calendar_edit_object): take meeting - boolean and show meeting page if true - (gnome_calendar_new_appointment_for): takeing meeting param and - pass to above - (gnome_calendar_new_appointment): add new param - - * gui/gnome-cal.h: update proto - - * gui/component-factory.c (create_component): take a comp editor - mode, determine vtype - (sc_user_create_new_item_cb): check for meeting user creatable - item - (create_object): add meeting as user creatable item - - * gui/comp-editor-factory.c (edit_new): get a comp editor mode - now, determine vtype and show meeting page if required - (queue_edit_new): get comp editor mode - (impl_editNew): ditto, plus queue the mode directly instead of - determining the vtype - - * gui/dialogs/event-editor.c (show_meeting): new internal util - function to show meeting page - (event_editor_show_meeting): show the meeting - (schedule_meeting_cmd): use show_meeting - - * gui/dialogs/event-editor.h: new proto - - * idl/evolution-calendar.idl: editNew takes a mode rather than a - type now - - * cal-util/Makefile.am: fix includes - -2002-02-07 Christopher James Lahey <clahey@ximian.com> - - * gui/e-tasks.c (e_tasks_setup_view_menus), gui/gnome-cal.c - (gnome_calendar_setup_view_menus): Made these use the new - GalViewMenus stuff. - -2002-02-06 Damon Chaplin <damon@ximian.com> - - * cal-util/cal-recur.c (cal_recur_from_icalproperty): convert months - from 1-12 to 0-11. Fixes bug #19235. - -2002-02-04 JP Rosevear <jpr@ximian.com> - - * conduits/todo/todo-conduit.c (e_todo_gui_new): new gui routines - for conduit settings - (e_todo_gui_fill_config): ditto - (e_todo_gui_fill_widgets): ditto - (e_todo_gui_destroy): ditto - (e_todo_context_destroy): destroy new_cfg and gui properly - (local_record_from_comp): set the priority to the default setting - if none is set on the icalendar object - (fill_widgets): fill gui widgets - (create_settings_window): create gui - -2002-01-30 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (write_html): if this is a reply, print the - attendee status - -2002-01-25 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/alarm-options.glade: Use 1 instead of zero as the - minimum value for the repetitions spin button as we use a check - box to specify whether the alarm has repetitions or not. Fixes - bug #19054. - -2002-01-24 Ettore Perazzoli <ettore@ximian.com> - - * importers/Makefile.am (evolution_calendar_importer_LDADD): - Ooops. Forgot to use EVOLUTION_CALENDAR_LIBS here. - -2002-01-24 Ettore Perazzoli <ettore@ximian.com> - - * conduits/calendar/Makefile.am: Use - EVOLUTION_CALENDAR_CONDUIT_LIBS and - EVOLUTION_CALENDAR_CONDUIT_CFLAGS. - * conduits/todo/Makefile.am: Likewise. - - * cal-client/Makefile.am: Use EVOLUTION_CALENDAR_LIBS and - EVOLUTION_CALENDAR_CFLAGS. - * cal-util/Makefile.am: Likewise. - * gui/alarm-notify/Makefile.am: Likewise. - * gui/Makefile.am: Likewise. - -2002-01-23 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (create_object): Pass a NULL @icon to - `evolution_shell_component_add_user_creatable_item()'. - -2002-01-21 JP Rosevear <jpr@ximian.com> - - * conduits/todo/todo-conduit.c (todoconduit_load_configuration): - return a new configuration struct, load default priority setting - (todoconduit_save_configuration): save default priority setting - (e_todo_context_new): dupe configuration - - * conduits/calendar/calendar-conduit.c (e_calendar_context_new): - set ps to NULL - -2002-01-17 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/alarm-page.c (get_alarm_string): save the alarm string - in the correct variable (str), so it actually gets shown for alarms - with specific trigger times. Fixes bug #18801. - -2002-01-15 Rodrigo Moya <rodrigo@ximian.com> - - * gui/dialogs/task-page.c (task_page_fill_widgets): default component - classification to PUBLIC. Fixes internal bug #1066 - -2002-01-14 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c: move all functions here, - get rid of header files, use e-pilot-settings to display gui - - * conduits/todo/todo-conduit.c: as above - -2002-01-14 JP Rosevear <jpr@ximian.com> - - * gui/gnome-cal.c (get_current_time): use icaltimetype_to_tm - -2002-01-14 JP Rosevear <jpr@ximian.com> - - * gui/e-week-view-main-item.c (e_week_view_main_item_draw_day): - figure out when today is and highlight if it is not selected - - * gui/e-week-view.h: enum the "today" color - - * gui/e-week-view.c (e_week_view_realize): init the "today" color - -2002-01-13 JP Rosevear <jpr@ximian.com> - - * gui/alarm-notify/save.h: add protos - - * gui/alarm-notify/save.c (save_blessed_program): records a - program as blessed - (is_blessed_program): checks to see if a program is blessed - - * gui/alarm-notify/alarm-queue.c (procedure_notification_dialog): - popup a dialog notifying the user that is a program and let them - not see the dialog about this program again - (procedure_notification): use above - -2002-01-11 Damon Chaplin <damon@ximian.com> - - * gui/e-timezone-entry.c: - * gui/e-itip-control.c (write_label_piece): - * gui/calendar-config.c (on_timezone_set): translate timezone names - when displayed. Fixes bug #6544. - -2002-01-03 JP Rosevear <jpr@ximian.com> - - * gui/tasks-control.c (tasks_control_complete_cmd): new verb - callback - (sensitize_commands): set sensitivity of mark complete command - - * gui/e-tasks.h: new proto - - * gui/e-tasks.c (e_tasks_complete_selected): mark selected tasks - in the table as complete - - * gui/e-calendar-table.h: new proto - - * gui/e-calendar-table.c (e_calendar_table_complete_selected): - mark selected rows as complete - -2002-01-03 JP Rosevear <jpr@ximian.com> - - * gui/tasks-control.c (confirm_expunge): only need one warning - message now - - * gui/e-tasks.c (create_sexp): change the logic to expunge all - completed tasks not just hidden ones - -2002-01-03 JP Rosevear <jpr@ximian.com> - - * gui/tasks-control.c (confirm_expunge): confirm expunging of the - tasks - (tasks_control_expunge_cmd): verb callback - - * gui/calendar-config.c (config_read): read confirm expunge value - (calendar_config_write): write confirm expunge value - (calendar_config_write_on_exit): ditto - (calendar_config_get_confirm_expunge): get value - (calendar_config_set_confirm_expunge): set value - - * gui/calendar-config.h: new proto - - * gui/e-itip-control.c (start_calendar_server): kill warning - - * gui/e-tasks.c (e_tasks_init): init query member to NULL - (set_status_message): util function to set status message - (e_tasks_open): use above - (cal_opened_cb): ditto - (create_sexp): create sexp of items to be deleted - (query_obj_updated_cb): remove any items found - (query_eval_error_cb): bail out on error - (query_query_done_cb): tidy when done - (e_tasks_delete_completed): set up query - - * gui/e-tasks.h: new proto - - * gui/calendar-model.c (query_query_done_cb): use g_warning - instead of printing to stderr - (query_eval_error_cb): ditto - (update_query): clear the status message if we can't create the - query - - * gui/tag-calendar.c (resolve_tzid_cb): make this static - -2001-12-21 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/comp-editor.c: remove needs send signal related - cruft - (save_comp_with_send): with send_component_dialog, indicate if the - meeting info is newly created or not - (real_edit_comp): remember if the dialog initially needs a send - - * gui/dialogs/send-comp.c (send_component_dialog): take a "new" - parameter indicating whether the dialog should intimate if the - component to be sent is a new meeting or not - - * gui/dialogs/send-comp.h: update proto - - * gui/dialogs/comp-editor.c: remove no longer used needs_send - notification and signal - - * gui/dialogs/comp-editor.h: remove proto - - * gui/e-day-view.c (e_day_view_on_main_canvas_drag_data_received): add new - param to send_component_dialog - (e_day_view_finish_long_event_resize): ditto - (e_day_view_finish_resize): ditto - (e_day_view_on_editing_stopped): ditto - (e_day_view_on_top_canvas_drag_data_received): ditto - - * gui/e-week-view.c (e_week_view_on_editing_stopped): add new - param to send_component_dialog - -2001-12-21 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/comp-editor.h: inherit from bonobo window - - * gui/dialogs/comp-editor.c: inherit from bonobo window - (comp_editor_key_press_event): Look for an escape key press and - close the window if found - -2001-12-20 Ettore Perazzoli <ettore@ximian.com> - - [Fixes #17377, Evolution doesn't work on multi-depth displays.] - - * gui/main.c (main): Push GdkRGB visual and colormap. - -2001-12-19 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (check_for_slow_setting): - go slow and clear the map if the last uri and the current uri do - not match - (post_sync): save the last uri - - * conduits/calendar/calendar-conduit-config.h: handle a last uri - config option - - * conduits/todo/todo-conduit-config.h: ditto - - * conduits/calendar/calendar-conduit.c (start_calendar_server): - use the open_default_calendar method - - * conduits/todo/todo-conduit.c (start_calendar_server): same as above - - * cal-client/Makefile.am: link with bonobo conf - - * cal-client/cal-client.h: new protos - - * idl/evolution-calendar.idl: make sure open method raises - appropriate exceptions - - * gui/e-itip-control.c (start_calendar_server): use - cal_client_open_default_* calls - - * cal-client/cal-client.c (real_open_calendar): do the real work - of loading - (cal_client_open_calendar): use above - (get_fall_back_uri): get the basic local uri - (get_default_uri): get the default uri from the config db - (cal_client_open_default_calendar): open the default uri or the - fallback if the method is unsupported - (cal_client_open_default_tasks): same for tasks - -2001-12-17 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (send_item): use get_real_item - (get_refresh_options): uncomment out - (get_real_item): obtain the real object which has the uid of the - item received - (show_current_todo): use get_refresh_options for refresh method - and provide the description and summary from the real component - since its not in the reply - (show_current_event): ditto - (send_item): use get_real_item - -2001-12-17 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (comp_limit_attendees): can't remove properties - in an iteration loop, so remove them outside the loop - (comp_minimal): don't set a recurid if there isn't one, add the x - properties to the clone - (comp_compliant): unref the clone for DECLINECOUNTER - - * gui/e-itip-control.c (get_refresh_options): make function - available again - (show_current_event): use it here - (ok_clicked_cb): can't remove properties in an iteration loop, so - remove them outside the loop - - * cal-util/cal-component.c (free_icalcomponent): properly free the - attendee list - (cal_component_rescan): don't destroy the alarm hash - -2001-12-13 Damon Chaplin <damon@ximian.com> - - * zones.h: new file to contain all timezone names for translation. - We won't be using the translations in 1.0.1, but it gives translators - time before we do use them in 1.0.2. - - * Makefile.am: added zones.h to EXTRA_DIST. - -2001-12-12 JP Rosevear <jpr@ximian.com> - - * gui/e-day-view.c (e_day_view_on_top_canvas_button_release): - ungrab the pointer before calling - e_day_view_finish_long_event_resize - (e_day_view_on_main_canvas_button_release): ditto - (e_day_view_finish_long_event_resize): ask if the meeting should - be sent - (e_day_view_finish_resize): ditto - (e_day_view_on_editing_stopped): ditto - (e_day_view_on_top_canvas_drag_data_received): ditto - (e_day_view_on_main_canvas_drag_data_received): ditto - -2001-12-11 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.c (process_free_busy_comp): properly convert - the dtstart and dtend times if they are UTC - (cursor_cb): if we don't have anybody to get f/b info for, process - the callbacks immediately - (e_meeting_model_refresh_busy_periods): take start/end times, - calculate the timet values with object timezone - (e_meeting_model_etable_model_to_view_row): proper cast - (e_meeting_model_etable_view_to_model_row): ditto - (async_open): bail out if we couldn't open properly - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_on_update_free_busy): use defines for - determining the number of days before and after of free busy to - request - (e_meeting_time_selector_update_dates_shown): use defines for the - number of days shown - - * gui/e-meeting-model.h: update proto - -2001-12-10 Damon Chaplin <damon@ximian.com> - - * gui/control-factory.c (control_factory_new_control): removed code - that connects to GnomeCalendar's "dates_shown_changed" signal. - - * gui/calendar-commands.c (gcal_calendar_dates_change_cb): - (calendar_control_activate): moved it here, so it gets reconnected - whenever the control is activated. Fixes bug #15798. - -2001-12-10 Damon Chaplin <damon@ximian.com> - - * importers/GNOME_Evolution_Calendar_Importer.oaf.in: fixed executable - name. Fixes bug #16880. - -2001-12-08 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (local_record_from_comp): - if we have an alarm that can be represented on the pilot, set the - appointment fields appropriately, if the duration has values for - minutes and/or hours and/or days, use the lowest common - denominator - (comp_from_remote_record): if the appointment on the pilot has an - alarm, find the first alarm an item currently had that is relative - to the start and with a negative duration and update it (or create - a new one if no valid ones exist) - - * cal-util/cal-component.c (cal_component_get_alarm_uids): build - list in the order they appear in the component so we get - consisting order for the gui and for the pilot - -2001-12-08 Rodrigo Moya <rodrigo@ximian.com> - - * gui/calendar-config.c (calendar_config_get_default_uri): - (calendar_config_get_default_tasks_uri): s/%/%s - -2001-11-09 Federico Mena Quintero <federico@ximian.com> - - (committed by Damon) - - Fix bug #14699. - - * pcs/query.c (QueryState): Added a state QUERY_WAIT_FOR_BACKEND - to indicate that the query is not populated as we are waiting for - the backend to be opened. - (query_init): Start in the QUERY_WAIT_FOR_BACKEND state. - (query_destroy): Only disconnect from the backend if we are in a - state that implies that we are connected to its signals. - (query_construct): If the backend is already loaded, immediately - set the state to QUERY_START_PENDING. - (backend_opened_cb): Disconnect from the backend's "opened" - signal. Set the state to QUERY_START_PENDING. - (match_component): We can now only match components if the query - is in progress or if it is done. Assert to that effect, and do - not ensure_sexp(). - (match_component): Do not check for a nonexistent component using - g_return_if_fail(). Also, there is no need to ref/unref the - component. - (backend_obj_updated_cb): Assert to the effect of our state. - (backend_obj_removed_cb): Likewise. - (parse_sexp): Renamed from ensure_sexp(). Assert that the query - has not started. Do not disconnect from the backend's signals - here, since we have no connections. - (start_query_cb): Set the state to QUERY_IN_PROGRESS here instead - of in populate_query(). - -2001-12-07 Rodrigo Moya <rodrigo@ximian.com> - - * gui/calendar-config.c (calendar_config_get_default_uri): - (calendar_config_get_default_tasks_uri): if the key in the config - database does not exist, just return the local URIs, but never - return NULL - -2001-12-06 Rodrigo Moya <rodrigo@ximian.com> - - * gui/dialogs/event-page.c (event_page_fill_widgets): default - component classification to PUBLIC - -2001-12-06 Jon Trowbridge <trow@ximian.com> - - * gui/dialogs/event-editor.c (event_editor_destroy): Explicitly - destroy the EMeetingModel. This is a hack to work around problems - with the reference counting; we are still leaking the - EMeetingModels. - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_construct): Ref our EMeetingModel. - (e_meeting_time_selector_destroy): Unref the model. - - * gui/e-meeting-model.c (destroy): Properly destroy - corba_select_names with a call to bonobo_object_release_unref. - (Fixes 14002) - -2001-12-05 Rodrigo Moya <rodrigo@ximian.com> - - * gui/dialogs/event-page.glade: added entry for the LOCATION field - - * gui/dialogs/event-page.c: added support for the new LOCATION entry - added in the Event editor. - -2001-12-05 Zbigniew Chyla <cyba@gnome.pl> - - * gui/itip-utils.c (comp_subject, comp_description): - Marked strings for translation. - -2001-12-03 Damon Chaplin <damon@ximian.com> - - * gui/e-meeting-model.c: - * gui/calendar-model.c: make sure we call e_table_model_pre_change() - before changing the model. - - * gui/calendar-config.c (calendar_config_configure_e_calendar_table): - removed call to e_table_model_changed(). calendar_model_refresh() - results in that anyway. - -2001-12-03 Damon Chaplin <damon@ximian.com> - - * gui/e-calendar-table.etspec: disabled 'Alarms', 'End Date' and - 'Show Time As' fields, as these are not useful for tasks. We may want - to reenable them later if we add a table view of calendar events. - -2001-12-02 Rodrigo Moya <rodrigo@ximian.com> - - * gui/calendar-offline-handler.c (backend_cal_opened): connect to - "cal_set_mode" signal before calling cal_client_set_mode. Also, - s/cal_mode_set/cal_set_mode - (backend_go_offline): connect to "cal_opened" signal before calling - cal_client_open_calendar - -2001-11-30 Damon Chaplin <damon@ximian.com> - - * gui/e-itip-control.c (remove_item): only show the dialog if we - created it. Hopefully fixes bug #15774. - Also ifdef'ed out a lot of code that isn't currently used, including - code to use a label which is never created. The unused code was there - to support handling multiple iTIP objects in a message, but was never - updated when we switched to use HTML for the control. Fixes bug #16232. - -2001-11-28 Federico Mena Quintero <federico@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_new_task): Set the category of - the new task to that of the search bar. Fixes bug #15533. - -2001-11-27 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-itip-control.c (update_attendee_status): - * gui/itip-utils.c (comp_to_list): fixed typos in translatable - strings. Fixes Ximian #15456 - -2001-11-14 Damon Chaplin <damon@ximian.com> - - * gui/print.c: Substituted gnome_font_get_width_string() with - gnome_font_get_width_utf8() and gnome_font_get_width_string_n() - with gnome_font_get_width_utf8_sized(). Fixes calendar part of #15379. - -2001-11-14 Federico Mena Quintero <federico@ximian.com> - - * gui/calendar-model.c (date_value_to_string): Convert the buffer - to UTF8. - (calendar_model_value_to_string): Do not convert the string fields - to UTF8 again; they are already in UTF8. Fixes the UTF8-related - bits of bug #15304. - -2001-11-14 Damon Chaplin <damon@ximian.com> - - * gui/calendar-model.c: - * cal-util/cal-component.h: #ifdef'ed out the LOCATION field for now, - since it wasn't supported everywhere, or in the .etspec file. - -2001-11-14 Damon Chaplin <damon@ximian.com> - - * gui/e-calendar-table.c: don't abort when e_table_selected_count() - returns odd values. There seems to be a bug in ETable. This is to - avoid bug #13843. - -2001-11-13 Federico Mena Quintero <federico@ximian.com> - - (committed to CVS by Damon) - Fixes bug #15137. - - * gui/e-day-view.c (e_day_view_on_delete_appointment): Do not try - to operate on the event if it gets deleted while stopping the - edition. - (e_day_view_on_event_double_click): Likewise. - (e_day_view_on_long_event_button_press): Likewise. - (e_day_view_on_event_button_press): Likewise. - (e_day_view_on_long_event_click): Likewise. - (e_day_view_on_event_click): Likewise. - - * gui/e-week-view.c (e_week_view_on_text_item_event): Likewise. - -2001-11-14 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (pre_sync): remove silly - debug warning - -2001-11-13 Damon Chaplin <damon@ximian.com> - - * gui/alarm-notify/config-data.c (ensure_inited): - * gui/calendar-config.c (config_read): - * conduits/todo/todo-conduit.c (get_default_timezone): - * conduits/calendar/calendar-conduit.c (get_default_timezone): - make the timezone default to UTC. Fixes bug #14362. - -2001-11-13 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-week-view.c (selection_received): only change the day, - month and year for the start date, for not screwing up the start - time, which was being set to midnight always (Fixes Ximian #5287) - Also, deal correctly with VCALENDAR components - - * gui/e-day-view.c (selection_received): dela correctly with - VCALENDAR components being pasted - -2001-11-11 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/save.c (get_calendars_to_load): The last - argument to the bonobo_config_get_XXX_with_default() is a gboolean - *, not a CORBA_Environment *. Fixes bug #14655. - -2001-11-11 JP Rosevear <jpr@ximian.com> - - * pcs/cal-backend-file.c (free_busy_instance): recurrence - expansion callback for free/busy - (create_user_free_busy): expand recurrences and use date/time - values for dtstart and dtend - -2001-11-11 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.h: new protos - - * gui/e-meeting-model.c (e_meeting_model_get_zone): accessor - (e_meeting_model_set_zone): ditto - (init): init to the calendar default zone - (process_free_busy_comp): take the zone to convert to as a param - (e_meeting_model_refresh_busy_periods): redraw properly - - * gui/dialogs/schedule-page.c (update_time): set the zone of the - model - -2001-11-09 Damon Chaplin <damon@ximian.com> - - * gui/e-week-view.c (e_week_view_key_press): don't subtract a day - from DTEND. For DATE values we don't include the entire day now. - Fixes bug #14842. - -2001-11-09 Damon Chaplin <damon@ximian.com> - - * gui/e-week-view-layout.c (e_week_view_layout_events): fix buffer - overflow. Fixes bug #10285 (the printing of lines & dates in the - printout of the month view). - -2001-11-09 Zbigniew Chyla <cyba@gnome.pl> - - * gui/dialogs/meeting-page.c - (meeting_page_fill_widgets): Convert strings to GTK+ encoding. - (meeting_page_destroy): Free allocated strings before freeing the list - itself. - -2001-11-08 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_timeout_handler): don't let an empty - event occur for all days when auto scrolling - -2001-11-08 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-file.c - (cal_backend_file_compute_changes_foreach_key): don't leak the - string returned by cal_component_get_as_string nor the temporary - CalComponent we create - -2001-11-08 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (ok_clicked_cb): don't add the item, remove - it if declining (in case it was added before) - (remove_item): Since we can't discern between an item not found - and another error, always say the removal is complete - -2001-11-07 Zbigniew Chyla <cyba@gnome.pl> - - * gui/e-cell-date-edit-text.c (ecd_get_text): - Convert generated string to UTF-8. - -2001-11-07 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_on_start_time_changed): emit changed - signal - (e_meeting_time_selector_on_end_time_changed): emit changed - signal, if end time is now before start time and all day event, - make sure a whole day is still selected - (e_meeting_time_selector_drag_meeting_time): calculate the first - and last_time's in whole days for all day events - (e_meeting_time_selector_timeout_handler): calculate the drag time - to be whole days for all day events and scroll the canvas even if - we don't update the time so the user can see where they're headed - -2001-11-06 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/event-editor.c (event_editor_edit_comp): make sure - to remove all attendees from the model when we edit a new comp, - append the pages if they are needed and we weren't showing them - before - - * gui/dialogs/task-editor.c (task_editor_edit_comp): same as above - - * gui/dialogs/comp-editor.c (comp_editor_remove_page): check for a - return value indicating the page was not found and return if so - -2001-11-05 Ettore Perazzoli <ettore@ximian.com> - - * gui/dialogs/e-delegate-dialog.c: #include - "Evolution-Addressbook-SelectNames.h", not - "../Evolution-Addressbook-SelectNames.h". Grrr. - -2001-11-05 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-time-sel.c (e_meeting_time_selector_class_init): - add a changed signal - (e_meeting_time_selector_construct): emit changed signal - (e_meeting_time_selector_set_meeting_time): ditto - (e_meeting_time_selector_set_all_day): set the all day setting - (e_meeting_time_selector_autopick): emit changed signal - (e_meeting_time_selector_find_nearest_interval): find proper - interval when in all day mode - (e_meeting_time_selector_find_nearest_interval_backward): ditto - (e_meeting_time_selector_drag_meeting_time): for all day events, - move the time when past the 12 hour mark, and and always make sure - 1 full day is selected, emit changed signal when appropriate - (e_meeting_time_selector_update_start_date_edit): set date and - time of day together - (e_meeting_time_selector_update_end_date_edit): ditto, and adjust - display time if all day event - - * gui/e-meeting-time-sel-item.c - (e_meeting_time_selector_item_draw): remove unused variable - (e_meeting_time_selector_item_button_press): for all day mode, - make the interval a whole day - - * gui/dialogs/schedule-page.c (update_time): set the meeting time - selector setting instead of manual mucking with the e-date-edit - widgets - (init_widgets): listen to the changed signal of the meeting time - selector instead of propagating multiple events as it updates - - * gui/dialogs/event-page.c (update_time): block time zone change - signals - -2001-11-05 Damon Chaplin <damon@ximian.com> - - * gui/calendar-model.c (dup_date_edit_value): removed ';' in the wrong - place. Fixes bug #14421. - -2001-11-05 Dan Winship <danw@ximian.com> - - * gui/alarm-notify/Makefile.am (evolution_alarm_notify_LDFLAGS): - -export-dynamic for libglade custom widget. - -2001-11-04 Damon Chaplin <damon@ximian.com> - - * gui/comp-editor-factory.c (get_default_component): use TZID from the - builtin timezone, instead of using the location name. - -2001-11-02 Federico Mena Quintero <federico@ximian.com> - - * cal-util/cal-util.c (compute_alarm_range): Short-circuit the - calculation of the repeat time if there are zero repetitions. - (compute_alarm_range): I'm a moron. De-reference alarm_start when - subtracting stuff from it! Fixes bug #14209. - -2001-10-31 Ettore Perazzoli <ettore@ximian.com> - - * gui/dialogs/Makefile.am: Added rules to generate - `Evolution-Addressbook-SelectNames.h'. - - * gui/dialogs/comp-editor-util.h: #include - "Evolution-Addressbook-SelectNames.h" from this directory. - -2001-10-31 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/alarm-options.c: #include <string.h> - -2001-10-31 Federico Mena Quintero <federico@ximian.com> - - * gui/gnome-cal.c (dn_query_obj_updated_cb): If a query is not in - progress, just retag the whole thing. An event may change dates - and tag_calendar_by_comp() would not know how to untag the old - dates. Fixes bug #10220. - - * pcs/query.c (start_query_cb): Connect to the backend's - "obj_updated" and "obj_removed" signals here instead of in - query_construct(). If a query is started while another one is - notifying of an update, these signal connections would get appened - to the running signal (the one that triggered the notification - about an update) and the new signal handlers would also get - called. We are really not interested in updates before we - populate the query, because we'll catch the changes anyways. - -2001-10-31 Federico Mena Quintero <federico@ximian.com> - - Fix bug #13723. - - * gui/gnome-cal.h (GnomeCalendarClass): New signals - "calendar_focus_change", "taskpad_focus_change", and - "taskpad_selection_changed". Renamed "selection_changed" to - "calendar_selection_changed". - - * gui/gnome-cal.c (gnome_calendar_get_num_tasks_selected): New - function. - (setup_widgets): Connect to the focus event signals of the task - pad and the calendar view widgets. - (gnome_calendar_delete_selection): Renamed from - gnome_calendar_delete_event(). - (gnome_calendar_cut_clipboard): Handle the current focus location. - (gnome_calendar_copy_clipboard): Likewise. - (gnome_calendar_paste_clipboard): Likewise. - (gnome_calendar_delete_selection): Likewise. - (table_selection_change_cb): New callback. - - * gui/calendar-commands.c (sensitize_calendar_commands): Take in - whether we should unconditionally disable everything. - (sensitize_taskpad_commands): Analogous function to the above. - (gcal_calendar_focus_change_cb): New callback, used for calendar - views. - (gcal_taskpad_focus_change_cb): New callback, used for the - taskpad. - - * gui/e-day-view.c (e_day_view_key_press): Use a better test for - keys that should start editing. Fixes bug #6447. - - * gui/e-week-view.c (e_week_view_key_press): Likewise. - -2001-10-31 Christopher James Lahey <clahey@ximian.com> - - * gui/calendar-model.c: Make the pre_changes and changes match - here. - -2001-10-31 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (itip_send_comp): send as mixed rather than - alternative - -2001-10-31 Ettore Perazzoli <ettore@ximian.com> - - * gui/alarm-notify/save.c (KEY_CALENDARS_TO_LOAD): - Removed. - (KEY_NUM_CALENDARS_TO_LOAD): New key, containing the number of - calendars to load. - (BASE_KEY_CALENDAR_TO_LOAD): New base key name for the URIs of the - calendars to load. - (save_calendars_to_load): Rewrote to not use a sequence, to work - around an ORBit bug that causes bonobo-moniker-xmldb to crash. - (get_calendars_to_load): Likewise. - -2001-10-30 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/comp-editor.c (comp_editor_remove_page): disconnect - signals added in append_page(). Fixes Gtk-Critical warning about - GtkAccelGroup being added twice to a window. - -2001-10-30 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (itip_send_comp): set a body for the message - -2001-10-30 Dan Winship <danw@ximian.com> - - * gui/itip-utils.c (itip_send_comp): call - GNOME_Evolution_Composer_setMultipartType to get a - multipart/alternative. - -2001-10-30 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_on_start_time_changed): don't overwrite - memory - (e_meeting_time_selector_on_end_time_changed): ditto - -2001-10-30 Damon Chaplin <damon@ximian.com> - - * gui/calendar-model.c (dup_date_edit_value): return NULL if passed - NULL. Should fix bug #14048. - -2001-10-30 Federico Mena Quintero <federico@ximian.com> - - * gui/calendar-config.c (config_read): Do not ignore the - exceptions of the cases that do not have defaults. - -2001-10-30 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_drag_meeting_time): if we are doing all - day stuff, make the drag increment 1 day at a time - -2001-10-30 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/meeting-page.c (meeting_page_fill_component): Add - _() to a string that was missing it. - -2001-10-30 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/meeting-page.c (table_canvas_focus_out_cb): Commit - the ETable click-to-add for if the dialog is being destroyed. - Should fix bug #13959. - -2001-10-30 Federico Mena Quintero <federico@ximian.com> - - * gui/itip-utils.c (itip_send_comp): Allocate enough space for the - string! (was missing the null terminator) Possibly fixes #13924. - Thanks a *LOT* to Michael Zucchi for running this through Purify. - -2001-10-30 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-time-sel-item.c - (e_meeting_time_selector_item_button_press): move in whole day - increments if we are in all day mode - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_on_start_time_changed): get rid of - localtime call - (e_meeting_time_selector_on_end_time_changed): ditto - (e_meeting_time_selector_update_start_date_edit): set the date - editor using the meeting time fields directly - (e_meeting_time_selector_update_end_date_edit): ditto - - * gui/dialogs/schedule-page.c (update_time): do the set_show_time - stuff first - - * conduits/calendar/calendar-conduit.c (process_multi_day): don't - adjust the time, set the default timezone for date values - -2001-10-30 Dan Winship <danw@ximian.com> - - * gui/alarm-notify/Makefile.am (INCLUDES): - s/BONOBO_HTML_GNOME_LIBS/BONOBO_HTML_GNOME_CFLAGS/ - -2001-10-30 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.c (e_meeting_model_count_actual_attendees): - count the actual attendees (doesn't include people delegating - - * gui/e-meeting-time-sel.c: use - e_meeting_model_count_actual_attendees (renamed) - - * gui/e-meeting-time-sel-item.c: use - e_meeting_model_etable_view_to_model_row calls instead of calling - on the model directly, use e_meeting_model_count_actual_attendees - - * gui/e-meeting-model.c - (e_meeting_model_etable_model_to_view_row): get the real mapping - (e_meeting_model_etable_view_to_model_row): ditto - (get_key): e-table-without callback - (duplicate_key): ditto - (free_gotten_key): ditto - (free_duplicated_key): ditto - (init): create without model - (e_meeting_model_etable_from_model): build etable from without - model - - * gui/e-meeting-model.h: update protos - - * gui/dialogs/meeting-page.c (right_click_cb): convert row from - view to model row - -2001-10-30 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/task-page.c (task_page_fill_widgets): set to the default - timezone for DATE values, in case the user switches to a DATE-TIME. - -2001-10-30 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/task-page.c: handle DATE values for Start and Due dates. - -2001-10-30 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/schedule-page.c: - * gui/dialogs/event-page.c: - * gui/dialogs/comp-editor-util.c: updated code to handle DATE values. - - * gui/gnome-cal.c (gnome_calendar_new_appointment_for): - * gui/e-day-view.c (e_day_view_key_press): updated DATE code. - - * gui/e-cell-date-edit-text.c: - * gui/calendar-model.c: updated to support DATE values. - - * cal-util/cal-recur.c (cal_recur_generate_instances_of_rule): updated - to use DATE values in same way as Outlook - i.e. the DTEND date is - not included entirely. Though I did make it so that if the DTSTART - and DTEND used the same DATE value, it includes the entire day. - So 1-day events should be the same. Long All-Day events will be - 1 day shorter. - - * cal-util/cal-component.c (cal_component_get_start_plus_duration): - don't subtract a day from the end date. - - * gui/tasks-control.c: updated the EPixmap paths for Cut/Copy etc. - Removed Print & Print Preview paths, since we don't have menu commands - for these any more. - -2001-10-30 Federico Mena Quintero <federico@ximian.com> - - Fix bug #10016. - - * gui/dialogs/comp-editor.c (comp_editor_merge_ui): Use - bonobo_ui_util_set_ui() instead of doing things by hand. Hmmm, if - only that function had a way of telling us whether it failed so - that we could avoid setting the verb list... - - * gui/dialogs/event-editor.c (event_editor_init): Do not pass the - filename with the full path so that Bonobo can find it in a smart - way. - - * gui/dialogs/task-editor.c (task_editor_init): Likewise. - -2001-10-30 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/delete-comp.c (delete_component_dialog): Use an - EMessageBox instead of a gnome_dialog_question so that the label - gets line breaking. Fixes bug #11260. - -2001-10-29 Federico Mena Quintero <federico@ximian.com> - - Fix bug #13649. - - * gui/calendar-config.c - (calendar_config_get_use_default_reminder): New function. - (calendar_config_set_use_default_reminder): New function. - (calendar_config_get_default_reminder_interval): New function. - (calendar_config_set_default_reminder_interval): New function. - (calendar_config_get_default_reminder_units): New function. - (calendar_config_set_default_reminder_units): New function. - (config_read): Get the options for default reminders. - (calendar_config_write): Set the options for default reminders. - - * gui/dialogs/cal-prefs-dialog.c (cal_prefs_dialog_show_config): - Set the default reminder widgets from the config values. - (cal_prefs_dialog_update_config): Set the config values from the - widgets. - - * gui/comp-util.c (cal_comp_event_new_with_defaults): New - function; creates a VEVENT component with the default alarm. - - * gui/e-day-view.c (e_day_view_key_press): Use - cal_comp_event_new_with_defaults (); - - * gui/e-week-view.c (e_week_view_key_press): Likewise. - * gui/calendar-model.c (calendar_model_append_row): Likewise. - * gui/comp-editor-factory.c (get_default_component): Likewise. - * gui/gnome-cal.c (gnome_calendar_new_appointment_for): Likewise. - - * cal-util/cal-component.c (ensure_alarm_properties_cb): Ensure we - have a DESCRIPTION property. - (cal_component_commit_sequence): Ensure we have the mandatory - alarm properties. - -2001-10-30 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.c (process_section): process an individual - section here - (select_names_ok_cb): call above - (get_select_name_dialog): listen for ok:dialog signal - -2001-10-29 Damon Chaplin <damon@ximian.com> - - * importers/Makefile.am (evolution_calendar_importer_LDADD): - * gui/Makefile.am (evolution_calendar_LDADD): - * cal-util/Makefile.am (test_recur_LDADD): - * cal-client/Makefile.am (client_test_LDADD): use libical-evolution.la - - * gui/dialogs/schedule-page.c: save the timezone passed in for the - start time, so if our times are changed we use this. Also, if the - end time was passed in in a different timezone, convert it. - Also hide the time fields for DATE values. Note that DATE values still - do not work. - - * gui/dialogs/meeting-page.glade: changed "Invite Others" to - "Invite Others..." to be consistent with the other page. - - * gui/dialogs/event-page.c (times_updated): - (all_day_event_toggled_cb): set is_date if appropriate. - - * gui/e-itip-control.c (write_label_piece): convert all UTC times to - the current timezone. Outlook sends simple, non-recurring, events as - UTC times, which isn't very useful. - -2001-10-29 Federico Mena Quintero <federico@ximian.com> - - * gui/main.c (launch_alarm_daemon): Launch the alarm daemon as - soon as the calendar component is started. Fixes bug #13867; - we can't really do much better than this. - -2001-10-29 Federico Mena Quintero <federico@ximian.com> - - * gui/tasks-control.c (pixmaps): Fix the verb names for the - pixmaps in the Edit menu; they were out of synch with the XML - UI description. - -2001-10-29 Chris Toshok <toshok@ximian.com> - - * pcs/cal-factory.c (cal_factory_dump_active_backends): new - function. - (dump_backend): new function. - - * pcs/cal-factory.h: add prototype for - cal_factory_dump_active_backends. - -2001-10-29 Federico Mena Quintero <federico@ximian.com> - - Fix bug #12163. - - * cal-util/cal-util.c (compute_alarm_range): Take alarm - repetitions into account. - (add_alarm_occurrences_cb): Add alarm repetitions. - (generate_absolute_triggers): Likewise. - (generate_absolute_triggers): Oops, absolute triggers are in UTC, - so convert them as such. Also, pay attention to the timezones of - the dtstart and dtend properties. - -2001-10-29 JP Rosevear <jpr@ximian.com> - - * importers/Makefile.am: include the header as a source so it gets - dist'ed. - -2001-10-29 Ettore Perazzoli <ettore@ximian.com> - - * importers/Makefile.am (INCLUDES): - s/BONOBO_CFLAGS/BONOBO_GNOME_CFLAGS/. - -2001-10-29 Rodrigo Moya <rodrigo@ximian.com> - - * importers/icalendar-importer.c (load_file_fn): fixed URI - construction, which was preventing importing into the root - calendar (~/evo/local/Calendar/) - -2001-10-29 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (is_all_day): handle date - values - -2001-10-29 Rodrigo Moya <rodrigo@ximian.com> - - * importers/: added evolution-calendar-importer binary, starting - with an iCalendar file importer - -2001-10-29 JP Rosevear <jpr@ximian.com> - - * conduits/todo/todo-conduit-config.h - (todoconduit_load_configuration): get the management object by id - - * conduits/calendar/calendar-conduit-config.h - (calconduit_load_configuration): ditto - -2001-10-29 Rodrigo Moya <rodrigo@ximian.com> - - * gui/calendar-config.[ch] (calendar_config_get_default_uri): - (calendar_config_set_default_uri): - (calendar_config_get_default_tasks_uri): - (calendar_config_set_default_tasks_uri): new functions for setting - and retrieving the default calendar URIs - - * gui/e-itip-control.c (init): don't use - hard-coded URI, but use the default calendar URI, as returned - by calendar_config_get_default_uri - (start_calendar_server): added a "gboolean tasks" parameter, so - that the local tasks.ics file is used if the calendar to be - started is for tasks when no default tasks URI is found in - the configuration - -2001-10-28 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (add_record): unref the - comp when finished - - * conduits/todo/todo-conduit.c (add_record): ditto - -2001-10-28 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/task-page.c (task_page_fill_widgets): added break - statements after each case, when setting the classification. - Fixes bug #13772. - -2001-10-28 Rodrigo Moya <rodrigo@ximian.com> - - * cal-client/cal-client.c (destroy_wombat_client): removed this - function, as we don't need to unref at all the WombatClient - object, since it is aggregated to the CalListener object, which - will take care of unrefing it (Fixes Ximian #12001) - (cal_client_open_calendar): create the WombatClient here - -2001-10-28 Damon Chaplin <damon@ximian.com> - - * gui/print.c (print_todo_details): get the tasks directly from the - CalendarModel, so we get the filtering & sorting for free. Fixes - bug #10280. Hmm. This seems too easy. It isn't going to work is it... - - * gui/gnome-cal.c (gnome_calendar_get_task_pad): new function to get - the TaskPad ECalendarTable, for printing. - - * gui/calendar-model.c: - * gui/calendar-config.c (calendar_config_get_hide_completed_tasks_sexp): - split this out from calendar-model.c so we could use it for printing, - but ended up doing that a different way. - - * gui/dialogs/task-page.c (init_widgets): removed a duplicated signal - connected to field_changed_cb(). - -2001-10-27 Damon Chaplin <damon@ximian.com> - - * gui/print.c (print_week_view): - (range_selector_new): when the week start day is set to Sunday, we - have to be careful to make sure we print the correct week, since - the previous Saturday is actually printed first. Fixes bug #13687. - (print_week_summary): always set compress_weekend to true if - multi_week_view is FALSE (i.e. we are printing the week view). - Fixes bug #13688. - - * gui/e-itip-control.c (send_freebusy): use the timezones from the - DTSTART and DTEND. - (write_label_piece): output the date-time and the timezone after it. - Note that we may want to convert it to the current timezone and display - that as well. Also converted COMPLETED to the current timezone. - And fixed all uses of old timezone functions. - - * gui/dialogs/comp-editor.c (commit_all_fields): added function to - set the focus in the window to NULL, so all fields lose their focus, - so they emit "changed" signals and update their values if needed. - We call this when most menu commands are used, e.g. 'Save and Close', - 'Print' etc. Fixes bug #11434. In future we should also check fields - are valid and show dialogs if they are not. - - * gui/calendar-model.c (get_completed): use the completed value - properly. Fixes bug #13694. - - * cal-util/timeutil.c (icaltimetype_to_tm_with_zone): don't check - from_zone and to_zone != NULL. A NULL zone is valid, it is for - floating times. - -2001-10-27 Federico Mena Quintero <federico@ximian.com> - - * gui/e-day-view.c (e_day_view_on_text_item_event): Cancel editing - if the user presses Escape. - - * gui/e-week-view.c (e_week_view_on_text_item_event): Likewise. - - * gui/cal-search-bar.c: #include <string.h> - -2001-10-27 Federico Mena Quintero <federico@ximian.com> - - * gui/e-day-view.c (e_day_view_on_editing_stopped): Delete - appointments with empty summaries. Fixes Ximian bug #780. - - * gui/e-week-view.c (e_week_view_on_editing_stopped): Likewise. - - * gui/dialogs/delete-comp.c (delete_component_dialog): Added an - argument to specify whether we unconditionally want single - components to be considered as not having a summary. - - * gui/comp-util.c (cal_comp_confirm_delete_empty_comp): New - function. - - * gui/misc.[ch]: New files with miscellaneous utility functions; - moved string_is_empty() over from calendar-model.c. - - * gui/calendar-model.c: Use the string_is_empty() - function from misc.c. - - * gui/Makefile.am (evolution_calendar_SOURCES): Added misc.[ch] to - the list of sources. - -2001-10-27 JP Rosevear <jpr@ximian.com> - - * conduits/todo/todo-conduit.c (local_record_from_comp): touch on - lookup - (check_for_slow_setting): write touched only if slow sync - (match): touch on lookup - - * conduits/calendar/calendar-conduit.c (local_record_from_comp): - touch the record on lookup - (check_for_slow_setting): write touched only if slow sync - (pre_sync): don't touch on lookup - (match): touch on lookup - -2001-10-26 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/e-calendar.conduit.in: remove the merges as - valid sync types - - * conduits/todo/e-todo.conduit.in: as above - - * conduits/calendar/calendar-conduit.c (pre_sync): write out only - the touched records if we are doing copies - - * conduits/todo/todo-conduit.c: as above - - * conduits/calendar/calendar-conduit-config.h - (calconduit_load_configuration): get the sync type - - * conduits/todo/todo-conduit-config.h: as above - -2001-10-26 Damon Chaplin <damon@ximian.com> - - * gui/e-itip-control.c (write_label_piece): convert the formatted - date to UTF-8. - - * cal-util/cal-recur.c (CAL_OBJ_DEBUG): turn off debug functions. - - * gui/dialogs/comp-editor-util.c (parse_contact_string): handle UTF8 - correctly. Bug #4450. Good enough for 1.0. - - * gui/e-week-view-event-item.c (e_week_view_draw_time): set the gc - color before drawing. Should fix bug #11469. - - * gui/dialogs/task-editor.c (task_editor_edit_comp): show or hide the - meeting page as appropriate. Note this may be called more than once, - if the task gets updated somewhere else and the user clicks 'Update - the object'. Hopefully fixes bug #12930. - - * gui/print.c (print_comp_item): printed more fields and made a little - prettier. Fixes bug #9352. - (print_date_label): used the correct timezones for each date field. - - * *.c: removed several debug messages. - -2001-10-26 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (check_for_slow_setting): - make debug output more accurate - - * conduits/todo/todo-conduit.c (check_for_slow_setting): ditto - -2001-10-26 JP Rosevear <jpr@ximian.com> - - * conduits/todo/todo-conduit.c (pre_sync): remove the uid from the - map if was archived and is now deleted - - * conduits/calendar/calendar-conduit.c: ditto - -2001-10-26 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-calendar_table.c (delete_selected_components): - (selection_received): added status bar messages - - * gui/e-day-view.c (e_day_view_cut_clipboard): - (selection_received): likewise - - * gui/e-week-view.c (e_week_view_cut_clipboard): - (selection_received): likewise - -2001-10-26 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.h: modify fields - - * conduits/todo/todo-conduit.h: as above - - * conduits/calendar/calendar-conduit.c (print_remote): free the - struct after use - (e_calendar_context_new): explicitly init context fields - (e_calendar_context_destroy): free local records and properly free - changed hash elements - (start_calendar_server_cb): tidy - (start_calendar_server): ditto - (free_local): free a local record - (local_record_to_pilot_record): use a static buffer to avoid leaks - (local_record_from_comp): only copy over alarm stuff from the - original record, we sync everything else - (local_record_from_uid): unref the comp when we are done - (pre_sync): free change_id - (post_sync): ditto - (for_each): track locals - (for_each_modified): ditto - (free_match): use free_local - - * conduits/todo/todo-conduit.c: as above - -2001-10-26 Federico Mena Quintero <federico@ximian.com> - - * pcs/cal.c (cal_construct): Get a fresh CORBA_Environment for - every CORBA call. Hopefully will fix #11978, but I'm not sure - about what else could be happening. - (cal_get_password): Free the exception. - -2001-10-25 Damon Chaplin <damon@ximian.com> - - * gui/e-itip-control.c: used functions to get PUBLISH_OPTIONS etc., - so we can translate them. - -2001-10-25 Damon Chaplin <damon@ximian.com> - - * cal-util/cal-recur.c (cal_obj_bysetpos_filter): subtract 1 from - any positive BYSETPOS value, since our array is 0-based. - - * gui/dialogs/recurrence-page.c (simple_recur_to_comp): - (recurrence_page_fill_widgets): Outlook (2000) will not accept monthly - recurrences like BYDAY=2TU. Instead it uses BYDAY=TU;BYSETPOS=2. - So to be compatable with it we now do the same, although we still - accept and convert the old format. - - * cal-client/cal-client.c (cal_client_get_component_as_string): new - function to return a complete VCALENDAR string containing a VEVENT - or VTODO with all the VTIMEZONEs it uses. - - * gui/dialogs/comp-editor.c (save_as_ok): use above function so we - save the VTIMEZONE data with the VEVENT/VTODO. Fixes bug #8626. - Also made sure we output "METHOD:PUBLISH" since Outlook (2000) will - not import it otherwise. - - * gui/dialogs/comp-editor.c (page_mapped_cb): - (page_unmapped_cb): install/uninstall the GtkAccelGroup for the page. - (comp_editor_append_page): connect to the map/unmap signals to - install/uninstall the accelerators. (This is all for bug #11609, - though of course it doesn't work too well in GTK+ 1.2 anyway.) - - * gui/dialogs/task-page.c (get_widgets): - * gui/dialogs/task-details-page.c (get_widgets): - * gui/dialogs/schedule-page.c (get_widgets): - * gui/dialogs/recurrence-page.c (get_widgets): - * gui/dialogs/meeting-page.c (get_widgets): - * gui/dialogs/event-page.c (get_widgets): - * gui/dialogs/alarm-page.c (get_widgets): got the GtkAccelGroup from - the original window, ref'ed it and placed it in the CompEditorPage - struct. - - * gui/dialogs/comp-editor-page.c (comp_editor_page_destroy): unref - any GtkAccelGroup for the page. - - * gui/dialogs/task-page.glade: changed '_Confidential' to - 'Con_fidential' as it clashed with '_Contacts'. It now matches the - event editor as well. - - * gui/dialogs/event-page.glade: - * gui/dialogs/task-page.glade: Set CAN_FOCUS to TRUE for the custom - EDateEdit widgets, and set them as the accel targets of the labels. - -2001-10-25 Rodrigo Moya <rodrigo@ximian.com> - - * gui/dialogs/comp-editor.c (save_comp): show an error message when - we can't update the object on the calendar server - -2001-10-25 Federico Mena Quintero <federico@ximian.com> - - * gui/control-factory.c: Ifdef-ed out the PersistFile bits. - - * gui/GNOME_Evolution_Calendar.oaf.in: The tasks folder does not - support the PersistFile interface; removed it. Removed it as well - from the calendar folder since it is aggregated but not actually - implemented. - -2001-10-25 Federico Mena Quintero <federico@ximian.com> - - * gui/component-factory.c (xfer_folder): Handle tasks folders as - well; was always using "calendar.ics" as the filename. - -2001-10-24 Damon Chaplin <damon@ximian.com> - - * gui/GNOME_Evolution_Calendar.oaf.in: added sections for Tasks - factory and control. I hope someone checks these! - -2001-10-24 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (xfer_folder): Fixed to only copy the - `calendar.ics' and `calendar.ics~' files. - -2001-10-24 Damon Chaplin <damon@ximian.com> - - * pcs/cal-backend-file.c (cal_backend_file_update_objects): when - iterating over the subcomponents, use 'subcomp' rather than 'icalcomp'. - That meant it wasn't working at all well when an entire VCALENDAR - was passed in. - - * cal-util/cal-component.c: handle DURATION property used instead of - DTEND or DUE. In cal_component_get_dtend/due we will return DTSTART - + DURATION if necessary. In set_dtend/due we remove any DURATION - property. Fixes bug #11262. - - * gui/e-meeting-model.c (build_etable): - * gui/e-calendar-table.c (e_calendar_table_init): use U_ for the - ECellCombo popdown strings, as it expects UTF-8 strings. - -2001-10-24 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-time-sel.c (e_meeting_time_selector_construct): - track the spacer vbox - (e_meeting_time_selector_style_set): make sure the rows are the - correct size for the style - - * gui/e-meeting-time-sel-item.c - (e_meeting_time_selector_item_paint_day_top): slight adjustments - to where the text is drawn - - * gui/e-meeting-time-sel.h: new member - - * gui/e-meeting-model.c (build_etable): ensure uniform row height - - * conduits/todo/todo-conduit.c (comp_from_remote_record): mark - status as completed in appropriate places and don't overwrite - legitimate percentages and such - -2001-10-24 Federico Mena Quintero <federico@ximian.com> - - Fixes bug #5282. - - * cal-util/timeutil.c (icaltimetype_to_tm_with_zone): New function - to avoid copying the same code all over the place. - (icaltimetype_to_tm): Also set the tm.tm_wday. - - * gui/alarm-notify/alarm-queue.c (queue_midnight_refresh): Use - time_day_end_with_zone(). - (load_alarms_for_today): Likewise. And oops, we were only - computing the times and not loading the alarms. - (obj_updated_cb): Likewise. - (load_alarms): Removed assertion that is no longer valid because - we may load the alarms for a client in two stages. - - * gui/dialogs/alarm-page.c (get_alarm_string): Convert absolute - trigger times to the local timezone. - - * gui/alarm-notify/alarm-notify-dialog.c (write_html_heading): - Convert the times to the local timezone. - (alarm_notify_dialog): Likewise, for the window title. - (alarm_notify_dialog): Set the window layer to WIN_LAYER_ONTOP. - - * gui/e-cell-date-edit-text.c (ecd_get_text): Use - icaltimetype_to_tm_with_zone(). - - * gui/alarm-notify/save.c (get_config_db): Made public. - (discard_config_db): Made public. - - * gui/alarm-notify/config-data.[ch]: New files with functions to - fetch the calendar configuration data used by the alarm daemon. - -2001-10-23 Damon Chaplin <damon@ximian.com> - - * cal-util/cal-component.c (cal_component_event_dates_match): make sure - we free all the CalComponentDateTime's when we are finished. - - * gui/gnome-cal.c (gnome_calendar_notify_dates_shown_changed): just - return if no time range is set. - -2001-10-23 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_table_vadjustment_changed): adjust the - display canvas when the table scrolls - (e_meeting_time_selector_construct): listen for table scrolling - -2001-10-23 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.c (build_etable): no longer set the - scrollbar policy here - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_update_main_canvas_scroll_region): add an - extra row to the height so the click to add row can be properly - seen - (e_meeting_time_selector_construct): set the scrollbar policy for - the etable scrolled - -2001-10-23 JP Rosevear <jpr@ximian.com> - - * cal-util/timeutil.c (icaltimetype_to_tm): convert an - icaltimetype to a tm - (tm_to_icaltimetype): vice versa - - * cal-util/timeutil.h: new protos - - * conduits/calendar/calendar-conduit.c: replace all mktime and - localtime calls (except for debugging calls) - - * conduits/todo/todo-conduit.c: ditto - (comp_from_remote_record): make sure the completed time is in UTC - -2001-10-23 Rodrigo Moya <rodrigo@ximian.com> - - * cal-client/cal-query.c (cal_query_construct) set priv->corba_query - to CORBA_OBJECT_NIL if there was an error - -2001-10-22 Damon Chaplin <damon@ximian.com> - - * idl/evolution-calendar.idl: added setDefaultTimezone() method. - - * pcs/cal-backend.c (cal_backend_get_default_timezone): - (cal_backend_set_default_timezone): new functions to call class - methods. - - * pcs/cal-backend-file.c: lots of changes to handle the default - timezone and use it. - - * pcs/query.c: use the default timezone. - - * gui/dialogs/task-details-page.c (date_changed_cb): initialized - completed_tt. - - * gui/dialogs/event-page.c: changed it to handle DATE values. The - 'All Day Event' checkbox is only set now when the DTSTART and DTEND - are DATE values. - - * gui/dialogs/comp-editor-util.c (comp_editor_free_dates): free the - CalComponentDateTime structs as well. - - * gui/e-tasks.c: set the default timezone on the server. - - * gui/tag-calendar.c: - * gui/gnome-cal.c: - * gui/e-week-view.c: - * gui/e-day-view.c: updates to handle DATE values. - - * gui/e-calendar-table.c (date_compare_cb): updated to use the new - ECellDateEditValue values, so it now works. - (percent_compare_cb): updated to use GPOINTER_TO_INT values. - (e_calendar_table_init): use an ECellPercent for the percent field - and an ECellDateEditText for the date fields. - - * gui/comp-util.c (cal_comp_util_compare_event_timezones): return TRUE - if the DTSTART or DTEND is a DATE value. We don't want to show the - timezone icons for DATE values. - - * gui/comp-editor-factory.c (resolve_pending_requests): set the default - timezone on the server. - - * gui/calendar-model.c: major changes to support sorting properly. - For date and percent fields we now use subclasses of ECellText, so - we don't use a char* as the model value. For the percent field we now - use a GINT_TO_POINTER. For the date fields we now use a - ECellDateEditValue* as the value. - - * gui/calendar-config.c (calendar_config_configure_e_cell_date_edit): - set the timezone and use_24_hour flags of the new ECellDateEditText. - - * conduits/todo/todo-conduit.c (pre_sync): - * conduits/calendar/calendar-conduit.c (pre_sync): set the default - timezone on the server. - - * cal-util/timeutil.c (time_days_in_month): removed debug message. - - * cal-util/test-recur.c: try to handle timezones in the iCalendar - file properly, and updated to pass default timezone. - - * cal-util/cal-util.c (cal_util_generate_alarms_for_comp): - (cal_util_generate_alarms_for_list): added default timezone argument. - - * cal-util/cal-recur.c: changed many of the functions to take a default - timezone, to use to resolve DATE and floating DATE-TIME values. - - * cal-client/cal-client.c (cal_client_set_default_timezone): new - function to set the default timezone. - (cal_client_ensure_timezone_on_server): new function to ensure that - a given timezone is on the server. - - * gui/e-cell-date-edit-text.c: new subclass of ECellText to display - and edit a date value. - - * cal-util/cal-recur.c (cal_obj_byday_expand_monthly): changed week_num - to -week_num when calculating the weeks to go back from the end of the - month for things like BYDAY=-2WE. Fixes bug #11525. - (cal_recur_generate_instances_of_rule): only go up to MAX_YEAR (2037). - We can't really handle anything past that anyway. - (cal_recur_ensure_rule_end_date): initialize cb_date.end_date to 0, - so if the RULE doesn't generate COUNT instances we save 0 as the - time_t. - -2001-10-22 Federico Mena Quintero <federico@ximian.com> - - * gui/tasks-control-factory.c (tasks_control_factory_fn): Put up a - warning dialog box if we failed to create the tasks control. - Fixes bug #13033. - -2001-10-22 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (set_date_label): write out the correct - time in the control - - * pcs/cal.c (build_fb_seq): utility function to build sequences of - f/b data - (impl_Cal_get_free_busy): use above so we never return a NULL - - * conduits/calendar/calendar-conduit-config.h - (calconduit_save_configuration): fix c/p error - (calconduit_load_configuration): ditto - -2001-10-22 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c (meeting_page_destroy): we don't need - to save the state - - * gui/e-meeting-time-sel.c (e_meeting_time_selector_destroy): - ditto - - * gui/e-meeting-model.c (build_etable): listen for the etable - being destroyed - (table_destroy_cb): save the state when the etable is destroyed - -2001-10-21 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/schedule-page.c (init_widgets): listen for changes - in the date editors - (schedule_page_set_dates): update the times when they change - elsewhere - (update_time): set the time in the dialog - (time_changed_cb): notify of changed times - - * gui/dialogs/comp-editor.c (page_dates_changed_cb): don't call - the set dates function on the page that noted the change - (page_summary_changed_cb): same for set summary function - - * gui/dialogs/event-page.c (update_time): move time setting stuff - to util function - (event_page_set_dates): use it - (event_page_fill_component): ditto - - * gui/e-meeting-time-sel.h: fix comment - -2001-10-19 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/alarm-notify.c (add_uri_to_load): Do not assert - if we fail to load the URI list. This would of course have been a - bonobo-conf activation problem. - (remove_uri_to_load): Likewise. - - * gui/alarm-notify/notify-main.c (load_calendars): Likewise. - - * gui/alarm-notify/alarm-queue.c (load_missed_alarms): Make the - time range half-open so that we do not display the last alarm - twice. - -2001-10-19 Rodrigo Moya <rodrigo@ximian.com> - - * gui/calendar-model.c (calendar_model_set_status_message): make - it a public function - - * gui/e-tasks.c (e_tasks_open): display progress messages - (cal_opened_cb): clean up status bar messages - - * gui/gnome-cal.c (gnome_calendar_open): display progress messages - (client_cal_opened_cb): clean up status bar messages - -2001-10-19 Rodrigo Moya <rodrigo@ximian.com> - - * gui/calendar-model.c (set_status_message): new function - (update_query): call set_status_message - (query_query_done_cb): - (query_eval_error_cb): clean up status bar messages - (get_location, set_location): new functions for setting and - retrieving the location in the calendar model - -2001-10-19 Rodrigo Moya <rodrigo@ximian.com> - - * gui/component-factory.c (owner_set_cb): keep a reference to the - EvolutionShellClient component - - * gui/e-week-view.c (e_week_view_set_status_message): new function - (update_query): call e_week_view_set_status_message - (query_query_done_cb): - (query_eval_error_cb): clean up status bar messages - - * gui/e-day-view.c (e_day_view_set_status_message): new function - (update_query): call e_day_view_set_status_message - (query_query_done_cb): - (query_eval_error_cb): clean up status bar messages - - * gui/Makefile.am: added EVOLUTION_IMAGESDIR to CFLAGS - -2001-10-18 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-time-sel.c - (e_meeting_time_selector_on_invite_others_button_clicked): call - the invite others dialog in the model - - * gui/e-meeting-attendee.c (e_meeting_attendee_get_atype): pick - attendee type based on role and cutype - - * gui/e-meeting-attendee.h: remove proto - - * gui/Makefile.am: compile select names idl - - * gui/e-meeting-model.h: new proto - - * gui/dialogs/meeting-page.c: remove invite others dialogs bits - from here - - * gui/e-meeting-model.c (e_meeting_model_invite_others_dialog): - and put them here - - * gui/dialogs/Makefile.am: compile corba bits in parent dir - - * gui/dialogs/comp-editor-util.h: reflect above in includes - - * gui/dialogs/e-delegate-dialog.c: ditto - - * gui/dialogs/schedule-page.c: ditto and clean includes - -2001-10-18 Larry Ewing <lewing@ximian.com> - - * gui/alarm-notify/alarm-notify-dialog.c: add html widget - (url_requested_cb): add function to load images from file as they - are requested. - (write_html_heading): convert to using html. - (alarm_notify_dialog): convert to use html display. - (make_html_display): this is the function the custom widget in the - galde file uses to create the html widget. - - * gui/alarm-notify/alarm-notify.glade: add placeholder for the - custom html widget. - - * gui/alarm-notify/Makefile.am: add flags for gtkhtml and gal. - -2001-10-18 Federico Mena Quintero <federico@ximian.com> - - Adds session management for the alarm daemon. Also makes it store - a list of calendars to be monitored. Those calendars will all be - loaded when the alarm daemon starts up. - - * idl/evolution-calendar.idl (AlarmNotify): Removed the ::die() - method. The alarm daemon now handles termination via the session - manager's commands. - - * gui/alarm-notify/notify-main.c (set_session_parameters): New - function, sets some parameters so that the session manager can - restart the daemon via the evolution-alarm-client program. Also, - sets up the "die" signal so that the daemon can terminate when the - session ends. - (load_calendars): New function to load the calendars on startup. - (main): Set the session parameters. Load the calendars on startup. - - * gui/alarm-notify/alarm-notify.c (alarm_notify_add_calendar): New - function, moved over from the impl_ function. Added a - load_afterwards argument to indicate whether the calendar should - just be loaded or if it should also be added to the list of - calendars to load on startup. - (AlarmNotify_addCalendar): Use alarm_notify_add_calendar(). - (AlarmNotify_removeCalendar): Remove the calendar from the list of - calendars to load on startup. - - * gui/alarm-notify/save.c (save_calendars_to_load): New function, - saves a sequence of the URIs to load. - (get_calendars_to_load): New function, loads a sequence of - calendars to load. - - * gui/alarm-notify/alarm.h: Removed stale prototype for alarm_init(). - - * gui/component-factory.c (remove_folder): Ask the alarm daemon to - stop monitoring alarms for the folder that is being deleted. - -2001-10-18 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-time-sel.c - - * gui/e-meeting-time-sel-item.c - (e_meeting_time_selector_item_paint_day_top): use 12 or 24 hour - settings - - * gui/e-meeting-time-sel.c: strings for 12 hour setting - (e_meeting_time_selector_construct): increase width slightly - - * gui/e-meeting-time-sel.h: extern the new char array - -2001-10-18 Rodrigo Moya <rodrigo@ximian.com> - - * cal-util/cal-component.[ch] (cal_component_get_location): - (cal_component_set_location): new functions - -2001-10-18 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.c (process_callbacks): util routine to - handle calling back - (async_close): use above - (e_meeting_model_refresh_busy_periods): ditto - -2001-10-17 JP Rosevear <jpr@ximian.com> - - * conduits/todo/todo-conduit.c (local_record_from_comp): translate - 1-5 priorites to 1-9 priorities better - (comp_from_remote_record): ditto - -2001-10-17 JP Rosevear <jpr@ximian.com> - - * idl/evolution-calendar.idl: allow some decent exceptions - -2001-10-17 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/query.c (match_component): there may be cases when the backend - will return an invalid component from a valid UID (an UID returned - by the get_uids method), so don't abort if that's the case - -2001-10-15 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/cal-prefs-dialog.glade: removed Help button. Do we have - any others? - -2001-10-15 Larry Ewing <lewing@ximian.com> - - * gui/dialogs/comp-editor.c (set_icon_from_comp): remove warnings. - -2001-10-15 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (process_multi_day): - function to break up multi day events into single events for both - evo and the pilot and create new CalClientChange structures - (pre_sync): call above function, and adjust changed list if - necessary - -2001-10-15 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (is_all_day): util function - to determine if event is all day - (local_record_from_comp): use new util function - (comp_from_remote_record): kill use of deprecated time functions - -2001-10-13 Larry Ewing <lewing@ximian.com> - - * gui/dialogs/comp-editor.c (real_edit_comp): call - set_icon_from_comp. - (set_icon_from_comp): set the window icon from the comp. - (make_icon_from_comp): get the icon path based on comp type. - - * gui/dialogs/Makefile.am (iconsdir): EVOLUTION_ICONSDIR bits. - -2001-10-13 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-editor.c (task_editor_send_comp): send - cancellation comp if necessary - -2001-10-12 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/alarm-page.c: return fill_component success - - * gui/dialogs/task-page.c: ditto - - * gui/dialogs/task-details-page.c: ditto - - * gui/dialogs/schedule-page.c: ditto - - * gui/dialogs/recurrence-page.c: ditto - - * gui/dialogs/event-page.c: ditto - - * gui/dialogs/meeting-page.c: use e_notice instead of - duplicate_error - (meeting_page_get_cancel_comp): duh, deleted_attendees is an array - now - (meeting_page_fill_component): spew gui errors if there is no - organizer or no attendees, return success - - * gui/dialogs/event-editor.c (event_editor_send_comp): always call - parent method and don't send the cancellation comp if the method - is publish - (refresh_meeting_cmd): use the orginal comp to refresh - (forward_cmd): prompt the user for the version they want to send - (current, original) - - * gui/dialogs/task-editor.c (forward_cmd): as above - (refresh_task_cmd): ditto - - * gui/dialogs/comp-editor-page.c - (comp_editor_page_fill_component): return boolean of whether the - component could be filled or not - - * gui/dialogs/comp-editor-page.h: update proto - - * gui/dialogs/comp-editor.c (prompt_to_save_changes): take a param - on whether to try and send or not - (comp_editor_get_current_comp): only fill component if its changed - (comp_editor_save_comp): prompt user as well - - * gui/dialogs/comp-editor.h: change proto - - * gui/itip-utils.c: replace error_dialog with e_notice - (comp_content_type): specify charset - -2001-10-11 Larry Ewing <lewing@ximian.com> - - * gui/e-itip-control.c: large reworking of i18n tagging and now - uses gtk_html_stream write and U_ where appropriate. More to - come. - -2001-10-10 Larry Ewing <lewing@ximian.com> - - * gui/e-itip-control.c (init): set the default character set to - utf-8. - -2001-10-10 Federico Mena Quintero <federico@ximian.com> - - * pcs/cal-factory.c (lookup_backend): Return the original key in - the hash table if requested. - (backend_last_client_gone_cb): Use lookup_backend() so that we - have the URI mangling done for us. - (impl_CalFactory_open): The type should be GtkType *, not GtkType! - -2001-10-10 JP Rosevear <jpr@ximian.com> - - * cal-client/cal-client.c (cal_set_mode_cb): remove unneeded - assertions - -2001-10-10 JP Rosevear <jpr@ximian.com> - - * pcs/cal-factory.c (add_uri): fix logic checks - - * gui/dialogs/event-editor.c (event_editor_init): init the - exisiting_org boolean - (set_menu_sens): base sensitivity on existing_org boolean - (event_editor_edit_comp): set exisiting_org boolean - - * gui/dialogs/task-editor.c: same as above - - * gui/calendar-offline-handler.c (add_connection): handle the - protocol or host being unknown - - * cal-util/cal-component.c (cal_component_has_organizer): - implement - -2001-10-09 Federico Mena Quintero <federico@ximian.com> - - Fixes bug #884. - - * gui/alarm-notify/save.[ch]: New files with functions to - save/load the last notification time. - - * gui/alarm-notify/alarm-queue.c (alarm_trigger_cb): Save the last - notification time. - (alarm_queue_init): Load the last notification time when the - daemon is inited. - (alarm_queue_add_client): Load the alarms that we missed while the - alarm daemon was not running. - (cal_opened_cb): Likewise. - - * gui/alarm-notify/Makefile.am (evolution_alarm_notify_SOURCES): - Added save.[ch] to the list of sources. - -2001-10-09 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (get_address): util function to get address - (itip_addresses_get_default): get only the default address - (itip_address_free): free single address - (itip_addresses_free): use above - (comp_limit_attendees): limit the number of attendees to one, the - user - (comp_sentby): set the sentby parameter if the user is not the - organizer - (comp_minimal): remove extraneous info for send (for refresh and - declinecounter) - (comp_compliant): remove all alarms, do various things to make the - components comply with itip spec based on method - (itip_send_comp): use comp_compliant method - - * gui/itip-utils.h: new protos - - * gui/e-itip-control.c: rescan the component when necessary - (get_next): don't get stuck in infinite loop if there are no - viewable components - (e_itip_control_set_data): if there are no viewable components, - spit an error message - - * gui/dialogs/meeting-page.h: tidy - - * gui/dialogs/meeting-page.c (meeting_page_fill_widgets): use - organizer's cn if possible - (other_clicked_cb): no longer doing the sent by stuff directly, - hide more widgets - - * pcs/query.c: use bonobo exception stuff - - * cal-util/cal-component.c (cal_component_rescan): have the comp - rescan its libical component (for when you change things directly) - (free_icalcomponent): take a param on whether to free the - component or just clean up the mappings - (cal_component_has_attendees): util function - - * cal-util/cal-component.h: new protos - -2001-10-09 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-factory.c (lookup_backend, add_backend): deal correctly with - URIs to be inserted into the hash table, so that we don't add the same - backend over and over because the URI strings were different (although - refering to the same backend) - - * pcs/cal-backend-file.c (mail_account_*): moved to a common place - (cal_backend_file_open): check if "uristr != NULL" and not - "uri != NULL" - - * pcs/cal-backend-util.c: moved to here - - * gui/e-day-view.c: add missing header file - -2001-10-09 Dan Winship <danw@ximian.com> - - * gui/e-meeting-model.c (process_free_busy_comp): Fix incorrect - variable name check. - -2001-10-03 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (itip_send_comp): refactor functionality into - several function - (comp_string): if we are publishing, empty the attendee list - - * gui/dialogs/event-editor.c (schedule_meeting_cmd): when we - schedule a new meeting, mark the event editor as changed - - * pcs/cal.c (cal_class_init): get correct parent class - - * gui/dialogs/comp-editor.c (comp_editor_merge_ui): use the - generated ui component name - -2001-10-03 Rodrigo Moya <rodrigo@ximian.com> - - * gui/component-factory.c: - * gui/calendar-offline-handler.c: - * gui/comp-editor-factory.c: replace use of gnome_vfs_uri with e_uri - - * gui/e-meeting-model.c (start_addressbook_server): make it return void, - since the return value does not mind - - * pcs/cal.c: - * pcs/cal-factory.c: - * pcs/cal-backend.[ch]: don't use GnomeVFS for URI management - - * pcs/cal-backend-file.c: ditto, only use GnomeVFS for internal - operations - - * cal-client/cal-client.c (cal_client_open_calendar): don't CORBA_exception_free - before checking for exceptions - -2001-10-03 Christopher James Lahey <clahey@ximian.com> - - * gui/e-calendar-table.etspec: Added priorities to a bunch of - these columns. Fixes Ximian bug #7158. - -2001-10-03 Damon Chaplin <damon@ximian.com> - - * gui/comp-util.c (cal_comp_util_add_exdate): save the EXDATE as a - DATE-TIME value, since we know the exact time. Fixes bug #11278. - (Before we were setting is_date, but icaltime_from_timet_with_zone() - didn't convert it properly. We need to figure out how to handle DATEs - when using time_t's.) - - * gui/dialogs/recurrence-page.c (get_exception_string): use - e_time_format_date_and_time() so we show the time as well, if the - exception is a DATE-TIME value. - - * cal-util/timeutil.c: removed time_add_month(), time_year_begin(), - time_month_begin() & time_week_begin() - old pre-timezone functions - which we no longer use. - - * cal-util/cal-recur.c (cal_recur_from_icalproperty): set - ir.until.is_date to FALSE before converting to a time_t. - Hopefully fixes bug #5034. - -2001-10-02 Ettore Perazzoli <ettore@ximian.com> - - * gui/dialogs/comp-editor.c (setup_widgets): Use - `bonobo_ui_component_new_default()', not - `bonobo_ui_component_new()'. - -2001-10-02 JP Rosevear <jpr@ximian.com> - - * cal-client/cal-query.c: use bonobo-exception to tidy - -2001-10-02 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (nth_weekday): handle -1 as - well - (comp_from_remote_record): fix monthly by day recurrences and - handle "last" day type - -2001-10-01 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/comp-editor.c (comp_editor_destroy): unref the page - objects here, instead of in close_dialog(). (This was fixed a while - ago, but accidentally reverted.) Fixes bug #7543. - -2001-10-01 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/alarm-notify-dialog.c (alarm_notify_dialog): - Set the window state to sticky. Thanks to Peter Teichman for the - suggestion. - -2001-10-01 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (local_record_from_comp): - Convert the comp exceptions to the pilot record - (comp_from_remote_record): record exceptions on the desktop and - use time zone stuff on recurrence end date - -2001-10-01 JP Rosevear <jpr@ximian.com> - - * pcs/cal-backend-file.c (cal_backend_file_compute_changes): - strdup the uid to avoid double free, write out only after - everything is done - -2001-10-01 Rodrigo Moya <rodrigo@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_open): don't use - gnome_vfs_uri_is_local on URIs created with - gnome_vfs_uri_new_private - -2001-09-28 Damon Chaplin <damon@ximian.com> - - * gui/print.c (print_comp_item): use bound_text to print the summary, - so it wraps instead of being clipped to 1 line. Fixes part 3 of bug - #10285, I think. - - * gui/dialogs/alarm-page.glade: left-aligned the Date/Time label. - Also set the width of the Summary & Date/Time labels to 10, and set - expand to TRUE, to make sure that the dialog doesn't keep getting - wider as the summary text on the main page gets longer. Could possibly - use an EClippedLabel here instead, so we get a '...' at the end if it - is clipped. - - * gui/dialogs/recurrence-page.glade: changed Summary & Date/Time - widths as above. - - * gui/print.c (print_calendar): use landscape mode for the month - preview. - (print_border_with_triangles): use EPSILON to account for floating - point errors. Hopefully fixes part 2b of bug #10285. - -2001-09-28 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (local_record_from_comp): - Handle the fields and category we don't sync by making sure we - don't overwrite them - (local_record_to_pilot_record): use local record category - (pre_sync): track db info - - * conduits/calendar/calendar-conduit.h: db info field - - * conduits/todo/todo-conduit.[hc]: same as above - - * pcs/cal-backend-file.c - (cal_backend_file_compute_changes_foreach_key): create a dummy - component of the right type and strdup the uid - (cal_backend_file_compute_changes): sync the db hash after each - change and free the uid - -2001-09-28 JP Rosevear <jpr@ximian.com> - - * cal-client/cal-client.c (cal_client_open_calendar): init the - execption rather than freeing it - -2001-09-28 Rodrigo Moya <rodrigo@ximian.com> - - * cal-client/cal-client.c (cal_client_construct): use bonobo-exception - for exceptions - (cal_client_open_calendar): likewise - -2001-09-27 Ettore Perazzoli <ettore@ximian.com> - - * gui/calendar-commands.c (pixmaps): Update pixmap menu paths; - /menu/ComponentToolsPlaceholder/Tools -> - /menu/Tools/ComponentPlaceholder . - * gui/tasks-control.c: Likewise. - -2001-09-27 Rodrigo Moya <rodrigo@ximian.com> - - * idl/evolution-calendar.idl: added InvalidURI and UnsupportedMethod - exceptions to the CalFactory interface - - * pcs/cal-factory.c (impl_CalFactory_open): raise InvalidURI exception on - URI errors and UnsupportedMethod when we don't support the method for - a given URI - -2001-09-26 Rodrigo Moya <rodrigo@ximian.com> - - * cal-client/cal-client.c: added support for using multiple calendar - factories - (cal_client_uri_list): use the list of factories loaded for this - CalClient - -2001-09-26 Damon Chaplin <damon@ximian.com> - - * gui/e-calendar-table.c (date_compare_cb): - (percent_compare_cb): - (priority_compare_cb): added comparison functions for these special - cell types. But the date and percent ones don't work yet due to the - use of static text buffers for return cell values. - (e_calendar_table_init): added the comparison functions to the - ETableExtras. NOTE: task_compare_cb() never seems to be called. - I'm not sure why it is there. - - * gui/e-calendar-table.etspec: set the comparison function names for - the date/percent/priority fields. - - * cal-util/cal-util.c (cal_util_priority_to_string): - (cal_util_priority_from_string): new utility functions. - - * gui/calendar-model.c (get_priority): - (set_priority): used above utility functions, and removed the warning - dialog which isn't useful now that the field isn't editable. - - * gui/dialogs/event-page.c (times_updated): handle timezones and for - all-day events make sure it stays an all-day event after adjusting. - Fixes bugs #5945 and #10222. - - * gui/calendar-commands.c (pixmaps): fixed the E_PIXMAP paths - the - edit items were moved beneath 'EditPlaceholder'. This gets rid of - those long Bonobo warnings! (and we get the icons back) - - * gui/dialogs/comp-editor.c (pixmaps): removed the PrintPreview toolbar - icon, since it doesn't appear in the xml file. Gets rid of warning. - - * gui/dialogs/event-page.c (notify_dates_changed): new function to - emit the notification signal when the dates are changed. It also - handles timezones now. - - * gui/dialogs/comp-editor-page.h (CompEditorPageDates): used - CalComponentDateTime for start/end/due so we have the timezone as well - as the time. - - * gui/dialogs/comp-editor-util.c (comp_editor_dates): updated to get - the timezones as well as the times. - (comp_editor_free_dates): new function needed to free all the structs. - - * gui/dialogs/recurrence-page.c (recurrence_page_set_dates): added call - to preview_recur() to make sure the preview gets updated. - - * gui/dialogs/alarm-page.c (alarm_page_fill_widgets): free the - CompEditorPageDates struct after use. - - * gui/tag-calendar.c (tag_calendar_by_comp): added 'comp_is_on_server' - argument. If FALSE, we try to use builtin timezones first. This is - needed for the recurrence page of the event editor, because the - timezones may not have been added to the server yet. This and the - changes to the notification stuff should fix bug #5034. - - * gui/gnome-cal.c (dn_query_obj_updated_cb): call above - tag_calendar_by_comp() with TRUE since the events will be on the - server in this case. - - * gui/e-day-view-layout.c: - * gui/e-day-view.c: made sure an event always takes up at least one - row, even when the start & end times are the same. Fixes bug #5944. - I don't know if we should try to also handle events with the end time - before the start time. - - * gui/e-week-view.c (e_week_view_style_set): check that the small font - is actually smaller than the normal font. If it isn't, don't use it. - Hopefully fixes bug #6876. - (e_week_view_on_new_appointment): if only one day is selected, then - we set the initial time of the event to 1/2-hour from the start of the - working day, to differentiate 'New Appointment' from 'New All Day - Event'. Fixes bug #8892. - - * gui/e-day-view.c (e_day_view_on_new_appointment): do the same as the - above. - -2001-09-26 Federico Mena Quintero <federico@ximian.com> - - Fixes the GUI part of bug #7892. - - * gui/dialogs/alarm-page.c (get_alarm_duration_string): Return - NULL if the duration is zero. - (get_alarm_string): Handle duration of zero. Also, hopefully - make the strings be more l10n-friendly. - - * gui/alarm-notify/alarm.c (alarm_ready_cb): I am a moron. Fix - reversed test. - -2001-09-26 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/comp-editor.c (comp_editor_destroy): disconnect - signals first thing - -2001-09-26 Dan Winship <danw@ximian.com> - - * gui/Makefile.am (evolution_calendar_LDFLAGS): Add - -export-dynamic to make glade custom widgets work on non-Linux. - -2001-09-26 Rodrigo Moya <rodrigo@ximian.com> - - * cal-util/cal-util.h: added CAL_MODE_INVALID to CalMode enum - -2001-09-26 JP Rosevear <jpr@ximian.com> - - * pcs/cal.h: new proto - - * pcs/cal.c (impl_Cal_set_mode): implement set mode method - (cal_class_init): set setMode function in epv - (cal_notify_mode): notify listener of mode change - - * pcs/cal-factory.c (add_uri): deal with UriType renaming - - * pcs/cal-backend.h: add new virtual methods and protos - - * pcs/cal-backend.c (cal_backend_class_init): init new virtual - methods to null - (cal_backend_set_mode): sets mode - (cal_backend_get_mode): gets mode - - * pcs/cal-backend-file.c (cal_backend_file_class_init): overide - get_mode and set_mode methods - (cal_backend_file_get_mode): return mode - (notify_mode): have listeners notified of the set mode call - (cal_backend_file_set_mode): set the mode by indicating not - supported - - * cal-client/cal-listener.h: update proto - - * cal-client/cal-listener.c (impl_notifyCalSetMode): implement set - mode callback - (cal_listener_construct): take set mode callback - (cal_listener_new): ditto - - * cal-client/cal-client.h: update protos, add signal proto - - * cal-client/cal-client.c (cal_client_class_init): add - cal_set_mode signal - (cal_set_mode_cb): handle set mode callback from listener - (cal_client_open_calendar): pass additional param to cal_listener_new - (cal_client_set_mode): wrapper to set the calendar mode - - * idl/evolution-calendar.idl: make UriType into CalMode, add - SetModeStatus enum and notifyCalSetMode method to the listener - - * gui/calendar-offline-handler.c (create_connection_list): fetch - the uri list ourselves - (impl_prepareForOffline): reflect param change of - create_connect_list - (update_offline): ditto - (backend_cal_set_mode): set mode call back - (backend_cal_opened): cal opened call back, set mode to local - (impl_goOffline): reflect UriType renaming - - * cal-util/cal-util.h: rename UriType to CalMode - -2001-09-25 Federico Mena Quintero <federico@ximian.com> - - Warning fixes courtesy of Chris Lahey <clahey@ximian.com>. - - * gui/e-itip-control.c (write_html): Warning fixes. Also, don't - strdup() more than necessary. - - * gui/e-meeting-time-sel.c (e_meeting_time_selector_refresh_cb): - Warning fixes. - - * gui/itip-utils.c (itip_addresses_get): Warning fixes. - - * gui/print.c (print_day_background): Warning fixes. - - * gui/dialogs/alarm-options.c (alarm_to_aalarm_widgets): Warning - fixes. - (alarm_to_palarm_widgets): Likewise. - - * gui/dialogs/delete-comp.c: #include "../calendar-config.h" - -2001-09-25 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/alarm.c (alarm_ready_cb): Check that the - timeout is not set up before we create a new one; the alarm_fn - callback may cause the alarm system to re-enter and add a new - alarm. Fixes bug #10840. - (pop_alarm): Assert that there is at least one alarm in the queue. - -2001-09-25 JP Rosevear <jpr@ximian.com> - - * pcs/cal.c: use bonobo-exception stuff to clean code - - * pcs/cal-factory.c (add_uri): add uri to the list if the type - matches - (impl_CalFactory_uriList): implement uriList method - - * pcs/cal-backend.h: new virtual function member - - * pcs/cal-backend.c (cal_backend_is_remote): call virtual function - - * pcs/cal-backend-file.c (cal_backend_file_class_init): override - virtual function - (cal_backend_file_is_remote): new virtual function, always return - FALSE - - * idl/evolution-calendar.idl: uriList factory call, with flags for - types to get - - * gui/dialogs/comp-editor.c (comp_editor_destroy): cast to remove - warning - - * gui/e-itip-control.c (write_label_piece): kill warnings by take - const char * - - * gui/component-factory.c (create_object): aggregate offline - interface - - * gui/Makefile.am: compile new files - - * calobj.[hc]: Remove obsolete files - - * cal-util/cal-util.h: enum URI types for uriList call - - * cal-client/cal-client.c (build_uri_list): build list from string - sequence - (cal_client_uri_list): factory call to get uri list - - * cal-client/cal-client.h: new proto - - * cal-client/cal-client.c: use bonobo exception stuff to clean - code - - * gui/calendar-offline-handler.[hc]: Start some skeleton routines - for online/offline handling - - * pcs/cal-factory.c (launch_backend_for_uri): use accessor and - remove FIXME - -2001-09-23 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (set_date_label): base text on component - type - -2001-09-20 Rodrigo Moya <rodrigo@ximian.com> - - * gui/component-factory.c: don't use gnome_vfs_uri_new_private - (fixes Ximian #10544) - -2001-09-20 Federico Mena Quintero <federico@ximian.com> - - * gui/component-factory.c: #include a few files we were missing - from libgnomevfs. - -2001-09-20 JP Rosevear <jpr@ximian.com> - - * pcs/cal-backend-file.c (load_db): gets a config db - (cal_backend_file_destroy): release config db - (cal_backend_file_init): use load_db - (mail_account_get): gets a mail account by number - (mail_account_get_default): gets the default mail account - (mail_account_is_valid): looks to see if any accounts have the - given address - (create_user_free_busy): modularize so we can call multiple times - if necessary, set organizer - (cal_backend_file_get_free_busy): if the list of users is null, - use the default account otherwise get the same info for each - address that is an identity in the mailer - - * gui/itip-utils.c (itip_addresses_get): s/gint/glong/ for bonobo - conf returns - - * gui/calendar-commands.c (publish_freebusy_cmd): fix problems - from a merge so that we publish 6 weeks of free/busy information - again - -2001-09-20 Larry Ewing <lewing@ximian.com> - - * gui/dialogs/recurrence-page.c (recurrence_page_destroy): make - sure to release the ref on priv->comp. - - * gui/dialogs/comp-editor.c (real_edit_comp): make sure to release - the ref on priv->comp. - -2001-09-19 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/alarm-queue.c (audio_notification): Display a - notification message always, in addition to playing the sound. - (procedure_notification): Present a confirmation dialog before - actually running the alarm's program. - (procedure_notification): Use gnome_execute_shell() instead of - gnome_execute_async() so that we handle multiple arguments - properly. Plus, it is most likely what the user expects. - (mail_notification): Display a message about unsupported email - reminders instead of blindly dropping the alarm. - - * gui/dialogs/alarm-options.glade: Added an explanatory message - about mail alarms not being supported. - - * gui/dialogs/alarm-page.glade: Removed the "Send an email" - option. - - * gui/dialogs/alarm-page.c (action_map): Removed CAL_ALARM_EMAIL. - -2001-09-19 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-editor.c (init_widgets): listen for model - changes - (task_editor_edit_comp): add the attendees to the model and notify - of need send - (row_count_changed_cb): mark as changed when row added/deleted - (model_row_changed_cb): mark as changed when row changes - - * gui/dialogs/event-editor.c (init_widgets): listen for model - changes - (event_editor_init): flip page order - (event_editor_edit_comp): set needs send value - (schedule_meeting_cmd): flip page order - (row_count_changed_cb): mark as changed when row added/deleted - (model_row_changed_cb): mark as changed when row changes - - * gui/dialogs/schedule-page.c: remove model change notification - stuff - (schedule_page_fill_widgets): no need to do the needs_send here - because the editor handles this since it owns the model - - * gui/dialogs/event-editor.c (init_widgets): listen for model - changes - (event_editor_init): flip page order - (event_editor_edit_comp): set needs send value - (schedule_meeting_cmd): flip page order - (row_count_changed_cb): mark as changed when row added/deleted - (model_row_changed_cb): mark as changed when row changes - - * gui/dialogs/meeting-page.c (meeting_page_fill_widgets): no need - to do the needs_send here because the editor handles this since it - owns the model - (invite_entry_changed): ditto - - * gui/dialogs/comp-editor.c (comp_editor_set_changed): new - accessor - (comp_editor_get_changed): ditto - (comp_editor_set_needs_send): ditto - (comp_editor_get_needs_send): ditto - - * gui/dialogs/comp-editor.h: new protos - - * gui/itip-utils.c (itip_addresses_get): reflect configuration - path changes in the mailer - - * gui/e-meeting-model.c: remove commented out code, ifdef one - section for later - -2001-09-19 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-factory.c (cal_factory_oaf_register): add a new parameter - (const char *iid) to specify the OAFIID of the factory being - registered - -2001-09-19 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-model.c (e_meeting_model_refresh_busy_periods): - remove silly debug #if 0 - - * gui/calendar-commands.c (publish_freebusy_cmd): g_list_free - rather than g_free - - * gui/e-itip-control.c (write_html): eliminate code path that - caused double freed memory - -2001-09-18 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/schedule-page.*: A page that shows the meeting time - selector and free/busy data for attendees - - * gui/dialogs/meeting-page.c: use the meeting model to track/edit - attendees, remove table value conversion routines and simple table - routines - (set_attendees): take a pointer array - (meeting_page_destroy): destroy the pointer array, save state - (meeting_page_init): new pointer array - (meeting_page_fill_widgets): don't null the deleted attendees - field - (popup_delegate_cb): array add - (popup_delete_cb): array add - (cleanup_attendees): iterate over the array to unref now - (meeting_page_fill_widgets): don't null out fields, no need to add - attendees here - (invite_entry_changed): use e_meeting_attendee routines - (popup_delegate_cb): ditto - (popup_delete_cb): ditto - (meeting_page_new): take new arg and pass it to construct - (meeting_page_construct): take new arg, use e-meeting-model - routines to construct table - - * gui/dialogs/task-editor.c (task_editor_init): new meeting model - (task_editor_destroy): unref the model - - * gui/dialogs/event-editor.c (event_editor_init): make new model - and pass it to meeting and schedule pages - (event_editor_set_cal_client): virtual function, set meeting model - client - (event_editor_edit_comp): add the attendees to the model - (event_editor_destroy): unref model - - * gui/dialogs/comp-editor.h: add virtual function - * gui/dialogs/comp-editor.c (comp_editor_set_cal_client): make - set_cal_client a virutal function - - * gui/e-meeting-types.h: generally useful type defines - - * gui/e-meeting-time-sel*.[hc]: Move here and use an e-table for - the attendee list and extract display information from the new - meeting model and attendees - - * gui/e-meeting-time-sel.etspec: spec for the table - - * gui/e-meeting-attendee.[hc]: meeting attendees for the model, - with to/from conversions for CalComponentAttendee structure, emits - changed signal and allows getting and setting of free busy - periods - - * gui/e-meeting-model.[hc]: move the model out on its own - - * gui/e-itip-control.c (write_error_html): clean up warnings - -2001-09-18 Federico Mena Quintero <federico@ximian.com> - - Fixes bug #6350. - - * gui/component-factory.c (remove_folder): Use a simplified method - for removing our folder data; we just need to remove calendar.ics - or tasks.ics and the corresponding backup files. - -2001-09-18 Federico Mena Quintero <federico@ximian.com> - - Fixes bug #2830. - - * gui/calendar-config.c (calendar_config_get_confirm_delete): New - function. - (calendar_config_set_confirm_delete): New function. - (config_read): Get the default value for the ConfirmDelete option. - (calendar_config_write): Set the value of ConfirmDelete. - - * gui/dialogs/delete-comp.c (delete_component_dialog): Handle the - configuration option for confirmation. - - * gui/dialogs/cal-prefs-dialog.c (CalPrefsDialogPrivate): Added - the fields for the Other page. - (get_widgets): Handle the new widgets. - (cal_prefs_dialog_show_config): Likewise. - (cal_prefs_dialog_update_config): Likewise. - -2001-09-18 Rodrigo Moya <rodrigo@ximian.com> - - * cal-client/cal-client-multi.[ch]: new class for managing multiple - calendars, with an API very similar to the CalClient one, - for ease of transition from one to the other - - * gui/component-factory.c (xfer_folder, remove_folder, create_folder): - reworked to be able to manage folders for any calendar backend, and - not only the file: one - -2001-09-18 Rodrigo Moya <rodrigo@ximian.com> - - * idl/evolution-calendar.idl: changed signature for the getFreeBusy - method, to return a sequence of CalObj's, and added sequence of users - as a new parameter to that method - - * cal-client/cal-client.c (cal_client_get_free_busy): adapted to new - IDL method signature, by adding a new "GList *users" parameter, for - callers to be able to specify a list of users - - * pcs/cal-backend.[ch] (cal_backend_get_free_busy): - * pcs/cal-backend-file.c (cal_backend_file_get_free_busy): add the - "GList *users" parameter. In cal_backend_file_get_free_busy, call - lookup_component to get the CalComponent for each uid, instead - of calling cal_backend_get_object, which meant converting the - component to a string and then parsing it again. - - * cal-client/client-test.c (cal_opened_cb): - * gui/e-itip-control.c (send_freebusy): - * gui/calendar-commands.c (publish_freebusy_cmd): adapted to - new getFreeBusy method signature - -2001-09-17 Damon Chaplin <damon@ximian.com> - - * gui/calendar-model.c: added a timeout to refresh the list every - 10 minutes. Not ideal, as the user may be editing a task when it gets - refreshed. - (adjust_query_sexp): use the 'completed-before?' operator to filter - out tasks according to the config settings. - - * gui/dialogs/task-details-page.c (task_details_page_fill_widgets): - added support for the 'Completed' date. This code must have got lost - somewhere, as it used to work. - (date_changed_cb): set the priv->updating flag while updating the other - widgets. - - * pcs/cal-backend-file.c (cal_backend_file_update_objects): made sure - we freed the components. - - * pcs/query.c (func_completed_before): added 'completed-before?' - operator. - - * gui/calendar-config.c (calendar_config_configure_e_cell_date_edit): - don't set the lower & upper hour. Use 0-24 like the EDateEdit does. - - * gui/dialogs/cal-prefs-dialog.c (cal_prefs_dialog_show_config): set - the 12/24-hour time format options sensitive only if we support both. - - * gui/calendar-config.c (config_read): if the locale doesn't define - 'am' and 'pm' strings then we must use 24-hour format. - - * gui/calendar-commands.c (calendar_set_folder_bar_label): don't - translate the '%d' as it doesn't make much sense. Resolves bug #8027. - -2001-09-17 Federico Mena Quintero <federico@ximian.com> - - * gui/component-factory.c (owner_set_cb): Do not call - calendar_config_init() here. - - * gui/main.c (main): Call calendar_config_init() here. - -2001-09-17 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/alarm.c (queue_alarm): Duh, only setup the - timeout if the list was empty. - (alarm_ready_cb): Notify with the ID of the original alarm. - (alarm_remove): Likewise. - -2001-09-17 Federico Mena Quintero <federico@ximian.com> - - Switch the alarm system from using SIGALRM to normal glib timers. - Also, use a more robust de-queueing mechanism. - - * gui/alarm-notify/alarm.c (alarm_init): Removed. - (alarm_done): Remove the glib timeout instead of closing the pipes - and the signal handler. - (alarm_add): Allow adding alarms that happen before right now. - (queue_alarm): Use a glib timer instead of a signal. - (alarm_remove): Adjust the timeout as appropriate. - - * gui/alarm-notify/notify-main.c (main): There is no need to - initialize the alarm system now. - - * gui/main.c (main): Likewise. - -2001-09-17 JP Rosevear <jpr@ximian.com> - - * gui/calendar-model.c (calendar_model_init): get itip addresses - (calendar_model_destroy): destroy same - (calendar_model_value_at): do more thorough checking on whether to - use recurring, assigned, assigned to or regular task icons - -2001-09-17 JP Rosevear <jpr@ximian.com> - - * cal-util/cal-component.c (for_each_remove_all_alarms): for each - call back, removes the alarms - (cal_component_remove_all_alarms): remove all alarms from the - component - - * cal-util/cal-component.h: new proto - - * gui/e-itip-control.c (write_error_html): writes error messages - rather than normal html - - * gui/itip-utils.c (itip_send_comp): remove all alarms if the - method warrants it - -2001-09-16 Christopher James Lahey <clahey@ximian.com> - - * gui/dialogs/meeting-page.c (build_etable): Updated this to match - the new ETableSimple interface. - -2001-09-14 Ettore Perazzoli <ettore@ximian.com> - - [Automake 1.5 fixes pointed out by Richard Boulton - <richard@tartarus.org>, as per #9258.] - - * cal-client/Makefile.am: Set CLEANFILES directly instead of using - `+='. - * gui/Makefile.am: Likewise. - * gui/alarm-notify/Makefile.am: Likewise. - * pcs/Makefile.am: Likewise. - -2001-09-14 Damon Chaplin <damon@ximian.com> - - * gui/e-itip-control.c (ok_clicked_cb): added space after 'identities' - in the message. Fixes bug #9896. - -2001-09-14 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/e-calendar.conduit.in: remove translation - marker for now - -2001-09-13 JP Rosevear <jpr@ximian.com> - - * cal-util/cal-component.h: use ical partstat, role, cutypes - directly - - * cal-util/cal-component.c: ditto - - * gui/e-itip-control.c (find_my_address): set my addresses if the - addresses match - (find_attendee): strstr returns non-null on a match - (write_html): use new icon, select the name displayed (organizer - or attendee) based on method, - (ok_clicked_cb): when rsvp'ing strip off all but the attendee - being replied for as is specified in the spec - (find_attendee_partstat): new util function to extract the - partstat of an attendee - (update_attendee_status): updates the partstat of a specific - attendee in the reply message - - * gui/dialogs/meeting-page.c: use ical partstat, role, cutypes - directly - (popup_delegate_cb): if we delegate, notify of needs send and - changed - (popup_delete_cb): notify of needs send and changed for each - deletion - -2001-09-12 JP Rosevear <jpr@ximian.com> - - * gui/calendar-commands.c (publish_freebusy_cmd): send 6 weeks of - free busy info starting with the UTC start of day - - * gui/itip-utils.c (get_label): create a text representation of - the given icaltime - (itip_send_comp): if the summary is empty, set the subject based - on the type of component, put the right extension on free/busy - components and base descriptions on type of component, include - start/end for free/busy info - -2001-09-11 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/alarm-queue.c (display_notification): Added an - use_description argument so that other alarms can fall back to - this type. - (audio_notification): Implemented. - (remove_comp): Call remove_queued_alarm() here; there is no longer - a destroy notification function for alarms so must we do this - manually. - (alarm_trigger_cb): Do not pass the alarm to the notification - functions so that we can free it ourselves before all the alarms - in the component get freed. - (display_notification): Get the alarm here instead of getting it - as an argument. - (procedure_notification): Implemented. - -2001-09-11 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c (invite_entry_changed): free the - destination vector when we finish with it, if we actually add - anyone, notify listeners of the needs send and changed info. Fixes - bug #8632. - -2001-09-10 Zbigniew Chyla <cyba@gnome.pl> - - * gui/print.c - (format_date): Convert string generated by strftime to UTF-8. - (print_week_view_background): Ditto. - (print_month_summary): Ditto. - (print_month_small): Use U_() instead of _(). - (print_day_background): Ditto. - (print_todo_details): Ditto. - (print_date_label): Convert generated string to UTF-8. - -2001-09-10 Federico Mena Quintero <federico@ximian.com> - - * cal-util/cal-component.c (cal_component_alarm_get_attach): - Handle the new icalattach type instead of struct icalattachtype. - (cal_component_alarm_set_attach): Likewise. - - * gui/dialogs/alarm-options.c (alarm_to_aalarm_widgets): Likewise. - (alarm_to_palarm_widgets): Likewise. - (aalarm_widgets_to_alarm): Likewise. - (palarm_widgets_to_alarm): Likewise. - -2001-09-05 Ettore Perazzoli <ettore@ximian.com> - - [Fix #958, ShellComponents should not be created by factories, for - the calendar.] - - * gui/GNOME_Evolution_Calendar.oaf.in: Remove the - ShellComponentFactory. - - * gui/component-factory.c (create_object): Renamed from - `component_fn'. Don't get any args. - (component_factory_init): Create the component using - `create_object()' and register it into OAF. - (COMPONENT_FACTORY_ID): Removed. - (COMPONENT_ID): New. - -2001-09-04 Federico Mena Quintero <federico@ximian.com> - - * gui/component-factory.c (sc_user_create_new_item_cb): - Implemented. - - * gui/main.c (component_editor_factory_init): New function to - create the factory for the comp_editor_factory. - - * gui/comp-editor-factory.c: Finished implementation. - - * gui/alarm-notify/alarm-queue.c (edit_component): Implemented the - Edit command. - - * gui/Makefile.am (evolution_calendar_SOURCES): Added - comp-editor-factory.[ch] to the list of sources. - -2001-09-03 Damon Chaplin <damon@ximian.com> - - * gui/calendar-commands.c (calendar_control_activate): - * gui/tasks-control.c (tasks_control_activate): don't call - calendar_config_check_timezone_set() now, since the startup wizard - handles that. - - * gui/e-tasks.c (e_tasks_class_init): changed selection_changed signal - to GTK_RUN_LAST. It has no reason to be GTK_RUN_FIRST. - - * gui/gnome-cal.c: - * gui/e-week-view.c: - * gui/e-day-view.c: added "selection_changed" signal, - XX_delete_event() and XX_get_num_events_selected(). - - * gui/e-day-view-top-item.c (e_day_view_top_item_draw): fix the shadow - around the dates at the top - it was 1 pixel off. - - * gui/calendar-commands.c: added sensitize_commands(), similar to in - tasks-control.c, so we only make Cut/Copy/Delete sensitive when an - event is selected. Also added delete_event_cmd(). - - * gui/dialogs/task-page.c (task_page_set_summary): - * gui/dialogs/event-page.c (event_page_set_summary): do nothing, - since the summary only gets changed on the main event/task page now. - Fixes bug #6939. - - * gui/e-day-view.c (e_day_view_on_main_canvas_drag_data_received): - (e_day_view_on_top_canvas_drag_data_received): check that we are - dragging an event from the same EDayView. We currently don't support - DnD from other widgets. - (e_day_view_update_top_canvas_drag): only get the summary if we - actually have an event. Fixes bug #5162. - - * gui/e-day-view.c (e_day_view_on_editing_stopped): if the text hasn't - changed we need to call e_day_view_update_event_label() to show the - times again if necessary. Fixes bug #1813. - - * gui/dialogs/comp-editor.c (comp_editor_destroy): destroy the - CompEditorPage objects here rather than in close_dialog(), after the - widgets have been destroyed. We do this because the widgets have lots - of signal handlers connected with the CompEditorPage objects as the - signal data, so we want to ensure that the data pointer is always - valid. (Alternatively we could disconnect all the handlers when the - CompEditorPage objects are destroyed, or use connect_while_alive()). - Fixes bug #7543. - - Note: there is still a small bug in that if you type in a time and - then hit 'Save and Close', the time won't be saved. I'm not sure - where this should be fixed - should the actions which close the - dialog grab the focus to the toplevel, so any widgets currently - being edited finish the edit and emit 'changed'? - - * gui/dialogs/recurrence-page.c (append_exception): use - gtk_clist_set_row_data_full() so freeing is handled automatically by - the GtkClist. This helps avoid problems at destroy-time. - (exception_delete_cb): just call gtk_clist_remove() now. No need to - free the row data as GtkCList now handles it. - (recurrence_page_destroy): no need to free the data in the clist. - - * gui/dialogs/alarm-page.c: ditto. - - * gui/dialogs/meeting-page.c: ditto. - (etable_destroy_cb): save the ETable state in this new handler cb - rather than in the destroy method, since the widget will already be - destroyed by then. - -2001-08-31 Damon Chaplin <damon@ximian.com> - - * gui/e-itip-control.c: changed 3 occurrences of 'Replyed' to 'replied' - -2001-08-31 Zbigniew Chyla <cyba@gnome.pl> - - * gui/e-itip-control.c (write_html): - Marked strings for translation (with U_). - - * gui/itip-utils.c (itip_send_comp): - Ditto. - -2001-08-31 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/comp-editor-util.c (comp_editor_contacts_to_widget): - (comp_editor_contacts_to_component): fix debugging messages so they - use "" rather than NULL. Fixes bug #8559. - -2001-08-29 Federico Mena Quintero <federico@ximian.com> - - * pcs/cal-backend-file.c (cal_backend_file_remove_object): See if - the set of categories changed by using the removed_categories hash - table. - (cal_backend_file_init): Create a table of removed categories. - This allows us to notify if and only if the set of category - changes when an object is updated/removed, instead of - unconditionally notifying if an object is updated. - (cal_backend_file_update_objects): Only notify if the set of - categories really changed. - (update_categories_from_comp): Shuffle the categories between the - priv->categories and priv->removed_categories lists. - -2001-08-28 Federico Mena Quintero <federico@ximian.com> - - Fixes bug #7879, a query may receive an update notification from - the backend before the query itself gets populated. - - * pcs/query.c (ensure_sexp): New function; ensures that the esexp - is created and notifies of parse errors. It is the bulk of - start_query_cb() but put in a separate function so that we can - share it elsewhere. - (start_query_cb): Use ensure_sexp(). - (process_component_cb): Oops, notify of a successfully finished - query. - (match_component): Call ensure_sexp(). This function can be - called by the backend notification callbacks before the query is - populated, so we need to make sure the esexp exists here. - -2001-08-22 Federico Mena Quintero <federico@ximian.com> - - * gui/cal-search-bar.c (cal_search_bar_construct): Set the - "category is" criterion as the default for the calendar and tasks. - -2001-08-22 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/recurrence-page.c (recurrence_page_fill_widgets): - Unset the priv->updating flag before returning in the case the - component has no recurrence information. Fixes bug #6850. - -2001-08-22 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/alarm-queue.c (QueuedAlarm): Added a snooze - flag to differentiate snoozed alarms from real occurrences. - (add_component_alarms): Do not specify a destroy function for the - alarm trigger. We handle this in the callbacks now. - (alarm_trigger_cb): Just remove the alarms for the unimplemented - notification types. - (create_snooze): Implemented snooze. - (notify_dialog_cb): Snooze as appropriate. - -2001-08-22 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (foreach_tzid_callback): call back to add - timezones to the top level - (itip_send_comp): call icalcomponent_foreach_tzid - -2001-08-22 Dan Winship <danw@ximian.com> - - * gui/gnome-cal.c: #include <libgnomevfs/gnome-vfs-types.h> so - this will compile against gnome-vfs 1.0.1. - -2001-08-22 Rodrigo Moya <rodrigo@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_open): open the tasks folder - associated with the calendar being opened, and not always the local - tasks.ics file - - * pcs/cal-factory.c (open_fn): use gnome_vfs_uri_new_private when - parsing the URI to allow non-registered URIs - -2001-08-21 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/alarm-options.c (alarm_to_palarm_widgets): Handle - the case where there is no attachment. Fixes bug #7257. - -2001-08-21 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (write_html): strip the mailto bit for the - email address if we display it - -2001-08-21 Damon Chaplin <damon@ximian.com> - - * pcs/query.c (func_is_completed): added new e-sexp operator. We - don't currently use it though. - - * gui/dialogs/cal-prefs-dialog.glade: Changed '_Overdue' to 'O_verdue' - since we have an '_Other' notebook tab. Added '_Hide' accel. - - * gui/dialogs/cal-prefs-dialog.c: hooked up config options to dialog. - - * gui/calendar-config.c: added config options for hiding completed - tasks. - - * gui/e-week-view-event-item.c (e_week_view_event_item_draw): - * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): - * gui/e-day-view.c (e_day_view_reshape_long_event): added 2 pixels - extra space between icons and text for long events, and 1 pixel space - between icons in all events. - (e_day_view_realize): changed the background color to match the - EGrayBar in the shell. - -2001-08-21 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-util.[ch]: new files to contain utility functions - for calendar backends - - * pcs/cal-backend.c (cal_backend_add_cal): implement it here, and not in - the calendar backends. Add a "cal_added" signal, so that backends are - notified when a new Cal is added, if they need to - (cal_backend_get_type_by_uid): implement it here - - * pcs/cal-backend-file.c (fill_alarm_instances_seq): moved to - cal-backend-util.c - (cal_backend_file_add_cal): removed - (cal_backend_file_init): connect to the "cal_added" signal in the - CalBackend class so that we can update categories when a new Cal is - added - (cal_backend_file_get_type_by_uid): removed - - * pcs/cal-backend-db.c (fill_alarm_instances_seq): moved to - cal-backend-util.c - (cal_backend_db_add_cal): removed - (cal_backend_db_get_type_by_uid): removed - - * AUTHORS: added JP and Damon to list of authors - -2001-08-20 Rodrigo Moya <rodrigo@ximian.com> - - * cal-util/cal-util.[ch] (cal_util_generate_alarms_for_list): - (cal_util_generate_alarms_for_comp): - new functions moved from the CalBackendFile, to allow its use outside - of it. The signature has changed a little bit, since these functions - need a way to get the timezones from the callers, so a callback - function to resolve the timezones has been added to the list of - parameters - - * pcs/cal-backend-file.c (generate_alarms_for_list): - (generate_alarms_for_comp): moved to cal-util, with all their related - functions/structures - - * pcs/cal-backend-db.c: removed functions that were moved to cal-util - -2001-08-20 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/comp-editor.c (pixmaps): use Delete icon in menu, and - change to bigger Save icon in toolbar. - - * gui/tasks-control.c: - * gui/calendar-commands.c (pixmaps): used new_task-16.png and - goto-16.png. - -2001-08-20 Damon Chaplin <damon@ximian.com> - - * gui/calendar-commands.c (pixmaps): added delete icons for menu - and toolbar. - -2001-08-20 Damon Chaplin <damon@ximian.com> - - * gui/tasks-control.c: added Cut/Copy/Paste icons for toolbar. - -2001-08-20 Damon Chaplin <damon@ximian.com> - - * gui/tasks-control.c: uses new delete icons in menu & toolbar. - -2001-08-19 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c: Update the folder list to include a - display name and a description. - -2001-08-20 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/comp-editor.c (pixmaps): use new delete icon for toolbar. - -2001-08-19 Damon Chaplin <damon@ximian.com> - - * gui/e-itip-control.c: fixed typo, 'send' -> 'sent'. Bug #7621. - -2001-08-18 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/cal-prefs-dialog.glade: added option to hide completed - tasks after a given number of minutes/hours/days. Unfinished. - - * gui/dialogs/event-page.c (event_page_fill_component): initialize - zone to NULL to avoid a warning. - (contacts_clicked_cb): work around a bug in SelectNames by notifying - that the page has changed when you click the 'Contacts' button. - Otherwise it is easy to lose changes. - - * gui/dialogs/task-page.c (contacts_clicked_cb): ditto. - -2001-08-18 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/comp-editor.c (pixmaps): used new Save/Save As icons. - - * gui/tasks-control.c: - * gui/calendar-commands.c (pixmaps): added new Cut/Copy/Paste icons, - and changed the 'New Task' icon to use the bigger one I made. - -2001-08-05 Zbigniew Chyla <cyba@gnome.pl> - - * gui/dialogs/task-page.c (summary_changed_cb): - Use e_dialog_editable_get instead of gtk_editable_get_chars (we need - UTF-8 string). - -2001-08-18 Zbigniew Chyla <cyba@gnome.pl> - - * gui/calendar-config.c (locale_uses_24h_time_format): New. - (config_read): Use locale's setting as default for - /Calendar/Display/Use24HourFormat so that Europeans don't have to - switch to 24-hour format manually. - -2001-08-17 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (destroy): destroy the addresses - (clean_up): don't free the addresses, we need them - -2001-08-17 Damon Chaplin <damon@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_new_task): new function to open the - task editor to add a new task. - - * gui/calendar-commands.c: added new_task_cb() to create a new task - in the calendar folder, and added menu commands for it, and a toolbar - button (I think that is what Ettore wanted. Maybe he just meant menu - commands. Anyway, it is easy to take out.) Note that we don't have a - decent icon for 'New Task' for the toolbar. - Also added the new Goto button (but we don't have a similar one for - the menu command). - -2001-08-16 Iain Holmes <iain@ximian.com> - - * gui/Makefile.am: Add the libetimezonedialog.a lib link - - * gui/calendar-config.c: Change the #include for the timezone dialog - - * gui/e-timezone-entry.c: Ditto. - - * gui/dialogs/Makefile.am: Remove the e-timezone-dialog stuff. - -2001-08-16 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/event-page.c: hide the timezone fields for all-day - events. We will use DATE values for these eventually, and these - don't have timezones associated with them. Currently we just use the - default timezone for all-day events, as a workaround until we have - DATE values working. - - * gui/dialogs/comp-editor-util.c (comp_editor_new_date_edit): added - make_time_insensitive flag. Though we may not use it. - - * gui/dialogs/event-page.glade: made the 'All day event' toggle - right-aligned, so it doesn't move when the other widgets are shown - and hidden. - - * gui/e-timezone-entry.c (e_timezone_entry_set_default_timezone): new - function to set the default timezone of the widget. If the current - timezone setting matches the default then the entry field is hidden. - Most people won't use timezones so this makes the GUI simpler. - - * gui/dialogs/event-page.c (init_widgets): - * gui/dialogs/task-page.c (init_widgets): set the default timezone - using the above function. - - * gui/dialogs/task-page.c (task_page_fill_widgets): if the start date - or due date is not set, we use the default timezone, so the user - doesn't have to set this each time they set the date. - -2001-08-16 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/alarm-page.c (alarm_page_fill_widgets): If the - component has no alarms remember to set the priv->updating flag to - FALSE before returning. - -2001-08-16 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/e-delegate-dialog.c - (e_delegate_dialog_get_delegate_name): get the destinations - property, not the text property - -2001-08-16 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/alarm-page.c (clear_widgets): Set the default-to-add - notification to be display a message 15 minutes before the start - of the appointment. Fixes bug #7175. - -2001-08-16 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/comp-editor-util.c (comp_editor_strip_categories): - New function to strip surrounding whitespace from a string of - categories entered by the user. - - * gui/dialogs/task-page.c (task_page_fill_component): Use - comp_editor_strip_categories(). - - * gui/dialogs/event-page.c (event_page_fill_component): Likewise. - -2001-08-16 Federico Mena Quintero <federico@ximian.com> - - * gui/calendar-config.c (calendar_config_configure_e_date_edit): - Do not set the time popup range. We also want to be able to - create appointments that are not within nine-to-five! Think of - going to the movies! Fixes bug #7436. - - * gui/dialogs/cal-prefs-dialog.glade: "am/pm" is now "AM/PM". - Fixes bug #7367. - -2001-08-16 Jon Trowbridge <trow@ximian.com> - - * gui/cal-search-bar.c: Changed to reflect my renaming of some of - the more hideously-named functions in the ESearchBar API. - -2001-08-15 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/comp-editor.c (save_comp): only fill the component - and save it if something has changed - (save_comp_with_send): only try to send if something has changed - and the editor needs a send - -2001-08-15 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/cal-prefs-dialog.glade: OK, re-added the default - alarm options. Way too many people are asking for them. - -2001-08-15 Federico Mena Quintero <federico@ximian.com> - - * gui/component-factory.c (factory_fn): Add the user creatable - items. The callback is not actually implemented yet; this is just - to finalize the GUI. - - * gui/dialogs/cal-prefs-dialog.glade: Added an option to ask for - confirmation when deleting items. Added underlined shortcuts - (they may not all work currently). - -2001-08-14 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/task-page.c: - * gui/dialogs/event-page.c: added support for the Contacts field. - Note that I'm not sure what we should put in the iCalendar CONTACT - properties. Currently we put "name <email>", but it isn't recognized - as a contact when we reopen the dialog, so we may need more info here. - Also we currently use a simple parser to parse the above format, and - we should maybe use some camel function. - - * gui/dialogs/task-page.glade: - * gui/dialogs/event-page.glade: replaced the GtkEntry fields for the - Contacts with a GtkEventBox which we put the BonoboControl in at - runtime. - - * gui/dialogs/meeting-page.c (invite_entry_changed): added FIXMEs - since it doesn't seem to be freeing the EDestination stuff. JP? - - * gui/dialogs/comp-editor-util.c: added bunch of utility functions to - handle the Contacts field in the main Event and Task pages. - - * gui/gnome-cal.c: added visible_start and visible_end fields, so we - only emit the 'dates-shown-changed' signal when really necessary. - Currently changing the folder title bar label results in a complete - redraw of the Evolution window (silly GtkLabel queueing a resize), - so we want to avoid that as much as possible. - (gnome_calendar_new_appointment_for): only move the event's end time - to the end of the day if it is not already 00:00:00. - - * gui/e-week-view-event-item.c: - * gui/e-week-view.c: - * gui/e-day-view.c: added support for double-clicking on an event to - open it, and for double-clicking on the background to create a new - event. There is still a minor problem to sort out, but it basically - works. - - * cal-util/cal-component.c: added support for CONTACT properties, - mainly by copying the code for COMMENT properties which are exactly - the same type. - - * gui/e-day-view.c (e_day_view_realize): use the same color for the - top canvas background as the shortcut bar, to make it look a little - nicer (I think). Although we still have the theme problem with - hard-coded colors. - -2001-08-14 Federico Mena Quintero <federico@ximian.com> - - * gui/e-calendar-table.etspec: Made the click-to-add message - shorter. Fixes bug #7177. - -2001-08-14 Federico Mena Quintero <federico@ximian.com> - - * gui/calendar-commands.c (pixmaps): Added Tigert's new icons for - Prev and Next. - -2001-08-14 Federico Mena Quintero <federico@ximian.com> - - * gui/cal-search-bar.c (make_suboptions): Make the "Any Category" - item consistent with the one in the addressbook. Also, free the - items correctly. - -2001-08-14 Federico Mena Quintero <federico@ximian.com> - - * gui/cal-search-bar.c (get_current_category): Handle an array of - categories in the CalSearchBar instead of our own menu items. - (notify_query_contains): Fetch the text from the search bar here - instead of in regen_query(). - (regen_query): Handle category searches. - (notify_category_is): New function. - (cal_search_bar_construct): Do not create an option menu. - (make_suboptions): New function to create the suboption items from - the list of categories. - (notify_query_contains): Do not include a category sexp here. - -2001-08-13 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (update_item): add dialog for feedback - (remove_item): ditto - (send_item): ditto - (send_freebusy): ditto - -2001-08-13 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c: rewrite the gui to use gtkhtml - - * gui/Makefile.am: define the icon dir - -2001-08-12 Kjartan Maraas <kmaraas@gnome.org> - - * gui/e-itip-control.h: Remove #include <config.h> from here. - * gui/itip-utilss.h: Same here. - -2001-08-11 Ettore Perazzoli <ettore@ximian.com> - - * gui/tasks-control.c: Update the paths of the Tools menu - according to the changes in the XML [i.e. things are moved to the - ComponentToolsPlaceholder]. - - * gui/calendar-commands.c: Likewise. - -2001-08-11 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/event-page.c (init_widgets): - * gui/dialogs/task-page.c (init_widgets): turn on word-wrap for the - description fields. Fixes bug #6821. - -2001-08-10 Jon Trowbridge <trow@ximian.com> - - * gui/cal-search-bar.c: Where we have ESearchBarItems, set their - subitems to NULL. - -2001-08-09 Damon Chaplin <damon@ximian.com> - - * pcs/cal-backend.c (cal_backend_get_object_component): added new - backend method to get the component given a UID. - - * pcs/cal-backend-file.c (cal_backend_file_get_object_component): - added implementation of above virtual method. - - * pcs/query.c (match_component): use the new backend function to get - the CalComponent rather than the string. This avoids converting all - the calendar components to strings and parsing them back into - components for every query! (That wasn't a good idea, was it ;) - - * gui/e-week-view.c: - * gui/e-day-view.c: use a timeout handler to layout the events, - to avoid doing a layout for each event we get from a query. - - * gui/print.c (print_day_add_event): - * gui/e-day-view.c (e_day_view_add_event): set start_row_or_col and - num_columns to 0. They are guint8's. - - * gui/e-week-view.c (e_week_view_free_events): hide all the jump - buttons. Fixes bug #5946. - - * gui/calendar-commands.c (calendar_set_folder_bar_label): added the - day numbers for the month view. - - * gui/dialogs/recurrence-page.glade: changed "_Delete" to "_Remove", - since it clashed with "_Add". Also added underlined accelerators for - the recurrence radio buttons. Note that none of these accelerators - actually work at present, due to the way we are using .glade files - for each notebook page. I need to add a bug about this. - Also, the "_Action" menu doesn't popup when I press Alt+A, even though - the "_File" menu does popup when I press Alt+F. Strange. - - * pcs/cal-backend-file.c (cal_backend_file_get_timezone_object): - removed debug msgs. - -2001-08-09 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): - * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): - * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons): - unref the GdkPixmap and GdkBitmap returned by the function - e_categories_config_get_icon_for () - -2001-08-09 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-page.*: Remove progress frame - - * gui/dialogs/task-details-page.*: Put in progress frame, remove - basics frame - - * gui/dialogs/task-editor.c (set_menu_sens): util function to set - menu sensitivity based on state - (task_editor_init): add meeting page - (task_editor_edit_comp): show page if necessary - (task_editor_destroy): unref meeting page - (assign_task_cmd): bring up meeting page - (refresh_task_cmd): save before sending - (forward_cmd): ditto - - * gui/dialogs/comp-editor.c (save_cmd): implement new save command - -2001-08-09 Federico Mena Quintero <federico@ximian.com> - - * gui/e-itip-control.c (destroy): Chain to the destroy handler in - the parent class! - - * gui/dialogs/comp-editor-page.c (comp_editor_page_destroy): - Likewise. Sigh. - - * gui/cal-search-bar.c (cal_search_bar_destroy): Whoops, added a - destroy handler. - -2001-08-08 Damon Chaplin <damon@ximian.com> - - * gui/goto-dialog.glade: removed underlined accelerator key from - "_Go To Today" button. GnomeDialog doesn't actually support underlined - accelerator keys for buttons. We could hack it, like Glade does, if - we really need to. Fixes bug #6418. - -2001-08-08 Federico Mena Quintero <federico@ximian.com> - - * gui/e-day-view.c (update_query): Stop editing any event. Fixes - bug #5949. - -2001-08-08 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/alarm-page.c (alarm_page_fill_component): Duuuh, set - the alarm_copy on the component, not the original alarm. Fixes - bug #5214. - -2001-08-08 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c (set_attendees): set the attendees of - a component - (meeting_page_fill_component): use above - (meeting_page_get_cancel_comp): return a comp with the attendees - to be cancelled - - * gui/dialogs/meeting-page.h: get a component that will be sent as - a cancellation - - * gui/dialogs/event-editor.c (event_editor_class_init): override - send_comp class method - (event_editor_send_comp): send cancellation notices to deleted - attendees - (refresh_meeting_cmd): save before send - (forward_cmd): ditto - - * gui/dialogs/comp-editor.c (comp_editor_class_init): set default - send_comp method - (real_send_comp): do the real work - (comp_editor_send_comp): call class method - (save_comp): don't do any sending - (save_comp_with_send): save and send here - (prompt_to_save_changes): use above - (save_close_cmd): ditto - - * gui/dialogs/comp-editor.h: add virtual function - -2001-08-08 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-week-view-event-item.c - (e_week_view_event_item_draw_icons): don't use a NULL mask in the - call to gdk_gc_set_clip_mask - - * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): - ditto - - * gui/e-day-view-main-item.c - (e_day_view_main_item_draw_day_event): ditto - -2001-08-08 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit-config.h: fix pre-processor - macros - - * conduits/calendar/calendar-conduit.h: ditto - - * conduits/todo/todo-conduit-config.h: fix pre-processor macros - - * conduits/todo/todo-conduit.h: ditto - -2001-08-07 Federico Mena Quintero <federico@ximian.com> - - * cal-client/cal-listener.c (cal_listener_stop_notification): New - function to stop further notification from happening. - (impl_notifyCalOpened): Do not notify if requested. - (impl_notifyObjUpdated): Likewise. - (impl_notifyObjRemoved): Likewise. - (impl_notifyCategoriesChanged): Likewise. - (CalListenerPrivate): Do not keep a reference to the server-side - Cal. This would create a circular reference since the server - keeps a reference to the listener. - (cal_listener_destroy): Likewise. - (impl_notifyCalOpened): Likewise. - - * pcs/cal.c (cal_destroy): bonobo_object_release_unref() the listener. - - * cal-client/cal-client.c (cal_client_destroy): Ask the listener - to stop notifications. Also, do not unref it as the server does - that itself when we unref the Cal. - -2001-08-07 Federico Mena Quintero <federico@ximian.com> - - * gui/calendar-model.c (calendar_model_free_value): Only unref the - FIELD_COMPONENT if it is non-NULL. We return a NULL for that - field from ::initialize_value(), after all. Fixes bug #6098. - -2001-08-07 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (itip_send_comp): Make calendar.ics the - suggested name when attaching the ical object - -2001-08-06 Damon Chaplin <damon@ximian.com> - - * gui/e-week-view.h: - * gui/e-day-view.h: added 'different_timezone' fields to EDayViewEvent - and EWeekViewEvent, to note that the event is in a different timezone. - We now compute this once when we add the event to the array, rather - than each time we draw the event. If it is set, we will draw the - timezone icon next to the event. - - * gui/e-day-view-main-item.c: take transparency into account when - drawing the blue vertical bars to represent busy time. - - * gui/tag-calendar.c: take transparency into account when tagging - the mini calendar. - - * gui/e-calendar-table.c (e_calendar_table_init): removed the "None" - options for transparency and classification, since these properties - have defaults anyway, so we may as well use those to keep it simple. - Also use "Free" and "Busy" for transparency, rather than "Transparent" - and "Opaque". - - * gui/calendar-model.c: updated classification & transparency code - as above. - - * gui/e-calendar-table.etspec: changed "Transparency" to "Show Time As" - since people have a chance of understanding that. - - * gui/e-week-view.c: - * gui/e-day-view.c: - * gui/gnome-cal.c: added functions to get the visible time range. - - * gui/calendar-commands.c: finished stuff to set the folder bar - label to the dates currently displayed. - - * gui/control-factory.c (control_factory_new_control): connected - signal to update the folder title bar label when the dates shown - are changed. I had to connect it here since we need the BonoboControl - in the callback, and I don't know how to get the control from the - widget. - - * gui/tasks-control.c (tasks_control_activate): clear the folder bar - label. We could display something here at some point. - - * gui/dialogs/recurrence-page.glade: changed "_Add" to "A_dd", since - we have an "_Actions" menu. (These also use Alt+key, right?) - - * gui/dialogs/event-page.glade: - * gui/dialogs/event-page.c: added 'Show Time As' field, which is - really the TRANSP property but with a better name! - Also changed one of the "_Confidential" to "Con_fidential" since we - already have "_Contacts" using the same 'C' key. - - * pcs/cal-backend-file.c (cal_backend_file_get_free_busy): skip - events that are TRANSPARENT. Also added comment as this code looks - inefficient. - - * cal-util/cal-component.c: removed stuff for comparing timezones. - - * gui/comp-util.c (cal_comp_util_compare_event_timezones): moved the - above function here, and updated it to compare the UTC offsets of the - times as well as the TZIDs. - -2001-08-06 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/cal-prefs-dialog.glade: In process of fixing bug - #6005. The "Calendar" page is now "Display", and it has no - frames. The "Task list" page has colons between the labels and - the color pickers, and it has no frame. - -2001-08-06 Rodrigo Moya <rodrigo@ximian.com> - - * cal-client/cal-client.c (destroy_wombat_client): added check for - NULL pointers. Maybe fixes #5203 (I can't reproduce it, so I'm not - sure) - -2001-08-03 Federico Mena Quintero <federico@ximian.com> - - * cal-client/query-listener.c (query_listener_stop_notification): - New function; stops further notification from happening. This is - needed since the listener is destroyed asynchronously from the - Wombat and the corresponding CalQuery may already have died. - (impl_notifyObjUpdated): Do not notify if requested. - (impl_notifyObjRemoved): Likewise. - (impl_notifyQueryDone): Likewise. - (impl_notifyEvalError): Likewise. - - * cal-client/cal-query.c (cal_query_destroy): Use - query_listener_stop_notification(). - - * cal-client/cal-listener.c (cal_listener_destroy): Nullify the - pointers to the callback functions. - - * gui/e-day-view.c (update_query): Commit our state of no longer - having a query before unrefing it. We may reenter from the ORBit - main loop and we *really* want this information to be committed. - - * gui/e-week-view.c (update_query): Likewise. - - * gui/calendar-model.c (update_query): Likewise. - - * gui/tag-calendar.c (tag_calendar_by_comp): Added a "clear_first" - argument that indicates whether the ECalendar should be cleared of - any marks first. - - * gui/calendar-commands.c (calendar_control_activate): Removed - ifdefed-out view buttons code from the Gnomecal days. - - * gui/gnome-cal.c (client_categories_changed_cb): Merge the - categories of the calendar and tasks clients so that we can - display the categories in both sets. - (gnome_calendar_construct): Connect to "categories_changed" on - both clients. - (gnome_calendar_on_date_navigator_selection_changed): Removed call - to gnome_calendar_update_view_buttons(). - (gnome_calendar_update_view_buttons): Removed. We cannot have - this until Bonobo supports radio toolbar items. - (gnome_calendar_set_view_buttons): Removed. - (gnome_calendar_dayjump): Do not use priv->day_button. - (GnomeCalendarPrivate): Removed the {day,work_week,week,month}_button - fields. - (gnome_calendar_set_query): Start a retagging process of the date - navigator so that it reflects the current query. - (update_query): New function to restart a query for the date navigator. - (initial_load): Use update_query() instead of tagging the date - navigator directly. - (gnome_calendar_on_date_navigator_date_range_changed): Likewise. - (client_cal_opened_cb): Use update_query() instead of initial_load(). - (initial_load): Removed. - (client_obj_updated_cb): Removed. - (client_obj_removed_cb): Removed. - (gnome_calendar_new_appointment_for): Set the default category of - the new component. - (search_bar_category_changed_cb): Set the default category for the - calendar views. - - * gui/cal-search-bar.c (cal_search_bar_set_categories): Sort the - categories before creating the menu. - - * gui/e-day-view.c (adjust_query_sexp): Return NULL instead of - "#f" if the time range is not set yet. - (update_query): Do not start a query if the time range is not set. - (e_day_view_set_default_category): New function. - (e_day_view_key_press): Set the default category on the new - component. - - * gui/e-week-view.c (adjust_query_sexp): Analogous to the above. - (update_query): Analogous to the above. - (e_week_view_set_default_category): Analogous to the above. - (e_week_view_key_press): Analogous to the above. - -2001-08-03 Federico Mena Quintero <federico@ximian.com> - - Fixes bug #1407. - - * gui/dialogs/cal-prefs-dialog.glade: Removed the alarm - preferences page, since we decided it was unnecessary. - -2001-08-03 Zbigniew Chyla <cyba@gnome.pl> - - I18n fixes. - - * gui/dialogs/event-page.c (summary_changed_cb): - Use e_dialog_editable_get instead of gtk_editable_get_chars (we need - UTF-8 string). - - * gui/itip-utils.c: - Added missing #include <config.h> - -2001-08-02 Jon Trowbridge <trow@ximian.com> - - * gui/Makefile.am: Added camel dependency (now needed by ebook). - -2001-08-01 Federico Mena Quintero <federico@ximian.com> - - * gui/calendar-model.c (calendar_model_value_is_empty): If the - default category is the same as the value passed in to this - function, return TRUE. This could be a hack or not, but it - prevents two items from being added to the table if a category is - selected. - - * gui/e-tasks.c (setup_widgets): Allow the search bar to shrink - horizontally. - - * gui/dialogs/task-page.c (clear_widgets): Pass valid values to - e_dialog_option_menu_set(); these need to come from the status map. - -2001-08-01 Damon Chaplin <damon@ximian.com> - - * cal-client/cal-client.c: removed debugging messages. - -2001-08-01 Federico Mena Quintero <federico@ximian.com> - - The calendar search bar widget now includes a drop-down menu of - available categories. - - * pcs/query.c (func_has_categories): Handle one and only one #f - value as meaning "unfiled", for components that have no categories - at all. - - * pcs/cal-backend-file.c (open_cal): Duh, do not notify here about - changed categories since at this point we don't have any clients - bound to us yet. - (create_cal): Likewise. - (cal_backend_file_add_cal): Notify here. - - * gui/cal-search-bar.h (CalSearchBarClass): New signal - "category_changed". - - * gui/cal-search-bar.c (cal_search_bar_construct): Add a drop-down - menu for the list of categories. - (search_option_items): Removed the "Has category" option, since we - now have the drop-down menu instad and it would be confusing to - have both options. - (regen_query): Likewise. Also, this function is now the old - cal_search_bar_query_changed() and is shared by that very function - and by the callback from the drop-down menu. - (notify_query_contains): Include the sub-sexp for the categories. - (cal_search_bar_set_categories): New function. - (cal_search_bar_get_category): New function. - (categories_selection_done_cb): Emit the "category_changed" signal. - - * gui/e-tasks.c (obj_updated_cb): Removed function since it did - not do anything; all updates are handled by the CalendarModel. - (obj_removed_cb): Likewise. - (ETasksPrivate): Removed the fields for the categories option - menu, since now it is in the ESearchBar. - (search_bar_sexp_changed_cb): Use calendar_model_set_query() - directly here, as we do not need to frob the sexp anymore. - (update_query): Removed. - (client_categories_changed_cb): New callback. - (search_bar_category_changed_cb): New callback. - (e_tasks_new_task): Set the default category on the component to - the one that is selected in the search bar. - (e_tasks_on_filter_selected): Removed. - (e_tasks_on_categories_changed): Removed. - (e_tasks_rebuild_categories_menu): Removed. - (e_tasks_add_menu_item): Removed. - (e_tasks_setup_view_menus): Sanitized not to sink objects wildly. - (e_tasks_discard_view_menus): New function. - - * gui/calendar-model.h (CalendarModelClass): Removed the - "categories_changed" signal since this is handled in the Wombat - now. - - * gui/calendar-model.c (calendar_model_get_categories): Removed. - (calendar_model_set_value_at): Do not collect the categories. - (query_obj_updated_cb): Likewise. - (calendar_model_collect_categories): Removed. - (calendar_model_set_default_category): Constify. - - * gui/tasks-control.c (tasks_control_deactivate): Call - e_tasks_discard_view_menus(). - - * gui/gnome-cal.c (search_bar_category_changed_cb): Set the - default category for the task pad's model. - -2001-07-31 Federico Mena Quintero <federico@ximian.com> - - The Wombat now keeps track of which categories are present in the - objects of a calendar. It will notify the clients of changes in - this set. This is to make the category drop-down menus in the - calendar/tasks views be always up to date. - - * idl/evolution-calendar.idl (Listener): Added a - notifyCategoriesChanged() method. The Wombat now keeps track of - the categories within a calendar. - - * cal-client/cal-listener.[ch]: Switched it to use BonoboXObject. - Also added the notifyCategoriesChanged implementation. - - * cal-client/cal-client.[ch]: Added a "categories_changed" signal. - - * pcs/cal-backend-file.c: Maintain a list of the live categories. - (update_categories_from_comp): New function to maintain the set of - live categories. - (add_component): Update the set of categories. - (remove_component): Likewise. - (open_cal): Notify about changes in the set of categories. - (create_cal): Likewise. - (cal_backend_file_update_objects): Likewise. - (cal_backend_file_remove_object): Likewise. - (notify_categories_changed): New function to notify the clients - about the current set of categories. - - * pcs/cal.c (cal_notify_categories_changed): New function. - -2001-07-31 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view.c (selection_received): - * gui/e-week-view.c (selection_received): yes, set the end date, but - correctly calculated, not by using the component's duration, which - may not exist. Now really fixes #5836 - -2001-07-31 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view.c (selection_received): - * gui/e-week-view.c (selection_received): don't set the end date - for the pasted components, since it will be recalculated when the start - date is set, thus keeping the same duration than the original - cut/copied component. Fixes #5836 - -2001-07-30 Damon Chaplin <damon@ximian.com> - - * gui/gnome-cal.c: - * gui/calendar-commands.c (clear_folder_bar_label): started some code - to show the currently displayed dates in the folder title bar. - Unfinished. - - * gui/e-itip-control.c (set_date_label): - * conduits/todo/todo-conduit.c (local_record_from_comp): - * conduits/calendar/calendar-conduit.c (local_record_from_comp): free - the CalComponentDateTimes. (Note the iTIP control needs updating for - timezone support.) - - * cal-util/cal-component.c: Changed CalComponentDateTime so that the - TZID is malloc'ed and freed rather than being a pointer to a static - string. This was causing problems as sometimes we were freeing the - string that was being pointed to, so we got corrupted TZIDs. - - * gui/comp-util.c (cal_comp_util_add_exdate): set TZID to NULL. - DATE values do not have timezones. - - * gui/e-week-view.c: - * gui/e-day-view.c: Moved 'Paste' after the New Appointment commands, - since I think they are more commonly-used. Also added underlined - accelerator keys. - - * gui/e-calendar-table.c: changed 'Edit this task' to 'Open' in the - popup menu to be consistent with other folders, and separated from the - clipboard commands. Also changed to use EPopupMenu so the accelerators - work, and the masks may be useful at some point. - - * gui/dialogs/recurrence-page.c: use DATE values for UNTIL, since - that makes it simpler. Fixes bug #5034. - - * gui/calendar-config.c (calendar_config_set_timezone): strdup the - location string. Fixes bug #4990. - - * gui/tag-calendar.c (tag_calendar_cb): take 1 off iend as the times - don't include the end time. - - * gui/e-week-view-layout.c (e_week_view_layout_event): fixed - days_shown. Fixes bug #5709. - - * cal-client/cal-client.c (cal_client_get_timezone): took out some - debugging messages. - -2001-07-30 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/cal-prefs-dialog.glade: added Help button. Though of - course it doesn't do anything yet. - -2001-07-30 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c: Mark strings for translation - -2001-07-30 Rodrigo Moya <rodrigo@ximian.com> - - * cal-client/client-test.c (cal_opened_cb): call - cal_client_get_free_busy for testing the new method - - * pcs/cal-backend-file.c (cal_backend_file_get_free_busy): implemented - -2001-07-28 Federico Mena Quintero <federico@ximian.com> - - Fixes bug #5352. - - * gui/dialogs/cal-prefs-dialog.c (cal_prefs_dialog_show): Added a - `page' argument so that we can select which page to show when - popping up the dialog. - (cal_prefs_dialog_construct): Added the `page' argument as well. - (cal_prefs_dialog_new): Likewise. - - * gui/calendar-commands.c (settings_cmd): Set the page to the main - calendar settings one. - - * gui/tasks-control.c (tasks_control_settings_cmd): Implemented - callback for the "Task Settings" command. - (verbs): Added the "TasksSettings" verb. - (pixmaps): Added an icon for the tasks settings command. - -2001-07-27 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (local_record_from_comp): - recur is always in UTC - -2001-07-27 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c: handle timezones - everywhere - (get_timezone): new function to get a timezone based - on a tzid - (get_default_timezone): get default timezone - - * conduits/calendar/calendar-conduit.h: time zone field for the - context - - * conduits/calendar/Makefile.am: link to bonobo conf - - * conduits/todo/todo-conduit.c: handle timezones - everywhere - (get_timezone): new function to get a timezone based - on a tzid - (get_default_timezone): get default timezone - - * conduits/todo/todo-conduit.h: time zone field for the - context - - * conduits/todo/Makefile.am: link to bonobo conf - -2001-07-27 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): - * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): - * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons): - initialize to NULL some pointers - - * e-calendar-table.c (selection_received): deal correctly with - VCALENDAR objects - (e_calendar_table_copy_clipboard): g_strdup the value returned by - icalcomponent_get_as_ical_string - -2001-07-27 Federico Mena Quintero <federico@ximian.com> - - * gui/gnome-cal.c (gnome_calendar_set_query): Constify and set the - query sexp on the task pad's model as well. - -2001-07-27 Federico Mena Quintero <federico@ximian.com> - - * gui/cal-search-bar.[ch]: New files with a derivative of - ESearchBar that generates sexps for calendar queries directly. - - * gui/gnome-cal.c (setup_widgets): Use CalSearchBar instead of - ESearchBar. - - * gui/e-calendar-table.h (ECalendarTable): Removed the ->colors - array since it is handled by ETableExtras now. - - * gui/e-calendar-table.[ch]: Removed the subset_model. Now we use - the live query facility to filter tasks. Removed the filter - function stuff as well. - - * gui/e-tasks.c (e_tasks_construct): Use - calendar_model_set_cal_client() directly instead of - e_calendar_table_set_model(). - (setup_widgets): Create a calendar search bar for the tasks - component. - (search_bar_sexp_changed_cb): Set the query sexp on the table model. - (e_tasks_on_filter_selected): Regenerate the query from the - selected category and the current sexp. - (update_query): New convenience function to recompute the real - query sexp. - - * gui/gnome-cal.c (gnome_calendar_construct): Likewise. - - * gui/e-calendar-table.c (e_calendar_table_set_cal_client): - Removed function; people are now supposed to get the model from - the calendar table and operate on it. - - * gui/calendar-commands.c (verbs): Consistency fixes with the XML - file. - (pixmaps): Likewise. - - * gui/Makefile.am (evolution_calendar_SOURCES): Added - cal-search-bar.[ch] to the list of sources. - -2001-07-20 Federico Mena Quintero <federico@ximian.com> - - * idl/evolution-calendar.idl (CompEditorFactory): New interface to - a centralized factory for calendar component editors. Has - editExisting() and editNew() methods to edit an existing component - from a URI/UID pair, and to create a new component in a calendar - that is in a particular URI, respectively. - - * gui/comp-editor-factory.[ch]: Implementation files for the - component editor factory. - - * gui/GNOME_Evolution_Calendar.oaf.in: Added the CompEditorFactory - stuff. - - * gui/Makefile.am (evolution_calendar_SOURCES): Added - comp-editor-factory.[ch] to the list of sources. - -2001-07-26 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c (invite_entry_changed): when an entry - has changed, iterate over the elements of the entry and add them - to the list if need be - (get_select_name_dialog): add a Chair Persons section - - * gui/itip-utils.c (itip_send_comp): send the empty string as - subject if there is no summary - -2001-07-26 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c (itip_send_comp): send the empty string as - subject if there is no summary - - * gui/dialogs/meeting-page.c (cleanup_attendees): free a list of - attendees - (meeting_page_fill_widgets): clean up attendee lists and fix typo - (find_match): add ability to return pos of match - (popup_delete_cb): if deletion happens, make sure to tidy up - delegation chain - - * gui/dialogs/e-delegate-dialog.c (e_delegate_dialog_construct): - use the destination rather than text property - (e_delegate_dialog_get_delegate): ditto - (e_delegate_dialog_new): take name/address pair for dialog default - - * gui/dialogs/e-delegate-dialog.h: update protos - - * gui/e-itip-control.c (clean_up): only unref the object if we - have one - - * gui/itip-control-factory.c (stream_read): make sure we null - terminate the final buffer - - * gui/itip-utils.c (itip_send_comp): strip the mailto: from the - organizer address if necessary - -2001-07-26 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/recurrence-page.c (exception_select_row_cb): check that - the row passed in is valid. Sometimes we get the "row-selected" - signal for row 0 when there are no rows in the list. Fixes bug #4266. - - * cal-client/cal-client.c (cal_client_get_object): prefetch all the - timezone data needed by the object, to try to avoid making Corba - calls all over the place. They can cause problems because they call - the GTK+ main loop recursively. This currently leads to an assertion - failure in the GnomeCanvas occasionally. - -2001-07-25 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (e_itip_control_set_data): gracefully - handle the lack of a method - -2001-07-25 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view.c (selection_received_cb): check type of component - before actually pasting. - Deal with VCALENDAR components also (fixes bug #5140) - - * gui/e-week-view.c (selection_received_cb): ditto - - * cal-client/cal-client.c (cal_client_update_object): check the return - value from cal_component_get_as_string and don't call - GNOME_Evolution_Calendar_Cal_updateObjects if NULL - -2001-07-25 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/comp-editor.c (pixmaps): used the new print preview icon. - - * gui/print.c (range_selector_new): changed the 'Current day/week...' - strings to 'Selected day/week...' to make a little less confusing. - Fixes bug #5451. - -2001-07-25 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c (is_duplicate): see if the address is - already in the list of attendees - (duplicate_error): throw up an error dialog - (popup_delegate_cb): if the attendee has already delegated, delete - the old delegatee - (value_at): cast to kill warnings - (append_row): don't add the new attendee if they are already in - the list - -2001-07-24 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/recurrence-page.c (get_exception_string): calculate - tmp_tm.tm_wday ourselves. strftime has a habit of crashing if you - have weird values here. I think this fixes bug #4574. - -2001-07-24 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c (value_at): stip the delto and - delfrom - (popup_delegate_cb): show a delegate dialog and add the new - delegatee and update the delegator - (add_section): listen for changes in a more direct manner - (get_select_name_dialog): add_section now takes a limit argument - - * gui/dialogs/e-delegate-dialog.[hc]: New dialog to query the user - for a person to delegate to - - * gui/dialogs/Makefile.am: build/install new files - - * gui/Makefile.am: add ldadd line for ebook - -2001-07-21 Damon Chaplin <damon@ximian.com> - - * gui/e-week-view-event-item.c (e_week_view_event_item_draw): fixed - the test to see whether we should draw the icons. - -2001-07-22 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (get_local_file_name_for_folder_type): - New helper function. - (remove_folder): Add a @type arg and handle it, by deleting - "tasks.ics" instead of "calendar.ics" if the type is "tasks". If - the type is not "tasks" or "calendar", report an - `UNSUPPORTED_TYPE' error. - (xfer_folder): Likewise. - -2001-07-21 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c: Make folders of type "calendar" and - "tasks" user-creatable by setting `user_creatable' to %TRUE in the - `EvolutionShellComponentFolderType's. - -2001-07-19 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/event-editor.h (event_editor_update_widgets): - Removed unused prototype. - - * gui/dialogs/task-editor.h (task_editor_update_widgets): - Likewise. - -2001-07-19 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (clean_up): free various data related - settings - (destroy): use cleanup and unref the clients - (e_itip_control_set_data): clean up before setting the data and - store the timezones in a top level component - (update_item): use cal_client_update_objects and our top level - (including the timezones) - -2001-07-19 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/comp-editor.c (pixmaps): - * gui/calendar-commands.c (pixmaps): updated to use new print icon. - -2001-07-17 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/recurrence-page.c (init_widgets): don't show the time - in the EDateEdit widget for adding EXDATEs. - - * cal-util/cal-component.c (cal_component_alarm_set_trigger): don't - set t.time.is_date to -1. It is a boolean flag, 0 or 1. We probably - don't want a date value, so we leave it at 0. - -2001-07-18 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): - do not discard drawing icon if mask is NULL - - * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): - ditto - -2001-07-17 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (get_next): find the next displayable - component - (get_prev): find the previous displayable component - (e_itip_control_set_data): use above - (prev_clicked_cb): ditto - (next_clicked_cb): ditto - -2001-07-17 Federico Mena Quintero <federico@ximian.com> - - Really fixes #4380. The previous fix was necessary but not - sufficient; it worked for me because my system timezone happens to - match the Evolution timezone --- if they don't match, the bug - would persist. Not matching is *not* an error; it is just a - matter of Unix sucking a lot and XST not being finished :) - - * cal-util/timeutil.c (time_to_gdate_with_zone): New function. We - cannot use g_date_set_time() anymore because it does not take - timezones into account. - - * gui/gnome-cal.c (get_days_shown): Use the function above. - - * gui/e-day-view.c (e_day_view_find_work_week_start): Likewise. - - * gui/e-week-view.c (e_week_view_set_selected_time_range): Likewise. - -2001-07-17 Jon Trowbridge <trow@ximian.com> - - * gui/dialogs/meeting-page.c (invite_entry_changed): Print - a g_message when the list of invited people changes - in the SelectNames control. - (add_section): #if 0/#endif out some (broken?) code. - (get_select_name_dialog): Listen for changes in the - SelectNames control. - -2001-07-17 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/e-timezone-dialog.c (e_timezone_dialog_destroy): destroy - the dialog widget here. Fixes bug #4198. - -2001-07-16 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/task-page.c (task_page_fill_widgets): - * gui/dialogs/event-page.c (event_page_fill_widgets): try to use - builtin timezones before getting them from the server. When creating - new events/tasks the timezones may not be on the server. - - * gui/dialogs/event-page.c (event_page_fill_widgets): for all-day - events we subtract a day from the end date rather than add it. - - * gui/dialogs/e-timezone-dialog.c (on_map_leave): ignore the event - if it isn't a GDK_CROSSING_NORMAL event. For some reason we are getting - leave events when the button is pressed, which meant that selecting - timezones in the map didn't work. - - * gui/dialogs/comp-editor-util.c (comp_editor_dates): - * gui/print.c (print_date_label): only free icaltimetype if not NULL. - -2001-07-12 Taylor Hayward <taylorhayward@yahoo.com> - - * gui/goto-dialog.glade: - * gui/meeting-mockup.glade: - * gui/alarm-notifyålarm-notify.glade: - * gui/dialogs/alarm-page.glade: - * gui/dialogs/meeting-page.glade: - * gui/dialogs/recurrence-page.glade: Added missing underlined - shortcuts. - -2001-07-12 JP Rosevear <jpr@ximian.com> - - * cal-util/cal-util.h: new proto - - * cal-util/cal-util.c (cal_util_new_top_level): standard place to - get your top level calendar component - - * pcs/cal-backend-file.c (create_cal): use it - - * gui/itip-utils.c (itip_send_comp): ditto - - * gui/e-calendar-table.c (e_calendar_table_copy_clipboard): ditto - -2001-07-12 JP Rosevear <jpr@ximian.com> - - * gui/e-calendar-table.c (e_calendar_table_copy_clipboard): fix - typo breaking compilation - - * gui/dialogs/meeting-page.c: fix include - - * gui/dialogs/Makefile.am: build select names idl here - - * gui/Makefile.am: remove select names compilation from here - -2001-07-12 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-details-page.c (task_details_page_set_dates): - guard against infinite loops with the updating boolean, fixes 4270 - -2001-07-12 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-calendar-table.c: added support for multiple selections in - cut/copy/paste. Also, it's now ready for the - s/update_object/update_objects change (I think) - -2001-07-11 Damon Chaplin <damon@ximian.com> - - * idl/evolution-calendar.idl: renamed updateObject to updateObjects - and removed the UID argument, since it can add/update multiple objects - at once. (It can't yet, but it will!) - - * pcs/cal.c: - * pcs/cal-backend.[hc]: - * pcs/cal-backend-file.c: renamed update_object to update_objects and - got rid of the UID arg. - - * cal-client/cal-client.c (cal_client_update_objects): new function to - add/update multiple objects in one go, i.e for iTIP and for importing - calendars. - - * gui/print.c (print_date_label): fixed type bug. - - * gui/e-week-view.[hc]: - * gui/e-week-view-event-item.c: draw the timezone icons if the event's - DTSTART or DTEND is in a different timezone to the current one. - Note that we may want to change this so it compares the UTC offsets - rather than the TZIDs, since currently it will draw the icons for all - events coming from iTIP requests from other clients. - -2001-07-11 Federico Mena Quintero <federico@ximian.com> - - Fixes bug #4380 as well as some leftovers from the days of struct - tm and some uninitialized values. - - * gui/gnome-cal.c - (gnome_calendar_on_date_navigator_selection_changed): Initialize - the icaltimetype structures completely. - (gnome_calendar_init): Do not reset priv->zone to NULL here, since - it was set by gnome_calendar_update_config_settings() from - setup_widgets(). - - * gui/calendar-model.c (set_completed): Do not set is_daylight. - - * gui/e-day-view.c (e_day_view_convert_grid_position_to_time): - Likewise. - - * gui/e-week-view.c (e_week_view_set_timezone): Likewise. - - * cal-util/cal-recur.c (generate_instances_for_chunk): Likewise, - and initialize start_tt and end_tt completely. - - * cal-util/timeutil.c (time_year_begin_with_zone): Likewise. - (time_month_begin_with_zone): Likewise. - (time_week_begin_with_zone): Likewise. - (time_day_begin_with_zone): Likewise. - (time_day_end_with_zone): Likewise. - (time_from_isodate): Likewise. - - * gui/dialogs/task-page.c (task_page_fill_component): Initialize - icaltime before using it. - - * gui/dialogs/event-page.c (event_page_fill_component): Likewise. - - * gui/dialogs/recurrence-page.c (simple_recur_to_comp): Removed an - unused icaltimetype. - - * gui/dialogs/task-details-page.c - (task_details_page_fill_component): Initialize icaltime before - using it. - -2001-07-11 JP Rosevear <jpr@ximian.com> - - * gui/component-factory.c: fix the calendar not exiting with a - gross hack because i don't have time to fix the ref counting right - now - -2001-07-11 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c: be careful about adding and - stripping MAILTO:'s properly - - * gui/dialogs/meeting-page.etspec: add missing columns - - * gui/itip-utils.c (itip_strip_mailto): point to the real start of - the email address - - * gui/itip-utils.h: add proto - - * gui/itip-control-factory.c: get rid of the my address property - - * gui/e-itip-control.c: use the users real identity to figure out - which attendee they are - (find_my_address): figure out who the user is among the attendees - - * gui/e-itip-control.h: remove protos - - * gui/dialogs/Makefile.am: extra dist etspecs - - * gui/Makefile.am: ditto - -2001-07-11 Kjartan Maraas <kmaraas@gnome.org> - - * gui/e-calendar-table.c: Added a hack to get the last - string translated since xml-i18n-tools doesn't recognize - _click-to-add-message="Click here to add a task". - -2001-07-10 Peter Williams <peterw@ximian.com> - - * gui/Makefile.am (BUILT_SOURCES): Move this higher so that - Makefile properly depends on us. Fixes distcheck. - -2001-07-11 Jason Leach <jleach@ximian.com> - - [Fix bug #4389: ETableSpecification still in e-calendar-table.c - file] - - * gui/e-calendar-table.etspec: New file containing the spec that - was in e-calendar-table.c as a big string. - - * gui/e-calendar-table.c (e_calendar_table_init): Use the spec - file instead of a string. - (e_calendar_table_get_spec): Removed this function, we don't need - it anymore. - - * gui/e-tasks.c (e_tasks_setup_menus): Don't load from string, - from file instead. - - * gui/Makefile.am: Necessary changes to get the new .etspec file - installed. - -2001-07-10 Jason Leach <jleach@ximian.com> - - [Fix bug #4388: ETableSpecification still in meeting-page.c file] - - * gui/dialogs/meeting-page.etspec: New file containing the spec - that was previously in meeting-page.c as a string. - - * gui/dialogs/meeting-page.c: One line change to get it to use - this spec file instead of a string. - - * gui/dialogs/Makefile.am: Necessary changes to get the new - meeting-page.etspec installed. - -2001-07-10 Damon Chaplin <damon@ximian.com> - - * gui/calendar-model.c: - * gui/e-calendar-table.c: - * gui/e-day-view-main-item.c: - * gui/e-day-view-top-item.c: - * gui/e-day-view.[hc]: - * gui/e-week-view.c: - * gui/gnome-cal.c: - * gui/print.c: - * gui/dialogs/cal-prefs-dialog.c: - * gui/dialogs/comp-editor-util.c: - * gui/dialogs/event-page.c: - * pcs/cal-backend-file.c: - * pcs/query.c: - * cal-util/cal-component.[hc]: - * cal-util/cal-recur.c: - * cal-util/timeutil.[hc]: - * cal-client/cal-client.[hc]: more timezone updates. I'm pretty much - done with the calendar code now, except for alarms and conduits, - which Federico and JP know more about. And there are a couple of - other minor things to fix. But it is still pretty buggy. - -2001-07-10 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c: Add popup support so you can delete - users from the list - - * gui/dialogs/comp-editor.c (setup_widgets): fix typo - -2001-07-10 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/alarm-queue.c (alarm_trigger_cb): Handle the - different alarm actions. - (display_notification): Do the alarm notification dialog here. - - * gui/alarm-notify/alarm-notify-dialog.c (make_heading): Take in a - CalComponentVType, not a whole component. - (alarm_notify_dialog): Take in a CalComponentVType and the final - message instead of generating it ourselves. - -2001-07-09 Federico Mena Quintero <federico@ximian.com> - - * pcs/cal-backend-file.c (generate_alarms_for_comp): Pass the - parent vCalendar component as the timezone closure of - cal_recur_generate_instances(). - - * gui/dialogs/alarm-page.c (get_alarm_string): Make the string - consistent with the option menu text. - (get_alarm_string): Removed extra spaces from the last part of the - alarm string. - -2001-07-09 Federico Mena Quintero <federico@ximian.com> - - * gui/e-day-view.c (e_day_view_key_press): Use - e_utf8_from_gtk_event_key() so that we can input utf8 text - properly. - (e_day_view_cut_clipboard): Constify. - (e_day_view_on_cut): Constify. - (e_day_view_reshape_long_event): Remove unused variable. - - * gui/e-week-view.c (e_week_view_key_press): Use - e_utf8_from_gtk_event_key() so that we can input utf8 text - properly. - (e_week_view_cut_clipboard): Constify. - (e_week_view_on_cut): Constify. - - * cal-client/cal-client.c (cal_client_resolve_tzid_cb): Fix the - prototype so that this matches CalRecurResolveTimezoneFn. Also - renamed it so that it is clear that it is supposed to be a - callback. - -2001-07-06 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c (init_widgets): connect to the entry - not the combo - - * gui/dialogs/event-editor.c (set_menu_sens): set menu - sensitivities based on whether or not the meeting page is shown - (event_editor_init): call above - (event_editor_edit_comp): ditto - (schedule_meeting_cmd): ditto - - * gui/dialogs/comp-editor.h: new proto - - * gui/dialogs/comp-editor.c (comp_editor_set_ui_prop): new - function to allow for set of ui props (esp. "sensitive") - -2001-07-06 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c (clear_widgets): actually clear some - widgets and hide/show widgets in the default setup - (meeting_page_destroy): destroy the address lists - (meeting_page_fill_widgets): allow the user to select among their - identities as a new organizer, or show the existing organizer as - label - (meeting_page_fill_component): set the "MAILTO:" bit of the - organizer to match spec, set CN properly if we know it - (get_widgets): load new widgets - (other_clicked_cb): handle "Other Organizer" click - (change_clicked_cb): handle "Change Organizer" click - (init_widgets): listen for clicks on new buttons - - * gui/dialogs/comp-editor.c (comp_editor_remove_page): remove the - page from our internal list and unref it - - * gui/itip-utils.c (itip_addresses_get): get the configure mail - identities - (itip_addresses_free): free a list of identities returned by - itip_addresses_get - - * gui/itip-utils.h: remove obsolete protos, and new protos - - * gui/gnome-cal.html: Remove ancient file - -2001-07-04 Federico Mena Quintero <federico@ximian.com> - - Fixes bug #4018 and what would be the analogous bugs for the other - component editors. - - * gui/dialogs/comp-editor-page.h (CompEditorPageClass): New - virtual method "::focus_main_widget()". - - * gui/dialogs/comp-editor-page.c - (comp_editor_page_focus_main_widget): New function. - - * gui/dialogs/comp-editor.c (comp_editor_append_page): If we are - inserting the main page, ask it to focus its main widget. - - * gui/dialogs/alarm-page.c (alarm_page_focus_main_widget): - Implemented. - - * gui/dialogs/event-page.c (event_page_focus_main_widget): - Implemented. - #include "e-util/e-categories-config.h". - - * gui/dialogs/meeting-page.c (meeting_page_focus_main_widget): - Implemented. - - * gui/dialogs/recurrence-page.c - (recurrence_page_focus_main_widget): Implemented. - - * gui/dialogs/task-details-page.c - (task_details_page_focus_main_widget): Implemented. - - * gui/dialogs/task-page.c (task_page_focus_main_widget): - Implemented. - -2001-07-04 Federico Mena Quintero <federico@ximian.com> - - * gui/calendar-commands.c (clear_folder_bar_label): New function. - (calendar_control_activate): Clear the folder bar label; we really - don't have anything interesting to display. - -2001-07-03 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/meeting-page.c: Add new columns for information - specification - (meeting_page_destroy): save the table state - (build_etable): load new table state - - * gui/dialogs/task-editor.c (task_editor_destroy): unref pages - - * gui/dialogs/event-editor.c (event_editor_destroy): unref pages - - * gui/dialogs/comp-editor.c (setup_widgets): kill warning - (comp_editor_append_page): ref page passed in - (close_dialog): unref pages - -2001-07-03 Damon Chaplin <damon@ximian.com> - - * gui/e-day-view.c (query_obj_updated_cb): fix warning, and added - some debug messages. - - * gui/dialogs/comp-editor-util.c (write_label_piece): - * gui/e-day-view-top-item.c (e_day_view_top_item_draw): call mktime() - to set the weekday, though this is a temporary fix. - -2001-07-03 Damon Chaplin <damon@ximian.com> - - * pcs/cal-backend.[hc]: added virtual method to get a VTIMEZONE - component given a TZID. We need this to resolve TZIDs when expanding - an event using cal_recur_generate_instances() in query.c. - - * pcs/cal-backend-file.c (cal_backend_file_get_timezone): implemented - virtual method. - (cal_backend_file_update_object): fixed bug, kind -> child_kind. - - * pcs/query.c (func_occur_in_time_range): use the virtual method for - resolving TZIDs. The other way didn't work anyway, as we didn't have - the entire VCALENDAR with VTIMEZONEs in it. - - * gui/dialogs/recurrence-page.c (init_widgets): - (make_ending_until_special): moved the call to - e_date_edit_set_get_time_callback() from init_widgets to - make_ending_until_special(), since that is where the widget gets - created. - - * gui/e-timezone-entry.c (e_timezone_entry_set_timezone): handle zone - being NULL. - -2001-07-02 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/alarm-options.[ch]: New files with the alarm options - dialog; this configures the repeat/duration properties and the - options specific to each alarm action type. - - * gui/dialogs/alarm-page.c (AlarmPagePrivate): Added the alarm - options button. Also, keep an alarm structure which we are - editing and an alarm options dialog. - (init_widgets): Connect to the options button. - (add_clicked_cb): Clone the component we are editing instead of - creating a new one so that we preserve the data from the alarm - options dialog. - (button_options_clicked_cb): Pop up the alarm options dialog. - - * cal-util/cal-component.c (cal_component_alarm_new): Doh, - initialize the other fields in the new alarm. - -2001-07-03 Damon Chaplin <damon@ximian.com> - - * cal-client/cal-client.[hc] - * cal-util/cal-component.c - * cal-util/cal-recur.[hc] - * cal-util/test-recur.c - * cal-util/timeutil.c - * gui/calendar-config.c - * gui/calendar-model.[hc] - * gui/comp-util.[hc] - * gui/e-calendar-table.c - * gui/e-day-view-main-item.c - * gui/e-day-view-top-item.c - * gui/e-day-view.[hc] - * gui/e-itip-control.c - * gui/e-timezone-entry.[hc] - * gui/e-week-view.[hc] - * gui/gnome-cal.[hc] - * gui/goto.c - * gui/tag-calendar.[hc] - * gui/dialogs/cal-prefs-dialog.c - * gui/dialogs/comp-editor-page.[hc] - * gui/dialogs/comp-editor-util.[hc] - * gui/dialogs/comp-editor.c - * gui/dialogs/e-timezone-dialog.[hc] - * gui/dialogs/event-page.c - * gui/dialogs/meeting-page.c - * gui/dialogs/recurrence-page.c - * gui/dialogs/task-details-page.c - * gui/dialogs/task-details-page.glade - * gui/dialogs/task-page.c - * idl/evolution-calendar.idl - * pcs/cal-backend-file.c - * pcs/cal-backend.c - * pcs/cal-backend.h - * pcs/cal.c - * pcs/query.c: timezone changes everywhere. There's still quite a - few things to update, and its not working well at present. - -2001-07-02 JP Rosevear <jpr@ximian.com> - - * gui/calendar-commands.c (publish_freebusy_cmd): publish - free/busy information for the currently viewed time range - -2001-07-02 Christopher James Lahey <clahey@ximian.com> - - * gui/Makefile.am (INCLUDES): Added $(BONOBO_CONF_CFLAGS). - (evolution_calendar_LDADD): Added $(BONOBO_CONF_LIBS). - -2001-07-02 Federico Mena Quintero <federico@ximian.com> - - Support for ATTACH, DESCRIPTION properties in alarm components. - - * cal-util/cal-component.c (scan_alarm_property): Deal with - ATTACH, DESCRIPTION properties. - (cal_component_alarm_get_attach): New function. Libical is - actually bogus; supposedly icalattachtype structures are - refcounted but the property functions return them by value. - (cal_copmonent_alarm_set_attach): New function. - (cal_component_alarm_get_description): New function. - (cal_component_alarm_set_description): New function. - -2001-07-02 Federico Mena Quintero <federico@ximian.com> - - Support for repeat/duration properties in alarm components. - - * cal-util/cal-component.h (CalAlarmRepeat): New structure that - pairs the repeat/duration values of an alarm component, which must - be set both together or not set at all. - - * cal-util/cal-component.c (CalComponentAlarm): Added fields for - the repeat and duration properties. - (scan_alarm_property): Scan the DURATION and REPEAT properties. - (make_alarm): Nullify/initialize all the fields in the alarm. - (cal_component_alarm_get_repeat): New function. - (cal_component_alarm_set_repeat): New function. - - * gui/dialogs/alarm-page.glade: Changed the label of display - alarms from "Show a dialog" to "Display a message". - -2001-07-02 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-details-page.c - (task_details_page_fill_widgets): fill in delegated from field - -2001-07-02 Rodrigo Moya <rodrigo@ximian.com> - - * gui/dialogs/task-page.c (categories_clicked_cb): - * gui/dialogs/event-page.c (categories_clicked_cb): use the new - self-contained e_categories_config_open_dialog_for_entry() function - - * gui/e-week-view-event-item.c (e_week_view_item_draw_icons): - * gui/e-day-view-top-item.c (e_day_view_reshape_long_event): - (e_day_view_reshape_day_event): ditto - * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): - use e_categories_config_get_icon_for() to retrieve the icon - associated with each category - -2001-07-02 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (send_freebusy): implement - - * cal-util/cal-component.c (set_attendee_list): add the delto - property rather than the delfrom property twice - - * gui/dialogs/task-editor.c (task_editor_edit_comp): show - delegation info if appropriate - (delegate_task_cmd): delegate command - (cancel_task_cmd): cancel command - (refresh_task_cmd): refresh command - - * gui/dialogs/task-details-page.c: Load new widgets - (task_details_page_show_delegation): show/hide delegation info widgets - - * gui/dialogs/task-details-page.h: new proto - - * gui/dialogs/event-editor.c (event_editor_edit_comp): free - attendee list when finished - - * gui/dialogs/comp-editor.c (setup_widgets): explicitly show the - widgets, update pixmaps after the verbs have been added - (comp_editor_focus): don't do a show all - -2001-07-02 Federico Mena Quintero <federico@ximian.com> - - Fixes bug #1406. - - * gui/calendar-config.c (config_read): Handle the options for the - task list colors. - (calendar_config_write): Ditto. - (calendar_config_get_tasks_due_today_color): New function. - (calendar_config_set_tasks_due_today_color): New function. - (calendar_config_get_tasks_overdue_color): New function. - (calendar_config_set_tasks_overdue_color): New function. - (calendar_config_configure_e_calendar_table): Use - e_table_model_changed() for the colors. - - * gui/dialogs/cal-prefs-dialog.glade: Updated the options for the - task list and alarms. - - * gui/dialogs/cal-prefs-dialog.c (cal_prefs_dialog_show_config): - Update the task list settings. - (cal_prefs_dialog_update_config): Ditto. - - * gui/calendar-model.c (get_color): Deal with tasks for today as - well as overdue tasks. Make it cleaner, even though we have to - duplicate a chunk of is_overdue(). - - * gui/calendar-commands.c (preferences_cmd): Renamed from - properties_cmd(). - -2001-07-01 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view-main-item.c - (e_day_view_main_item_draw_day_event): draw icons per category - - * gui/e-day-view-top-item.c - (e_day_view_top_item_draw_long_event): draw icons per category - - * gui/e-day-view.c - (e_day_view_reshape_long_event): - (e_day_view_reshape_day_event): calculate space for category icons - - * gui/e-week-view-event-item.c - (e_week_view_event_item_draw_icons): draw icons per category - - * gui/e-week-view.c - (e_week_view_reshape_event_span): calculate space for category icons - -2001-07-01 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view.c (e_day_view_*_clipboard): fixed clibpoard - command activation from the menu entries. CTRL-C and CTRL-X don't - work though, since it seems the key presses are being captured by - the text item - - gui/e-week-view.c (e_week_view_*_clipboard): ditto - -2001-06-30 Federico Mena Quintero <federico@ximian.com> - - * gui/e-week-view-event-item.c - (e_week_view_event_item_button_press): Only set the - pressed_event_num and pressed_span_num if button 1 was pressed. - Fix up return values a bit. This fixes bug #3780. - - * gui/gnome-cal.c - (gnome_calendar_on_date_navigator_selection_changed): Doh, the - call for the day view was supposed to be - gnome_calendar_set_view(), not set_view(). Fixes bug #3779. - -2001-06-30 Rodrigo Moya <rodrigo@ximian.com> - - * gui/tasks-control.c (tasks_control_cut_cmd): call - e_calendar_table_cut_clipboard with the correct object - - (tasks_control_copy_cmd): ditto - - (sensitize_commands): sensitize clipboard commands based on the - number of selected tasks - -2001-06-28 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-calendar-table.[ch] (e_calendar_table_cut_clipboard), - (e_calendar_table_copy_clipboard), - (e_calendar_table_paste_clipboard): new functions for allowing the - execution of clipboard-related commands - - * gui/tasks-control.c (tasks_control_cut_cmd), - (tasks_control_copy_cmd), (tasks_control_paste_cmd): added - callbacks for the new clipboard-related menu entries - -2001-06-28 Rodrigo Moya <rodrigo@ximian.com> - - * gui/component-factory.c: removed not-uses-anymore parameter in - call to evolution_shell_component_new - - * gui/gnome-cal.[ch] (gnome_calendar_cut_clipboard), - (gnome_calendar_copy_clipboard), (gnome_calendar_paste_clipboard): - new functions for allowing execution of clipboard-related commands - - * gui/e-day-view.[ch] (e_day_view_cut_clipboard), - (e_day_view_copy_clipboard), (e_day_view_paste_clipboard): ditto - - * gui/e-week-view.[ch] (e_week_view_cut_clipboard), - (e_week_view_copy_clipboard), (e_week_view_paste_clipboard): ditto - -2001-06-27 Rodrigo Moya <rodrigo@ximian.com> - - * gui/calendar-commands.c (cut_event_cmd), - (copy_event_cmd), (paste_event_cmd): added callbacks for the new - clipboard-related menu entries - -2001-06-27 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (factory_fn): Pass NULL as the - @external_uri_schemas argument to - `evolution_shell_component_new()'. - -2001-06-27 Peter Williams <peterw@ximian.com> - - * conduits/*/Makefile.am (INCLUDES): More srcdir != builddir - fixes. - -2001-06-27 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-calendar-table.c (selection_received): fixed - (e_calendar_table_on_copy): fixed - -2001-06-26 Federico Mena Quintero <federico@ximian.com> - - * idl/evolution-calendar.idl (CalAlarmInstance): Renamed the occur - field to occur_start; added an occur_end field. This way we can - present the complete times for the occurrence from the server. - - * cal-util/cal-component.h (CalAlarmInstance): Likewise. - - * pcs/cal-backend-file.c (add_alarm_occurrences_cb): Fill the new - fields appropriately. - (generate_absolute_triggers): Likewise; we use -1 in case the - component has no DTSTART or DTEND because there are no meaningful - occurrence dates here. - (fill_alarm_instances_seq): Fill in the new fields. - - * cal-client/cal-client.c (build_alarm_instance_list): Likewise. - - * gui/alarm-notify/alarm-notify-dialog.c (alarm_notify_dialog): - Take in both the occur_start and occur_end times. - - * gui/goto.c (goto_dialog): Free the dlg structure on the bail-out - cases. - - * gui/dialogs/event-page.c (get_widgets): Do not assert if we - cannot find the main widget; just return FALSE. - - * gui/dialogs/alarm-page.c (get_widgets): Likewise. - - * gui/dialogs/task-page.c (get_widgets): Likewise. - - * gui/dialogs/task-details-page.c (get_widgets): Likewise. - - * gui/dialogs/meeting-page.c (get_widgets): Likewise. - -2001-06-25 Peter Williams <peterw@ximian.com> - - * conduits/calendar/Makefile.am (INCLUDES): Fixes for - srcdir != builddir. Link to the static libwombat. - - * conduits/todo/Makefile.am (INCLUDES): Here too. - -2001-06-24 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/notify-main.c (main): Initialize libglade. - - * pcs/cal-backend-file.c (compute_alarm_range): - icaldurationtype_as_int() will now return a negative value if - dur->is_neg is true, so we need to flip the sign of some - operations here. - (add_alarm_occurrences_cb): Likewise. - - * pcs/cal-backend-db.c (compute_alarm_range): Likewise. - (add_alarm_occurrences_cb): Likewise. - -2001-06-24 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/alarm-notify.c: Converted to use BonoboXObject. - - * gui/gnome-cal.c (gnome_calendar_open): Ask the alarm - notification service to add the calendar and tasks URIs. - (add_alarms): New function. - - * gui/alarm-notify/notify-main.c (main): Doh, fixed typo in the - OAFIID. - (main): Initialize and shut down gnome-vfs. - - * gui/Makefile.am (IDLS): Added evolution-calendar.idl, sigh. - (evolution_calendar_SOURCES): Added the files generated from the IDL. - - * gui/alarm-notify/alarm-queue.c (alarm_trigger_cb): New function - used when an alarm is triggered. - - * gui/dialogs/Makefile.am: Removed the alarm-notify-dialog files; - they are now in gui/alarm-notify. - - * gui/alarm-notify/Makefile.am: Added the alarm-notify-dialog - files. - - * pcs/cal.c (cal_forget_password): This was incorrectly named - cal_client_forget_password(); renamed it. - - * gui/main.c (main): Initialize and shut down gnome-vfs. - -2001-06-23 Federico Mena Quintero <federico@ximian.com> - - * gui/e-calendar-table.c (task_compare_cb): New function to - compare tasks like the Pilot task list. - - * cal-util/cal-component.h (CalComponentField): Added a - semi-hackish CAL_COMPONENT_FIELD_COMPONENT. In the ETable model, - it is intended to return a pointer to the component itself. - - * gui/calendar-model.c (calendar_model_value_at): Return the - component itself for CAL_COMPONENT_FIELD_COMPONENT. Be more - paranoid about invalid columns. - (calendar_model_set_value_at): Be more paranoid about invalid - columns. - (calendar_model_duplicate_value): Ref the component field. - (calendar_model_initialize_value): Deal with the component field. - (calendar_model_value_is_empty): Likewise. - (calendar_model_value_to_string): Likewise. - -2001-06-22 Jeffrey Stedfast <fejj@ximian.com> - - * gui/Makefile.am: Added itip-control-factory.* to the build. - -2001-06-22 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal.[ch] (cal_get_password): new function for the backends to - be able to call the getPassword method on the associated - WombatClient - (cal_forget_password): ditto for the forgetPassword method - -2001-06-22 Rodrigo Moya <rodrigo@ximian.com> - - * idl/evolution-calendar.idl: changed getFreeBusy method to return - a CalObj instead of a sequence - - * cal-client/cal-client.[ch] (cal_client_get_free_busy): changed it to - work like the cal_client_get_object function, that is, it does not - return anymore a list of UIDs, but a CalClientGetStatus code, and - added a new parameter for the caller to get the component back when - this function returns - (cal_client_open): aggregate WombatClient interface to the CalListener - being used - - * pcs/cal-backend-db.c, pcs/cal-backend-file.c (..get_free_busy): set - return value to "char *" as it will be returning a FreeBusy object, - and not a list of UIDs - - * pcs/cal-backend.[ch] (cal_backend_get_free_busy): ditto - - * pcs/cal.c (cal_construct): queryInterface on the listener to obtain - the WombatClient interface - -2001-06-21 JP Rosevear <jpr@ximian.com> - - * gui/main.c (main): update to new call - - * gui/e-itip-control.[hc]: break the widget bits out on their own - into a proper object, basic stuff seems to be working again - - * gui/itip-control-factory.c: put the control specific bits here - from e-itip-control.c - - * gui/itip-control-factory.h: new header - -2001-06-21 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/Makefile.am (gladedir): add include path - - * gui/dialogs/comp-editor.c (setup_widgets): remove buttons and - use evolution's standard ui config - - * gui/print.c (print_comp_item): print description text - -2001-06-21 Rodrigo Moya <rodrigo@ximian.com> - - * cal-client/cal-client.[ch]: - (cal_client_init): create a WombatClient when creating a CalClient - object, so that we can receive authentication notifications from - the wombat - (cal_client_destroy): destroy the WombatClient object when dying - (cal_client_set_auth_func): new function to set the authentication - function to be called when a password is required by the calendar - server (through the WombatClient object) - (cal_client_get_free_busy): new function for calling the new IDL - method Cal::getFreeBusy - - * gui/alarm-notify/Makefile.am: add libwombat to LDADD - - * gui/Makefile.am: add libwombat to LDADD - -2001-06-20 Dave Camp <dave@ximian.com> - - * gui/itip-utils.c (itip_send_comp): Changed attach_data - to be a GNOME_Evolution_Composer_AttachmentData rather than a - CORBA_char*. - -2001-06-20 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/comp-editor.c (print_cmd): print menu command - (print_preview_cmd): ditto for print preview - (print_setup_cmd): ditto for print setup - (comp_editor_set_cal_client): listen for updated and removed - signals - (obj_updated_cb): if the item changes else where, query the user - for the course of action - (obj_removed_cb): ditto for removal - - * gui/print.c (print_setup): rudimentary page setup support - (print_comp): rudimentary individual event/task printing support - - * gui/print.h: new protos - - * gui/dialogs/changed-comp.[hc]: dialog to query the user about - what to do when a item is changed elsewhere - - * gui/dialogs/Makefile.am: build new files - - * gui/dialogs/send-comp.c (send_component_dialog): remove useless - assignment - -2001-06-20 Rodrigo Moya <rodrigo@ximian.com> - - * idl/evolution-calendar.idl: added getFreeBusy method - - * pcs/cal.c (impl_Cal_get_free_busy): implementation of the new - getFreeBusy added method - - * pcs/cal-backend.[ch]: added new virtual method to the CalBackend - class (get_free_busy) - - * pcs/cal-backend-db.c (cal_backend_db_get_free_busy): new function, - not implemented yet - - * pcs/cal-backend-file.c (cal_backend_file_get_free_busy): new funtion, - not implemented yet - -2001-06-20 Damon Chaplin <damon@ximian.com> - - * gui/calendar-config.[hc]: - * gui/gnome-cal.[hc]: - * gui/tasks-control.c (tasks_control_activate): - * gui/calendar-commands.c (calendar_control_activate): moved the - function to check for a default timezone to calendar-config.c, and - also used it in the tasks control. - - * gui/dialogs/e-timezone-dialog.h: #include <gtk/gtkwidget.h> fix. - -2001-06-20 Damon Chaplin <damon@ximian.com> - - * gui/calendar-commands.c (calendar_control_activate): - * gui/gnome-cal.[hc]: added code to show the timezone dialog if the - user hasn't set a default timezone yet. - - * gui/dialogs/e-timezone-dialog.c (e_timezone_dialog_add_timezones): - set the "None" item string before adding it to the combo, to stop the - combo putting "None" in the entry initially. - -2001-06-19 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-calendar-table.[ch]: added cut/copy/paste support. It works - with single selections (a single component selected) and with - multiple ones (several components selected) - -2001-06-19 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/event-page.c: if the timezones of the start and end of - the event are the same, then if the start timezone is changed we - change the end timezone as well, since that is what most users will - want. - -2001-06-19 Damon Chaplin <damon@ximian.com> - - * pcs/cal.c: - * idl/evolution-calendar.idl: - * cal-client/cal-client.[hc]: removed stuff to get builtin timezone - info from the server. - -2001-06-19 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/cal-prefs-dialog.c: added a 'Time zone' setting. Also - rearranged a little, adding a new 'General' page, since we had too - many settings on the 'Calendar' page. - - * gui/e-timezone-entry.[hc]: - * gui/dialogs/e-timezone-dialog.[hc]: - * gui/dialogs/comp-editor.c: - * gui/dialogs/comp-editor-page.[hc]: - * gui/dialogs/event-page.c: - * gui/dialogs/task-details-page.c: - * gui/dialogs/task-page.c: removed CalClient stuff. The timezone dialog - now uses the timezone data directly from the client's libical library. - -2001-06-19 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-editor.c (task_editor_init): add ui - (forward_cmd): implement forward command - - * gui/dialogs/comp-editor.c (save_as_ok): bug fix, seems to work - now - -2001-06-19 JP Rosevear <jpr@ximian.com> - - * gui/control-factory.c (control_factory_init): add auto exit unref - - * gui/component-factory.c (destroy_cb): destroy our selves if we - have no more shells - (component_factory_init): add auto exit unref - -2001-06-19 JP Rosevear <jpr@ximian.com> - - * gui/Makefile.am: don't compile or install the old meeting edit - stuff - - * gui/e-week-view.c: ditto - - * gui/e-day-view.c: Remove scheduling menu option - -2001-06-19 JP Rosevear <jpr@ximian.com> - - * gui/itip-utils.c: add some needed commas - (itip_send_comp): if publishing, don't set the to list and show - the message. unless publishing, just send the email - - * gui/Makefile.am: remove typo - -2001-06-19 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/send-comp.c: itip/imip send dialog - - * gui/dialogs/send-comp.h: new proto - - * gui/dialogs/recurrence-page.c (recurrence_page_set_dates): only - use the weekday picker if visible - - * gui/dialogs/meeting-page.c: just show the meeting list - - * gui/dialogs/event-editor.c (event_editor_edit_comp): remove the - meeting page if no attendees - (schedule_meeting_cmd): schedule a meeting menu item - (refresh_meeting_cmd): refresh meeting request menu item - (cancel_meeting_cmd): ditto for cancel - (forward_cmd): send as attachment - - * gui/dialogs/comp-editor.c (comp_editor_remove_page): remove page - from dialog - (comp_editor_show_page): show a given page - (comp_editor_get_current_comp): return a cal component - representing the current widget state - (comp_editor_save_comp): save the cal component - (comp_editor_delete_comp): delete the cal component - (comp_editor_send_comp): send the cal component - (comp_editor_merge_ui): merge xml in to the bonobo gui - (setup_widgets): use a bonobo window instead of a gtk window, add menus again - (save_as_cmd): save to file on disk - still broken - (save_close_cmd): close menu command - (save_close_cmd): save and close menu command - - * gui/dialogs/comp-editor.h: new protos - - * gui/dialogs/cancel-comp.c (cancel_component_dialog): itip/imip - cancellation dialog - - * gui/dialogs/cancel-comp.h: new proto - - * gui/dialogs/Makefile.am: build new files - - * gui/dialogs/comp-editor-page.c - (comp_editor_page_notify_needs_send): emit needs_send signal - - * gui/dialogs/comp-editor-page.h: new signal protos - - * gui/itip-utils.c (itip_send_comp): new function to send cal - components - - * gui/itip-utils.h: new proto - - * gui/e-itip-control.c (pstream_load): trim using cal-component - wrapper stuff - (accept_button_clicked_cb): use itip_send_comp - (tentative_button_clicked_cb): ditto - (decline_button_clicked_cb): ditto - - * gui/Makefile.am: compile select name idl stuff - - * cal-util/cal-component.c (cal_component_get_organizer): get the organizer - (cal_component_set_organizer): set the organizer - (cal_component_get_recurid): get the recurrence id - (cal_component_set_recurid): set the recurrence id - (set_attendee_list): actually set the attendee list - (get_attendee_list): build the attendee list - - * cal-util/cal-component.h: new protos - -2001-06-19 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/task-details-page.glade: - * gui/dialogs/task-page.glade: - * gui/dialogs/event-page.glade: added timezone fields. Also moved the - 'All Day' flag into an alignment so it doesn't mess up the height of - the other widgets. - - * gui/dialogs/task-details-page.c: - * gui/dialogs/task-page.c: - * gui/dialogs/event-page.c: added code to handle the timezone fields. - This still needs to be hooked up when the libical code is finished. - - * gui/dialogs/e-timezone-dialog.c (on_map_leave): new function to - clear the preview label and turn off the highlighted point on the - map when you move the mouse outside it. - (find_selected_point): new function to try to find the point - corresponding to the text in the combo. - (on_combo_changed): call the above function to update the selected - point. - (on_map_leave): turn off the preview point & label when the mouse - leaves the map. - (e_timezone_dialog_set_cal_client): changed it so that selecting "None" - clears the entry. - - * gui/dialogs/comp-editor-page.[hc]: added set_cal_client() virtual - method since some pages need to access the CalClient to get timezone - information. Also added comp_editor_page_set_cal_client() to call - the virtual method. - - * gui/dialogs/comp-editor.c (comp_editor_set_cal_client): called - comp_editor_page_set_cal_client() on each page. - - * gui/calendar-config.c: added functions to get & set the timezone. - -2001-06-18 Eskil Heyn Olsen <eskil@eskil.dk> - - * conduits/calendar/calendar-conduit.c: (comp_from_remote_record), - (check_for_slow_setting), (conduit_get_gpilot_conduit): - * conduits/todo/todo-conduit.c: (check_for_slow_setting), - (conduit_get_gpilot_conduit): - Tweaked for some gnome-pilot api changes - -2001-06-15 Federico Mena Quintero <federico@ximian.com> - - * gui/calendar-view.[ch]: New files with the generic calendar view - object. It sucks that we have to implement at least two classes - to define a GalView and its factory. - - * gui/calendar-view-factory.[ch]: New files; factory for calendar - views. - - * gui/gnome-cal.h (GnomeCalendarViewType): Moved from gnome-cal.c - and renamed from ViewType. We no longer use strings to identify - the view types. - - * gui/gnome-cal.c (gnome_calendar_get_view_type): New function. - (set_view): Renamed from gnome_calendar_set_view_internal(). - (gnome_calendar_set_query): Made public; renamed from set_query(). - (gnome_calendar_setup_view_menus): New function to set up the view - collection and the GalViewMenus. - (gnome_calendar_discard_view_menus): New function to discard them. - - * gui/calendar-commands.c (calendar_control_activate): Set up the - GalView menus. - (calendar_control_deactivate): Discard the GalView menus. - - * gui/e-day-view.c: #include <gtk/gtkinvisible.h> - - * gui/dialogs/comp-editor.c (comp_editor_get_type): The type info - structure should be static. - -2001-06-15 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view.c (selection_received): generate a new UID - when pasting - - * gui/e-week-view.c (selection_received): ditto - -2001-06-15 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view.c (selection_received): finished implementation - of Paste stuff - - * gui/e-week-view.c (selection_received): ditto - -2001-06-14 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view.[ch]: added popup menu items for cut/copy/paste - - * gui/e-week-view.[ch]: ditto - -2001-06-14 Damon Chaplin <damon@ximian.com> - - * gui/e-timezone-entry.[hc]: new widget to enter a timezone. - - * gui/Makefile.am (evolution_calendar_SOURCES): added the above. - * gui/Makefile.am (evolution_calendar_LDADD): had to move - libcal-dialogs.a above libmiscwidgets.a to get it to compile. - -2001-06-14 Damon Chaplin <damon@ximian.com> - - * gui/dialogs/e-timezone-dialog.[hc]: - * gui/dialogs/e-timezone-dialog.glade: new dialog for setting the - time zone. - - * gui/dialogs/Makefile.am: added timezone dialog files. - - * idl/evolution-calendar.idl: added CalTimezoneInfo struct and seq, - and getBuiltinTimezoneInfo method. - - * pcs/cal.c (impl_Cal_get_builtin_timezone_info): implemented method. - (cal_class_init): added method to epv. - - * cal-client/cal-client.c (struct CalClientPrivate): added - timezone_info array to contain cached info on builtin timezone city - names and coordinates. - (cal_client_get_builtin_timezone_info): new function to get the info - about builtin timezones. - - * cal-client/cal-client.h: added CalTimezoneInfo struct, to contain - the city names and coords of the builtin timezones. - -2001-06-13 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/comp-editor-util.c (comp_editor_date_label): remove - unnecessary space - - * gui/dialogs/task-page.c (task_page_set_summary): indicate we are - updating, Fixes #3307 - -2001-06-13 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-details-page.c (task_details_page_set_dates): - set the completed time in the date editor if appropriate - - * gui/dialogs/task-page.c (task_page_set_dates): if we are - updating, return - (complete_date_changed): don't returns if we are updating - the - guards are done in the calling function - (status_changed): indicate when we are updating and when we are - finished, round the completion time to the nearest minute - (percent_complete_changed): indicate when are updating and when we - are finished - (percent_complete_changed): notify of the date change after the - option menu is updated - -2001-06-11 Rodrigo Moya <rodrigo@ximian.com> - - * gui/e-day-view.[ch]: added cut&paste support, by using a GtkInvisible - widget to manage the clipboard selections. - - * gui/e-week-view.[ch]: ditto - -2001-06-08 Iain Holmes <iain@ximian.com> - - * gui/component-factory.c: Removed the executive-summary includes. - (component_factory_init): Don't init the summary factory. - - * gui/calendar-summary.[ch]: Removed. - - * gui/Makefile.am: Remove executive-summary stuff, move some libs - around a bit. - -2001-06-04 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/recurrence-page.c (recurrence_page_set_dates): - update the blocked/selected days if the starting day of the - appointment changes, fixes #2188 - - * gui/dialogs/task-details-page.h: tidy proto - -2001-06-03 Ettore Perazzoli <ettore@ximian.com> - - * gui/e-itip-control.c: #include <bonobo/bonobo-context.h> instead - of <bonobo/bonobo-running-context.h>. - * gui/tasks-control-factory.c: Likewise. - - * gui/Makefile.am (evolution_calendar_LDADD): Move `$(DB3_LDADD)' - before libeutil. - -2001-06-01 JP Rosevear <jpr@ximian.com> - - * gui/Makefile.am: no longer build widget-util.*, the code has - been moved - -2001-06-01 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/event-page.c (make_date_edit): use new func - - * gui/dialogs/task-details-page.c - (task_details_page_create_date_edit): ditto - - * gui/dialogs/recurrence-page.c (make_ending_until_special): ditto - - * gui/dialogs/comp-editor-util.c (comp_editor_new_date_edit): - rename date_edit_new function - - * gui/dialogs/comp-editor-util.h: new proto - - * gui/dialogs/task-page.c (task_page_set_summary): no longer any - need to block/unblock the handler - (task_page_create_date_edit): use new func - -2001-06-01 JP Rosevear <jpr@ximian.com> - - * gui/.cvsignore: Update - - * gui/evolution-calendar-control.c: Remove dead file - - * gui/*.vcf: Remove dead files - -2001-06-01 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/comp-editor-page.[hc]: renamed from editor-page for - consistency, more complete implementation - - * gui/dialogs/comp-editor.[hc]: More complete implementation - - * gui/dialogs/*-page.*: The various pages needed to construct the - event and task dialogs - - * gui/dialogs/comp-editor-util.[hc]: useful utility functions for the - component editor pages to use - - * gui/dialogs/Makefile.am: Build and install new files - - * gui/event-editor*: Remove, obsoleted by the new comp-editor - stuff - - * gui/dialogs/task-editor-dialog.glade: ditto - - * gui/e-calendar-table.c (open_task): update to use comp editor - stuff - - * gui/e-tasks.c (e_tasks_new_task): ditto - - * gui/gnome-cal.c (gnome_calendar_edit_object): ditto - - * gui/Makefile.am: don't build non-existent files nor try to - install them - -2001-06-01 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (e_itip_control_factory_init): ditto - - * gui/tasks-control-factory.c (tasks_control_factory_init): - auto_exit_unref the factory - -2001-06-01 Ettore Perazzoli <ettore@ximian.com> - - * gui/Makefile.am (evolution_calendar_LDADD): Add `$(DB3_LDADD)'. - -2001-05-29 Federico Mena Quintero <federico@ximian.com> - - * gui/e-tasks.c (e_tasks_get_calendar_table): New function. - - * gui/tasks-control.c (tasks_control_activate): Connect to the - "selection_changed" signal of the tasks widget here, not in - tasks_control_new(). Also, update the sensitivity of the commands - here for the first time. - (tasks_control_deactivate): Disconnect from the signal here since - it only makes sense to monitor selection changes while the control - is active. - (selection_changed_cb): Removed hack that tested the presence of - the remote UI container. - (sensitize_commands): New function. - -2001-05-28 Damon Chaplin <damon@ximian.com> - - * gui/e-week-view-layout.[hc]: - * gui/e-day-view-layout.[hc]: new files to contain layout code split - off from EDayView an EWeekView, so we can use it for printing. - - * gui/print.c: rewritten to use the same layout code as the EDayView - and EWeekView widgets. - - * gui/gnome-cal.c (gnome_calendar_get_task_pad_cal_client): added - function so we can get the CalClient used for the TaskPad for printing. - - * gui/Makefile.am (evolution_calendar_SOURCES): added - e-day-view-layout.[hc] amd e-week-view-layout.[hc]. - - * cal-util/timeutil.c (time_week_begin): - (time_week_end): added week_start_day argument. - - * cal-util/cal-recur.c: added comments describing problems in it. - -2001-05-27 Rodrigo Moya <rodrigo@ximian.com> - - * gui/component-factory.c (remove_folder): implemented the - 'remove_folder' function for the calendar shell component - (xfer_folder): ditto for 'xfer_folder' - -2001-05-27 Dan Winship <danw@ximian.com> - - * gui/calendar-commands.c: #include - "evolution-shell-component-utils.h" rather than "e-gui-utils.h" - for e_pixmaps_update. - - * gui/tasks-control.c: Likewise. - -2001-05-25 Peter Williams <peterw@ximian.com> - - * gui/Makefile.am: Reference libeshell.la instead of libeshell.a. - -2001-05-23 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/recurrence-page.c: Finished porting from the old - event-editor.c. Made it store a clone of the component for when - we need to expand the recurrence set. - - * gui/dialogs/event-page.c (event_page_get_dates): New function. - - * gui/dialogs/editor-page.c (editor_page_set_dates): Renamed from - editor_page_set_dtstart(); now sets both DTSTART and DTEND. - - * gui/dialogs/alarm-page.c (alarm_page_set_dates): Ahem, it is a - label, not an entry. - -2001-05-21 Federico Mena Quintero <federico@ximian.com> - - Fix bug #2831; the tasks toolbar and menu now have a button to - delete the selected tasks. - - * gui/e-calendar-table.c (e_calendar_table_delete_selected): New - function. - (delete_cb): Use e_calendar_table_delete_selected(). - (e_calendar_table_get_table): New function. - - * gui/tasks-control.c (tasks_control_new_task_cmd): Handle the - delete command. - (selection_changed_cb): Change the sensitivity of the TasksDelete - command when the selection in the table changes. - - * gui/e-tasks.c (table_selection_change_cb): Notify upstream when - the ETable selection changes. - -2001-05-18 Federico Mena Quintero <federico@ximian.com> - - Fix bug #2829. - - * gui/dialogs/delete-comp.c (delete_component_dialog): Allow the - caller to specify whether just one or many components are to be - deleted. - - * gui/e-calendar-table.c (tasks_popup_one): Popup menu definition - for when one and only one task is selected. - (tasks_popup_many): Likewise, for more than one task. - (e_calendar_table_on_right_click): Do not create a structure for - the closure data; we can simply pass the cal_table. Use a - different menu depending on the number of selected tasks. - (mark_as_complete_cb): Renamed; now iterates over the selected - rows. - (delete_selected_components): New function to delete all the - selected components. - (delete_cb): Adjusted for delete_component_dialog(). - (open_task): New function, simply open a CalComponent in the task - editor. - (open_task_by_row): Renamed; use open_task(). - - * gui/e-week-view.c (e_week_view_on_delete_appointment): Updated - for delete_component_dialog(). - - * gui/e-day-view.c (e_day_view_on_delete_appointment): Likewise. - -2001-05-16 Duncan Mak <duncan@ximian.com> - - * gui/Makefile.am (evolution_calendar_SOURCES): removed - editor-page.[ch] because they've now moved dialogs. - -2001-05-16 Federico Mena Quintero <federico@ximian.com> - - Split the event and task editors into different objects for the - separate pages; this way they can be shared by both editors. - - * gui/dialogs/editor-page.[ch]: New abstract class for a page in a - calendar component editor. - - * gui/dialogs/event-page.[ch]: Main page of an event editor. - - * gui/dialogs/alarm-page.[ch]: Alarm page of a calendar component - editor. - - * gui/dialogs/recurrence-page.[ch]: Recurrence page of a calendar - component editor. - - * gui/dialogs/event-page.c (event_page_fill_widgets): Eeek, this - was missing a bunch of break statements. - (event_page_fill_component): Use a temporary variable rather than - allocating a struct icaltimetype. - - * gui/dialogs/alarm-page.c (get_alarm_string): Do not use - fixed-size buffers. - (alarm_page_fill_widgets): Use cal_obj_uid_list_free(). - (append_reminder): Now the list stores the plain CalComponentAlarm - structures in the row data. We do *NOT* want to be frobbing the - component's data directly. Rather, we clone the alarms from the - component and maintain them on our own. - (alarm_page_fill_component): Clone the alarms before adding them - to the component so that we maintain the invariant that the alarm - structures in the list did *not* come from the component. - - * cal-util/cal-component.c (cal_component_add_alarm): Added - documentation. - (cal_component_remove_alarm): Added documentation. - (cal_component_remove_alarm): Do a lookup in our hash table of - alarms instead of scanning the whole component. - (CalComponentAlarm): Removed the `parent' field, since it was - unused. - (cal_component_free_alarm_uids): Removed function, since - cal_component_get_alarm_uids() is documented so that the user will - know that he must use cal_obj_uid_list_free(). - (cal_component_alarm_clone): New function. - -2001-05-09 Federico Mena Quintero <federico@ximian.com> - - * gui/Makefile.am (evolution_calendar_SOURCES): Added - editor-page.[ch] to the list of sources. - -2001-05-09 JP Rosevear <jpr@ximian.com> - - * gui/event-editor.c (reminder_add_cb): switch on the correct - widget and map - -2001-05-08 JP Rosevear <jpr@ximian.com> - - * gui/e-itip-control.c (e_itip_control_factory): unref the - property bag when we finish with it - - * gui/evolution-calendar-control.c (calendar_properties_init): ditto - - * gui/control-factory.c (calendar_properties_init): ditto - - * gui/calendar-summary.c (create_summary_view): ditto - -2001-05-08 JP Rosevear <jpr@ximian.com> - - * cal-util/cal-component.c (cal_component_alarm_free): - (cal_component_alarm_free): free the alarm component if it doesn't - have a parent, rather than if it does - - * gui/Makefile.am: sanitize LD_ADDS and CFLAGS so the libtool - lines are shorter (fixes problem on solaries due to sed) - -2001-05-07 JP Rosevear <jpr@ximian.com> - - * pcs/cal-factory.[hc]: Convert to bonobo xobject - - * pcs/cal.[hc]: Convert to bonobo xobject - -2001-05-07 Gediminas Paulauskas <menesis@delfi.lt> - - * gui/event-editor.c (make_title_from_comp): conversion summary - from utf8 here, use translated strings as is. - (set_title_from_comp): reflect this, simplify. - - * gui/dialogs/task-editor.c: updated copies of above functions here. - - * gui/gnome-cal.c: use defines from widgets/misc/e-filter-bar.h for - consistency in "Show all". - -2001-05-04 JP Rosevear <jpr@ximian.com> - - * gui/calendar-model.c (calendar_model_append_row): unref the - calcomponent when we're done with it - - * cal-util/cal-component.c (cal_component_gen_uid): free the iso - date string when we finish with it - -2001-04-27 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-edit.c (put_property_in_list): remove hardcoded - values - (edit_attendee): ditto, and there are only 4 roles now - - * gui/e-meeting-dialog.glade: tweak - - * gui/itip-utils.c: There shouldn't be an "other" role - -2001-04-26 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-edit.c (edit_attendee): use enums not hard code - values - -2001-04-26 JP Rosevear <jpr@ximian.com> - - * gui/e-meeting-edit.c (add_button_clicked_cb): - icalparameter_new_rsvp now takes an enum - -2001-04-26 JP Rosevear <jpr@ximian.com> - - * cal-util/cal-component.c (cal_component_alarm_set_trigger): the - value type should be inited with ICAL_VALUE_* rather than - ICAL_*_VALUE because it is a param argument. - -2001-04-26 Federico Mena Quintero <federico@ximian.com> - - * gui/calendar-model.c (get_is_overdue): Replace "<" by "<=" in - the comparison for due dates against the current time. This makes - tasks appear immediately as red when you click Now in the due date - popup field. - - This is not a complete solution to the more general problem of - tasks staying the same color even if they become overdue while the - task list remains the same on the screen. This has been logged as - bug #2399. - -2001-04-26 Ettore Perazzoli <ettore@ximian.com> - - * gui/dialogs/Makefile.am (INCLUDES): Add `$(EXTRA_GNOME_CFLAGS)'. - -2001-04-26 Dan Winship <danw@ximian.com> - - * conduits/todo/Makefile.am (libetodo_conduit_la_LIBADD): Remove - UNICODE_LIBS - - * cal-client/Makefile.am (client_test_LDADD): Remove -lunicode - -2001-04-24 Duncan Mak <duncan@ximian.com> - - * gui/alarm-notify/notify-main.c (funny_trigger_cb): Fixed - Strftime so it uses the locale prefered way to display date/time. - ("%x %X" instead of "%Y/%m/%d %H:%M:%S") - -2001-04-21 Gediminas Paulauskas <menesis@delfi.lt> - - * gui/calendar-summary.c: translate "Things to do" etc. and convert them - to utf8. Changed some link from helixcode to ximian. - -2001-04-18 Ettore Perazzoli <ettore@ximian.com> - - * gui/dialogs/Makefile.am (INCLUDES): Add - `-I$(top_srcdir)/calendar/cal-client', - `-I$(top_builddir)/calendar/cal-client'. - * gui/Makefile.am (INCLUDES): Likewise. - - * cal-client/cal-query.h: #include "evolution-calendar.h". - -2001-04-17 Federico Mena Quintero <federico@ximian.com> - - * gui/event-editor.c (init_widgets): Connect to the "changed" - signal of the categories entry so that they will be applied - correctly. - (EventEditorPrivate): Added fields for the contacts button and - entry. - (init_widgets): Disable the contacts widgets as we do not support - them yet. - (get_widgets): Get the contacts widgets. - - * gui/dialogs/task-editor.c (get_widgets): Get the contacts - button, which was missing. - (init_widgets): Disable the contacts widgets as we do not support - them yet. - - * pcs/query.c (matches_text_list): Use e_utf8_strstrcasedecomp() - instead of plain e_utf8_strstrcase(). - (matches_summary): Likewise. - -2001-04-17 JP Rosevear <jpr@ximian.com> - - * cal-util/cal-component.c (cal_component_alarm_set_action): the - libical action stuff uses enums rather than strings to enumerate - the various actions now - (cal_component_alarm_get_action): ditto - -2001-04-17 Ettore Perazzoli <ettore@ximian.com> - - * gui/alarm-notify/Makefile.am (evolution_alarm_notify_SOURCES): - Add `$(CORBA_GENERATED)'. - -2001-04-16 Dan Winship <danw@ximian.com> - - * pcs/Makefile.am (INCLUDES): Add EXTRA_GNOME_CFLAGS, for gal. - -2001-04-15 Federico Mena Quintero <federico@ximian.com> - - * gui/gnome-cal.c (setup_widgets): Create the ESearchBar thingy. - (search_bar_query_changed_cb): Build the different queries based - on the type and string. - - * pcs/query.c (backend_obj_updated_cb): Ref the query while we are - notifying the listener so that it will not disappear from under us. - (backend_obj_removed_cb): Likewise. - (process_component_cb): Likewise. - (func_contains): New function to match text fields. - (matches_comment): New function to match comment lists. - (matches_description): New function to match description lists. - (matches_summary): New function to match summaries. - (matches_any): New function to match any text field. - (func_has_categories): New function to match categories. - -2001-04-14 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/notify-main.c (main): Initialize the trigger - and queue systems. - -2001-04-13 Dan Winship <danw@ximian.com> - - * cal-util/timeutil.c (time_from_isodate): Fix the syntactic bogon - here, and attempt to fix the logical bogon too. (tm_gmtoff and - timezone have opposite signs... I'm assuming Federico tested the - Linux case, so I'm flipping the sign of the BSD case. But maybe he - didn't and it's supposed to be the other way...) - -2001-04-12 Federico Mena Quintero <federico@ximian.com> - - * gui/e-day-view.c (update_query): New function to restart a query - for the day view. - (query_obj_updated_cb): Renamed from obj_updated_cb(); updated for - queries instead of calendar clients. - (query_obj_removed_cb): Likewise. - (cal_opened_cb): Just update_query() instead of queueing reloading - all the events. - (e_day_view_set_cal_client): Likewise. - (e_day_view_set_query): Likewise. - (e_day_view_set_selected_time_range): Likewise. - (e_day_view_set_days_shown): Likewise. - (e_day_view_recalc_work_week): Likewise. - (e_day_view_queue_reload_events): Removed function now that events - are updated entirely by the query. - (e_day_view_reload_events_idle_cb): Likewise. - (e_day_view_reload_events): Likewise. - (e_day_view_init): Use a pretty arrow instead of GDK_TOP_LEFT_ARROW. - - * gui/e-week-view.c: Analogous changes to the ones in e-day-view.c. - (e_week_view_init): Use a pretty arrow instead of GDK_TOP_LEFT_ARROW. - - * cal-util/timeutil.c (isodate_from_time_t): Return a g_strdup()ed - version of the string instead of a pointer to a static buffer. - (time_from_isodate): Resurrected function. Polished up to our - current standards of paranoia. - - * pcs/query.c (func_time_now): New function (time-now). - (func_make_time): New function (make-time ISODATE). - (func_time_add_day): New function (time-add-day TIME N). - (func_time_day_begin): New function (time-day-begin TIME). - (func_time_day_end): New function (time-day-end TIME). - (func_occur_in_time_range): Use time_t values instead of ints. - (match_component): Free the stringized component. Free the ESexp - result value. - - * gui/e-day-view.h: Removed a couple of unused prototypes. - - * pcs/query.c (query_destroy): Oops, disconnect from the backend. - - * pcs/cal.c (Cal_get_query): Duplicate the query reference before - we return it. - - * gui/calendar-commands.c (pixmaps): Fixed paths to image files. - -2001-04-11 JP Rosevear <jpr@ximian.com> - - * pcs/cal-backend-file.c (cal_backend_file_compute_changes): - prepend to both changes and change_ids when different and mark as - modified, not added - -2001-04-11 Christopher James Lahey <clahey@ximian.com> - - * gui/calendar-model.c (calendar_model_append_row): Fix this to - just send the data to the wombat instead of inserting it - ourselves. - -2001-04-11 Gediminas Paulauskas <menesis@delfi.lt> - - Display fixes, thanks to Kjartan for finding these. - - * gui/event-editor.c: use simple (not e_utf8_) gtk_clist_append for - strings which are never in utf-8. - * dialogs/delete-comp.c (delete_component_dialog): convert only - summary from utf-8 to gtk charset. Translated values are in correct - craset already. - -2001-04-04 Kjartan Maraas <kmaraas@gnome.org> - - * gui/calendar-commands.c: Fix headers. - * gui/calendar-config.c: Same here. - * gui/calendar-model.c: Same here. - * gui/e-day-view-time-item.c: Same here. - * gui/e-day-view-top-item.c: Same here. - * gui/e-day-view.c: Same here. - * gui/e-meeting-edit.c: Same here. - * gui/e-week-view-main-item.c: Same here. - * gui/e-week-view.c: Same here. - * gui/event-editor.c: Same here. - * gui/gnome-cal.c: Same here. - * gui/goto.c: Same here. - * gui/main.c: Same her. - * gui/print.c: Same here. - -2001-04-02 Federico Mena Quintero <federico@ximian.com> - - * gui/e-tasks.c (e_tasks_setup_menus): Plug leak. - - * gui/event-editor.c (obj_updated_cb): Do nothing for now until we - think of something sensible to do. - (obj_removed_cb): Likewise. - - * gui/dialogs/task-editor.c (obj_updated_cb): Likewise. - (obj_removed_cb): Likewise. - - * gui/event-editor.c (dialog_to_comp_object): Plug leak. - -2001-04-01 Federico Mena Quintero <federico@ximian.com> - - Client-side glue for the live query engine. - - * cal-client/query-listener.[ch]: New files with the - implementation fo the QueryListener interface. - - * cal-client/cal-query.[ch]: New files with the client-side - convenience object for live queries. - - * cal-client/cal-listener.h (CalListenerClass): Removed unused - slots for signal handlers. - - * cal-client/Makefile.am (libcal_clientinclude_HEADERS): Now we - install the evolution-calendar.h header. This sucks a bit. - -2001-04-01 Gediminas Paulauskas <menesis@delfi.lt> - - * gui/calendar-commands.c: use new pixmap cache. Added some menu icons - and changed filenames of renamed icons. - * gui/tasks-control.c: added icons for new task and print in menu. - -2001-03-29 Federico Mena Quintero <federico@ximian.com> - - Engine for live queries to calendars. A query object watches a - CalBackend in the PCS and is otherwise completely separate from - it; backends need to do nothing to support live queries. Right - now we have the following functions: - - (get-vtype) - - Returns a string indicating the type of component - (VEVENT, VTODO, VJOURNAL, VFREEBUSY, VTIMEZONE, - UNKNOWN). - - (occur-in-time-range? START END) - - START - int, time_t start of the time range - END - int, time_t end of the time range - - Returns a boolean indicating whether the component - has any occurrences in the specified time range. - - * idl/evolution-calendar.idl (Cal::getQuery): New method that - initiates a live query. - (Query): New interface for a handle to a live query. - (QueryListener): New interface for a listener to changes in a live - query. - - * pcs/query.[ch]: New files with the live query engine. - - * pcs/cal-backend.h (CalBackendClass): Added notification signals - so that the query system can catch them. - (CalBackendClass): New virtual method ::get_load_state(). - - * pcs/cal-backend.c (cal_backend_opened): - (cal_backend_obj_updated): - (cal_backend_obj_updated): New functions to emit the notification - signals; to be used only by backend implementations. - (cal_backend_get_load_state): New function. - - * pcs/cal-backend-file.c (notify_update): Call - cal_backend_obj_updated(). - (notify_remove): Call call_backend_obj_removed(). - (open_cal): Free the icalcomp if it is not of the correct type. - (cal_backend_file_get_load_state): Implemented new method. - - * pcs/cal-backend-db.c (cal_backend_db_update_object): Call - cal_backend_obj_updated(). - (cal_backend_db_remove_object): Call cal_backend_obj_removed(). - (cal_backend_db_get_load_state): Implemented new method. - - * pcs/cal.c (Cal_get_query): Implementation of the ::getQuery() - method. - -2001-03-27 Anna Marie Dirks <anna@ximian.com> - - * gui/e-itip-control.c: fixed button placement to comply - with gnome standards. - -2001-03-27 Anna Marie Dirks <anna@ximian.com> - - * gui/e-itip-control.glade: fixed spacing and label alignment to - comply with gnome standards. Also removed shadows from extraneous - scrolled windows to avoid bevelitous. There are many more changes - that need to happen to this viewer, but they all require a hacker - to do some c-coding, so I will avoid committing them until after the - .10 release. - -2001-03-26 Kjartan Maraas <kmaraas@gnome.org> - - * cal-client/client-test.c: Replace includes of <gnome.h>, <bonobo.h> - and <gtk/gtk.h> with the needed headers to speed up compile. - * cal-util/test-recur.c: Same here for <gtk/gtk.h> - * gui/calendar-commands.c: Replace <bonobo.h> and remove - <libgnorba/gnorba.h> - * gui/calendar-summary.c: Replace <gnome.h> and <bonobo.h> - * gui/calendar-summary.h: Added <bonobo/bonobo-generic-factory.h> - * gui/component-factory.c: Remove <bonobo.h> - * gui/control-factory.c: Replace <bonobo.h> - * gui/e-calendar-table.c: Remove <gnome.h> - * gui/e-itip-control.c: Replace <gnome.h> and <bonobo.h> - * gui/e-meeting-edit.c: Replace <bonobo.h> - * gui/e-tasks.c: Replace <gnome.h> - * gui/e-tasks.h: Replace <bonobo.h> - * gui/gnome-cal.h: Remove <bonobo.h> - * gui/main.c: Replace <bonobo.h> and <glade/glade.h> - * gui/tasks-control-factory.c: Replace <bonobo.h> - * gui/tasks-control.c: Replace <gnome.h> and <bonobo.h> - * gui/weekday-picker.c: Add <string.h> and <libgnome/gnome-defs.h> - * gui/alarm-notify/client-main.c: Remove <gnome.h> and <bonobo.h> - * gui/alarm-notify/notify-main.c: Replace <gnome.h> and <bonobo.h> - * gui/dialogs/alarm-notify-dialog.c: Replace <gnome.h> - * pcs/cal-backend.c: Replace <gtk/gtk.h> - -2001-03-25 Federico Mena Quintero <federico@ximian.com> - - * gui/e-calendar-table.c (e_calendar_table_init): The - model_rows_{inserted,deleted} signals changed names; deal with it. - (e_calendar_table_on_rows_inserted): Updated for new ETable API. - (e_calendar_table_on_rows_deleted): Likewise. - - * gui/gnome-cal.h (GnomeCalendarOpenMode): Removed unused enum. - - * gui/gnome-cal.c (gnome_calendar_open): Constify. - - * gui/calendar-commands.c (calendar_set_uri): Removed function, - since it was just calling gnome_calendar_open(). - - * gui/control-factory.c (set_prop): Replace usage of - calendar_set_uri() with gnome_calendar_open(). - (load_calendar): Likewise. - (calendar_persist_init): Made static. - - * gui/e-tasks.c: #include "calendar-config.h" - (e_tasks_update_all_config_settings): We are configuring a table, - not a calendar! Use the appropriate function. - -2001-03-17 Miguel de Icaza <miguel@ximian.com> - - * gui/e-day-view.c (e_day_view_on_new_event, - e_day_view_on_new_appointment): Simplifed this function to use the - shared code. - - * gui/e-week-view.c (e_week_view_on_new_event, - e_week_view_on_new_appointment): ditto. - - * gui/gnome-cal.c (gnome_calendar_new_appointment_for): New - function used to launch editor components with a time range. A - bunch of functions use this code now instead of duplicating code - all over the place - - * gui/e-week-view.c (e_week_view_new_event): Moved functionality - here from e_day_view_on_new_appointment. Allows setting for "full - day" event. - (e_week_view_on_new_full_day): New function for making a full day - event. - (e_week_view_on_goto_date): Go To support. - (e_week_view_on_goto_today): Goto today support. - - * gui/e-day-view.c (e_day_view_new_event): Moved functionality - here from e_day_view_on_new_appointment. Allows setting for "full - day" event. - (e_day_view_on_new_full_day): New function for making a full day - event. - (e_day_view_on_goto_date): Go To support. - (e_day_view_on_goto_today): Goto today support. - - * main_items: Add New All Day Event; Go to Today; Go to Date. - -2001-03-07 Miguel de Icaza <miguel@ximian.com> - - * gui/control-factory.c (calendar_persist_init): New function: - inits the BonoboPersistFile server. - - * gui/GNOME_Evolution_Calendar.oaf.in: Added BonoboPropertyBag to - the list of supported interfaces that were supported but not - reported. Add the new PersistFile. - - Add text/calendar mime type attribute. - -2001-03-15 Dan Winship <danw@ximian.com> - - * gui/e-week-view.c (e_week_view_start_editing_event): - * gui/e-day-view.c (e_day_view_start_editing_event): Update - arguments to e_canvas_item_grab_focus. - -2001-03-15 Gediminas Paulauskas <menesis@delfi.lt> - - * gui/*.xpm: moved to ../art. - * gui/Makefile.am: removed *.xpm and oaf_DATA from EXTRA_DIST. - * gui/e-calendar-table.c, gui/e-day-view.c, gui/e-week-view.c: - #include "art/*.xpm". - -2001-03-09 JP Rosevear <jpr@ximian.com> - - * conduits/todo/Makefile.am: PISOCK_INCLUDEDIR has become - PISOCK_CFLAGS in gnome-pilot.m4 and remove capplet foo - - * conduits/calendar/Makefile.am: ditto - -2001-03-08 Ettore Perazzoli <ettore@ximian.com> - - * gui/component-factory.c (factory_fn): Specify a NULL - `EvolutionShellComponentGetDndSelectionFn'. - -2001-02-27 Miguel de Icaza <miguel@ximian.com> - - * gui/e-day-view.c (e_day_view_on_event_right_click): Reorganize - the menus to have entries always in a consistent fashion, as - reported to the genepool mailing list. - (e_day_view_on_event_right_click): Added a FIXME comment to the - FIXME comment without a FIXME. - - Now we use e_popup_menu. This allows us to hide/show items on - demand, and to sensitize/de-sensitize items depending on their - state. - - This will also let us add icon support (when we get nice icons for - this) - - * gui/e-week-view.c (e_week_view_show_popup_menu): Ditto. - - The files popup-menu.c and popup-menu.h can now be removed. - -2001-03-05 Damon Chaplin <damon@ximian.com> - - * gui/e-tasks.c: keep list of all Tasks folders so we can update the - preference settings when necessary. - - * gui/gnome-cal.c: configure the TaskPad according to the settings. - - * gui/e-calendar-table.c: use ECellCombo and ECellDateEdit for fields, - so the tasks folders is almost usable now. - - * gui/calendar-model.c: added support for the Status property. - - * gui/calendar-config.[hc]: added convenience functions to setup - ECalendarTable and ECellDateEdit objects. - - * gui/calendar-commands.c: connected to "destroy" signal of calendars - so we can remove them from all_calendars list. - - * gui/dialogs/cal-prefs-dialog.c (cal_prefs_dialog_update_config): - call e_tasks_update_all_config_settings() to update all the settings - in the Tasks folders as well. - - * cal-util/cal-component.h: added CAL_COMPONENT_FIELD_STATUS. - - * cal-util/cal-component.c (cal_component_get_transparency): fixed - calls to strcasecmp so they check for '== 0'. - - Applied patch from Miguel... - -2001-02-27 Miguel de Icaza <miguel@ximian.com> - - * gui/e-day-view.c (e_day_view_on_event_right_click): Reorganize - the menus to have entries always in a consistent fashion, as - reported to the genepool mailing list. - (e_day_view_on_event_right_click): Added a FIXME comment to the - FIXME comment without a FIXME. - - Now we use e_popup_menu. This allows us to hide/show items on - demand, and to sensitize/de-sensitize items depending on their - state. - - This will also let us add icon support (when we get nice icons for - this) - - * gui/e-week-view.c (e_week_view_show_popup_menu): Ditto. - - The files popup-menu.c and popup-menu.h can now be removed. - -2001-03-02 JP Rosevear <jpr@ximian.com> - - * conduits/todo/e-todo.conduit.in: update for new pilot foo - - * conduits/calendar/e-calendar.conduit.in: ditto - - * conduits/todo/Makefile.am: update sed script - - * conduits/calendar/Makefile.am: ditto - -2001-02-28 Federico Mena Quintero <federico@ximian.com> - - * gui/event-editor.c (recurrence_exception_select_row_cb): New - function to set the EDateEdit's value when a row is selected in - the exception date list. Fixes bug #1638. - (append_exception): Set the value as well. Block/unblock signals - from the clist as appropriate. Gotta love non-model/view widgets. - (recurrence_exception_delete_cb): Be more paranoid about the - contents of the list row's data. - (recur_to_comp_object): Likewise. - (fill_exception_widgets): Select the first row after we are done - appending the exception dates. - -2001-02-26 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/Makefile.am (libalarm_a_SOURCES): Create a - little stand-alone library for the low-level alarm trigger - mechanism. This is so that the GUI parts of the calendar can use - it in addition to the alarm daemon. - - * gui/main.c: #include "alarm-notify/alarm.h". - - * gui/calendar-summary.c: Likewise. - (alarm_fn): Do not remove the previous alarm; it is removed - automatically when it is triggered. - - * gui/Makefile.am (evolution_calendar_SOURCES): Removed alarm.[ch] - from the sources. - - * gui/alarm.[ch]: Removed obsolete files. - -2001-02-23 Federico Mena Quintero <federico@ximian.com> - - * gui/alarm-notify/alarm-notify.c (AlarmNotify_addCalendar): - Switched to using our own refcounted structure for loaded clients. - (AlarmNotify_removeCalendar): Ditto. Also, do the full - destruction of the client. - (alarm_notify_destroy): Destroy each element in the hash table. - - * cal-client/cal-client.c (cal_client_construct): Test for - exceptions from OAF when activating the Wombat calendar factory. - - * gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.oaf.in: - New .oaf.in file. - - * gui/alarm-notify/Makefile.am (oaf_in_files): Updated. - - * gui/GNOME_Evolution_Calendar.oaf.in: Put all the servers here - instead of in a million files. - - * gui/GNOME_Evolution_Calendar_Control.oaf.in: Removed file. - - * gui/GNOME_Evolution_Calendar_gnomecal.oaf.in: Removed *REALLY* - obsolete file. - - * gui/Makefile.am (oaf_in_files): Updated. - -2001-02-23 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-db.c (add_history): fixed generation of history records - -2001-02-16 Federico Mena Quintero <federico@ximian.com> - - * pcs/cal-factory.c (CalFactoryPrivate): Added a `registered' - field. - (cal_factory_oaf_register): New function; now the factory performs - its own registration with OAF. - (cal_factory_destroy): Unregister from OAF if appropriate. - -2001-02-19 JP Rosevear <jpr@ximian.com> - - * conduits/todo/Makefile.am: Remove PISOCK_LIBDIR - - * conduits/calendar/Makefile.am: ditto - -2001-02-16 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/calbackend-db.c (cal_backend_db_destroy): close DB environment. - Some compilation warnings removed - -2001-02-13 Christopher James Lahey <clahey@ximian.com> - - * gui/Makefile.am (evolution_calendar_LDADD): Added libmenus.la. - - * gui/e-calendar-table.c, gui/e-calendar-table.h - (e_calendar_table_get_spec): Added this function. - - * gui/e-tasks.c, gui/e-tasks.h (e_tasks_setup_menus): Added this - function. - - * gui/tasks-control.c (tasks_control_activate): Call - e_tasks_setup_menus. - -2001-02-13 JP Rosevear <jpr@ximian.com> - - * gui/e-tasks.c (e_tasks_new_task): call task_editor_focus - -2001-02-13 JP Rosevear <jpr@ximian.com> - - * gui/calendar-commands.c (update_pixmaps): Set toolbar new - appointment icon - (set_pixmap): load files rather than create from xpm file - - * gui/*view.xpm: move to the art directory - -2001-02-13 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-db.c (cal_backend_db_get_alarms_for_object): - implemented - -2001-02-13 JP Rosevear <jpr@ximian.com> - - * gui/calendar-commands.c (update_pixmaps): Set toolbar new command - - * gui/e-calendar-table.c: Add titles to pixbuf column for grouping - - * gui/calendar-model.c (calendar_model_class_init): override value - to string virtual method - (calendar_model_value_to_string): implement value to string for - etable (necessary for group by) - -2001-02-12 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-file.c: - cal_backend_db_update_object(): manage both updates and additions/add notification - cal_backend_db_get_object(): don't use DB cursors - cal_backend_db_get_type_by_uid(): don't use DB cursors - cal_backend_db_remove_object(): don't use DB cursors/add notification - cal_backend_db_get_alarms_in_range(): implemented - -2001-02-12 Kjartan Maraas <kmaraas@gnome.org> - - * gui/Makefile.am: Hook up the xml-i18n-tools + .oaf.in stuff. - * gui/GNOME_Evolution_Calendar*.oaf.in: Marked strings for translation. - -2001-02-11 Rodrigo Moya <rodrigo@ximian.com> - - * pcs/cal-backend-db.c: added DB3 transactions support - * pcs/cal-backend-db.[ch]: added the new DB3-based backend. This is just - the beginning, there are some missing things still. - -2001-02-11 Gediminas Paulauskas <menesis@delfi.lt> - - Really use xml-i18n-tools. - - * conduits/calendar/e-calendar-conduit-control-applet.desktop, - conduits/todo/e-todo-conduit-control-applet.desktop: removed. - - * conduits/calendar/e-calendar-conduit-control-applet.desktop.in, - conduits/todo/e-todo-conduit-control-applet.desktop.in: added empty. - - * conduits/calendar/Makefile.am, conduits/todo/Makefile.am: - reflect above changes, merge translations. - - * gui/*.glade.h, gui/dialogs/*.glade.h: removed, xml-i18n-extract - takes care of strings itself. - - * gui/*.glade, gui/dialogs/*.glade: do not output_translatable_strings - - * gui/Makefile.am, gui/dialogs/Makefile.am: do not include removed - files in EXTRA_DIST. - -2001-02-08 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-editor-dialog.glade: Oops, remove old widget - -2001-02-08 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/task-editor.c (fill_widgets): fill in new - classification stuff properly - (get_widgets): load new class. widgets - (init_widgets): if the class. widgets change, mark the dialog - dirty - (dialog_to_comp_object): set the comp class. from the new widgets - - * gui/dialogs/task-editor-dialog.glade: Make more consistent, - fixing bugs 1247 and 1249 - - * gui/dialogs/task-editor.c (fill_widgets): - - * gui/event-editor-dialog.glade: Gui tidying - - * gui/event-editor.c: Remove old alarm cruft - - * cal-util/cal-component.c (cal_component_set_url): Don't try and - write an empty string as a property - - -2001-02-08 JP Rosevear <jpr@ximian.com> - - * pcs/cal-backend-file.c: Move the get_change code here - - * pcs/cal-backend.c: Remove get_changes related stuff and - implement by calling the virtual method instead - - * pcs/cal-backend.h: New virtual method. - - * pcs/cal-backend-file.c (compute_alarm_range): Use - icaldurationtype_as_int (replace _as_timet) - (add_alarm_occurrences_cb): ditto - -2001-02-08 JP Rosevear <jpr@ximian.com> - - * pcs/cal-backend-file.c (compute_alarm_range): Use - icaldurationtype_as_int (replace _as_timet) - (add_alarm_occurrences_cb): ditto - - * gui/e-week-view.c (e_week_view_on_schedule_meet): new routine to - throw up the meeting schedule dialog - (e_week_view_show_popup_menu): add schedule meeting to the - contextual menu where appropriate - -2001-02-08 JP Rosevear <jpr@ximian.com> - - * gui/event-editor.c: Remove assorted menu/bonobo stuff - - * gui/dialogs/task-editor.c: Remove assorted menu/bonobo stuff - (task_editor_construct): no longer suck out the glade contents - into a bonobo win, listen for apply and close signals - (tedit_apply_event_cb): listen for apply signal and save object - (tedit_close_event_cb): listen for close signal and prompt to save - if need be - (task_editor_focus): new function to bring the dialog to the front - - * gui/dialogs/task-editor.h: new prototype - - * gui/e-meeting-edit.c (schedule_button_clicked_cb): no need to - update widgets in the event editor since the event editor won't be - open - (e_meeting_editor_new): don't need the event editor reference any - more - - * gui/e-meeting-edit.h: Change prototype - - * gui/e-day-view.c (e_day_view_on_event_right_click): Make - schedule meeting a new contextual menu item - (e_day_view_on_schedule_meet): new routine to schedule a meeting - from the contextual menu - - * gui/e-calendar-table.c (e_calendar_table_open_task): Call - task_editor_focus - - * gui/event-editor-dialog.glade: Update to be a property box - - * gui/dialogs/task-editor-dialog.glade: Update to be a property - box - -2001-02-07 Iain Holmes <iain@ximian.com> - - * gui/calendar-summary.c (create_summary_view): Add a setter to the - property bag. - (set_property): The setter. - (generate_html_summary): Sort the UIDs accodring to time. - -2001-02-06 JP Rosevear <jpr@ximian.com> - - * gui/event-editor.c (fill_reminder_widgets): Match new - append_alarm signature - (reminder_to_comp_object): only add alarms tagged as new, no - longer delete all alarms first - (append_reminder): the row data is now of type ReminderData, - rename from append_alarm - (reminder_add_cb): math new append_alarm signature - (reminder_delete_cb): if the alarm existed before the dialog was - loaded, delete it immediately from the cal component - -2001-02-06 JP Rosevear <jpr@ximian.com> - - * gui/event-editor-dialog.glade: Gui tweaks for bugs 1248 and 1246 - - * gui/dialogs/task-editor-dialog.glade: ditto - -2001-02-07 JP Rosevear <jpr@ximian.com> - - * gui/event-editor-dialog.glade: Fix spacing - -2001-02-06 JP Rosevear <jpr@ximian.com> - - * gui/event-editor-dialog.glade: Gui tweaks for bugs 1248 and 1246 - - * gui/dialogs/task-editor-dialog.glade: ditto - -2001-02-06 JP Rosevear <jpr@ximian.com> - - * gui/e-week-view.c (e_week_view_show_popup_menu): Make the menus more - consistent - - * gui/e-day-view.c (e_day_view_on_event_right_click): ditto - - * gui/e-calendar-table.c: ditto - -2001-02-06 JP Rosevear <jpr@ximian.com> - - * cal-util/cal-component.c (cal_component_set_categories): If the - categories string is empty, remove the property - (get_period_list): Fixes from clahey to handle the new rdate - format in libical - (set_period_list): ditto - -2001-02-05 JP Rosevear <jpr@ximian.com> - - * cal-util/cal-component.c (cal_component_alarm_set_trigger): Set - the time and duration values in the trigger to null by default - (cal_component_free_alarm_uids): properly free the list of alarm - uids - -2001-02-05 JP Rosevear <jpr@ximian.com> - - * gui/event-editor.c (get_widgets): get the new reminder widgets - (sync_entries): different callback data - (summary_changed_cb): take different data and handle various cases - (init_widgets): connect signals for the new widgets - (get_alarm_duration_string): give a text string of the alarm - duration - (get_alarm_string): give a string representing the alarm - (fill_widgets): make sure we don't loop infinitely and remove old - alarm cruft - (reminder_to_comp_object): dump alarm info in the gui into the cal - component - (append_alarm): add alarm to the clist - (reminder_add_cb): create new alarm - (reminder_delete_cb): remove the alarm from the list - - * gui/event-editor-dialog.glade: Update gui - - * gui/e-calendar-table.c: include gnome.h for all the menu stuff - - * gui/calendar-summary.c: for internationalization - - * gui/tasks-control.c: include gnome.h - - * gui/e-tasks.c: ditto - - * gui/e-itip-control.c: ditto - - * cal-util/cal-recur.c (cal_recur_set_rule_end_date): Update for - libical changes - -2001-02-05 Christopher James Lahey <clahey@helixcode.com> - - * gui/calendar-model.c: Fixed up these #includes. - -2001-02-03 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/save-comp.c (save_component_dialog): - gnome_dialog_grab_focus() on the Yes button. Fixes bug #1242. - -2001-01-30 Kjartan Maraas <kmaraas@gnome.org> - - * gui/e-calendar-table.c: Mark a string for translation. - * gui/e-itip-control.c: Mark a bunch of strings for translation. - -2001-01-30 Ettore Perazzoli <ettore@ximian.com> - - * gui/print.c: #include <sys/time.h>. - -2001-01-29 Federico Mena Quintero <federico@ximian.com> - - * gui/calendar-config.c: <gnome.h> trimming to reduce compilation - time. - * gui/calendar-summary.c: Likewise. - * gui/e-calendar-table.c: Likewise. - * gui/e-day-view-time-item.c: Likewise. - * gui/e-day-view.c: Likewise. - * gui/e-itip-control.c: Likewise. - * gui/e-meeting-edit.c: Likewise. - * gui/e-meeting-edit.h: Likewise. - * gui/e-tasks.c: Likewise. - * gui/e-week-view.c: Likewise. - * gui/event-editor.c: Likewise. - * gui/gnome-cal.c: Likewise. - * gui/goto.c: Likewise. - * gui/itip-utils.h: Likewise. - * gui/main.c: Likewise. - * gui/popup-menu.c: Likewise. - * gui/print.c: Likewise. - * gui/tasks-control-factory.c: Likewise. - * gui/tasks-control.c: Likewise. - * gui/tasks-migrate.c: Likewise. - -2001-01-25 Federico Mena Quintero <federico@ximian.com> - - * cal-util/timeutil.c: <gnome.h> trimming to reduce compilation time. - * gui/dialogs/task-editor.c: Ditto. - * gui/dialogs/cal-prefs-dialog.c: Ditto. - * gui/dialogs/save-comp.c: Ditto. - * gui/dialogs/delete-comp.c: Ditto. - * gui/calendar-commands.c: Ditto. - * gui/calendar-model.c: Ditto. - -2001-01-26 Ettore Perazzoli <ettore@ximian.com> - - * gui/e-itip-control.c (itip_control_destroy_cb): Don't attempt to - call `icalcomponent_remove_component()' on a NULL component or a - NULL subcomponent. - -2001-01-25 Damon Chaplin <damon@ximian.com> - - * gui/tag-calendar.c: don't tag the calendar if no dates are shown. - (e_calendar_item_get_date_range() now returns FALSE in this case.) - -2001-01-23 Damon Chaplin <damon@helixcode.com> - - * gui/calendar-model.c (ensure_task_complete): make sure the status - is set to "Completed". Fixes bug #1253. - - * gui/e-tasks.c (e_tasks_open): load the ETable state after opening - the tasks folder, since it relies on the folder uri, which isn't set - now until you open the folder. - - * gui/calendar-model.c (obj_updated_cb): add the categories from the - updated object to our tree, and emit the "categories-changed" signal - if they have changed. Fixes bug #1255. - - * gui/e-tasks.c: removed debug messages. - -2001-01-23 JP Rosevear <jpr@ximian.com> - - * libical import cleanup - -2001-01-23 JP Rosevear <jpr@ximian.com> - - * conduits/todo/todo-conduit.c (local_record_from_comp): properly ref - the cal component when we use it, prevents double free - - * conduits/calendar/calendar-conduit.c (local_record_from_comp): ditto - -2001-01-22 JP Rosevear <jpr@ximian.com> - - * gui/dialogs/Makefile.am: compile new stuff - - * gui/dialogs/task-editor.c (prompt_to_save_changes): use new - standard dialog - - * gui/event-editor.c (prompt_to_save_changes): ditto - - * gui/dialogs/save-comp.h: new header - - * gui/dialogs/save-comp.c (save_component_dialog): shows the save - dialog - -2001-01-22 JP Rosevear <jpr@ximian.com> - - * conduits/todo/todo-conduit.c (for_each_modified): remove duplicate - message - - * conduits/calendar/Makefile.am: Remove vfs lib dependency - - * conduits/todo/Makefile.am: ditto - - * conduits/calendar/calendar-conduit.c: Remove alarm foo for now - (for_each_modified): remove duplicate message - -2001-01-21 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (delete_record): Remove - deleted records from the pilot map so we don't have dupes in the future - - * conduits/todo/todo-conduit.c (delete_record): ditto - -2001-01-21 Federico Mena Quintero <federico@ximian.com> - - * gui/dialogs/task-editor.c (file_delete_cb): Fix bug #1250; now - we present a confirmation dialog before deleting the component. - -2001-01-20 Federico Mena Quintero <federico@ximian.com> - - * gui/event-editor-dialog.glade: Fix bug #1243. Turn on the Y - expand/fill options for the date widgets in the General page. - This makes them be vertically aligned with the "All day event" - toggle so that they will get the focus in the proper order; the - toggle would get the focus before them because it was a pixel or - two above them. - -2001-01-19 Federico Mena Quintero <federico@ximian.com> - - * gui/weekday-picker.c (weekday_picker_init): Unset the - GTK_CAN_FOCUS flag on the weekday picker. This will do until it - supports being used with the keyboard. - -2001-01-19 JP Rosevear <jpr@ximian.com> - - * cal-util/cal-component.c (cal_component_alarm_new): create a new - cal component alarm - (cal_component_add_alarm): add alarm to the cal component - (cal_component_remove_alarm): remove alarm from the cal component - (remove_alarm): remove alarm from hash - - * cal-util/cal-component.h: new protos - - * conduits/calendar/calendar-conduit.c (comp_from_remote_record): - add alarm information, still needs to be hacked to replace an already - existing alarm. questions abound about the heuristic for doing this. - -2001-01-17 JP Rosevear <jpr@ximian.com> - - * gui/event-editor.c (dialog_to_comp_object): Properly set categories - to NULL if there are none - -2001-01-18 Federico Mena Quintero <federico@ximian.com> - - * gui/tasks-migrate.[ch]: New files with a simple sequence to - migrate the task components from the old calendar folder into the - new tasks folder. - - * gui/component-factory.c (owner_set_cb): Call tasks_migrate() - once evolution_dir is set. It sucks to have to do this here. - - * cal-client/cal-client.c (cal_client_get_uids): In the inline - docs, indicate how to free the return value. - (cal_opened_cb): Ahem, moved assertion to the right place. Also, - ref() and unref() around our own signal emission because we are - not inside a signal handler, rather a simple callback from the - listener object; we want to have a chance to clean up even if the - client is unrefed during the emission. - - * gui/Makefile.am (evolution_calendar_SOURCES): Added - tasks-migrate.[ch] to the list of sources. - -2001-01-17 Federico Mena Quintero <federico@ximian.com> - - * gui/event-editor.c (init_widgets): Use - e_calendar_item_set_max_days_sel() instead of setting GTK+ object - arguments. - - * gui/e-day-view.c (e_day_view_set_cal_client): Oops, we had a - reversed test for the client being loaded. - - * gui/tag-calendar.c (tag_calendar_by_client): Fixed similarly - reversed test. - -2001-01-17 Damon Chaplin <damon@helixcode.com> - - * gui/e-week-view*.c - * gui/e-day-view*.c: don't use the theme colors at all within - the graphical parts of the widgets, since they may clash with - our colors. May make them configurable in future so people can tweak - them to go with their theme. At least the calendars are usable in any - theme now, even though the colors may not go well with the theme. - Also set the font of all the EText items in style_set. - - * gui/e-week-view-event-item.c (e_week_view_event_item_draw): don't - draw the icons if we are editing the event. - - * gui/e-day-view.c: - * gui/e-week-view.c: reinstated the optimizations so we don't do a - complete relayout if the event's dates haven't been changed. - (Though we still do a re-layout when recurring events change, since - comparing all the RDATES/RRULES/EXDATES/EXRULES is too much hassle.) - A side-effect of this change is that the EWeekView won't crash so - often - only recurring events will be a problem. - - * cal-util/cal-component.[hc]: added function to check if the start - and end dates of a component match. Used for optimizing the updating - of the EDayView & EWeekView. - -2001-01-17 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (start_calendar_server): Check - for open error and handled - - * conduits/todo/todo-conduit.c (start_calendar_server): ditto - -2001-01-17 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/calendar-conduit.c (start_calendar_server): Check - for open error and handled - - * pcs/cal-backend.c (cal_backend_compute_changes): Fix transposition - of sync db location - -2001-01-17 Federico Mena Quintero <federico@ximian.com> - - * */*: Ximianified email addresses and copyrights. - - * idl/evolution-calendar.idl (CalFactory::open): Renamed from - ::load(), and added an only_if_exists argument. - (CalFactory::create): Removed method. - (Listener::OpenStatus): Removed the IN_USE error and replaced it - with a NOT_FOUND one; renamed the enum from LoadStatus. - (Listener::notifyCalOpened): Renamed from notifyCalLoaded(). - - * pcs/cal-backend.h (CalBackend): Removed the uri field. - (CalBackendOpenStatus): Renamed from CalBackendLoadStatus and - added a NOT_FOUND value. - (CalBackendClass::open): Put in a slot for the open method. - - * pcs/cal-backend.c (cal_backend_create): Removed function. - - * pcs/cal-backend-file.c (cal_backend_file_open): Return the - appropriate value when only_if_exists is TRUE. - (create_cal): We are Ximian now, so set the PRODID property to - the appropriate foo. - - * pcs/cal-factory.c (CalFactory_open): implemented, replacing - CalFactory_load() and CalFactory_create(). - (CalFactory_open): Moved the queue_load_create_job() stuff to - here, since we now only need to contemplate the open case instead - of load/create ones. - (open_backend): Do everything here; replaces load_backend() and - create_backend(). - - * cal-client/cal-listener.h (CalListenerClass::cal_opened): - Renamed from cal_loaded. - (CalListenerClass): Replaced the silly signals, which are - gratuitous abstraction, by a set of function pointers in the - instance structure. - - * cal-client/cal-listener.c (cal_listener_get_calendar): Removed - unused function. - (cal_listener_construct): Added the listener notification functions. - (cal_listener_new): Ditto. - (Listener_notifyCalOpened): Renamed to our new naming convention - for servant implementations. - (Listener_notifyObjUpdated): Ditto. - (Listener_notifyObjRemoved): Ditto. - - * cal-client/cal-client.h (CalClientOpenStatus): Renamed from - CalClientLoadStatus. - (CalClientClass::cal_opened): Renamed from ::cal_loaded(). - (CalClientLoadState): New enum; basically make LoadState public so - that users of this code do not have to maintain their own states. - - * cal-client/cal-client.c (cal_client_create_calendar): Removed - function. - (cal_client_open_calendar): Moved the functionality over from - load_or_create(); now we do everything here. - (*): Use the CalClientLoadState enum values instead of the old - LoadState values. - (cal_client_get_load_state): Renamed from cal_client_is_loaded(), - and return the appropriate value. - (CalClientPrivate): Added an uri field. - (cal_client_init): Initialize priv->uri. - (cal_client_destroy): Free the priv->uri. - (cal_opened_cb): Maintain the priv->uri. - (cal_client_open_calendar): Fill in the priv->uri. - (cal_client_get_uri): New function. - - * gui/calendar-model.c (calendar_model_set_new_comp_vtype): New - function to configure the type of calendar components to create - when doing click-to-add. This makes the model usable for - something other than task lists. - (calendar_model_get_new_comp_vtype): New function. - - * gui/e-calendar-table.c (e_calendar_table_get_model): New function. - (e_calendar_table_destroy): Unref the subset_model. - - * gui/gnome-cal.h (GnomeCalendarOpenMode): Removed enum. - - * gui/gnome-cal.c (LoadState): Removed enum; we now use the - CalClientLoadState from the client objects. - (GnomeCalendarPrivate): Removed the loading_uri and - task_pad_loading_uri fields as well as the load_state and - task_pad_load_state fields, as we can now query them directly from - the CalClient. - (open_error): Renamed from load_error(). - (create_error): Removed function. - (gnome_calendar_open): Do not take in the mode parameter. - (cal_opened_cb): Get rid of our beautifully-crafted state machine - and replace it with simple code; all the loading smarts are in the - Wombat now. - (setup_widgets): Set the new component vtype of the table model to - CAL_COMPONENT_TODO. - - * gui/Makefile.am (evolution_calendar_SOURCES): Removed - gnome-month-item.[ch] from the list of sources. - - * gui/calendar-summary.c (CalSummary): Removed unused cal_loaded - field. - (create_summary_view): Do not check if the file exists; this is - the job of the Wombat. - (generate_html_summary): Fixed prototype. - (alarm_fn): Fixed prototype. - (property_dialog): Fixed prototype. Wonder if/how this ever - worked. - (create_summary_view): Cast the component and view as - appropriate. Removed unused html variable. - - [Iain dude, are you compiling with -Wall?] - - * gui/e-itip-control.c (cal_opened_cb): Sigh, this function - signature was *very* wrong. It was using CalClientGetStatus - instead of CalClientOpenStatus. - - * gui/e-tasks.h (ETasksOpenMode): Removed enum. - - * gui/e-tasks.c (setup_widgets): Set the new component vtype of - the table model to CAL_COMPONENT_TODO. - (LoadState): Removed the state machine foo. - (e_tasks_open): Removed the mode parameter. - (initial_load): Removed function. - (create_error): Removed function. - (ETasksPrivate): Removed folder_uri field. - (cal_opened_cb): Remove the state machine. - - * gui/component-factory.c: #include "tasks-control.h" - - * conduits/calendar/calendar-conduit.h (ECalConduitContext): - Removed calendar_load_tried field. - - * conduits/calendar/calendar-conduit.c (start_calendar_server_cb): - Sigh, fixed function prototype. - - * conduits/todo/todo-conduit.h (EToDoConduitContext): Removed - calendar_load_tried field. - - * conduits/todo/todo-conduit.c (start_calendar_server_cb): Fixed - function prototype. - -2001-01-16 JP Rosevear <jpr@ximian.com> - - * conduits/todo/todo-conduit.c (print_local): fix debug output - (print_remote): ditto - -2001-01-15 JP Rosevear <jpr@ximian.com> - - * pcs/cal-backend.c (cal_backend_compute_changes): accomadate tasks - in their new dir - - * conduits/todo/todo-conduit.c (start_calendar_server): ditto - -2001-01-15 JP Rosevear <jpr@ximian.com> - - * conduits/todo/todo-conduit.c (print_local): prevent segfaults and - buffer overflows. - (print_remote): ditto - - * conduits/calendar/calendar-conduit.c: as above - -2001-01-14 Damon Chaplin <damon@helixcode.com> - - * gui/e-calendar-table.c (E_CALENDAR_TABLE_SPEC): changed the expansion - values so that small text fields are 1.0, all the date fields and the - URL field are 2.0, and the Summary is 3.0. Hopefully the user will - resize the fields as desired, but at least this is a better start. - -2001-01-14 JP Rosevear <jpr@ximian.com> - - * conduits/calendar/Makefile.am: pass -module and -avoid-version to - conduit linker - - * conduits/todo/Makefile.am: ditto - -2001-01-14 Damon Chaplin <damon@helixcode.com> - - * gui/dialogs/task-editor.[hc]: moved #include - <cal-client/cal-client.h> to the .h file. - - * gui/e-tasks.c: load & save the Tasks folders' ETable layout. - Added an option menu to filter tasks by category. - - * gui/gnome-cal.c: use the "Tasks" folder for the TaskPad. - (We may make the actual tasks folder shown a per-calendar option.) - - * gui/tasks-control.c (tasks_control_new_task_cmd): added support for - the New Task icon on the toolbar. - - * gui/e-calendar-table.[hc]: we now use an ETableSubsetVariable model - to filter the tasks by a category. And tidied up a little. - - * gui/calendar-model.[hc]: added way to get all the categories used by - the tasks, so we can show an option menu of them. Also a signal which - is emitted when they are changed. - Also allows a default category to be set, which is used to initialize - the 'click-to-add' row. - Also made sure the initialize_value()/get_value() functions don't - return NULL since that can cause a SEGV. - - * gui/e-week-view.c: - * gui/e-day-view.c: set the "fill_color_rgba" arg of the EText items - to black since it doesn't seem to set up a default color properly. - Hopefully this fixes the bug on Solaris where the items appear with - strange colors. - - * gui/widget-util.c (date_edit_new): use the calendar_config function - to set most of the options. It wasn't setting the 12/24 hour option - before. - - * gui/dialogs/task-editor-dialog.glade: added "Undefined" priority. - -2001-01-12 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component-factory.c (factory_fn): Pass NULL as the - @copy_folder_fn arg to `evolution_shell_component_new()'. - -2001-01-12 Miguel de Icaza <miguel@ximian.com> - - * gui/e-calendar-table.c: Add translation strings. - -2001-01-08 Iain Holmes <iain@helixcode.com> - - * gui/calendar-summary.c (create_summary_view): Add a PropertyControl - interface to set whether or not to show tasks and appointments. Add - a PersistStream to remember this. - -2001-01-09 Dave Camp <dave@helixcode.com> - - * gui/Makefile.am: Replaced e-meet-dialog.glade.h with - e-meeting-dialog.glade in glade_messages. - - * gui/e-meeting-dialog.glade: Enabled the translatable string option. - - * gui/e-itip-control.glade: Likewise. - -2001-01-09 Federico Mena Quintero <federico@helixcode.com> - - * idl/evolution-calendar.idl (AlarmNotify): New interface for the - alarm notification system. - - * gui/alarm-notify: New directory for the alarm notification - daemon and its auxiliary stuff. - - * gui/alarm-notify/alarm.[ch]: Moved over from gui/alarm.[ch]. - - * gui/alarm-notify/alarm-queue.[ch]: Moved over from - gui/alarm-notify.[ch]. Renamed functions from alarm_notify_*() to - alarm_queue_*(). - - * gui/alarm-notify/alarm-notify.[ch]: Implementation of the - GNOME::Evolution::Calendar::AlarmNotify interface. - - * gui/Makefile.am (evolution_calendar_LDADD): Removed the - LINK_FLAGS variable and reordered the libraries to remove some - duplicated ones. - (SUBDIRS): Added the alarm-notify directory. - -2001-01-08 Iain Holmes <iain@helixcode.com> - - * gui/calendar-summary.c (generate_html_summary): Get the tasks - correctly. - (generate_html_summary): Mark the tasks as completed if so. - -2001-01-08 Damon Chaplin <damon@helixcode.com> - - * gui/Makefile.am: added new source files for the Tasks folders. - - * gui/e-tasks.[hc]: new widget to encapsulate the Tasks view. - - * gui/tasks-control.[hc]: new files to implement the Tasks control. - - * gui/tasks-control-factory.[hc]: new files to implement the factory - for the Tasks controls. (I think the way I've split the code up is a - lot cleaner than the GnomeCal implementation - the factory file just - contains the factory functions and the control file contains all the - control functions. Maybe we should make GnomeCal like this.) - - * gui/main.c: initialize the Tasks control factory. - - * gui/component-factory.c: added support for the Tasks control. - Also added a "create_folder" function so we can now create new Tasks - and Calendar folders within Evolution. - I'm not a Bonobo expert so someone might want to check these over. - - * gui/calendar-config.[hc]: added convenience functions to configure - the common settings of ECalendar and EDateEdit widgets. - - * gui/dialogs/task-editor.c (task_editor_create_date_edit): - * gui/gnome-cal.c (gnome_calendar_update_config_settings): - * gui/event-editor.c: used function to configure the ECalendars - and EDateEdits. - - * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): - fixed minor bug in format strings. - -2001-01-06 Iain Holmes <iain@helixcode.com> - - * gui/calendar-summary.c (generate_html_summary): Neaten the HTML, - and fix the time printing stuff. Add stuff the get Tasks. - (alarm_fn): Set up an alarm for midnight everynight and regenerate - the HTML for the new day. - -2001-01-05 JP Rosevear <jpr@helixcode.com> - - * gui/event-editor.c (get_widgets): get categories button - (init_widgets): listen for button click - (fill_widgets): fill in the categories area - (dialog_to_comp_object): set the cal component categories - (categories_clicked): throw up the categories dialog and update - when ok is clicked - - * gui/event-editor-dialog.glade: Add categories and contacts buttons - and fields - - * gui/dialogs/task-editor-dialog.glade: Rename button - -2001-01-05 JP Rosevear <jpr@helixcode.com> - - * gui/dialogs/task-editor.c (get_widgets): get categories button - (init_widgets): listen for button click - (fill_widgets): fill in the categories area - (dialog_to_comp_object): set the cal component categories - (categories_clicked): throw up the categories dialog and update - when ok is clicked - - * gui/dialogs/task-editor-dialog.glade: Tweak to name the categories - button and make it active - - * gui/calendar-model.c (get_categories): We can get the string list of - categories directly now - - * cal-util/cal-component.c (cal_component_get_categories): new function - to get the categories list as a string - (cal_component_set_categories): same but for setting - (free_icalcomponent): init the categories var - (scan_categories): kill - (scan_property): assign the prop to the categories var - (cal_component_get_categories_list): deal with renaming var to categories - (cal_component_set_categories_list): fix brokeness - -2001-01-03 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-commands.c (new_calendar): Handle the case where - the calendar view cannot be created; present a warning dialog box. - (new_calendar): Do not show the widget here, since we already show - it in control-factory.c. - - * gui/control-factory.c (control_factory_new_control): Handle the - case where the calendar view cannot be created. - - * gui/component-factory.c (create_view): Ditto. - - * gui/calendar-summary.h: Added prototype for - calendar_summary_factory_init(). - -2001-01-02 Federico Mena Quintero <federico@helixcode.com> - - * gui/alarm-notify.c (add_component_alarms): If the component has - no alarms, do not try to queue them. - (remove_client_alarms): New function to remove all the queued - alarms for a calendar client. - (alarm_notify_remove_client): Remove the client's alarms. - -2001-01-02 Federico Mena Quintero <federico@helixcode.com> - - * gui/dialogs/delete-comp.c (delete_component_dialog): Do not - compose strings so that they can be localized correctly. Also, - convert from UTF8 into the font's encoding. Fixes bug #1030. - - * gui/e-calendar-table.c (delete_component): Pass the widget - argument to delete_component_dialog(). - - * gui/e-day-view.c (e_day_view_on_delete_appointment): Likewise. - - * gui/e-week-view.c (e_week_view_on_delete_appointment): Likewise. - - * gui/event-editor.c (file_delete_cb): Likewise. - - * gui/calendar-commands.c: Use BONOBO_UI_VERB() instead of - BONOBO_UI_UNSAFE_VERB(). Guess what, all of our handler - signatures were wrong. - - * gui/event-editor.c: Likewise. - - * gui/dialogs/task-editor.c: Likewise. - - * gui/goto-dialog.glade: Added some spacing between the month/year - widgets and the calendar widget. - -2001-01-01 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (gnome_calendar_destroy): Unconditionally remove - the client from the alarm notification system. - Removed all the obsolete alarm code. - - * gui/event-editor.c: Removed some crufty externs left over from - Gnomecal. - - * gui/calendar-commands.c: #include "goto.h" - Removed crufty variables left over from Gnomecal. - (new_calendar): Do not take a full_name parameter. - (init_username): Removed function. - (init_calendar): Wheeeeeeee! Removed crufty function. - (quit_cmd): Removed function. - - * gui/print.c (WEEK_STARTS_ON_MONDAY): Made it unconditionally - FALSE because we do not use the configuration setting anyways. - Sigh, all the printing code needs to be revamped. - -2000-12-26 Iain Holmes <iain@helixcode.com> - - * gui/calendar-summary.c (create_summary_view): Create a shared - BonoboEventSource object. - -2000-12-25 Miguel de Icaza <miguel@helixcode.com> - - * gui/e-day-view.c (e_day_view_init): Set draw background to FALSE. - (e_day_view_reshape_long_event): ditto. - (e_day_view_reshape_day_event): ditto. - -2000-12-22 JP Rosevear <jpr@helixcode.com> - - * gui/dialogs/delete-comp.c (delete_component_dialog): Clean up - translatable strings for translators, fixes bug 993 - -2000-12-22 JP Rosevear <jpr@helixcode.com> - - * gui/goto.c (create_ecal): Make sure the current month is shown - when the dialog pops up. - - * gui/goto-dialog.glade: Remove flicker - -2000-12-22 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend-file.c (cal_backend_file_get_alarms_for_object): - account for the case where there are no alarms, fixes crash - -2000-12-22 JP Rosevear <jpr@helixcode.com> - - * gui/goto.c (ecal_date_range_changed): New function to keep the - ecal marked properly - (create_ecal): move more creation code here, update marks - (goto_dialog_init_widgets): listen for date_range_changed signal - in the ecal - - * gui/calendar-commands.c (init_calendar): Remove ancient gnomecal - cruft - - * gui/mark.[hc], gui/prop.c: Remove ancient gnomecal code that is - no longer needed, last bit of bug 904 - -2000-12-22 JP Rosevear <jpr@helixcode.com> - - * gui/goto-dialog.glade.h: translations - - * gui/goto-dialog.glade: new glade file for goto dialog - - * gui/gnome-cal.c (setup_widgets): Set date navigator attributes - - * gui/calendar-commands.h: remove prototype - - * gui/goto.h: Add prototype - - * gui/Makefile.am: Add glade file stuff - - * gui/gnome-cal.c (setup_widgets): Use accessors to configure the - calendar item properly - -2000-12-21 Federico Mena Quintero <federico@helixcode.com> - - Alarm trigger queueing for the GUI part. - - * gui/alarm-notify.[ch]: New files with the high-level alarm - notification system; mostly moved over from gnome-cal.c. The - low-level timer stuff is still in alarm.[ch]. - - * gui/alarm-notify.c (alarm_notify_init): New function to - initialize the alarm notification system. - (alarm_notify_done): New function to shut down the alarm - notification system. - (alarm_notify_add_client): New function to start monitoring a - calendar client for alarm notification. - (alarm_notify_remove_client): New function to stop monitoring a - client. - - * gui/alarm.h (AlarmDestroyNotify): Also pass in the alarm ID so - the callback may know which ID is being destroyed. - - * gui/alarm.c (clear_itimer): New function. - (pop_alarm): Use clear_itimer(). - (alarm_done): New function to shut down the timer system. - (alarm_add): Add some preconditions. Do not call the destroy - notification function if we could not create the alarm. - (alarm_ready): Pass the alarm ID to the destroy notify function. - (alarm_remove): Likewise. Also, add some preconditions. - - * gui/gnome-cal.c: Removed the alarm notification functions from - here since they are now in alarm-notify.c. - (gnome_calendar_construct): Register the client with - alarm_notify_add_client(). - (gnome_calendar_destroy): Use alarm_notify_remove_client() to - unregister the client. - (obj_updated_cb): Do not do any alarm-related stuff. - (obj_removed_cb): Likewise. - - * gui/main.c (main): Shut down the alarm timer system. - (main): Initialize and shut down the alarm notification system. - - * gui/Makefile.am (evolution_calendar_SOURCES): Added - alarm-notify.[ch] to the list of sources. - - * gui/calendar-model.c (calendar_model_set_cal_client): Only - connect to the "cal_loaded" signal if the client is not already - loaded. - - * gui/e-day-view.c (e_day_view_set_cal_client): Likewise. - - * gui/e-week-view.c (e_week_view_set_cal_client): Likewise. - - * gui/e-itip-control.c (update_calendar): Connect to "cal_loaded" - before issuing the load request. - -2000-12-21 Iain Holmes <iain@helixcode.com> - - * gui/calendar-summary.c: Updated for new executive summary. - - * gui/component-factory.c: Reenabled the summary. - - * gui/GNOME_Evolution_Calendar.oafinfo: Added the summary. - -2000-12-20 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.h: Fix erroneous documentation - - * conduits/todo/todo-conduit.c (comp_from_remote_record): if - !is_empty_time rather than is_empty_time - (e_todo_context_new): Return a pointer rather than fill in - a parameter - (e_todo_context_foreach_change): Free just the key - (e_todo_context_destroy): Plug this enormous leakage. I had assumed - i had done this earlier, which isn't too bright when anything beyond - 2 minutes ago is fuzzy. - (comp_from_remote_record): Kill warnings - (post_sync): Destroy the map later - (conduit_get_gpilot_conduit): Fix e_todo_context_new params - - * conduits/calendar/calendar-conduit.[hc]: Similar to above - -2000-12-19 JP Rosevear <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c: Remove pointless comment - - * conduits/todo/todo-conduit.c (is_empty_time): add utility function - (comp_from_remote_record): use it - -2000-12-19 JP Rosevear <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c (local_record_from_comp): - Convert cal component strings to pilot character set - (comp_from_remote_record): vice versa - - * conduits/todo/todo-conduit.c: Same as above - -2000-12-19 Federico Mena Quintero <federico@helixcode.com> - - * pcs/cal-backend-file.c (compute_alarm_range): Fix confusion in - the way the range is expanded. - - * cal-util/cal-component.c (cal_component_alarms_free): Doh, - alarms->alarms is a list, not a generic pointer. Free it properly. - (cal_component_free_pilot_id): Removed unused function. - (cal_component_free_pilot_status): Likewise. - - * gui/main.c (init_bonobo): Use VERSION instead of a hardcoded - string. Pass argc by value, not by reference. Test the return - value of gnome_init_with_popt_table(). - - * cal-client/cal-client.c (cal_client_free_alarms): Oops, missed - implementing this function. - - * cal-util/timeutil.c (print_time_t): Better printing format. - (isodiff_to_secs): Removed unused function. - (isodiff_from_secs): Removed unused function. - (time_day_end): Removed crufty part. - (time_day_begin): Removed crufty part. - (time_day_hour): Removed unused function. - (format_simple_hour): Removed unused function. - (get_time_t_hour): Removed unused function. - (time_from_start_duration): Removed unused function. - - * cal-util/timeutil.h (parse_date): Removed unimplemented, unused - function prototype. - -2000-12-19 Christopher James Lahey <clahey@helixcode.com> - - * gui/gnome-cal.c: Removed prototype for setup_alarm to fix a - warning. - -2000-12-18 Federico Mena Quintero <federico@helixcode.com> - - Alarm instance generation support for the Wombat. - - * idl/evolution-calendar.idl (Cal::CalAlarmInstance): Changed to - have an alarm UID, the trigger time, and the actual occurrence - time. - (Cal::CalComponentAlarms): New structure to hold a pair of a - component and its alarms that trigger in a particular range of - time. - (Cal::getAlarmsInRange): Changed to return a CalComponentAlarmsSeq. - - * cal-util/cal-component.h (CalAlarmInstance): New C-side - structure to match the one on the IDL. - (CalComponentAlarms): Ditto. - (CalAlarmAction): Renamed from CalComponentAlarmAction. - (CalAlarmTriggerType): Renamed from CalComponentAlarmTriggerType. - Encoded the START and END parameters for the RELATED parameter in - this enum, too. Added a NONE value for invalid or missing trigger - specifications. - (CalComponentAlarmTriggerRelated): Removed. - (CalAlarmTrigger): Renamed from CalComponentAlarmTrigger. Renamed - the duration/time fields to rel_duration/abs_time, respectively. - - * cal-util/cal-component.c (cal_component_alarm_get_trigger): - Changed to use the new trigger structure. - (cal_component_alarm_set_trigger): Likewise. - (cal_component_alarm_free_trigger): Removed function. - (cal_component_has_alarms): Count the elements in the - alarm_uid_hash instead of trying to fetch the first alarm subcomponent. - (cal_component_alarms_free): New function to free a - CalComponentAlarms structure. - (CalComponentAlarmPrivate): Added an uid property pointer. - (scan_alarm_property): Scan for the our extension UID property. - (cal_component_alarm_get_uid): New function. - - * pcs/cal-backend.h (CalBackendClass): Changed the signatures of - the ::get_alarms_in_range() and ::get_alarms_for_object() methods. - - * pcs/cal-backend.c (cal_backend_get_alarms_in_range): Changed - signature; use the new method. - (cal_backend_get_alarms_for_object): Likewise. - - * pcs/cal-backend-file.c (compute_alarm_range): New spiffy - function to compute a range of time for alarm occurrences. - (add_alarm_occurrences_cb): New function to add alarms for a - particular occurrence of the component. - (generate_absolute_triggers): New function to add the absolute - alarm triggers. - (generate_alarms_for_comp): New function to generate all the alarm - instances for a component. - (cal_backend_file_get_alarms_in_range): Implemented. - - * pcs/cal.c (Cal_get_alarms_in_range): Use the new CalBackend API. - (Cal_get_alarms_for_object): Likewise. - (build_alarm_instance_seq): Removed old function. - - * cal-util/cal-util.c (cal_alarm_instance_list_free): Removed - function. - - * cal-client/cal-client.c (build_component_alarms_list): New - function to demarshal the component alarms sequence. - (build_alarm_instance_list): New function to demarshal the alarm - instances sequence. - (cal_client_get_alarms_in_range): Updated for the new API. - (cal_client_get_alarms_for_object): Updated for the new API. - - * gui/gnome-cal.c: Temporary #ifdef-ing out of alarm-related stuff - to make it build. - -2000-12-15 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/timeutil.[ch] (time_from_isodate): Removed unused - function, a relic from Gnomecal. - -2000-12-15 Dan Winship <danw@helixcode.com> - - * cal-util/timeutil.c (time_from_isodate): Fix the sign in the - HAVE_TM_GMTOFF case - -2000-12-15 Federico Mena Quintero <federico@helixcode.com> - - * gui/Makefile.am (evolution_calendar_SOURCES): Removed getdate.y. - We no longer use it; it is a relic from Gnomecal. - - * gui/getdate.y: Removed file. - -2000-12-14 Federico Mena Quintero <federico@helixcode.com> - - Fixes bug #955. - - * gui/weekday-picker.c (WeekdayPickerPrivate): Added a field for - the week_start_day, to be used in the same way as - calendar-config.h defines it. Removed the week_starts_on_monday - flag. - (day_event_cb): Use the week_start_day. - (colorize_items): Likewise. - (configure_items): Likewise. - (weekday_picker_set_week_start_day): New function. - (weekday_picker_get_week_start_day): New function. - (weekday_picker_set_week_starts_on_monday): Removed function. - (weekday_picker_get_week_starts_on_monday): Removed function. - - * gui/widget-util.[ch]: New files with utilities for creating or - configuring widgets. - - * gui/widget-util.c (date_edit_new): New function to create an - EDateEdit configured with the calendar's preferences; moved over - from event-editor.c. - - * gui/event-editor.c (make_recur_weekly_special): Use - weekday_picker_set_week_start_day() and the corresponding function - from calendar-config.h. - (init_widgets): Likewise. - (make_date_edit_with_time): Removed function. - (make_recur_ending_until_special): Use date_edit_new(). - (make_date_edit): Likewise. - - * gui/dialogs/task-editor.c (task_editor_create_date_edit): Likewise. - - * gui/event-editor-dialog.glade: Removed references to - make_date_edit_with_time(); replace them with make_date_edit(). - - * gui/Makefile.am (evolution_calendar_SOURCES): Added - widget-util.[ch] to the list of sources. - -2000-12-14 Federico Mena Quintero <federico@helixcode.com> - - * gui/e-calendar-table.c (E_CALENDAR_TABLE_SPEC): Reset the widths - of the columns with pixbufs to the actual pixbufs' sizes; now - ETable properly computes its column widths so we do not need to - add extra padding here. - -2000-12-14 Dan Winship <danw@helixcode.com> - - * gui/calendar-model.c (_XOPEN_SOURCE): #define this to 500, not - nothing. Also, move this bit after the other #includes to - prevent potential messiness. - -2000-12-13 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (ensure_mandatory_properties): Even - though icaltime_from_timet() now properly ignores the is_utc - argument since time_t values *are* in UTC by definition, we were - passing FALSE for that argument's value in a bunch of places. So - although it is ignored, changed them to TRUE for consistency. - Hopefully newer versions of libical will remove that argument - entirely since it does not make sense to speak of non-absolute - time_t values. - - * cal-util/cal-recur.c (cal_recur_set_rule_end_date): Likewise. - - * conduits/calendar/calendar-conduit.c (comp_from_remote_record): Likewise. - - * conduits/todo/todo-conduit.c (comp_from_remote_record): Likewise. - - * gui/dialogs/task-editor.c (dialog_to_comp_object): Likewise. - - * gui/e-day-view.c (e_day_view_on_new_appointment): Likewise. - (e_day_view_on_delete_occurrence): Likewise. - (e_day_view_on_unrecur_appointment): Likewise. - (e_day_view_on_unrecur_appointment): Likewise. - (e_day_view_finish_long_event_resize): Likewise. - (e_day_view_finish_resize): Likewise. - (e_day_view_key_press): Likewise. - (e_day_view_on_top_canvas_drag_data_received): Likewise. - (e_day_view_on_main_canvas_drag_data_received): Likewise. - - * gui/e-week-view.c (e_week_view_key_press): Likewise. - (e_week_view_on_new_appointment): Likewise. - (e_week_view_on_delete_occurrence): Likewise. - (e_week_view_on_unrecur_appointment): Likewise. - - * gui/event-editor.c (simple_recur_to_comp_object): Likewise. - (recur_to_comp_object): Likewise. - (dialog_to_comp_object): Likewise. - - * gui/gnome-cal.c (gnome_calendar_new_appointment): Likewise. - -2000-12-13 Christopher James Lahey <clahey@helixcode.com> - - * cal-util/cal-recur.c: #if 0ed cal_obj_date_only_compare_func. - (cal_object_get_rdate_end): Changed this function to get rid of a - possible uninitialized error on the rdate function. - - * gui/calendar-model.c: Fixed some warnings involving the #define - _XOPEN_SOURCE lines here. - - * gui/component-factory.c: #ifdef WANT_THE_EXECUTIVE_SUMMARYed out - the summary_factory object since it's unused if - WANT_THE_EXCUTIVE_SUMMARY is not defined. - - * gui/e-day-view.c: #if 0ed out e_day_view_remove_event_cb. - (obj_updated_cb): #ifndef NO_WARNINGSed out a #warning. - - * gui/e-week-view-event-item.c (e_week_view_event_item_draw): Made - it so that - - * gui/e-week-view.c (obj_updated_cb): #ifndef NO_WARNINGSed out a - #warning. - -2000-12-13 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/Makefile.am: Revert federico's change for now - because of libtool limitations with ldadding shared libtool - libs - - * conduits/calendar/Makefile.am: ditto - -2000-12-12 JP Rosevear <jpr@helixcode.com> - - * gui/dialogs/task-editor.c (task_editor_set_todo_object): Use - set_title_from_comp - (save_todo_object): ditto - (set_title_from_comp): Make sure the title is encoded properly (as in - event-editor) - -2000-12-12 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (get_text_list): Constify for new - libical API. - (set_text_list): Likewise. - - * cal-util/cal-recur.c (cal_recur_get_rule_end_date): Likewise. - (cal_recur_set_rule_end_date): Likewise. - - * gui/e-itip-control.c (find_attendee): Likewise. - (pstream_load): Likewise. - - * gui/gnome-cal.c (released_event_object_cb): Removed unused function. - - * gui/dialogs/task-editor.c (status_string_map): Removed unused - variable. - -2000-12-11 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/Makefile.am (test_recur_LDADD): Link to the libical - shared library. - - * cal-client/Makefile.am (client_test_LDADD): Likewise. - - * conduits/calendar/Makefile.am (libecalendar_conduit_la_LIBADD): - Likewise. - - * gui/Makefile.am (LINK_FLAGS): Likewise. - -2000-12-11 Federico Mena Quintero <federico@helixcode.com> - - This is to make things work with libical 0.21helix1 and later. - Warnings remain because at last libical was constified; will take - care of those tomorrow. - - * cal-util/timeutil.h: #include <ical.h> instead of <icaltypes.h> - - * gui/e-itip-control.c: Likewise. - - * gui/e-meeting-edit.c: Likewise. - - * gui/itip-utils.h: Likewise. - - * cal-util/cal-component.c (alarm_uid_from_prop): constify. - (cal_component_get_status): Updated for new libical API. - (cal_component_set_status): Likewise. - - * gui/calendar-model.c (ensure_task_complete): Removed unused - status code. - (ensure_task_not_complete): Update for new status API. - - * gui/dialogs/task-editor.c (status_string_to_value): Removed - function. - (status_value_to_string): Removed function. - (status_string_map): Removed variable. - (fill_widgets): Update for new status API. - (dialog_to_comp_object): Likewise. - -2000-12-11 Damon Chaplin <damon@helixcode.com> - - * cal-util/cal-recur.c (generate_instances_for_chunk): updated the - tests on the start & end time just before calling the callback. It - was skipping occurrences that started before the required interval's - start time, which was wrong. We want all occurrences that intersect - the interval. - (cal_obj_time_weekday): removed the CalRecurrence* argument, since it - isn't needed. - -2000-12-11 Damon Chaplin <damon@helixcode.com> - - * gui/event-editor.c: added changed flags and added calls to a new - function event_editor_set_changed() to set & reset this flag. - Added prompt_to_save_changed() which is called when the user - selects File/Close or the window's close button. - Fixed the 'All day event' toggle button. - Made the 'Alarm' page sensitive as appropriate when filling widgets. - (Though note that the alarm widgets are not being set yet.) - - * gui/dialogs/task-editor.c: added changed flag as above. - - * gui/event-editor-dialog.glade: used good names for all the - classification radio buttons so we can access them in the code. - - * gui/event-editor.c (init_widgets): use the "show week numbers" config - option in the recurrence preview calendar. - - * gui/e-day-view.c (e_day_view_update_event_label): use 9:00 instead - of 09:00 in the main view, as we do everywhere else now. It means the - times won't line up, but they are easier to read which I think is - better. - Added support for Page Up/Down, though I think it should move the - selection rather than just scroll the canvas. - - * cal-util/cal-recur.c (generate_instances_for_chunk): removed the - end parameter since we should be using the chunk end time now. - Added single_rule parameter for when we are generating the - occurrences of a single RRULE, in which case the event's start date is - not included in the occurrences output (unless it results from the - RRULE expansion). Both of these fix problems when using COUNT. - - * gui/gnome-cal.c (gnome_calendar_on_date_navigator_selection_changed): - fixed bug when checking if the new start day starts on the week start - day. If you select a complete week it should now show the Week view. - -2000-12-08 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (dialog_to_comp_object): Free the strings we - get from the editables. - - * gui/dialogs/task-editor.c (dialog_to_comp_object): Likewise. - This sucks; this code should be shared between the two dialogs. - -2000-12-08 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (fill_widgets): Free the dates we get from - the component. - -2000-12-08 JP Rosevear <jpr@helixcode.com> - - * gui/e-calendar-table.c (e_calendar_table_init): Attach signal - handlers to the e_scrolled_table's etable rather than to the - e_scrolled_table directly - (e_calendar_table_on_double_click): This signal provides more - params now - -2000-12-07 Christopher James Lahey <clahey@helixcode.com> - - * gui/e-calendar-table.c: Got rid of code referencing the - ETableScrolled proxy functions. - -2000-12-07 JP Rosevear <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c (post_sync): Ugly hack for syncing - until pcs can be altered (longer term) - - * conduits/todo/todo-conduit.c (post_sync): ditto - -2000-12-07 Chris Toshok <toshok@helixcode.com> - - * cal-client/Makefile.am (client_test_LDADD): add - EXTRA_GNOME_LIBS. - -2000-12-07 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend.c (cal_backend_compute_changes_foreach_key): Create - an empty cal component if the object has been deleted. - - * idl/evolution-calendar.idl: Bit shift the change type constants - properly - -2000-12-07 Federico Mena Quintero <federico@helixcode.com> - - * cal-client/cal-client.c (cal_client_generate_instances): Unref - the component from the objects list; it got referenced as many - times as appropriate for the instances list. - -2000-12-06 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (file_delete_cb): Confirm before deleting the - event. - -2000-12-06 JP Rosevear <jpr@helixcode.com> - - * gui/e-week-view.c (e_week_view_init): unref the pixbuf when - finished with it - -2000-12-06 Federico Mena Quintero <federico@helixcode.com> - - Fixes bug #920. - - * gui/e-calendar-table.c (delete_component): New function. - (e_calendar_table_on_delete_task): Use delete_component(). - (e_calendar_table_on_key_press): Likewise. Also, mark the event - as handled. - - * gui/calendar-model.c (calendar_model_get_component): Renamed - function from calendar_model_get_cal_object(). - (calendar_model_delete_task): Removed function. - - * gui/dialogs/delete-comp.[ch]: New files with the dialog for - deleting a calendar component. - - * gui/e-day-view.c (e_day_view_on_delete_appointment): Confirm - before actually deleting the appointment. - - * gui/e-week-view.c (e_week_view_on_delete_appointment): Likewise. - - * gui/dialogs/Makefile.am (libcal_dialogs_a_SOURCES): Added - delete-comp.[ch] to the list of sources. - - * cal-util/cal-component.c (cal_component_destroy): Free the alarm - UID hash. - -2000-12-06 JP Rosevear <jpr@helixcode.com> - - * pcs/cal.c (build_change_seq): kill - (Cal_get_changes): return the corba sequence directly - - * pcs/cal-backend.h: update prototype - - * pcs/cal-backend.c (cal_backend_compute_changes_foreach_key): Build - the corba struct rather than the old calobjchange thing - (cal_backend_compute_changes): ditto. build and return the actual - corba sequence rather than the list of calobjchanges - (cal_backend_get_changes): return the corba sequence - - * cal-util/cal-util.h: Remove CalObjChange cruft - - * cal-util/cal-util.c (cal_obj_change_list_free): Kill - -2000-12-06 JP Rosevear <jpr@helixcode.com> - - * cal-util/cal-util.c: - - * conduits/calendar/calendar-conduit.c (map_name): Update so as not to conflict - with calendar - (next_changed_item): update to use CalClientChange instead of CalObjChange - (compute_status): ditto - (pre_sync): ditto - (for_each_modified): since we now have the cal component we can call - local_record_from_comp directly - - * conduits/todo/todo-conduit.c: same as above - - * pcs/cal-backend.c: Remove much logging cruft - (cal_backend_compute_changes): Calculate the changes based on the - hashed database - (cal_backend_get_changes): call cal_backend_compute_changes - (cal_backend_compute_changes_foreach_key): hash callback for - calculating deletions - - * pcs/cal-backend.h: update protype, remove logging cruft from - object - - * pcs/cal.c (build_change_seq): dup the calobj rather than the uid - now - (Cal_get_changes): rename from Cal_get_changed_uids - (cal_get_epv): reflect name change in epv - - * cal-util/cal-util.c (cal_obj_change_list_free): update assertion - - * cal-util/cal-util.h: CalObjChange now returns the entire ical - component, update the change types. This should all go away shortly - - * idl/evolution-calendar.idl: getChangedUIds -> getChanges. - CalObjChange now contains the calobj rather than the uid, update - the change types - - * cal-client/cal-client.c (cal_client_get_changes): rename from - cal_client_get_changed_uids to make idl and addressbook - - * cal-client/cal-client.h: Update prototype - - * cal-client/cal-client.c (build_change_list): Build a list of - CalClientChange instead of CalObjChange - - * cal-client/cal-client-types.c (cal_client_change_list_free): Free - a glist of CalClientChanges - - * cal-client/cal-client-types.h: New file. Declarations for - CalClientChange. - - * cal-client/Makefile.am: Build new files - -2000-12-06 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/Makefile.am: Fix my build stupidty READ THE MACRO - - * conduits/calendar/Makefile.am: ditto - -2000-12-04 JP Rosevear <jpr@helixcode.com> - - * gui/e-day-view-time-item.c (e_day_view_time_item_get_column_width): - Initialize max_large_digit_width to 0 to prevent crazy sizing issues. - -2000-12-04 Dan Winship <danw@helixcode.com> - - * gui/e-itip-control.c: Remove mysterious #include inserted by - mmeeks to break the build. - -2000-12-01 Federico Mena Quintero <federico@helixcode.com> - - Fixes bug #918. - - * gui/weekday-picker.c (WeekdayPickerPrivate): Added a field for a - set of blocked days. - (weekday_picker_set_blocked_days): New function to configure a set - of days that cannot be modified by the user. - (weekday_picker_get_blocked_days): Query function for the above. - (day_event_cb): Block the appropriate days from being modified. - - * gui/event-editor.c (get_start_weekday_mask): New function to - compute a day mask for the start day of a calendar component. - (set_recur_special_defaults): New function to set sane defaults - for the recurrence special widgets. - (fill_recurrence_widgets): Use set_recur_special_defaults(). - (make_recur_weekly_special): Block the appropriate days. - -2000-12-01 Federico Mena Quintero <federico@helixcode.com> - - * gui/control-factory.c (set_prop): Removed debugging message. - (control_factory_init): Ditto. - - * gui/calendar-commands.c (calendar_set_uri): Ditto. - - * gui/main.c (main): Ditto. - - * gui/event-editor.c (set_title_from_comp): New function to - generate a title and convert it from UTF8 before setting it on the - window. - (save_event_object): Uset set_title_from_comp(). - (event_editor_set_event_object): Likewise. - -2000-11-30 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c: Debug message cleanups - (comp_from_remote_record): Properly set the ical description field - - * conduits/calendar/calendar-conduit.c (is_empty_time): New utility - functions that look for all 0's in a struct tm - (comp_from_remote_record): use above - (local_record_from_comp): Correctly set the repeatForever value so - that we repeat forever instead of a really long time - (comp_from_remote_record): Only set the cal component recurrence - until field when repeatForever is 0 - -2000-11-30 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.c: fixed a bug that caused the calendar to - segfault when the iTip control was destroyed. - -2000-11-30 JP Rosevear <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c (local_record_from_comp): Empty - by_day entries are no longer indicated by ICAL_RECURRENCE_ARRAY_MAX not - SHRT_MAX. Calculate weekly and monthly by date recurrences properly - (get_pilot_day): Convert ical day to corresponding integer for pilot day - -2000-11-30 JP Rosevear <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c: Debug message cleanups - (get_ical_day): Fix off-by-one error which affected weekly occurences. - (comp_from_remote_record): Monthly by day and by date were reversed - (nth_weekday): function taken from event-editor.c that encodes BYDAY - values - this needs to be in libical really. - (comp_from_remote_record): Don't set the description if the pilot note - is null. Rejig so that we don't have to free objects. - -2000-11-28 Federico Mena Quintero <federico@helixcode.com> - - Upgrade of the alarm framework. We now access alarms by a unique - identifier. This UID is added as an extension property to alarm - subcomponents when their parent components are scanned by - CalComponent. - - * cal-util/cal-component.c (CalComponentPrivate): Added a hash - table of alarm UIDs -> alarm properties. - (cal_component_init): Initialize priv->alarm_uid_hash. - (free_icalcomponent): Free the elements in the - priv->alarm_uid_hash. - (scan_alarm): New function to add scan an alarm subcomponent and - ensure that it has an alarm UID extension property so that we can - add it to our mapping table. - (cal_component_get_first_alarm): Removed function. - (cal_component_get_next_alarm): Removed function. - (cal_component_get_alarm_uids): New function. - (cal_component_get_alarm): New function. - -2000-11-28 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c (local_record_to_pilot_record): Return - a struct rather than a pointer to a struct - (compare): local_record_to_pilot_record now returns a struct - (prepare): ditto - (free_prepare): remove as per gnome-pilot changes - (conduit_get_gpilot_conduit): don't listen for free_prepare signal - - * conduits/calendar/calendar-conduit.c: Same as above - -2000-11-28 Federico Mena Quintero <federico@helixcode.com> - - * gui/e-calendar-table.c (E_CALENDAR_TABLE_SPEC): Reformatted the - table spec to make it easier to read. - - * gui/tag-calendar.c: Oops, Damon wrote this, not me. Fixed the - Authors line. - -2000-11-28 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view*.[hc]: - * gui/e-week-view*.[hc]: finished 12-hour support and tried to tidy - up & comment the drawing code in places. Also fixed a couple of bugs I - spotted. All the options on the 'Calendar' page should now work. - -2000-11-28 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-meeting-edit.c: removed some debugging code that I had, - which might have caused problems. - -2000-11-27 Jesse Pavel <jpavel@helixcode.com> - - * gui/calendar-model.c: added a preliminary change to have - Assigned To-Do items have a corresponding icon. - -2000-11-27 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c (free_prepare): Ditto - - * conduits/calendar/calendar-conduit.c (free_prepare): Adjust - free_prepare to the correct signal parameters. Don't actually - do anything - there is a semantic discrepancy that needs to be - resolved. - -2000-11-26 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view.c (e_day_view_set_days_shown): == instead of =. - -2000-11-26 Damon Chaplin <damon@helixcode.com> - - * gui/gnome-cal.c: added more support for config settings. - - * gui/e-week-view.[hc]: - * gui/e-day-view.[hc]: added support for setting - show event end - times, week start day and 12-hour format (unfinished). - - * gui/e-day-view-time-item.c: started 12-hour support. - - * gui/tag-calendar.c (prepare_tag): use end_day + 1 since we want to - include the last day. - - * gui/event-editor.c (set_all_day): minor change when turning all_day - off - set the event end to one hour after the event start if it is on - or before the start time. Also added more comments to make it a bit - clearer. - - * cal-util/cal-recur.c (cal_obj_time_add_days): use a gint for day - rather than a guint since we now support -ve days. - Also fixed bug with weekly recurrences. - - * gui/dialogs/task-editor.c (task_editor_create_date_edit): use - config settings. - - * gui/dialogs/cal-prefs-dialog.c (cal_prefs_dialog_update_config): - updated EDateEdit calls. - -2000-11-24 Federico Mena Quintero <federico@helixcode.com> - - * gui/e-calendar-table.c (e_calendar_table_init): Unref the ETable - extras. - -2000-11-24 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (free_icalcomponent): DOH, fixed - reversed test for the presence of the icalcomp's parent. This was - causing memory leaks in the Wombat and elsewhere. - - * pcs/cal-backend.c (cal_backend_set_node_timet): Plug leak. - -2000-11-24 Federico Mena Quintero <federico@helixcode.com> - - * pcs/cal-backend-file.c (scan_vcalendar): Use the new libical - external iterators (icalcomponent_begin_component() and friends); - the internal iterators are deprecated. - - * cal-util/test-recur.c (generate_occurrences): Likewise. - - * gui/e-itip-control.c (pstream_load): Likewise. - - * gui/e-meeting-edit.c (e_meeting_edit): Likewise. - - * pcs/cal-backend.c (cal_backend_log_entry): Plug leak. - (cal_backend_log_sync): Free the entry->uid. - - * util/icalendar-save.[ch]: - * util/icalendar-test.c: - * util/icalendar.[ch]: Removed obsolete files. - -2000-11-21 Federico Mena Quintero <federico@helixcode.com> - - * gui/task.xpm: Remove the check because it makes it look like the - task is already completed. This fixes bug #819. - - * gui/task-recurring.xpm: Make it use a prettier overlaid icon. - - * gui/task-*.xpm: Made the things look like little spiral-bound - notebooks. - - * gui/e-calendar-table.c (E_CALENDAR_TABLE_SPEC): Make the default - column order be icon/completed/summary. You may need to erase - your ~/evolution/config/TaskPad for this to appear. - -2000-11-21 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-model.c (calendar_model_is_cell_editable): The icon - column is not editable! - - * gui/calendar-commands.c (todo_properties_changed): Removed. - (time_format_changed): Removed. - (colors_changed): Removed. - - * gui/calendar-commands.h: - * gui/prop.c (prop_apply): - * gui/calendar-commands.c (init_calendar): Removed the old to-do - list crap. - - * gui/gncal-todo.[ch]: Removed obsolete files. - - * gui/Makefile.am (evolution_calendar_SOURCES): Removed gncal-todo.[ch]. - - * gui/gnome-cal.c (gnome_calendar_todo_properties_changed): Removed. - (gnome_calendar_time_format_changed): Removed. - (gnome_calendar_colors_changed): Removed. - -2000-11-21 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.c: fixed the stupid Bonobo widget size - allocation bug that had been vexing me. - - * gui/e-itip-control.glade: I removed some hacks that were - necessary for said size bug. - -2000-11-16 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.c, gui/e-meeting-edit.c: added cancellation - code to our program; people can cancel meetings, which is the best - thing to do for most meetings. - -2000-11-13 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.c: made the REPLY code actually work. - -2000-11-13 Jesse Pavel <jpavel@helixcode.com> - - * gui/itip-utils.[ch]: I created this file to store some commonly used enumeration to - string mappings and functions. - - * gui/Makefile.am: this was changed to reflect the addition of the above file. - - * gui/e-itip-control.c: added code to take action on a REPLY message. - - * gui/e-meeting-edit.c: bug fixes. - -2000-11-12 Federico Mena Quintero <federico@helixcode.com> - - OK, bugzilla bug #829 is fixed and that does not redeem me from - extreme procrastination. Wheeeeeeeeeeeeeeee! - - * gui/event-editor-dialog.c: Changed the "Rule view" label to - "Preview" - -2000-11-12 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (make_recur_ending_count_special): Misspelled - "occurrences". - (fill_recurrence_widgets): Sensitize the "Custom recurrence" radio - button as appropriate. - (sensitize_recur_widgets): Resurrected the recurrence custom - warning label. - (get_widgets): Load the recurrence custom warning bin. - - * gui/event-editor-dialog.glade: Add an empty alignment for the - recurrence custom warning label. - -2000-11-12 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (recur_preview_date_range_changed_cb): New - function; re-tag the calendar when its date range changes. - (init_widgets): Connect to "date_range_changed" on the recurrence - preview calendar. - (make_recur_weekly_special): Connect to "changed" on the weekday - picker. - (recur_weekday_picker_changed_cb): New function; re-tag the calendar. - (month_day_menu_selection_done_cb): Re-tag the calendar. - (recur_month_index_value_changed_cb): Likewise. - (recur_ending_until_changed_cb): Likewise. - (recur_ending_count_value_changed_cb): Likewise. - (make_recur_monthly_special): Connect to "value_changed" on the - adjustment of the month index. - (make_recur_ending_until_special): Connect to "changed" on the - ending-until date picker. - (make_recur_ending_count_special): Connect to "value_changed" on - the ending-count adjustment. - (init_widgets): Set to zero the maximum number of selectable days - in the recurrence preview calendar. Set the week_start_day from - the calendar's configuration. - -2000-11-12 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (clear_widgets): Block the signals as appropriate. - (fill_ending_date): Ditto. - (fill_recurrence_widgets): Ditto. - (recurrence_type_toggled_cb): Only sensitize the widgets and - preview the recurrence if the toggle button is active. - -2000-11-12 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (recur_to_comp_object): Clear the rdate and - exrule lists from the component if we are setting a simple - recurrence. - (recur_to_comp_object): Set the exdate list here instead of in - dialog_to_comp_object(). - (preview_recur): New function to tag the recurrence preview - calendar based on the information from the dialog box. - (fill_exception_widgets): Fill the exception widgets here; moved - over from fill_widgets(). - (fill_recurrence_widgets): Call preview_recur(). Also, call - fill_exception_widgets() first of all. - (recurrence_type_toggled_cb): Call preview_recur(). - (recur_interval_selection_done_cb): Likewise. - (recur_ending_selection_done_cb): Likewise. - (recurrence_exception_add_cb): Likewise. - (recurrence_exception_modify_cb): Likewise. - (recurrence_exception_delete_cb): Likewise. - (date_changed_cb): Likewise. - (recur_interval_value_changed_cb): Likewise, new function. - - * gui/tag-calendar.[ch]: New files with utilities for tagging - calendars. mark.[ch] should go away some day. - - * gui/tag-calendar.c (tag_calendar): Moved over from - gnome_calendar_tag_calendar(). Take in a CalClient instead of a - GnomeCalendar. Added API docs. - (tag_calendar_by_comp): New function to tag a calendar based on a - single calendar component instead of a whole client. - - * gui/gnome-cal.c (initial_load): Use tag_calendar_by_client(). - (obj_updated_cb): Likewise. - (obj_removed_cb): Likewise. - (gnome_calendar_on_date_navigator_date_range_changed): Likewise. - (editor_closed_cb): Free the closure. - (destroy_editor_cb): Renamed from free_uid(). Do not free the - UID; just unref the event editor. Our destroy handler to it will - free things properly. This will also cause the corresponding - calendar client to be unrefed. - (editor_closed_cb): Use a flag on the GnomeCalendar to decide - whether to remove the editor from the hash table. This is sort of - icky. - - * gui/calendar-model.c (obj_updated_cb): If the object is new, we - have to use e_table_model_row_inserted(), not row_changed(). - Thanks to JP Rosevear for reporting this. - - * gui/Makefile.am (evolution_calendar_SOURCES): Added - tag-calendar.[ch] to the list of sources. - -2000-11-11 Matt Bissiri <bissiri@eecs.umich.edu> - - * gui/evolution-calendar.oafinfo: - Update the remaining "IDL:Evolution*" to "IDL:GNOME/Evolution*" - to sync up with yesterday's IDL re-scoping. - -2000-11-10 Michael Meeks <michael@helixcode.com> - - * gui/Makefile.am ($(IDL_GENERATED)): sort include order. - - * pcs/Makefile.am (idl_flags): ditto. - -2000-11-10 JP Rosevear <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c (for_each_modified): Inc the - iterator before finding the next changed item. - - * conduits/todo/todo-conduit.c (for_each_modified): ditto - -2000-11-09 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.c: I wrote the code so that recipients of meeting requests - can reply appropriately. - -2000-11-09 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-meeting-edit.c: fixed a bug that would make the calendar segfault - if the meeting editor were called up twice without first saving the - component. - -2000-11-08 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.c, gui/e-itip-control.glade: updated the GUI - to allow the user to add PUBLISHed events to his calendar, and created - unworking buttons for meeting requests. - -2000-11-08 Federico Mena Quintero <federico@helixcode.com> - - These changes fix bugzilla bugs #874 and #875. - - * cal-util/cal-component.c (cal_component_get_exdate_list): Return - a list of CalComponentDateTime instead of simple struct - icaltimetype objects. Exception date properties *can* contain a - timezone parameter, so we need to include those if they are - present. - (cal_component_set_exdate_list): On the input, handle a list of - CalComponentDateTime structures. On the internals, handle a list - of struct datetime instead of plain properties. - (cal_component_free_exdate_list): Handle a list of - CalComponentDateTime structures. - (scan_exdate): Create a list of struct datetime structures. - (free_icalcomponent): Free the exdate_list properly. - - * cal-util/cal-recur.c (generate_instances_for_chunk): Use the - proper types for exception dates. - - * gui/comp-util.h: - * gui/comp-util.c: New files with utilities for manipulating - calendar component objects. - (cal_comp_util_add_exdate): New function. - - * gui/Makefile.am (evolution_calendar_SOURCES): Added - comp-util.[ch] to the list of sources. - - * gui/e-day-view.c (add_exdate): New convenience function to add - an exception date to a calendar component. - (e_day_view_on_unrecur_appointment): Use cal_comp_util_add_exdate(). - (e_day_view_on_delete_occurrence): Likewise. - - * gui/e-week-view.c (e_week_view_on_delete_occurrence): Likewise. - (e_week_view_on_unrecur_appointment): Likewise. - - * gui/event-editor.c (nth_weekday): Be paranoid about valid - position values. - (fill_widgets): Use the proper types for exdates. - (dialog_to_comp_object): Likewise. - -2000-11-08 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (adjust_day_index_spin): Adjust the valid - range of the month index spin button depending on the selection of - the day/weekday menu. - -2000-11-07 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.c, gui/e-itip-control.glade: changed the GUI, - and added some extra feedback for the user. - -2000-11-07 Federico Mena Quintero <federico@helixcode.com> - - * gui/weekday-picker.h (WeekdayPickerClass): Added a "changed" - signal to notify of changes to the set of selected days. - - * gui/weekday-picker.c (weekday_picker_class_init): Create the - "changed" signal. - (weekday_picker_set_days): Emit the "changed" signal. - -2000-11-06 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.c, gui/e-itip-control.glade: changed to GUI to - accomodate dynamically generated buttons, which will be tailored to - the type of iTip message that is incoming. - - * gui/e-meeting-dialog.glade gui/e-meeting-edit.c: added a new button - to publish events, in addition to requesting meetings. - -2000-11-05 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor-dialog.glade: Removed the old recurrence page. - Wheeeeeeeeee! - - * gui/event-editor.c (make_recurrence_special): Clear the monthly - widgets. - (make_recur_monthly_special): Create the monthly widgets. - (clear_widgets): Clear the monthly values. - (simple_recur_to_comp_object): Fill in the monthly values. - (fill_recurrence_widgets): Fill in the monthly and yearly source - values. - (dialog_to_comp_object): Take in a CalComponent instead of using - the event editor's directly. - (recur_to_comp_object): Likewise. - (simple_recur_to_comp_object): Likewise. - (EventEditorPrivate): Removed the widgets from the old recurrence - page. - (get_widgets): Likewise. - (clear_widgets): Likewise. - (dialog_to_comp_object): If the description or summary are empty, - just clear the description list or summary property, respectively, - instead of saving empty ones. - (simple_recur_to_comp_object): Set the week_start field. - - * gui/main.c: Fix includes, and add calendar-config.h. - - * gui/Makefile.am (evolution_calendar_SOURCES): The glade messages - file should not be in SOURCES. - -2000-11-05 Christopher James Lahey <clahey@helixcode.com> - - * doc/.cvsignore, doc/C/.cvsignore: Removed unnecessary .cvsignore - files. - -2000-11-03 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (check_all_day): Block signals from the - toggle button. - (date_changed_cb): Merged check_dates() and check_times() into - this function; provide better behavior as well. - (check_dates): Removed function. - (check_times): Removed function. - (init_widgets): Connect to the "changed" signal on the start_time - and end_time widgets. - (check_all_day): Use a better test. - - * gui/Makefile.am: Clean the idl-generated sources properly. - * cal-client/Makefile.am: Likewise. - -2000-11-03 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.c: added some checks for the type of an - incoming iCal component before passing it off to the CalComponent - routines. - -2000-11-02 Federico Mena Quintero <federico@helixcode.com> - - * gui/dialogs/task-editor.c (init_widgets): The date editor's - signal is now "changed". - (completed_changed): Renamed callback to reflect the name of the - signal. - -2000-11-01 Gediminas Paulauskas <menesis@delfi.lt> - - * gui/main.c: (main): added call to bindtextdomain and textdomain, so - all calendar gui shows up localized. - -2000-10-31 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (count_by_xxx): Hmmm. SHRT_MAX changed to - ICAL_RECURRENCE_ARRAY_MAX in libical. Deal with it. - (fill_recurrence_widgets): Likewise. - (simple_recur_to_comp_object): Fixed incorrect assertion. The - weekday picker is not the immediate child of the recurrence - special container. - (fill_recurrence_widgets): Call make_recurrence_special() after - setting the recurrence period type. - (fill_ending_date): Call make_recurrence_ending_special(). This - would be so much nicer if GTK+ were model/view all over. - -2000-10-31 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.h: Remove add/del/mod hashes and - add changed_hash. - - * conduits/calendar/calendar-conduit.h: ditto - - * conduits/todo/todo-conduit.c (next_changed_item): Utility function - to get the next "really" changed item (changed status can be cleared now) - (compute_status): Compute status based on changed_hash - (pre_sync): Fill changed_hash and counts adds/mods/dels - (set_status_cleared): New callback handler - avoid double syncing - (for_each_modified): Use next_changed_item to iterate - (add_archive_record): kill - (delete_archive_record): kill - (archive_record): New callback handler - mark/unmark archive status - (conduit_get_gpilot_conduit): Adjust signal connects - - * conduits/calendar/calendar-conduit.c: ditto - -2000-10-30 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (sensitize_recur_widgets): New function. We - split it from the radio callback so that we can call it explicitly - from fill_recurrence_widgets(). - (fill_recurrence_widgets): Call sensitize_recur_widgets() as - appropriate. - -2000-10-30 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-commands.c (new_calendar): Removed the geometry and - hidden arguments. This code is ancient. - (all_calendars): Made static. This sucks; configuration should be - notification-based instead of "let's iterate through all open - calendars". - (active_calendars): Removed. Functions can check the length of - the all_calendars list if they are interested. - - * gui/event-editor.c (sync_entries): Do not take in an extra data - pointer. - (summary_changed_cb): Use a single call back to sync both entries. - (sync_date_edits): New function to sync two EDateEdit widgets. - (init_widgets): Connect the general and recurrence starting date - widgets. - -2000-10-27 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (sync_entries): New function. - (general_summary_changed_cb): Sync the general summary to the - recurrence summary widget. - (recurrence_summary_changed_cb): Vice-versa. - (init_widgets): Hook to the summaries. - - * event-editor-dialog.glade: Do not expand/fill the start and end - date so that the "all day event" button is not pushed all the way - to the right. - Decrease the spacing between the recurrence sentence widgets. - Remove a spurious empty label that was lurking around the - recurrence widgets. - Make the alarm widgets expand the right way. - Delete old recurrence widgets. - -2000-10-27 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (init_widgets): Connect to the recurrence - ending menu. - (recur_ending_selection_done_cb): Implemented. - (make_recurrence_ending_special): Implemented. - (make_recur_ending_until_special): Implemented. - (fill_ending_date): Implemented. - (make_recur_ending_count_special): Implemented. - (simple_recur_to_comp_object): Fill in the ending date. - (clear_widgets): Clear the recurrence ending widgets. - - * gui/event-editor-dialog.glade: Moved the recurrence type radio - buttons to a single hbox to save space. - Fixed the lower value of the recurrence interval spin button. - Removed the stale widgets from the recurrence ending date part. - -2000-10-27 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-meeting-edit.c: fixed problems in which I allocated CORBA - strings of 0 length, but then didn't NULL terminate them. - -2000-10-27 <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c (check_for_slow_setting): - Check boundary case of fast sync - - * conduits/todo/todo-conduit.c (check_for_slow_setting): ditto - -2000-10-27 <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c (add_archive_record): Remove - invalid test. - (local_record_from_comp): If the event is all day, mark it as timeless - (comp_from_remote_record): Timeless events take up all day - - * conduits/todo/todo-conduit.c (add_archive_record): ditto - -2000-10-27 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c (add_archive_record): Take proper - number of parameters - - * conduits/calendar/calendar-conduit.c (add_archive_record): ditto - -2000-10-26 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (EventEditorPrivate): Integrate Anna's new - recurrence page. Replace the old widget pointers with the new - ones. Modified the relevant functions accordingly and added - plenty of new ones. - (event_editor_get_cal_client): New function. - (fill_recurrence_widgets): This is *THE* tricky function for you. - It has to discriminate whether we get a recurrence we support for - editing or not. And this is not trivial. Sigh. - (event_editor_update_widgets): Added preconditions and API docs. - - * event-editor-dialog.glade: Fixed all the spacings/ - paddings/packing options so that the widgets will look right if - the dialog box is resized. Also fixes some misaligned widgets. - - * cal-util/cal-component.c (cal_component_set_rdate_list): Removed - incorrect assertion. - -2000-10-26 Michael Meeks <michael@helixcode.com> - - * pcs/cal-factory.c (str_tolower): unsigned chars to isalpha - - * cal-util/calobj.c (weekdaylist, weekdaynum): ditto. - -2000-10-25 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-meeting-edit.c: brushed up some code to deal with - the organizer entry, and solidified the CORBA memory-freeing - issues. - -2000-10-25 Jesse Pavel <jpavel@helixcode.com> - - * removed the Evolution-Composer generated files, due - to a tip on how we do things. - -2000-10-25 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-meeting-edit.c: I fixed a bunch of memory-deallocation - bugs, and finished the initial integration with the mailer. - - * gui/Makefile.am: made the build us the Evolution-Composer.idl - from the composer directory. - -2000-10-25 Jesse Pavel <jpavel@helixcode.com> - - * gui/Evolution-Composer.idl: added this from the composer IDL sources - - * gui/Makefile.am: changed to reflect the above IDL and the associated - orbit-idl generated files. - - * gui/Evolution-Composer.h, - gui/Evolution-Composer-common.c, - gui/Evolution-Composer-stubs.c, - gui/Evolution-Composer-skels.c: - the generated files, as per the above description. - - * gui/e-meeting-edit.c: more work towards mailer integration. - -2000-10-24 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-meeting-edit.c: I've added code to interact with the mailer's - CORBA interfaces, though it's not yet working. - -2000-10-23 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c (local_record_from_comp): Use - new e-pilot-map lookup function - (match): ditto - - * conduits/calendar/calendar-conduit.c (local_record_from_comp): Use - new e-pilot-map lookup function - (match): ditto - -2000-10-23 Dan Winship <danw@helixcode.com> - - * pcs/Makefile.am (INCLUDES): - * gui/dialogs/Makefile.am (INCLUDES): - * gui/Makefile.am (INCLUDES): - * cal-util/Makefile.am (INCLUDES): - * cal-client/Makefile.am (INCLUDES): Update GNOMELOCALEDIR. - -2000-10-23 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.h: Use new libeconduit calls and - abstraction - - * conduits/calendar/calendar-conduit.c: ditto - - * conduits/calendar/calendar-conduit.h: ditto - - * conduits/todo/todo-conduit.c: ditto - - * conduits/calendar/Makefile.am: Add libeconduit-static.la - - * conduits/calendar/calendar-conduit.c (post_sync): Use e_pilot_map_write - (pre_sync): Use e_pilot_map_read - -2000-10-23 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/Makefile.am: Add libeconduit-static.la - - * conduits/todo/todo-conduit.c (post_sync): Use e_pilot_map_write - (pre_sync): Use e_pilot_map_read - -2000-10-21 Damon Chaplin <damon@helixcode.com> - - * gui/dialogs/cal-prefs-dialog.c - (cal_prefs_dialog_use_24_hour_toggled): removed debug message. - - * gui/e-calendar-table.c (e_calendar_table_save_state): new function - to save the state of the table to a given file. - - * gui/e-calendar-table.h (struct _ECalendarTable): added etable field - so we can access it to save the state. - - * gui/gnome-cal.c (gnome_calendar_destroy): call - e_calendar_table_save_state() to save the state of the TaskPad. - (setup_widgets): load the state of the TaskPad. - - * gui/calendar-config.c: added support for the default view. - - * gui/gnome-cal.c (gnome_calendar_construct): - (gnome_calendar_set_view_internal): use/set the default view setting. - -2000-10-20 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-meeting-editor.c: added more (working) integration with the - meeting schedular. - -2000-10-20 Jesse Pavel <jpavel@helixcode.com> - - * cal-utils/cal-component.c: in set_datetime(), I put an #if 0'd portion - of the code back into operation, because the icalproperty_remove_parameter() - function is now implemented. - - * gui/e-meeting-editor.c: added more (unworking) integration with the - meeting schedular. - -2000-10-20 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend.c (cal_backend_destroy): New destroy - handler to properly stop the timer, sync the log and unref - the URI. - (cal_backend_last_client_gone): Just emit the signal, - clean up work is done in cal_backend_destroy now. - - * pcs/cal-backend-file.c (cal_backend_file_load): Unref the - uri we are replacing NOT the new uri. - -2000-10-20 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/Makefile.am: Fix build - - * conduits/calendar/Makefile.am: Fix build - -2000-10-20 JP Rosevear <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c (delete_archive_record): - Don't throw an error - - * conduits/todo/todo-conduit.c (delete_archive_record): ditto - -2000-10-20 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit-control-applet.c: Add defines - - * conduits/todo/todo-conduit-config.h: put #ifdefs around functions - can't make this a public interface in the usual way as then the - symbols would be exported - - * conduits/todo/todo-conduit.c: Kill warnings. clahey will be - happy! Add some defines to include only the necessary config functions. - (conduit_get_gpilot_conduit): Hook up archive signals - - * conduits/calendar/calendar-conduit.c: Same as above - - * conduits/calendar/calendar-conduit-control-applet.c: ditto - - * conduits/calendar/calendar-conduit-config.h: ditto - -2000-10-20 Michael Meeks <michael@helixcode.com> - - * gui/calendar-commands.h: s/BonoboUIHandler/BonoboUIComponent/ - - * gui/calendar-commands.c (properties_cmd): ditto. - -2000-10-20 Damon Chaplin <damon@helixcode.com> - - * gui/calendar-model.c (calendar_model_value_at): use - cal_component_has_alarms(). - -2000-10-20 Damon Chaplin <damon@helixcode.com> - - * gui/e-calendar-table.c (E_CALENDAR_TABLE_SPEC): added - _click-to-add-message, though I'm not sure if i18n will work. - - * cal-util/cal-recur.c (cal_obj_time_add_hours): - (cal_obj_time_add_minutes): - (cal_obj_time_add_seconds): updated to handle -ve args. - - * cal-util/timeutil.c (time_add_day): set tm_isdst to -1 before calling - mktime(). - - * cal-util/cal-recur.c (generate_instances_for_chunk): don't call the - callback if the event ends exactly on the interval start time. - - * gui/e-week-view.c (e_week_view_reshape_event_span): - * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons): - * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): - * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): - * gui/e-day-view.c (e_day_view_reshape_long_event): - (e_day_view_reshape_day_event): use cal_component_has_alarms(). - - * cal-util/cal-component.[hc]: added cal_component_has_alarms(). - -2000-10-16 Damon Chaplin <damon@helixcode.com> - - * gui/calendar-config.c (config_read): set default MonthVPanePosition - to 1 rather than 0, so if you move the hpane you'll see the date - navigator. - -2000-10-19 Jesse Pavel <jpavel@helixcode.com> - - * gui/event-editor.[ch]: added a public function which causes the - event editor to reload its widgets to the associated CalComponent. - - * gui/e-meeting-edit.c: added rudimentary support for the phat - e-meeting-time-selector widget, though it has no effect on the - component yet. - - * gui/Makefile.am: the meeting editor depends on the meeting widget - library, now. - - * gui/e-itip-control.glade: I added another toolbar button that summons - from the hoary deep the meeting time widget. - -2000-10-19 Ettore Perazzoli <ettore@helixcode.com> - - * gui/Makefile.am: Add `event-editor-dialog.glade.h'. - (EXTRA_DIST): Add `$(glade_messages)'. - -2000-10-19 Michael Meeks <michael@helixcode.com> - - * gui/calendar-commands.c (tb_print_cb): remove; redundant. - - * gui/event-editor.c (create_menu, create_toolbar): kill. - (event_editor_destroy): upd. - (event_editor_construct): update to new UI handler, cast - priv->general_summary to a widget not an object. - -2000-10-18 Michael Meeks <michael@helixcode.com> - - * gui/dialogs/task-editor.c (create_menu, create_toolbar): die. - (debug_xml_cb): add debugging hook. - - * gui/dialogs/Makefile.am: add EVOLUTION_DATADIR - - * gui/dialogs/task-editor.c (task_editor_construct): upd for new UI. - -2000-10-17 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit-control-applet.c: Add defines - - * conduits/todo/todo-conduit-config.h: put #ifdefs around functions - can't make this a public interface in the usual way as then the - symbols would be exported - - * conduits/todo/todo-conduit.c: Kill warnings. clahey will be - happy! Add some defines to include only the necessary config functions. - (conduit_get_gpilot_conduit): Hook up archive signals - - * conduits/calendar/calendar-conduit.c: Same as above - - * conduits/calendar/calendar-conduit-control-applet.c: ditto - - * conduits/calendar/calendar-conduit-config.h: ditto - -2000-10-16 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.c: You can now add incoming iTip - messages to your calendar store. - - * gui/e-itip-control.glade: added a progress bar dialog - in case the calendar loading takes a long time. - -2000-10-16 JP Rosevear <jpr@helixcode.com> - - * cal-client/cal-client.h: Remove pilot cruft. All pilot stuff - is in the conduits now and uses the logging facility. - - * pcs/cal-backend-file.c: ditto - - * pcs/cal-backend.h: ditto - - * pcs/cal-backend.c: ditto - - * pcs/cal.c: ditto - - * pcs/cal.h: ditto - - * idl/evolution-calendar.idl: ditto - - * cal-util/cal-component.h: ditto - - * cal-util/cal-component.c: ditto - - * cal-client/cal-client.c: ditto - - * conduits/calendar/calendar-conduit.c (local_record_from_comp): - Take a stab at storing recurrence stuff on the pilot properly - - * pcs/cal-backend.c (cal_backend_update_object): Don't log the - event until after the update in case its a new item - -2000-10-16 Tuomas Kuosmanen <tigert@helixcode.com> - - * gui/dayview.xpm, gui/workweekview.xpm, gui/weekview.xpm - gui/monthview.xpm gui/yearview.xpm: Updated icons, let me know - if you like these or not, I might work on these some more but - I wanted to put these versions up anyway to get feedback.. - -2000-10-15 Dan Winship <danw@helixcode.com> - - * gui/Makefile.am: Remove CPPFLAGS def since the -D there was - already in INCLUDES - -2000-10-14 Ettore Perazzoli <ettore@helixcode.com> - - * gui/evolution-calendar.oafinfo: Added an - "evolution:shell-component-icon" attribute. - -2000-10-12 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.{c,glade}: Made the control much more - relavent to the function at hand. - -2000-10-12 Damon Chaplin <damon@helixcode.com> - - * gui/e-calendar-table.c (E_CALENDAR_TABLE_SPEC): set the 2 icon - columns to a min width of 18 and resizable to FALSE. - -2000-10-12 Damon Chaplin <damon@helixcode.com> - - * gui/calendar-commands.c (calendar_control_activate): - (update_pixmaps): - (set_pixmap): set the pixmaps of the toolbar buttons for the views, - and removed a lot of old unused stuff. We'll use plain buttons for - the view buttons for now, until Bonobo toolbars support radio buttons. - - * gui/gnome-cal.c (gnome_calendar_dayjump): check day_button is not - NULL before using it. - (gnome_calendar_update_view_buttons): check button is not NULL. - -2000-10-11 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view-time-item.c (e_day_view_time_item_draw): got 12/24 - hour format the wrong way round. - -2000-10-12 JP Rosevear <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c (comp_from_remote_record): - Store recurrence stuff on the desktop properly - (get_ical_day): Utility function - -2000-10-12 Iain Holmes <iain@helixcode.com> - - * gui/component-factory.c: Disable the executive summary. - -2000-10-11 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend.c (cal_backend_log_entry): Take CalObjType - as a param because its impossible to determine after a delete. - (cal_backend_remove_object): Calculate CalObjType and pass - it to cal_backend_log_entry - (cal_backend_update_object): ditto - - * conduits/todo/todo-conduit.c (local_record_from_comp): Kill - unused variables. - (add_archive_record): Don't kill the sync if this happens - (update_record): Kill old function - (replace_record): New function to handle replace_record signal - (conduit_get_gpilot_conduit): Listen for replace record signal - (add_record): Always add a new record, never replace - (replace_record): Always replace an existing record - - * conduits/calendar/calendar-conduit.c: Same as above - -2000-10-10 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-itip-control.c: set a default size for the control. - -2000-10-10 Jesse Pavel <jpavel@helixcode.com> - - * gui/evolution-calendar.oafinfo: Added information about the - text/calendar MIME type, so that the evolution-calendar is called - to deal with iMIP attachments. - - * gui/e-itip-control.[ch]: These files implement a Bonobo - control that will eventually deal with iMIP/iTIP messages from - the mailer. Right now, it's not working. - - * gui/e-itip-control.glade: The Glade GUI for the above-mentioned - control. - - * gui/Makefile.am: added references to the files I created. - - * gui/main.c: called the initialization function of the Bonobo - control factory. - -2000-10-11 Tuomas Kuosmanen <tigert@helixcode.com> - - * gui/task-assigned-to.xpm gui/task-assigned.xpm - gui/recur.xpm gui/task-recurring.xpm gui/task.xpm: - New versions of the icons for the tasklist/pad. - -2000-10-11 Damon Chaplin <damon@helixcode.com> - - * gui/component-factory.c (owner_unset_cb): don't free evolution_dir - as we need it to save the config settings. - -2000-10-11 Damon Chaplin <damon@helixcode.com> - - * gui/main.c (main): call calendar_config_write_on_exit() to write - out some special config settings (as the mail component does). - - * gui/calendar-commands.c (properties_cmd): changed to use the new - preferences dialog. - (update_all_config_settings): new function to iterate over all the - calendars and update the config settings. - - * gui/dialogs/cal-prefs-dialog.glade: preferences dialog. - - * gui/dialogs/cal-prefs-dialog.[hc]: new files for the preferences - dialog. - - * gui/calendar-config.[hc]: new files to handle loading/saving config - settings. - - * cal-util/cal-recur.c: fixed bug in YEARLY when no filters were set, - plus minor changes. - - * cal-util/test-recur.c: updated. - - * gui/e-day-view-time-item.c: - * gui/popup-menu.c: update to #include <gal/widgets/e-gui-utils.h> - - * gui/component-factory.c (owner_set_cb): called calendar_config_init. - (owner_set_cb): - (owner_unset_cb): updated the prototypes. - - * gui/main.c (main): added call to calendar_config_write_on_exit(). - - * gui/component-factory.h: - * gui/component-factory.c (owner_set_cb): added global evolution_dir - just like the mail component, so we know we to store config stuff. - -2000-10-11 Christopher James Lahey <clahey@helixcode.com> - - * gui/e-calendar-table.c: Fixed the column elements here. - -2000-10-11 Christopher James Lahey <clahey@helixcode.com> - - * gui/e-calendar-table.c: Updated to use the new ETable - specification stuff. - -2000-10-11 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c (map_sax_start_element): The - element is "pilot_id" not "pilotid". Update both maps - (compute_pid): Utility function to set a local records pid - (local_record_from_comp): Compute the pid and status here, - no longer use the old cal_component pilot interfaces - (free_match): Its a *local not a **local - - * conduits/calendar/calendar-conduit.c: same as above - - * conduits/todo/todo-conduit.h: Have both a uid and pid map - - * conduits/todo/calendar-conduit.h: same as above - -2000-10-09 JP Rosevear <jpr@helixcode.com> - - * conduits/*: Adjust to using gnome-pilot-sync-abs conduit which - is based on the latest pilot link changes. - -2000-10-09 Iain Holmes <iain@helixcode.com> - - * Makefile.am: Added the executive-summary library and cflags - - * gui/evolution-calendar.oafinfo: Added oaf servers for the - executive summary and executive summary factory. - - * gui/calendar-summary.[ch]: New files to create the summary. - - * gui/component-factory.c (summary_fn): Create the executive - summary component. - (component_factory_init): Start the summary factory as well. - -2000-10-06 Federico Mena Quintero <federico@helixcode.com> - - * gui/weekday-picker.[ch]: New widget to pick weekdays. - -2000-10-05 Michael Meeks <michael@helixcode.com> - - * gui/calendar-commands.c: upd. - (calendar_control_activate): upd. - (calendar_control_deactivate): upd. - -2000-10-05 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view.c: - * gui/e-week-view.c: when the user types in a new event, don't create - it until the user hits Return or switches focus. Removed the - editing_new_event flags. - - * cal-util/test-recur.c: rewritten to work on ics files. Now I can - start testing the recurrence code. - - * cal-util/cal-recur.c: a few fixes. - - * gui/e-day-view.c (e_day_view_check_if_new_event_fits): fixed to - return TRUE for long events, not FALSE. - -2000-10-04 Federico Mena Quintero <federico@helixcode.com> - - * gui/print.c (print_todo_details): As a temporary solution to the - to-do printing, just print the summaries. We'll use the ETable - printing stuff later. - - * gui/print.c (print_day_summary_cb): Use g_list_append() correctly. - (print_todo_details_cb): Likewise. - (print_day_summary): Initialize psi.events. This code was - obviously never tested. - (print_todo_details): Likewise. - (print_day_details): Initialize pdi.slots. - - * gui/print.c (range_selector_new): Fix strftime() %a versus %b - confusion. Fixes bugzilla #644. - (range_selector_new): Fix the whole localization mess by making - better use of strftime(). Now we generate whole date strings at a - time and compose them later. Fixes bugzilla #643. - -2000-10-02 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-meeting-edit.c: added support for the ROLE and RSVP parameters - in both the GUI and underlying iCal. - -2000-09-29 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-meeting-edit.c: added support for organizers in the meeting - scheduler. - -2000-09-29 Jesse Pavel <jpavel@helixcode.com> - - * gui/e-meeting-edit.c: added code that makes changes to the underlying - iCAL structure of an event, when the user changes meeting information. - - * gui/e-meeting-dialog.glade: this is the Glade UI for the meeting dialog - and accoutrements. - -2000-09-29 Damon Chaplin <damon@helixcode.com> - - * cal-util/cal-recur.c: updated to support RDATE end times or - durations. Note that if you have two RDATEs with the same start times, - but with different end dates/durations set, the results are - unpredictable. So the event editor dialog should check for this. - - * gui/e-week-view-main-item.c (e_week_view_main_item_draw_day): - make strftime() strings translatable, and changed the formats a bit. - - * NOTE: someone needs to check print.c to make sure strftime strings - are OK for i18n. - - * gui/e-day-view.h: Changed EDayViewDateFormat enum. We now try to - include the weekday if possible. Also changed EDayView struct so we - store the month & weekdays with the longest names rather than the - actual widths. This helps i18n. - - * gui/e-day-view.c (e_day_view_recalc_cell_sizes): used _() for - strftime strings, tried to see if weekday fits, and rearranged a - bit to make i18n easier. - - * gui/e-day-view-top-item.c (e_day_view_top_item_draw): used _() for - strftime strings, and updated to use new formats. - - * gui/calendar-model.c: added use_24_hour_format boolean to - CalendarModelPrivate so we can display dates in 12-hour format if - requested. This meant adding a CalendarModel argument to a few - functions. Also added get/set functions to set use_24_hour_format. - I suppose ideally we should have an ECellDate renderer and this option - should go there. - -2000-09-27 Jesse Pavel <jpavel@helixcode.com> - - * gui/event-editor.c: changed a menu entry so that it will invoke - my meeting editor. - - * gui/e-meeting-edit.[ch]: added these files to provide preliminary - support for iTIP meeting scheduling. Currently, only the GUI works; - there is not yet any backend support. - - * gui/Makefile.am: added entries for e-meeting-edit.[ch] - -2000-09-24 Damon Chaplin <damon@helixcode.com> - - * gui/dialogs/task-editor-dialog.glade: set the height of the scrolled - window for the description field, since the default window height - doesn't seem to be working. - - * cal-util/cal-component.h: added functions to get the actual - icalproperty lists for RRULE and EXRULE properties. - - * cal-util/cal-recur.[hc]: added support for COUNT, though I need to - test it a bit. Also fixed the call to generate_instances_for_year() so - it uses the chunk dates. - -2000-09-20 Damon Chaplin <damon@helixcode.com> - - * gui/event-editor.c: got rid of 1 '_' in '__Formatting'. - -2000-09-22 Michael Meeks <michael@helixcode.com> - - * gui/calendar-commands.c (calendar_control_activate): upd. - -2000-09-21 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-commands.c (verbs): Removed the "about calendar" - command, since we don't want to have both "About Evolution" and - "About Calendar". - -2000-09-21 Michael Meeks <michael@helixcode.com> - - * gui/calendar-commands.c (calendar_control_activate): _UIHandler - update. - -2000-09-20 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c (pre_sync): Don't fail if there - is no map file. - -2000-09-20 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.h: Add since field to context - - * conduits/todo/todo-conduit.c (map_set_node_timet): New utility - function - (map_sax_start_element): Look for the map timestamp as well - (map_write): Write the map timestamp - (pre_sync): Use the map time stamp when looking for changed entries - - * pcs/cal-backend.c (cal_backend_log_sax_start_element): Make sure - we are in a valid timestamp - -2000-09-20 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend.c (cal_backend_log_name): Make the log file - name relevant to the actual calendar file, rather than just the - directory. - -2000-09-20 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend.c (cal_backend_get_log_entries): Oops - -2000-09-20 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend.c (cal_backend_get_log_entries): Use a local - sax handler. - - * conduits/todo/todo-conduit.c (pre_sync): Use xmlSAXParseFile - (map_sax_parse): Delete - -2000-09-20 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend.c (cal_backend_log_sax_start_element): Properly - assign the CalObjChange type. - (cal_backend_log_sax_parse): Delete - (cal_backend_get_log_entries): Use xmlSAXUserParseFile - -2000-09-19 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend.c (cal_backend_set_uri): New utility function - (cal_backend_load): use above - (cal_backend_create): use above - (cal_backend_log_name): Take a uri instead of a backend param - - * pcs/cal-backend-file.c: Get rid of useless hash functions - (cal_backend_file_load): Check to make sure path exists and is - local - (cal_backend_file_load): Unref the current uri if there is one - (cal_backend_file_create): ditto - - * pcs/cal-backend.c (cal_backend_last_client_gone): Sync before - shooting ourselves in the foot - - * pcs/cal-backend-file.c (save): Fully implement backing up the - calendar before writing out the new entry. - -2000-09-19 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c (check_for_slow_setting): Add some - other cases where a slow sync is in order - (pre_sync): Pre load the uids, the map and the add/mod/del lists - (match_record): Use the map hash to match records - (iterate): Iterate using the pre-loaded uid list - (iterate_specific): Iterate using the add/mod/del lists - (purge): Delete all entries in the del list - (set_status): Set status by adding to an appropriate list - (set_pilot_id): Set pilot_id by updating map hash - - * conduits/todo/todo-conduit.h: Add lists for added, modified and - deleted objects - - * conduits/todo/todo-conduit.c (map_name): Get the pilot_id->uid map - file name - (map_sax_start_element): SAX handler to extract a pilot_id->uid - mapping - (map_sax_parse): Parse the given file and build a pilot_id->uid hash - (map_write_foreach): Write out individual mapping elements - (map_write): Write out the pilot_id->uid mapping - (start_calendar_server_cb): Rename from gnome_calendar_load_cb - - * conduits/todo/todo-conduit-config.h: Rename pilotID to pilot_id - - * conduits/todo/e-todo.conduit.in: A little renaming - - * conduits/todo/Makefile.am: Fix build slightly - - * pcs/cal.c (build_change_seq): Build a corba sequence out of a list - of CalObjChanges - (Cal_get_objects_in_range): Implement new corba function - - * pcs/cal-backend.c (cal_backend_init): Intiliaze to NULL - (cal_backend_load): Track the uri so we can write the log file - to the same place - (cal_backend_log_name): Figure out the log filename/path based on - the calendar uri - (cal_backend_set_node_timet): Set an xml node property value from - a time_t - (cal_backend_log_entry): Adds a log entry to list waiting to be written - out - (cal_backend_log_sync): Syncs the log entries to disk - (cal_backend_log_sax_start_element): SAX callback for reading in - log entries - (cal_backend_log_sax_end_element): ditto - (cal_backend_log_sax_parse): Main SAX parser call to parse the log - file looking for particular log entries and creating a CalObjChange - hash with the last change for each object - (cal_backend_get_log_entries): Returns a hash of objects of a given - type changed since the given time - (cal_backend_update_object): Add appropriate log entries - (cal_backend_remove_object): ditto - (cal_backend_get_changed_uids): Implement new idl interface call - (cal_backend_foreach_changed): Convert CalObjChange hash into a list - - * pcs/cal-backend-imc.[hc]: Remove crufty files - - * pcs/cal-backend-file.c (cal_backend_file_get_type_by_uid): New - function that returns the CalObjType for a uid. - - * cal-client/cal-client.h: Update prototypes. - - * cal-client/cal-client.c (build_change_list): Build a list - of CalObjChange items from a corba sequence. - (cal_client_get_changed_uids): New accessor method for the - similarly named addition to the idl file. - - * cal-util/cal-util.h: Update prototypes and add CalObjChangeType - enum. - - * cal-util/cal-util.c (cal_obj_change_list_free): New utility - method to free a list of CalObjChange objects. - - * idl/evolution-calendar.idl: Add get_changed_uids method - and associated types. - -2000-09-18 Christopher James Lahey <clahey@helixcode.com> - - * gui/Makefile.am: Added $(EXTRA_GNOME_CFLAGS) and - $(EXTRA_GNOME_LIBS). Removed unneeded libraries. - - * gui/calendar-model.h, gui/e-calendar-table.c, gui/e-day-view.c, - gui/e-week-view-event-item.c, gui/e-week-view.c, - gui/event-editor.c, gui/gncal-todo.c, gui/gnome-cal.c, gui/main.c, - gui/print.c, gui/dialogs/task-editor.c: Fixed the #include lines - to deal properly with gal. - - * gui/check-filled.xpm: New file since we can't include it from - e-table anymore. - -2000-09-16 Michael Meeks <michael@helixcode.com> - - * gui/Makefile.am (INCLUDES): add datadir - - * gui/calendar-commands.c (calendar_control_activate): use it. - -2000-09-14 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/.cvsignore: Shush - -2000-09-14 JP Rosevear <jpr@helixcode.com> - - * Add headers with GPL notice and credit copyright to those appropriate - - * conduits/todo/todo-conduit-control-applet.c (doHelp): Update name, - authors, copyright for about dialog. - (activate_sync_type): Tidy - - * conduits/todo/Makefile.am: Rename binaries and libs to e-todo* - to avoid conflicts. - - * conduits/todo/e-todo.conduit.in: Reflect binary/lib name changes - - * conduits/todo/e-todo-conduit-control-applet.desktop: ditto - - * conduits/todo/todo.conduit.in: Removed - - * conduits/todo/todo-conduit-control-applet.desktop: Removed - - * conduits/todo/todo-conduit-config.h (todoconduit_load_configuration): - The config file will now be called e-todo-conduit - (todoconduit_save_configuration): ditto - - * conduits/todo/todo-conduit.c: Some renaming to keep consistent. - (pre_sync): Remove commented out function that does not exist. - - * conduits/todo/todo-conduit-control-applet.c: ditto - - * conduits/todo/todo-conduit-config.h: ditto - - * conduits/todo/todo-conduit.h: ditto - - -2000-09-07 Michael Meeks <michael@helixcode.com> - - * gui/calendar-commands.c: Re-write most UI handler code. - -2000-09-13 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-model.c (obj_updated_cb): Removed an unused - variable. - - * gui/calendar-model.c (obj_updated_cb): See if the new object - matches the type of objects we were told to deal with. - (load_objects): Likewise. - -2000-09-13 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend-file.c (remove_component): Only remove the pilot - item from the hash if it exists in the first place. - -2000-09-12 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend-file.c (add_component): plug leakage - -2000-09-12 JP Rosevear <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c: Hack to compile for distcheck. - - * conduits/calendar/calendar-conduit.h: Remove calobj.h dependency - -2000-09-12 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend-file.c (cal_backend_file_load): Use g_int_* - for now - (cal_backend_file_create): ditto - - * conduits/todo/todo-conduit.c (local_record_from_compobject): Make - this actually fill in the todo record. - (find_record_in_repository): Add debug stuff - (iterate_specific): Use the already exisiting utility function - - * pcs/cal-backend-file.c (cal_backend_file_update_pilot_id): correct - the status and id types. g_strdup the uid since this is not a - constified return - (cal_backend_file_get_uid_by_pilot_id): correct the id type - -2000-09-12 Ettore Perazzoli <ettore@helixcode.com> - - * gui/Makefile.am: Remove `ui.xml' stuff. - - * pcs/cal-backend.c: Dont' #include calobj.h anymore as it's gone. - -2000-09-12 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (gnome_calendar_construct): Connect to the - "cal_loaded" signal of the client here. - (connect_load): Removed function. - (disconnect_load): Removed function. - (cal_loaded_cb): Store the URI we are loading in the GnomeCal - structure instead of in a weird closure. This gets rid of the - connect/disconnect mess as well. - (gnome_calendar_open): Store the URI in the GnomeCal. - -2000-09-11 Christopher James Lahey <clahey@helixcode.com> - - * gui/e-day-view.c: Fixed a warning (removed unused variable - gfloat width from e_day_view_get_event_position.) - -2000-09-11 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c: Handle renaming, header cleanup - - * conduits/todo/todo-conduit.h: Rename GCalLocalRecord to - EToDoLocalRecord, header cleanup - -2000-09-11 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c (comp_from_remote_record): Use - description list instead of comment list for pilot todo note - (transmit): Check for null cal component properties, set priority - correctly, use description list instead of comment list. Make - pilot record private when appropriate. - -2000-09-10 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c (comp_from_remote_record): Only - set the due date only if it exists - -2000-09-10 JP Rosevear <jpr@helixcode.com> - - * gui/calendar-model.c (get_is_complete): Relying on the status - field is somewhat faulty since it is related to group scheduling - -2000-09-10 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c (update_calendar_entry_in_repository): - Make log output a little more sensible - (comp_from_remote_record): Minor correction when making a CalComponent - from scratch. - (update_record): Use comp_from_remote_record for new items, rather - than repeating the code here. - -2000-09-10 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c: Remove catch_ret_val function - since its no longer useful. Fix naming of various fields from - the header changes. Use GnomePilotRecord* stuff instead of - ICAL_PILOT_SYNC_* - (e_todo_context_new): Rename from gcalconduit_new_context. Now takes - a pilot id and loads the configuration here - (e_todo_context_destroy): Rename from gcalconduit_destroy_context. - Unref the client and destroy the configuration if they exist here - (start_calendar_server): Change the default calendar name - (local_record_from_comp_uid): Rename from local_record_from_ical_uid - (local_record_from_compobject): Rename from - local_record_from_icalobject. Properly do the pilot id and status. - (comp_from_remote_record): Rename from ical_from_remote_record. - Handle due, complete, classification and pilot stuff properly - (pre_sync): Remove some old stuff. We need to figure out how to - set some of the field values. - (set_status): Reflect pilot status changes from above - (conduit_destroy_gpilot_conduit): Remove cleanup stuff that is - now done by e_todo_context_destroy - (conduit_get_gpilot_conduit): Only set the context as object - data of the conduit. - - * conduits/todo/todo-conduit.h: Rename GCalConduitContext to - EToDoConduitContext. Remove some unused struct fields. - For GCalLocalRecord, rename ical to comp. - -2000-09-11 Damon Chaplin <damon@helixcode.com> - - * gui/dialogs/task-editor.c: changed to use EDateEdit. - - * gui/dialogs/task-editor-dialog.glade: added "None" option to - Classification option menu, and used custom widgets for the date - entries so we can use EDateEdit widgets. - - * gui/event-editor.c: changed to use EDateEdit. Note that this needs - to be fixed at some point to handle invalid dates, i.e. when - e_date_edit_get_time returns -1. - - * gui/calendar-model.c (ensure_task_complete): - (ensure_task_not_complete): new functions to set the related properties - to make sure a task is marked as complete on not, i.e. "Date Completed" - "Status" and "Percent" properties. - -2000-09-08 Damon Chaplin <damon@helixcode.com> - - * gui/calendar-model.c (get_is_complete): use the status field rather - than the completed date, as it is more reliable. - (get_is_overdue): use get_is_complete(). - (calendar_model_mark_task_complete): check if it is already complete, - and if so don't update it. - - * cal-util/cal-component.c (cal_component_get_status): - (cal_component_set_status): added functions to support the STATUS - property. Also added the property to CalComponentPrivate and set it - to NULL in free_icalcomponent(). Someone should check my code as I've - mainly done a Cut & Paste job. - -2000-09-10 JP Rosevear <jpr@helixcode.com> - * conduits/todo/todo-conduit.c: Convert "//" style comments - (local_record_from_ical_uid): Remove iCalObject cruft - (ical_from_remote_record): ditto - (free_match): Properly unref the CalComponent - -2000-09-10 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c (local_record_from_icalobject): Use - cal component pilot stuff properly - (find_record_in_repository): Remove cruft - (ical_from_remote_record): Remove cruft - (update_record): Set the vtype immediately after creation. Remove cruft - - * conduits/todo/todo-conduit.h: Remove iCalObject stuff - - * conduits/todo/todo-conduit-config.h: Move all the config stuff - here, I need to kill the warnings at some point - - * conduits/todo/todo-conduit-control-applet.c (doRevertSettings): - Set all the state variables correctly on a revert - (doSaveSettings): Update original state - (doHelp): Rename from about_cb - (main): Destroy configurations when done - - * conduits/todo/Makefile.am: Tidy - - * pcs/cal-backend-file.c (cbf_pilot_hash): Function for hashing - pilot ids - (cbf_pilot_equal): For hash table of pilot ids - (cal_backend_file_destroy): Destroy pilot id hash - (add_component): Insert the uid into the pilot hash - (remove_component): Remove the uid from the pilot hash - (cal_backend_file_load): Create the pilot hash - (cal_backend_file_create): ditto - (cal_backend_file_get_uid_by_pilot_id): Implement using the pilot hash - (cal_backend_file_update_pilot_id): ditto - - * cal-util/cal-component.h: Update prototypes - - * cal-util/cal-component.c (cal_component_get_pilot_id): Implement - using ical X properties - (cal_component_set_pilot_id): ditto - (cal_component_get_pilot_status): ditto - (cal_component_set_pilot_status): ditto - (cal_component_free_pilot_id): Free a pilot id - (cal_component_free_pilot_status): Free a pilot status - -2000-09-09 Ettore Perazzoli <ettore@helixcode.com> - - * gui/dialogs/Makefile.am (INCLUDES): Add - `-I$(top_builddir)/libical/src/libical' so that we get - `icalversion.h' from the build directory instead of taking it from - the installation directory, which is of course Wrong (tm). - * gui/Makefile.am (INCLUDES): Likewise. - -2000-09-08 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (cal_loaded_cb): New function with the - loading/creation state machine. It is carefully modelled after - the state machine that started the Universe, so bow before it. - (gnome_calendar_construct): Do not connect to cal_loaded here. - (connect_load): The closure for the cal_loaded callback is a bit - tricky, so provide a function to create it and connect to the - signal. - (disconnect_load): Disconnect from the signal and free the - closure. - (gnome_calendar_load_cb): Removed obsolete buggy function. - (gnome_calendar_open): Use the new mechanism. - - * gui/control-factory.c (set_prop): The default filename is now - calendar.ics. - -2000-09-08 JP Rosevear <jpr@helixcode.com> - - * conduits/calendar/calendar-conduit.c (transmit): Use - icaltime_as_timet - -2000-09-08 Christopher James Lahey <clahey@helixcode.com> - - * cal-util/cal-recur.c, gui/e-day-view.c, gui/e-week-view.c, - gui/event-editor.c, gui/getdate.y, gui/gncal-todo.c, - gui/gnome-cal.c, gui/dialogs/task-editor.c: Fixed some warnings. - -2000-09-08 JP Rosevear <jpr@helixcode.com> - - * conduits/calendar/Makefile.am: Tidy - - * conduits/todo/Makefile.am: Tidy - -2000-09-08 Federico Mena Quintero <federico@helixcode.com> - - Fall equinox cleanup! - - OK, I know the equinox is not here yet, but weather has changed - enough to warrant it. - - Sigh. This place is definitely not the tropics. - - * gui/gnome-cal.c (obj_updated_cb): Renamed from - gnome_calendar_object_updated_cb(); fixed prototype. - (obj_removed_cb): Renamed from gnome_calendar_object_removed_cb(); - fixed prototype. - (GnomeCalendarPrivate): Moved all the GnomeCalendar fields to a - private structure so I don't have to rebuild the whole calendar - GUI directory every time something changes in the object. - (GnomeCalendarPrivate): Removed the property bag and the control - fields; they are local to the control-factory now. - (gnome_calendar_update_view_buttons): Remove the - ignore_view_button_clicks mess and just block the signal. - (gnome_calendar_set_view): Added a "focus" argument to indicate - whether we want the main widget in the specified view to grab the - focus. - (gnome_calendar_set_view_internal): Handle the focus argument here. - (gnome_calendar_set_view_buttons): Temporary hack to notify the - calendar about its buttons. - (gnome_calendar_get_selected_time_range): New function. - (gnome_calendar_get_cal_client): New function. - - * gui/control-factory.c (calendar_properties_init): Keep the - property bag local to here; it does not need to be in the calendar - object yet. - (control_factory_fn): Renamed from control_factory(). Just use - control_factory_new_control(). - (control_factory_new_control): Moved the stuff over from - create_control(), and keep the control local to here. Check the - return value of bonobo_control_new(). - - * gui/calendar-commands.c (show_day_view_clicked): Remove the - ignore_view_button_clicks mess. - (new_calendar): Removed the useless "page" argument. - (calendar_control_activate): Use gnome_calendar_set_view_buttons() - for now. - -2000-09-07 Lauris Kaplinski <lauris@helixcode.com> - - * cal-client/Makefile.am: Added -lunicode - - * gui/dialogs/task-editor.c: More UTF-8 wrappers - (priority_index_to_value): Kill warning, add assertion - -2000-09-06 JP Rosevear <jpr@helixcode.com> - - * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): - Use new cal_component_has_recurrences convenience function - - * gui/e-week-view.c (e_week_view_show_popup_menu): ditto - - * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons): - ditto - - * gui/calendar-model.c (calendar_model_value_at): ditto - (calendar_model_value_at): ditto - - * gui/e-day-view.c (e_day_view_on_event_click): ditto - (e_day_view_on_event_right_click): ditto - (e_day_view_on_top_canvas_motion): ditto - (e_day_view_on_top_canvas_motion): ditto - (e_day_view_on_main_canvas_motion): ditto - (e_day_view_on_main_canvas_motion): ditto - (e_day_view_reshape_day_event): ditto - - * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): - ditto - - * gui/e-day-view.c (e_day_view_on_long_event_click): ditto - -2000-09-06 JP Rosevear <jpr@helixcode.com> - - * cal-util/cal-recur.c (cal_recur_generate_instances): Use - new convenience functions and only get the recurrence - stuff if needed. Free the recurrence stuff if used. - -2000-09-05 JP Rosevear <jpr@helixcode.com> - - * cal-util/cal-component.h: Add new prototypes - - * cal-util/cal-component.c (cal_component_has_exrules): Utility - function to determine whether a cal component has any exrules - (cal_component_has_exdates): Ditto for exdates - (cal_component_has_exceptions): Utility function to determine - whether a cal component has any exception rules - (cal_component_has_recurrences):Utility function to determine - whether a cal component has any recurrence rules - -2000-09-05 JP Rosevear <jpr@helixcode.com> - - * gui/event-editor.c (dialog_to_comp_object): Kill all exdates if - there are no dates in the box - - * cal-util/cal-recur.c (generate_instances_for_year): Add a special - case for when there are exceptions but no rrules or rdates. - (cal_obj_remove_exceptions): Use date only compare func - (cal_obj_date_only_compare_func): New compare function that - compares the date only, not the time. - - * gui/event-editor.c (dialog_to_comp_object): Need a break for the - yearly recurrence type - (dialog_to_comp_object): We need to allocate icaltimetypes for the - exdate list - (fill_widgets): Handle a weekly recurrence with no particular day set - (dialog_to_comp_object): Kill all rrules if "None" is selected as - the recurrence type by the user - -2000-09-06 Damon Chaplin <damon@helixcode.com> - - * gui/e-calendar-table.c (e_calendar_table_open_task): uses the new - TaskEditor dialog. - - * gui/dialogs/task-editor.[hc]: - * gui/dialogs/task-editor-dialog.glade: updated. Still need to fix the - 'Status' property (CalComponent doesn't support it yet), and use a - replacement for GnomeDateEdit, since we need to support setting 'None' - as the date. - -2000-09-04 Damon Chaplin <damon@helixcode.com> - - * gui/event-editor.c (obj_updated_cb): - (obj_removed_cb): compare the updated object's uid with the one we - are editing, and just return if it doesn't match. - -2000-09-01 Damon Chaplin <damon@helixcode.com> - - * gui/gnome-cal.c (gnome_calendar_tag_calendar): added check to see - if the client has loaded successfully. Gets rid of a few warnings. - -2000-09-05 JP Rosevear <jpr@helixcode.com> - - * cal-util/cal-recur.c (generate_instances_for_year): The exdate - and rdate lists are a list of icaltimetypes, not CalComponentPeriods - - * gui/e-day-view.c (e_day_view_on_delete_occurrence): The exdate list - is a list of icaltimetypes, not CalComponentDateTimes - -2000-09-05 JP Rosevear <jpr@helixcode.com> - - * gui/e-day-view.c (e_day_view_on_delete_occurrence): Append - the exdate to the list AFTER we create the date value. - -2000-09-05 JP Rosevear <jpr@helixcode.com> - - * cal-util/cal-component.c (cal_component_free_recur_list): Free - the data, not the list element. - -2000-09-05 JP Rosevear <jpr@helixcode.com> - - * cal-util/cal-recur.c (cal_recur_generate_instances): Compute - the event duration using the event start/end times, not the - interval times. - -2000-09-05 JP Rosevear <jpr@helixcode.com> - - * cal-util/cal-recur.c (cal_recur_from_icalrecurrencetype): Check - to see if r->enddate is (time_t)-1 and set to 0 if so - -2000-09-02 Ettore Perazzoli <ettore@helixcode.com> - - * conduits/calendar/Makefile.am (INCLUDES): Add libical include - directories and `$(BONOBO_GNOME_CFLAGS)'. - * conduits/todo/Makefile.am (INCLUDES): Likewise. - -2000-09-02 Lauris Kaplinski <lauris@helixcode.com> - - * gui/event-editor.c: e_utf8 wrappers - - * gui/gncal-todo.c: e_utf8_wrappers - -2000-09-02 Christopher James Lahey <clahey@helixcode.com> - - * conduits/calendar/calendar-conduit.c, - conduits/todo/todo-conduit.c, gui/e-week-view.c, gui/gnome-cal.c: - Fixed some warnings. - -2000-09-01 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (gnome_calendar_new): Use - gnome_calendar_construct() so that we can check for proper - creation of the client. - (gnome_calendar_destroy): Check that the client exists before we - unref it. - (gnome_calendar_construct): Do the CalClient creation here. Bind - the views to it here as well instead of in setup_widgets(). - (gnome_calendar_init): Call setup_widgets() here. - - * gui/e-calendar-table.c (e_calendar_table_destroy): Unref the - model. - -2000-09-01 JP Rosevear <jpr@helixcode.com> - - * conduits/todo/todo-conduit.c: Update for new libical. - Conduits should atleast compile now. - - * conduits/calendar/calendar-conduit.c: ditto - - * Makefile.am: Build the conduits only when they've been - enabled. - -2000-09-01 JP Rosevear <jpr@helixcode.com> - - * gui/event-editor.c: Make toolbar save and close button. - We should put a similar menu option in sometime. - -2000-08-31 JP Rosevear <jpr@helixcode.com> - - * cal-util/cal-recur.c (array_to_list): Use - ICAL_RECURRENCE_ARRAY_MAX instead of MAX_SHORT - -2000-08-31 JP Rosevear <jpr@helixcode.com> - - * gui/event-editor.c (file_delete_cb): Implement delete option - (dialog_to_comp_object): Set the weekday start value and use - local not UTC time - -2000-08-31 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (file_delete_cb): No need to spit a warning - if removal fails. - (event_editor_destroy): Free the exception clist data. Unref the - calendar client here. - (close_dialog): Just call gtk_object_destroy() on the event - editor; the destroy handler will free everything else. - - * cal-client/cal-client.c (cal_client_object_exists): Removed - function; this is not useful because we operate asynchronously. - - * gui/e-day-view.c (e_day_view_on_delete_appointment): No need to - spit a warning if removal fails. - - * gui/e-week-view.c (e_week_view_on_delete_appointment): Likewise. - - * gui/calendar-model.c (calendar_model_delete_task): Likewise. - -2000-08-31 JP Rosevear <jpr@helixcode.com> - - * gui/event-editor.c (file_delete_cb): Implement delete option - (recurrence_toggled): Make an ugly hack to get the recurrence - pages showing properly since we don't yet implement all of the - recurrence rule stuff. - - * cal-client/cal-client.c (cal_client_object_exists): New function - to see if an object exists and is obtainable from the backend - - * cal-client/cal-client.h: Add prototype - -2000-08-31 JP Rosevear <jpr@helixcode.com> - - * gui/gnome-cal.c (editor_closed_cb): Event editor destroyed - callback to do hash cleanup - (gnome_calendar_edit_object): Set event editor calendar client. - - * gui/event-editor.h: Add new prototype - - * gui/event-editor.c: Trash signal stuff. We will manipulate - the client directly. Make the toolbar save and menu save items - work identically. Add icons to the toolbar. - (save_event_object): Call cal_client_update_object - (close_dialog): Unref the client and disconnect signals - Actually destroy the event editor object. - (obj_updated_cb): New function. Doesn't really do anything - yet but it will inform the user the event has changed elsewhere - in the future. - (obj_removed_cb): ditto - (event_editor_set_cal_client): New function to set the calendar - client - - * gui/gnome-cal.c (gnome_calendar_new_appointment): Commit - the sequence to the cal component and use non UTC times. - -2000-08-30 Lauris Kaplinski <lauris@helixcode.com> - - * gui/print.c: Countless small changes for gnome-print 0.21+ - -2000-08-30 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view.[hc]: - * gui/e-day-view-main-item.c: - * gui/e-week-view.[hc]: - * gui/e-week-view-main-item.c: - * gui/calendar-commands.c: - * gui/gnome-cal.[hc]: switched to using new ECalendar widget, - and a few other fixes. - -2000-08-30 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.h (GnomeCal): Removed unused field event_editor. - - * gui/e-day-view.c (e_day_view_key_press): Oops, set the - dtstart/dtend on the component before adding it. - (e_day_view_on_editing_stopped): No need to check for an UID. - Update the summary properly. - -2000-08-30 JP Rosevear <jpr@helixcode.com> - - * gui/e-week-view.c: Make sure the is_utc flag is always - FALSE for icaltime_from_timet - (e_week_view_on_unrecur_appointment): Use icaltimetype struct - from the stack and make sure tzid is always NULL - (e_week_view_key_press): ditto - -2000-08-30 JP Rosevear <jpr@helixcode.com> - - * gui/e-day-view.c: Make sure the is_utc flag is always - FALSE for icaltime_from_timet - (e_day_view_on_unrecur_appointment): Use icaltimetype struct - from the stack and make sure tzid is always NULL - (e_day_view_finish_long_event_resize): ditto - (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 - -2000-08-30 JP Rosevear <jpr@helixcode.com> - - * cal-client/cal-client.c (add_instance): Actually add the - comp_instance struct to the instances list. We now appear - to able to keep events and todos between sessions. Yay! - -2000-08-29 Federico Mena Quintero <federico@helixcode.com> - - Now the views monitor the client by themselves; it does not make - sense to proxy all notifications through the GnomeCal. The - GnomeCal should just be a meta-widget that holds all the views. - - At some later point we'll want to decouple the views from the - GnomeCal so that they can be embedded anywhere; they should emit - signals to request appropriate actions from the toplevel GUI - instead of calling the GnomeCal directly. - - * gui/e-day-view.c (e_day_view_set_cal_client): New function; now - the day view monitors the client by itself. - (cal_loaded_cb): New callback; moved over from - e_day_view_update_all_events(). - (obj_updated_cb): New callback; moved over from - e_day_view_update_event(). - (obj_removed_cb): New callback; moved over from - e_day_view_remove_event(). - (e_day_view_update_all_events): Removed function. - (e_day_view_update_event): Removed function. - (e_day_view_remove_event): Removed function. - (*): Use the day_view->client directly instead of fetching it from - the GnomeCal. - (e_day_view_destroy): Unref the client. - (e_day_view_reload_events): Check if the client is loaded. - (e_day_view_key_press): Set the vtype of the new component. - - * gui/e-week-view.c (e_week_view_set_cal_client): New function. - (cal_loaded_cb): New callback. - (obj_updated_cb): New callback. - (obj_removed_cb): New callback. - (e_week_view_update_all_events): Removed function. - (e_week_view_update_event): Removed function. - (e_week_view_remove_event): Removed function. - (*): Use the week_view->client directly. - (e_week_view_destroy): Unref the client. - (e_week_view_reload_events): Check if the client is loaded. - - * gui/gnome-cal.c (setup_widgets): Set the cal_client on all the - views. - (gnome_calendar_update_all): Do not update the views, since now - they do it themselves. - (gnome_calendar_object_updated_cb): Likewise. - (gnome_calendar_object_removed_cb): Likewise. - (setup_widgets): Remove all to-do list cruft. - (gnome_calendar_colors_changed): Likewise. - (gnome_calendar_todo_properties_changed): Likewise. - - * gui/calendar-commands.h (todo_style_changed): Removed variable. - - * gui/gncal-todo.c: Removed old clist cruft; just left in the - temporary dialog box for now. - -2000-08-29 Dan Winship <danw@helixcode.com> - - * cal-client/client-test.c: - * cal-client/cal-client.c: - * conduits/todo/todo-conduit.h: - * conduits/calendar/calendar-conduit.h: remove USING_OAF checks. - -2000-08-29 JP Rosevear <jpr@helixcode.com> - - * gui/gnome-cal.c (gnome_calendar_edit_object): Use - event_editor_set_event_object - - * gui/event-editor.c (event_editor_set_event_object): Rename - from event_editor_set_ical_object - - * gui/event-editor.h: Update prototype - - * gui/e-week-view.c (e_week_view_on_new_appointment): - Call cal_component_commit_sequence after event changes. Default - to these being all day events. - -2000-08-29 JP Rosevear <jpr@helixcode.com> - - * gui/event-editor.c (dialog_to_comp_object): These are not UTC - times - -2000-08-28 Federico Mena Quintero <federico@helixcode.com> - - * cal-client/cal-client.c (cal_client_is_loaded): New function. - We need this from code that dynamically updates from a client and - could not have connected to the "cal_loaded" signal right after - the client was created. - - * gui/calendar-model.c (load_objects): Do not try to load the - objects if the client has not been loaded yet. - (cal_loaded_cb): Check the status value. - - * gui/calendar-model.h (CalendarModel): Declare the private - structure here so that gdb will give me love. - - * pcs/cal-factory.h (CalFactory): Likewise. - - * pcs/cal.h (Cal): Likewise. - - * cal-client/cal-listener.h (CalListener): Likewise. - - * cal-client/cal-client.h (CalClient): Likewise. - - * pcs/cal-backend.h (CalBackend): This no longer has a private - structure, so remove it. - - * cal-util/Makefile.am (libcal_util_la_SOURCES): Removed the - vCalendar and old iCalendar cruft. - (libcal_utilinclude_HEADERS): Likewise. - Removed the obsolete iCalendar test program. - -2000-08-28 JP Rosevear <jpr@helixcode.com> - - * cal-util/timeutil.h: We no longer need time_from_icaltimetype - as libical has the API for this - - * cal-util/timeutil.c: ditto - - * cal-util/cal-recur.c: Replace time_from_icaltimetype with - icaltime_as_timet - - * gui/calendar-model.c: ditto - - * gui/event-editor.c: ditto - - * gui/gnome-cal.c: ditto - -2000-08-28 Federico Mena Quintero <federico@helixcode.com> - - * pcs/cal-backend-file.c (remove_component): Remove the - icalcomponent from the toplevel calendar here. - (cal_backend_file_update_object): Do not remove it here. - (cal_backend_file_remove_object): Do not remove it here. - (add_component): Add the icalcomponent to the toplevel calendar if - asked to. - (cal_backend_file_update_object): Do not add it here. - -2000-08-28 JP Rosevear <jpr@helixcode.com> - - * gui/event-editor.c (dialog_to_comp_object): Initiliaze tzid to - null, only set recurrence rules and exception dates if there - are any - -2000-08-27 JP Rosevear <jpr@helixcode.com> - - * pcs/cal-backend-file.c (save): Write out the calendar object - (cal_backend_file_update_object): Remove/add the icalcomponent - from our master icalcomponent (the calendar) - (cal_backend_file_remove_object): Remove the icalcomponent - from our master icalcomponent - -2000-08-26 JP Rosevear <jpr@helixcode.com> - - * gui/Makefile.am: Remove gnorba stuff - - * gui/main.c: ditto - - * gui/component-factory.c: ditto - - * gui/control-factory.c: ditto - - * gui/*.gnorba: ditto - -2000-08-25 JP Rosevear <jpr@helixcode.com> - - * gui/e-calendar-table.c (e_calendar_table_init): Uncomment - debug code. - - * gui/calendar-model.c (set_complete): Set the completed - date to the current date - (calendar_model_set_value_at): Handle complete field - -2000-08-25 JP Rosevear <jpr@helixcode.com> - - * gui/calendar-model.c (get_is_complete): Don't attempt to - free this if its null - (calendar_model_duplicate_value): Implement for summary field - value - (calendar_model_initialize_value): Remove debug code - - * gui/e-calendar-table.c: Correct etable init xml - (create_column): Pass the id to e_table_header_add_column - rather than a hard coded one - (e_calendar_table_init): Make sure summary column isn't - added twice. Add an alarms column, else etable won't - work with columns who have an ID higher than that - -2000-08-24 JP Rosevear <jpr@helixcode.com> - - * gui/gncal-todo.c (ok_button): Properly append to list - - * gui/event-editor.c (dialog_to_comp_object): ditto - - * gui/e-day-view.c (e_day_view_on_new_appointment): The base - times are not UTC - - * gui/e-week-view.c (e_week_view_on_new_appointment): ditto - -2000-08-24 JP Rosevear <jpr@helixcode.com> - - * Update for libical 0.19 - -2000-08-24 Christopher James Lahey <clahey@helixcode.com> - - * gui/calendar-commands.c, gui/e-day-view.c, gui/e-week-view.c, - gui/event-editor.c, gui/gncal-todo.c, gui/gnome-cal.c, gui/prop.c: - Fixed some warnings. - -2000-08-24 JP Rosevear <jpr@helixcode.com> - - * gui/e-week-view.c (e_week_view_on_new_appointment): Do not alloc - the struct icaltimetype but point to one on the stack. More - importantly, set the date.tzid to NULL. - -2000-08-24 JP Rosevear <jpr@helixcode.com> - - * gui/gnome-cal.c (save_event_object_cb): Make signal - names saner - (released_event_object_cb): ditto - (gnome_calendar_edit_object): ditto - - * gui/event-editor.h: Make signal names saner - - * gui/event-editor.c (event_editor_class_init): Make signal - names saner now that we don't use ical object - (save_event_object): ditto with callback names - (file_save_cb): ditto - (tb_save_and_close_cb): ditto - (event_editor_set_ical_object): ditto - - * gui/e-day-view.c (e_day_view_update_event): Umm, - != CAL_COMPONENT_EVENT (I hope that wasn't me!) - -2000-08-24 Federico Mena Quintero <federico@helixcode.com> - - * gui/e-day-view.c (e_day_view_on_new_appointment): Do not alloc - the struct icaltimetype but point to one on the stack. More - importantly, set the date.tzid to NULL. - -2000-08-24 JP Rosevear <jpr@helixcode.com> - - * gui/event-editor-dialog.glade: Remove owner field - - * gui/event-editor.c (clear_widgets): Forget about owner field - (get_widgets): ditto - (fill_widgets): ditto - -2000-08-24 JP Rosevear <jpr@helixcode.com> - - * gui/calendar-model.c (calendar_model_initialize_value): Handle - summary field - (calendar_model_value_is_empty): ditto - (calendar_model_free_value): ditto - -2000-08-23 JP Rosevear <jpr@helixcode.com> - - * gui/event-editor-dialog.glade: Remove status bar - - * cal-util/cal-component.c (cal_component_set_rrule_list): Allow - a null list - (cal_component_set_rdate_list): Allow a null list - - * gui/e-day-view.c (e_day_view_on_new_appointment): Commit - the CalComponent sequence - -2000-08-23 Federico Mena Quintero <federico@helixcode.com> - - * gui/main.c: #include <e-util/e-cursors.h> - - * gui/e-day-view-time-item.c (e_day_view_time_item_draw): - Initialize time_min_x1 and hour_r to keep gcc happy. - - * gui/e-day-view.c (e_day_view_update_event_label): Warning fix. - (e_day_view_update_main_canvas_drag): Initialize start_row. - - * gui/e-week-view-event-item.c (e_week_view_event_item_draw): - Initialize time_y_small_min, icon_x. - - * Makefile.am (SUBDIRS): Re-enable the gui directory. - - * gui/prop.c (prop_store_alarm_default_values): Temporarily #if 0 - out. - -2000-08-23 JP Rosevear <jpr@helixcode.com> - - * gui/e-week-view.c (e_week_view_key_press): Set vtype of new - CalComponent - (e_week_view_on_new_appointment): ditto - - * gui/e-day-view.c (e_day_view_on_new_appointment): ditto - -2000-08-23 JP Rosevear <jpr@helixcode.com> - - * gui/e-day-view-time-item.c: Include gnome.h for gettext purposes - - * gui/gnome-cal.c: ditto - - * gui/prop.c: #if out some alarm stuff - -2000-08-23 Federico Mena Quintero <federico@helixcode.com> - - * gui/e-calendar-table.c (e_calendar_table_init): Updated - function. - (e_calendar_table_open_task): Updated function. - -2000-08-21 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-model.c (calendar_model_duplicate_value): Updated - function. - (calendar_model_free_value): Updated function. - (calendar_model_initialize_value): Updated function. - (calendar_model_value_is_empty): Updated function. - (remove_object): Updated function. - (obj_updated_cb): Updated function. - (calendar_model_get_cal_client): Added inline docs. - (calendar_model_delete_task): Updated. - (calendar_model_mark_task_complete): Updated. - (calendar_model_get_cal_object): Updated. - -2000-08-21 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-model.c (set_categories): New function. - (parse_time): Moved over from the old set_time_t(). This just - parses the time and leaves the warning dialog for the caller. - (set_datetime): New function. - (set_geo): Updated old function. - (set_percent): Updated old function. - (set_priority): Updated old function. - (set_summary): New function. - (set_url): New function. - (calendar_model_set_value_at): Updated function. - (calendar_model_is_cell_editable): Updated function. - (calendar_model_append_row): Updated. Added an ugly hack to - accomodate ETable's lack of a real API for adding new items. - Also, don't try to set columns that are not editable. - -2000-08-21 JP Rosevear <jpr@helixcode.com> - - * gui/e-week-view.c (e_week_view_reload_events): - Use CalObjType - - * gui/e-day-view.c (e_day_view_reload_events): ditto - -2000-08-21 JP Rosevear <jpr@helixcode.com> - - * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): - Use CalComponent instead of iCalObject. #if some alarm stuff - -2000-08-21 JP Rosevear <jpr@helixcode.com> - - * gui/e-day-view-top-item.c (e_day_view_top_draw_long_event): - Use CalComponent instead of iCalObject. #if some alarm stuff - -2000-08-21 JP Rosevear <jpr@helixcode.com> - - * gui/e-day-view.h: Update prototypes - - * gui/e-day-view.c (e_day_view_on_unrecur_appointment): - Remove commented out portions. - - * gui/e-week-view.c (e_week_view_on_unrecur_appointment): - Tidy. - -2000-08-21 JP Rosevear <jpr@helixcode.com> - - * gui/e-day-view.c - (e_day_view_update_event): Use CalComponent - instead of iCalObject. Work around not having a compare - dates routine for two CalComponents. - (e_day_view_reshape_long_event): Use CalComponent instead - of iCalObject, #if some alarm stuff - (e_day_view_reshape_day_event): ditto - (e_day_view_reload_events): Use revamped CalClient - (e_day_view_update_event_cb): Use CalComponent - instead of iCalObject - (e_day_view_foreach_event_with_uid): ditto - (e_day_view_remove_event_cb): ditto - (e_day_view_update_event_label): ditto - (e_day_view_find_event_from_uid): ditto - (e_day_view_on_event_click): ditto - (e_day_view_on_event_right_click): ditto - (e_day_view_on_new_appointment): ditto - (e_day_view_on_edit_appointment): ditto - (e_day_view_on_delete_occurrence): ditto - (e_day_view_on_delete_appointment): ditto - (e_day_view_on_unrecur_appointment): ditto - (e_day_view_on_top_canvas_motion): ditto - (e_day_view_on_main_canvas_motion): ditto - (e_day_view_finish_long_event_resize): ditto - (e_day_view_finish_resize): ditto - (e_day_view_free_event_array): ditto - (e_day_view_add_event): ditto - (e_day_view_key_press): ditto - (e_day_view_on_editing_stopped): ditto - (e_day_view_update_top_canvas_drag): ditto - (e_day_view_update_main_canvas_drag): ditto - (e_day_view_on_drag_data_get): ditto - (e_day_view_on_top_canvas_drag_data_received): ditto - (e_day_view_on_main_canvas_drag_data_received): ditto - -2000-08-20 JP Rosevear <jpr@helixcode.com> - - * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons): - Use CalComponent instead of iCalObject. #if some alarm stuff - -2000-08-20 JP Rosevear <jpr@helixcode.com> - - * gui/e-week-view.c (e_week_view_update_event): Use CalComponent - instead of iCalObject. Work around not having a compare - dates routine for two CalComponents. - (e_week_view_reload_events): Use revamped CalClient - (e_week_view_reshape_event_span): Use CalComponent instead - of iCalObject, #if some alarm stuff - (e_week_view_update_event_cb): Use CalComponent instead of - iCalObject - (e_week_view_foreach_event_with_uid): ditto - (e_week_view_remove_event_cb): ditto - (e_week_view_free_events): ditto - (e_week_view_add_event): ditto - (e_week_view_on_editing_stopped): ditto - (e_week_view_find_event_from_uid): ditto - (e_week_view_key_press): ditto - (e_week_view_show_popup_menu): ditto - (e_week_view_on_new_appointment): ditto - (e_week_view_on_edit_appointment): ditto - (e_week_view_on_delete_occurrence): ditto - (e_week_view_on_delete_appointment): ditto - (e_week_view_on_unrecur_appointment): ditto - - * gui/e-week-view.h: Update prototypes. - -2000-08-18 JP Rosevear <jpr@helixcode.com> - - * gui/event-editor.h: Update prototypes. - - * gui/event-editor.c: Need to come back here later to fix the - alarm stuff. The gui also needs to be completely redone to - support the fancier CalComponent settings (exrules, rdates, etc) - There are some warnings that I put in to mark some of these - spots - (event_editor_destroy): Use Calcomponent instead - of iCalObject - (make_title_from_comp): ditto - (clear_widgets): ditto - (fill_widgets): ditto - (classification_get): ditto - (dialog_to_comp_object): ditto - (save_ical_object): ditto - (close_dialog): ditto - (event_editor_set_ical_object): ditto - -2000-08-17 JP Rosevear <jpr@helixcode.com> - - * gui/gncal-todo.c (ok_button): Use CalComponent instead of - iCalObject - (cancel_button): ditto - (gncal_todo_edit): ditto - (add_todo): ditto - (edit_todo): ditto - (delete_todo): ditto - (insert_in_clist): ditto - (gncal_todo_update): ditto - - * gui/gncal-todo.h: Update prototypes - -2000-08-16 JP Rosevear <jpr@helixcode.com> - - Rework gnome-cal.c - alarms are a tad broken ATM so this - will need more cleaning later. - - * gui/gnome-cal.c (snooze): Use CalComponent instead of - iCalObject - (edit): ditto - (audio_notification): ditto - (display_notification_cb): Use CalComponent member of - alarm_notify_closure rather than iCalObject - (display_notification): ditto - (trigger_alarm_cb): ditto. Use CalComponent alarm types - (gnome_calendar_tag_calendar_cb): New - cal_client_generate_instances callback to - mark_gtk_calendar_day's - (gnome_calendar_tag_calendar): Use above callback - (save_ical_object_cb): Use CalComponent instead of - iCalObject - (gnome_calendar_edit_object): ditto - (gnome_calendar_new_appointment): ditto - -2000-08-15 JP Rosevear <jpr@helixcode.com> - - * gui/mark.c (mark_month_item_cb): Callback used to mark every - event in a month. - (mark_month_item): Use cal_client_generate_instances with - above callback - -2000-08-15 JP Rosevear <jpr@helixcode.com> - - * gui/print.c (print_month_small): Use - cal_client_get_objects_in_range - (print_day_details_cb): Callback used to create columns and fill - events into a day view. Code should be shared with e-day-view - in reality. Maybe need to go back to layout.[hc] a bit later - (print_day_details): Use cal_client_generate_instances with - above callback. Iterate over results to expand events to fit. - (print_day_summary_cb): Callback to build list of event info - for a day - (print_day_summary): Use cal_client_generate_instances with - above callback to generate the required event info for printing - (print_todo_details_cb): Callback used create list of todo info - (print_todo_details): Use cal_client_generate_instances with - above callback to generate required todo info for printing. - - * gui/layout.[hc]: No longer used. - -2000-08-12 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-model.c (get_is_overdue): Finished implementing. - (calendar_model_value_at): Handle the color field. - -2000-08-11 Seth Alves <alves@hungry.com> - - * cal-util/cal-component.c (cal_component_get_pilot_id): - (cal_component_set_pilot_id): stubs for pilot id accessors - (cal_component_get_pilot_status): - (cal_component_set_pilot_status): stubs for pilot status accessors - - * conduits/calendar/calendar-conduit.c (transmit): start to - convert to cal-component interface - - * conduits/todo/todo-conduit.c (transmit): same - -2000-08-11 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-model.c (get_geo): Generate a prettier string for - the geographical position. - (get_classification): New function. - (get_categories): New function. - (get_completed): New function. - (get_dtend): New function. - (get_dtstart): New function. - (get_due): New function. - (get_percent): New function. - (get_priority): New function. - (get_summary): New function. - (get_transparency): New function. - (get_url): New function. - (get_has_alarms): New function. - (get_has_recurrences): New function. - (get_is_complete): New function. - (get_is_overdue): New function. - - * cal-util/cal-component.c (scan_property): Handle the GEO - property. - (free_icalcomponent): Likewise. - (cal_component_get_geo): Likewise. - (cal_component_set_geo): Likewise. - (cal_component_free_geo): Likewise. - (cal_component_set_exdate_list): Removed incorrect assertion. - (cal_component_set_exrule_list): Removed incorrect assertion. - (cal_component_get_next_alarm): Oops, this had not been - implemented at all. - (cal_component_has_rdates): New function. - (cal_component_has_rrules): New function. - - * cal-util/cal-component.h (CalComponentField): Added the GEO - property. - -2000-08-11 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (scan_property): Handle the - PERCENT-COMPLETE property. - (free_icalcomponent): Likewise. - (cal_component_get_percent): Likewise. - (cal_component_set_percent): Likewise. - (cal_component_free_percent): Likewise. - (scan_property): Handle the PRIORITY property. - (free_icalcomponent): Likewise. - (cal_component_get_priority): Likewise. - (cal_component_set_priority): Likewise. - (cal_component_free_priority): Likewise. - - * cal-util/cal-component.h (CalComponentField): New enumeration - with the list of fields we support for ETable. - -2000-08-10 Dan Winship <danw@helixcode.com> - - * gui/component-factory.c (owner_set_cb): Update prototype. - -2000-08-10 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (gnome_calendar_new_appointment): New function. - Mostly moved over from calendar-commands.c:display_objedit(). - - * gui/calendar-commands.c (calendar_iterate): Removed. Wheee! - (display_objedit): Removed. - (new_appointment_cb): New function. Just call - gnome_calendar_new_appointment(). - (display_objedit_today): Removed. - (calendar_control_activate): Removed the "New appointment for - today" option, since it is pretty useless. - -2000-08-10 Federico Mena Quintero <federico@helixcode.com> - - * cal-client/cal-client.c (cal_client_generate_instances): There. - A pretty function to generate recurrence instances atomically so - that clients don't have to jump through hoops. Now we can get rid - of the ugly calendar_iterate() function. - -2000-08-09 Cody Russell <bratsche@gnome.org> - - * gui/calendar-commands.c: Make the toolbar honor the user's - gnomecc settings for detachable toolbars. - -2000-08-09 Federico Mena Quintero <federico@helixcode.com> - - * gui/alarm.c (pop_alarm): Oops, subtract the new alarm's trigger - time from the current time. - -2000-08-09 Christopher James Lahey <clahey@helixcode.com> - - * cal-client/cal-client.c: Fixed a warning. - -2000-08-09 Christopher James Lahey <clahey@helixcode.com> - - * cal-client/cal-client.c, gui/e-calendar-table.c, pcs/cal.c: - Fixed some warnings. - -2000-08-08 Federico Mena Quintero <federico@helixcode.com> - - * idl/evolution-calendar.idl (Cal): Added a get_objects_in_range() - method. Takes in a time range and the type of component we are - interested in; returns a list of UIDs. The idea is that - ocurrences get computed in the client; we can have multiple - recurrences in iCalendar and we cannot identify them trivially - across the wire. - (Cal): Removed the get_events_in_range() method. - - * pcs/cal-backend.c (cal_backend_free_uid_list): New function. - (cal_backend_get_objects_in_range): New function. - (cal_backend_get_events_in_range): Removed. - - * pcs/cal-backend-file.c (cal_backend_file_get_objects_in_range): - Implemented new method. - (cal_backend_file_get_events_in_range): Removed. - - * pcs/cal.c (Cal_get_events_in_range): Removed. - (uncorba_obj_type): New function. - (Cal_get_uids): Use uncorba_obj_type(). - (Cal_get_n_objects): Likewise. - (Cal_get_objects_in_range): Implemented new method. - - * cal-client/cal-client.c (cal_client_get_events_in_range): Removed. - (cal_client_get_objects_in_range): Implemented. - (corba_obj_type): New function. - (cal_client_get_n_objects): Use corba_obj_type(). - (cal_client_get_uids): Likewise. - -2000-08-07 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (cal_component_clone): New function. - (cal_component_get_icalcomponent): Ensure that the SEQUENCE - property does not need incrementing. - - * gui/dialogs/alarm-notify-dialog.c (alarm_notify_dialog): Use - CalComponent. Deal with an empty summary property. - -2000-08-07 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (cal_component_get_as_string): Doh, - libical owns the string's memory, so do not free it. - - * cal-client/client-test.c (create_client): Connect to the destroy - signal of the client here. - - * cal-client/test.ics: New test file, modified from Eric Busboom's - test file from RFC 2445. - -2000-08-05 Federico Mena Quintero <federico@helixcode.com> - - * cal-client/client-test.c (dump_component): This was gone for - some reason. - (main): Load a new test file. - -2000-08-04 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (cal_component_commit_sequence): New - function to commit changes to the SEQUENCE property. - (cal_component_get_as_string): Ensure that the sequence has been - committed. - - * cal-client/cal-client.c (cal_client_get_object): Use - CalComponent instead of the old iCalObject. - (cal_client_update_object): Use iCalObject. Commit the SEQUENCE - property before stringifying the object and piping it over to the - Wombat. - -2000-08-04 Seth Alves <alves@hungry.com> - - * conduits/todo/todo-conduit.c (conduit_get_gpilot_conduit): if - oaf isn't initialized by the time the conduit starts, start it - up. we do this because we need to start wombat with oaf, and - gpilotd doesn't currently start oaf. - -2000-08-04 Michael Meeks <michael@helixcode.com> - - * gui/calendar-commands.c (calendar_control_activate): unref. - -2000-08-02 Federico Mena Quintero <federico@helixcode.com> - - * pcs/cal-backend-file.c (cal_backend_file_get_uid_by_pilot_id): - Added stub for now. - (cal_backend_file_update_pilot_id): Likewise. - - * pcs/Makefile.am (libpcs_a_SOURCES): Removed cal-backend-imc.[ch] - from the list of sources. The idea is to move vCalendar importing - to the GUI as a convenience function. - -2000-08-02 Seth Alves <alves@hungry.com> - - * pcs/cal-backend-imc.c (cal_backend_imc_update_pilot_id): call - save (cbimc) after setting the pilot id and status. - -2000-08-02 Joe Shaw <joe@helixcode.com> - - * pcs/cal-backend-file.c (cal_backend_file_update_pilot_id): - Fixed a g_return_if_fail that had two parameters and thus - wouldn't build. - -2000-08-03 Damon Chaplin <damon@helixcode.com> - - * gui/calendar-model.c (calendar_model_append_row): updated to match - the new ETableModel append_row. This meant we could also get rid of - the row_being_added and idle_id hack. - -2000-08-02 Christopher James Lahey <clahey@helixcode.com> - - * gui/calendar-model.c: Emit "model_pre_change" signals as - appropriate. - -2000-08-02 Federico Mena Quintero <federico@helixcode.com> - - * pcs/cal-backend-file.[ch]: New files for the iCalendar file - backend. - - * pcs/Makefile.am (libpcs_a_SOURCES): Added cal-backend-file.[ch]. - - * cal-util/cal-component.c (cal_component_set_icalcomponent): - Return an operation success code for if we are passed a component - of a type we don't support. - -2000-07-31 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-recur.c (*): Use CalComponent and the new property - types instead of the old iCalObject stuff. - (cal_recur_generate_instances): Renamed from - cal_object_generate_events(). Ensure that the component has the - DTSTART property. - (generate_instances_for_year): Renamed from - cal_object_generate_events_for_year(). - (cal_obj_expand_recurrence): Made static. - (cal_recur_from_icalrecurrencetype): New function. We should - really convert this whole file to use struct icalrecurrencetype - instead. - (cal_recur_free): New function. - - * cal-util/cal-recur.h (CalRecurType): Renamed from CalObjRecurType. - (CalRecurrence): Renamed from CalObjRecurrence. - - * cal-util/timeutil.c (time_from_icaltimetype): New function. - - * cal-util/Makefile.am: Commented out the test-recur program. - -2000-08-01 Damon Chaplin <damon@helixcode.com> - - * Removed doc directory, since it is the old gnome-pim docs which - aren't used any more. - - * Makefile.am (SUBDIRS): removed doc. - -2000-07-26 Peter Williams <peterw@helixcode.com> - - * gui/calendar-model.c: compile fix for Solaris - (works under Linux, too; don't know about others) - - * this is a test of whether CVS merge does what I - think it will do. - -2000-07-26 Federico Mena Quintero <federico@helixcode.com> - - OK, it seems that we have all the interesting properties for - single-user calendars now. RFC 2445 can bite me. - - * cal-util/cal-component.c (scan_property): Handle the RRULE - property. Yay!. - (scan_recur): Likewise, yow! - (get_recur_list): Likewise, yeehaw! - (get_recur_list): Likewise, honk honk! - (set_recur_list): Likewise, booooga booooga! - (cal_component_get_rrule_list): Likewise, squeek squeek! - (cal_component_set_rrule_list): That's it, I ran out of sounds. - (cal_component_free_recur_list): Likewise. - (scan_property): Handle the EXRULE property. - (free_icalcomponent): Likewise. - (cal_component_get_exrule_list): Likewise. - (cal_component_set_exrule_list): Likewise. - (set_period_list): Oops, free the old properties as well as - removing them. - (set_text_list): Ditto. - (cal_component_set_exdate_list): Ditto. - - * cal-util/cal-component.c: Put all the functions used to free - returned values all together. - (cal_component_set_rdate_list): Oops, mark SEQUENCE property to be - incremented since the RFC requires it. - (scan_property): Handle the EXDATE property. - (scan_exdate): Likewise. - (free_icalcomponent): Likewise. - (cal_component_get_exdate_list): Likewise. - (cal_component_set_exdate_list): Likewise. - (cal_component_free_exdate_list): Likewise. - -2000-07-26 Jeffrey Stedfast <fejj@helixcode.com> - - * gui/Makefile.am: Fixed a typo - -2000-07-26 Jeffrey Stedfast <fejj@helixcode.com> - - * gui/Makefile.am: Added a few xpm files to the EXTRA DIST section - -2000-07-25 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (cal_component_free_period_list): New function. - (scan_property): Handle the RDATE property. - (scan_period): Likewise. - (free_icalcomponent): Likewise. - (get_period_list): Likewise. - (set_period_list): Likewise. - (cal_component_get_rdate_list): Likewise. - (cal_component_set_rdate_list): Likewise. - (scan_text): Simplify a bit since we only handle the ALTREP - parameter; there is no need to iterate over all parameters. - (scan_datetime): Simplify; just handle the TZID parameter. - (scan_summary): Simplify; just handle the ALTREP parameter. - (cal_component_get_as_string): New function. - - * idl/evolution-calendar.idl (CalObjType): Removed the TYPE_OTHER; - now we only expose the types of objects we know about. - - * cal-util/cal-util.h (CalObjType): Likewise. - - * cal-client/cal-client.c (cal_client_get_n_objects): Likewise. - (cal_client_get_uids): Likewise. - - * conduits/calendar/calendar-conduit.c (get_calendar_objects): Likewise. - (check_for_slow_setting): Likewise. - - * pcs/cal-backend-imc.c (count_objects): Likewise. - (build_uids_list): Likewise. - - * pcs/cal.c (Cal_get_uids): Likewise. - (Cal_get_n_objects): Likewise. - -2000-07-25 Damon Chaplin <damon@helixcode.com> - - * gui/e-calendar-table.[hc]: new ECalendarTable to show an ETable view - for Todo/Event items. - - * gui/task-assigned-to.xpm: - * gui/task-recurring.xpm: - * gui/task-assigned.xpm: - * gui/task.xpm: new pixmaps (all the same at present) to go in the - icon column of the ETable. - - * gui/event-editor.c: hid the silly 'Calendar' labels on the - GnomeDateEdits and hid the times when you select 'All day event'. - Also adjusted the time_t's so that when an all day event finishes on - say midnight 13th May, we show 12th May in the dialog, since it - implicitly includes all of that day up to midnight. - - * gui/dialogs/task-editor-dialog.glade: - * gui/dialogs/task-editor.[hc]: unfinished dialog to edit tasks. - - * gui/gncal-todo.c: temporary hack so that we can use the simple dialog - with our new ETable. - -2000-07-23 Damon Chaplin <damon@helixcode.com> - - * cal-util/calobj.h: added a few more fields. - - * cal-util/calobj.c (ical_object_create_from_vobject): check for a - NULL return from vObjectUStringZValue for URL property to avoid SEGV. - For some reason an empty 'URL:' property appears and causes trouble. - -2000-07-20 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component-factory.c (factory_fn): Update for the new - `evolution_shell_component_new()' arg. - -2000-07-19 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (cal_component_alarm_set_trigger): - Finish filling the trigger. What a pain, again. - (cal_component_alarm_free_trigger): Implemented. - -2000-07-19 Fatih Demir <kabalak@gmx.net> - - * conduits/calendar/calendar-conduit-control-applet.desktop: - - * conduits/todo/todo-conduit-control-applet.desktop: - Added the Turkish desktop entries. - -2000-07-18 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (cal_component_alarm_free): Free the - icalcomponent if this is an unattached alarm. - (scan_alarm_property): Handle the TRIGGER property. - (cal_component_alarm_get_trigger): Ditto. Royal pain. - (cal_component_alarm_set_trigger): Ditto. Less pain. - -2000-07-17 Federico Mena Quintero <federico@helixcode.com> - - * cal-client/cal-client.c (cal_client_get_object): Fixed inline - docs. - (cal_client_new): Ditto. - (cal_client_get_n_objects): Added inline docs. - -2000-07-14 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (CalComponentAlarm): New internal - represntation for alarm components. We really don't map them to a - CalComponent because it is more convenient to handle them as - "child" structures. - (make_alarm): New function to create a CalComponentAlarm from an - icalcomponent representing a VALARM. - (scan_alarm_property): New function to scan a property from an - alarm component. We support ACTION. - (cal_component_get_first_alarm): New function to start an iterator - over the alarms in a calendar component. - (cal_component_alarm_get_action): New function. - (cal_component_alarm_set_action): New function. - -2000-07-13 Seth Alves <alves@hungry.com> - - * conduits/todo/todo-conduit.c: conduit based on the calendar conduit. - this conduit syncs a pilot's ToDoDB database to wombat's list of "todo" - events. - - * gui/gncal-todo.c (simple_todo_editor): set todo's priority control - based on value from ical object during edit. - -2000-07-12 Federico Mena Quintero <federico@helixcode.com> - - * gui/print.c: Revert Michael's GnomeFont patch until the - gnome-print API stabilizes. - -2000-07-12 Michael Meeks <michael@helixcode.com> - - * gui/print.c (titled_box, print_text, print_month_small), - (bound_text): GnomeFont update. - -2000-07-12 Seth Alves <alves@hungry.com> - - * conduits/calendar/calendar-conduit.c: fixed various problems - - * cal-client/Makefile.am: build a static version of the library - to link with the conduits - - * cal-util/Makefile.am: same - -2000-07-11 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (scan_property): Handle the COMPLETED - property. - (free_icalcomponent): Ditto. - (cal_component_get_completed): Ditto. - (cal_component_set_completed): Ditto. - (scan_property): Handle the TRANSPARENCY property. - (free_icalcomponent): Ditto. - (cal_component_get_transparency): Ditto. - (cal_component_set_transparency): Ditto. - (scan_property): Handle the URL property. - (free_icalcomponent): Ditto. - (cal_component_get_url): Ditto. - (cal_component_set_url): Ditto. - - * pcs/cal-factory.c (queue_load_create_job): Removed unneeded - check for the URI. - (load_fn): Be more paranoid about the URI and notify the listener - if we got passed a bad URI. Simplify the termination code a bit. - (create_fn): Likewise. - (queue_load_create_job): Be more paranoid about the URI. - -2000-07-10 Ettore Perazzoli <ettore@helixcode.com> - - * gui/Makefile.am: Remove pilot stuff for now. - - * Makefile.am (SUBDIRS): Remove `conduits'. - -2000-07-10 Dan Winship <danw@helixcode.com> - - * gui/Makefile.am (EXTRA_DIST): remove gnomecal.conduit - - * conduits/calendar/Makefile.am (EXTRA_DIST): We want - calendar.conduit.in, not calendar.conduit. - -2000-07-10 Seth Alves <alves@hungry.com> - - * gui/Makefile.am (SUBDIRS): - * conduits/calendar/Makefile.am: moved calendar-conduit stuff from - the gui directory to here. - - * Makefile.am (SUBDIRS): added conduits to SIBDIRS - -2000-07-08 Ettore Perazzoli <ettore@helixcode.com> - - * gui/calendar-commands.c (calendar_control_activate): Remove - "close calendar" command. - -2000-07-08 Anders Carlsson <andersca@gnu.org> - - * gui/e-week-view.c (e_week_view_on_button_press): Handle mouse wheel scrolling. - - * gui/e-day-view.c (e_day_view_on_time_canvas_button_press): New function to handle - mouse wheel scrolling. - (e_day_view_on_main_canvas_button_press): Handle mouse wheel scrolling. - -2000-07-07 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (scan_property): Handle the SEQUENCE - property. - (free_icalcomponent): Ditto. - (cal_component_get_sequence): Ditto. - (cal_component_set_sequence): Ditto. - (cal_component_free_sequence): Ditto. - (cal_component_set_last_modified): Removed incorrect assertion. - (CalComponentPrivate): New need_sequence_inc flag. The sequence - number must be incremented when certain properties change, so we - store a flag that says if we need to bump it when piping the - object over the wire. - (free_icalcomponent): Reset need_sequence_inc. - (cal_component_set_dtstart): Set need_sequence_inc. - (cal_component_set_dtend): Ditto. - (cal_component_set_due): Ditto. - -2000-07-06 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (scan_property): Handle the - LAST-MODIFIED property. - (free_icalcomponent): Ditto. - (cal_component_get_last_modified): Ditto. - (cal_component_set_last_modified): Ditto. - (get_icaltimetype): New function to get struct icaltimetype - values. - (cal_component_get_created): Use get_icaltimetype(). - (set_icaltimetype): New function to set struct icaltimetype - values. - (cal_component_set_created): Use set_icaltimetype(). - - * cal-util/cal-component.c (scan_property): Handle the CREATED - property. - (free_icalcomponent): Ditto. - (cal_component_free_icaltimetype): Ditto. - (cal_component_get_created): Ditto. - (cal_component_set_created): Ditto. - (cal_component_init): Do not create an UID here. - (ensure_mandatory_properties): New function to ensure that the - mandatory RFC properties are indeed in the component. If they are - not, we create them on the fly. - (cal_component_set_new_vtype): Use ensure_mandatory_properties(). - (cal_component_set_icalcomponent): Ditto. - (cal_component_get_uid): Return the UID in a parameter, not as a - function return value, for consistency's sake. - (scan_property): Handle the DTSTAMP property. - (free_icalcomponent): Ditto. - (cal_component_get_dtstamp): Ditto. - (cal_component_set_dtstamp): Ditto. - -2000-07-04 Damon Chaplin <damon@helixcode.com> - - * gui/gncal-todo.c (gncal_todo_update): Use &obj instead of &ico in - the call to cal_client_get_object(). The ToDo list should work now. - - * gui/event-editor-dialog.glade: set the toplevel GnomeApp to invisible - so it doesn't appear and then resize. - -2000-07-03 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (cal_component_get_summary): Use - CalComponentText instead of CalComponentPropSummary. Removed the - latter typedef. - (cal_component_set_summary): Likewise. - (scan_property): Handle the CLASSIFICATION property. - (cal_component_get_classification): Ditto. - (cal_component_set_classification): Ditto. - - * cal-util/cal-component.c (cal_component_free_text_list): Renamed - from cal_component_free_description_list(). We can share this - function since both comments and descriptions have the same form. - (scan_text): Ditto. - (get_text_list): New function. - (set_text_list): New function. - (cal_component_get_description_list): Use get_text_list(). - (cal_component_set_description_list): Use set_text_list(). - (cal_component_set_uid): Add sanity check. - (cal_component_get_summary): Ditto. - (cal_component_get_description_list): Ditto. - (cal_component_get_dtstart): Ditto. - (cal_component_get_dtend): Ditto. - (cal_component_get_due): Ditto. - (scan_property): Handle the COMMENT property. - (cal_component_get_comment_list): Ditto. - (cal_component_set_comment_list): Ditto. - -2000-07-02 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (scan_categories): Handle CATEGORIES. - This can appear multiple times, so we maintain a list. We - compress them later to a single property with multiple values. - (cal_component_get_categories_list): Ditto. - (cal_component_set_categories_list): Ditto. - (cal_component_free_categories_list): Ditto. - (free_icalcomponent): Properly free the mappings. - -2000-07-02 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (scan_datetime): Handle date/time and - timezone pairs. - (scan_property): Handle DTSTART and DTEND. - (cal_component_free_datetime): Ditto. - (get_datetime): Ditto. - (cal_component_get_dtstart): Ditto. - (set_datetime): Ditto. - (cal_component_set_dtstart): Ditto. - (cal_component_get_dtend): Ditto. - (cal_component_set_dtend): Ditto. - (scan_property): Handle DUE date. - (cal_component_get_due): Ditto. - (cal_component_set_due): Ditto. - -2000-07-01 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (cal_component_get_description_list): - Handle the DESCRIPTION property. There can be multiple - descriptions with parameters each, so we deal with a list instead - of a single structure. - (cal_component_set_description_list): Ditto. - (cal_component_free_description_list): Ditto. - (scan_property): Ditto. - (scan_description): Ditto. - -2000-06-30 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c (cal_component_get_summary): To avoid - passing a million parameters to setters/getters for properties - that support parameters, we now pass client-side structures - instead. Here we use CalComponentPropSummary. - (cal_component_set_summary): Ditto. - -2000-06-29 Christopher James Lahey <clahey@helixcode.com> - - * gui/component-factory.c: Make calendar die when evolution quits. - -2000-06-30 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.c: Change of plans. We use an - icalcomponent from libical as our core representation so that we - can preserve extension fields and fields that we don't (yet) - support. CalComponent is just a wrapper with a nice API that - provides non-iterative, random access to the ical's fields. - (cal_component_destroy): Free the thing correctly. - (cal_component_get_vtype): Re-implement in terms of icalcomponent. - (cal_component_set_icalcomponent): New function to set the - CalComponent's data from an existing icalcomponent. - (cal_component_get_icalcomponent): New function. - (cal_component_set_new_vtype): New convenience function to create - an empty component. - (scan_icalcomponent): Core scanning function. - (scan_property): Another core scanning function. - (cal_component_get_uid): Use the property directly. - (cal_component_get_summary): Ditto. Handle the altrep parameter - as well. - (cal_component_set_summary): Ditto. Feel the pain, motherfucker. - It is ridiculous how much code this involves. - (scan_summary): Ditto. - -2000-06-29 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component-factory.c (owner_set_cb): Get an - EvolutionShellClient instead of an Evolution_Shell to match the - changes in libeshell. - -2000-06-29 Federico Mena Quintero <federico@helixcode.com> - - * gui/Makefile.am: Do not link and include the pilot stuff for the - calendar component, just for the Pilot conduit. Commented out the - Pilot part so that Evolution can build. Sigh, we'll have to - modify gnome-pilot to use OAF. - -2000-06-29 Peter Williams <peterw@helixcode.com> - - * gui/Makefile.am (LINK_FLAGS): Make the calendar-pilot-sync - program conditional on HAVE_GNOME_PILOT, and add - GNOME_PILOT_CFLAGS, GNOME_PILOT_LIBS, and PISOCK_LIBS in the - appropriate places. - -2000-06-29 Seth Alves <alves@hungry.com> - - * pcs/cal.c (Cal_get_uid_by_pilot_id): - (Cal_update_pilot_id): - * pcs/cal-backend-imc.c (cal_backend_imc_update_pilot_id): - (cal_backend_imc_get_uid_by_pilot_id): - * pcs/cal-backend.c (cal_backend_get_uid_by_pilot_id): - (cal_backend_update_pilot_id): server code to service these: - - * gui/calendar-pilot-sync.c: updated to make use of cal-client. - also uses dirty bits on both sides to aid in syncing. - - * cal-client/cal-client.c (cal_client_get_uid_by_pilot_id): new - function -- ask the cal server to return uid given an object's - pilot id. - (cal_client_update_pilot_id): new function -- inform the - cal server of an objects pilot id and pilot dirty-flag. - -2000-06-28 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/cal-component.[ch]: New files for the new iCalendar - component object. Today's properties: basic component type, UID, - SUMMARY. - - * cal-util/Makefile.am: Added cal-component.[ch] to the list of - sources. - -2000-06-27 Michael Meeks <michael@helixcode.com> - - * pcs/Makefile.am (INCLUDES): use BONOBO_VFS_GNOME_CFLAGS. - -2000-06-26 Christopher James Lahey <clahey@helixcode.com> - - * gui/calendar-model.c: Added an #ifdefed value_to_string handler - assignment. - -2000-06-26 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-model.c (calendar_model_duplicate_value): - Implement. - (calendar_model_initialize_value): Implement. - (calendar_model_value_is_empty): Implement. - -2000-06-21 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view.c (e_day_view_reshape_long_event): set event before - using it! - (e_day_view_init): used new colors from tigert. - -2000-06-21 Christopher James Lahey <clahey@helixcode.com> - - * gui/e-day-view.c, gui/e-week-view.c: Remove the usage of the "x" - and "y" arguments. - -2000-06-21 Damon Chaplin <damon@helixcode.com> - - * gui/gnome-cal.c (gnome_calendar_direction): changed so it keeps the - selection range. It just moves it on one day/week etc. This makes - it very handy for the keyboard shortcut code. - - * gui/calendar-commands.c (calendar_control_activate): fixed bug - setting the radio button active. - - * gui/e-day-view.[hc]: added support for keyboard navigation and - selection of the time range. - -2000-06-20 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-model.c (calendar_model_set_value_at): Implemented. - (calendar_model_is_cell_editable): Implemented. - - * cal-client/cal-client.c (cal_client_update_object): Take in an - iCalObject instead of a stringified version. - - * gui/gnome-cal.c (gnome_calendar_update_object): Removed. - (gnome_calendar_remove_object): Removed. - (save_ical_object_cb): Use the CalClient function. - - * gui/e-day-view.c (e_day_view_on_delete_occurrence): Likewise. - (e_day_view_on_unrecur_appointment): Likewise. - (e_day_view_finish_long_event_resize): Likewise. - (e_day_view_finish_resize): Likewise. - (e_day_view_key_press): Likewise. - (e_day_view_on_editing_stopped): Likewise. - (e_day_view_on_top_canvas_drag_data_received): Likewise. - (e_day_view_on_main_canvas_drag_data_received): Likewise. - (e_day_view_on_delete_appointment): Likewise. - - * gui/e-week-view.c (e_week_view_on_editing_stopped): Likewise. - (e_week_view_key_press): Likewise. - (e_week_view_on_delete_occurrence): Likewise. - (e_week_view_on_unrecur_appointment): Likewise. - (e_week_view_on_delete_appointment): Likewise. - - * gui/gncal-todo.c (ok_button): Likewise. - (delete_todo): Likewise. - -2000-06-19 Damon Chaplin <damon@helixcode.com> - - * gui/event-editor-dialog.glade: tidied up dialog a bit, adding - space etc. - - * gui/e-week-view.c (e_week_view_reshape_events): removed debug msg. - -2000-06-18 Ettore Perazzoli <ettore@helixcode.com> - - * cal-util/Makefile.am (INCLUDES): Include from - `$(top_builddir)/libical/src/libical' too. [For the generated - libical `icalversion.h' header.] - * cal-client/Makefile.am (INCLUDES): Likewise. - -2000-06-18 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view.c (e_day_view_on_top_canvas_drag_data_received): - fixed a DnD bug. - -2000-06-17 Dan Winship <danw@helixcode.com> - - * cal-client/Makefile.am (INCLUDES): Fix to not depend on - installed ical.h - -2000-06-17 Damon Chaplin <damon@helixcode.com> - - * gui/e-week-view.c: added little buttons which are shown when there - are more events than will fit in a day. Clicking on the button takes - the user to the 1-Day view and shows the full day. - - * gui/e-day-view.c: - * gui/e-week-view.c: set the "use_ellipsis" arg to TRUE for the EText - items so we get tooltips automatically. Though we may want to use our - own code to show tooltips so we can show the tips when the mouse is - around the edges of the event box, and we may want to show the start - and end times of the event in full. - - * gui/calendar-commands.c (calendar_control_activate): - * gui/gnome-cal.h: added view_toolbar_buttons[] so we can access the - radio buttons in the code easily. We need this if we want to jump to - another view programmatically. - -2000-06-16 Damon Chaplin <damon@helixcode.com> - - * gui/jump.xpm: new icon for the EWeekView to jump to the day. - - * gui/Makefile.am (EXTRA_DIST): added jump.xpm - -2000-06-16 Damon Chaplin <damon@helixcode.com> - - * gui/calendar-model.c (calendar_model_class_init): #ifdef'ed out - references to functions which don't exist yet, so evolution still - compiles. - -2000-06-16 Damon Chaplin <damon@helixcode.com> - - * cal-util/test-recur.c: updated. - - * cal-util/cal-recur.[hc]: mostly finished, though it depends on the - iCalObject struct being updated to support more of iCalendar. - -2000-06-16 Damon Chaplin <damon@helixcode.com> - - * pcs/.cvsignore: added icalendar-test. - -2000-06-15 Damon Chaplin <damon@helixcode.com> - - * cal-util/Makefile.am (test_recur_LDADD): use libical.a - -2000-06-15 Dan Winship <danw@helixcode.com> - - * cal-util/Makefile.am (noinst_PROGRAMS): merge the two separate - noinst_PROGRAMS declarations into one so automake accepts it. - (INCLUDES): include libical src dir so we don't depend on having - ical.h already installed - -2000-06-14 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-model.c: GPtrArray cannot insert stuff in the - middle of the array (!), so use plain GArray everywhere. Sigh. - -2000-06-13 Federico Mena Quintero <federico@helixcode.com> - - * cal-client/cal-client.c (cal_client_get_object): Use vCalendar - again. - - * cal-util/calobj.c (ical_object_find_in_string): From Seth, make - it use vCalendar again. - -2000-06-13 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-model.c (obj_updated_cb): Juggle some eggs in - asynchronous fashion. Finished implementing. - (obj_removed_cb): Implemented. This one needs no juggling. - (calendar_model_set_cal_client): Only load the objects if we have - a client. - (calendar_model_destroy): Disconnect from the client's signals. - - * gui/Makefile.am (evolution_calendar_SOURCES): Added - calendar-model.[ch] to the list of sources. - - * pcs/cal-backend-imc.c (cal_backend_imc_get_n_objects): Doh, - return the computed value. - -2000-06-13 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-model.c (CalendarModelPrivate): Added the array of - objects and the hash table of UID->array index. - (calendar_model_row_count): Return the length directly from the - array instead of asking the Wombat. - (calendar_model_value_at): Implemented. - (calendar_model_new): Create an empty model. We provide a new - setter function now. - (calendar_model_construct): Removed function. - (calendar_model_set_cal_client): New function to set the calendar - client and object type at any time. This lets us reuse a calendar - model object. - - * cal-util/calobj.h (iCalObjectField): Just report whether the - object has alarms; not every single alarm. - -2000-06-13 Ettore Perazzoli <ettore@helixcode.com> - - * gui/Makefile.am (SHELL_OBJS): Removed. - (evolution_calendar_LDADD): Link with - `$(top_builddir)/shell/libeshell.a'. - -2000-06-09 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component-factory.c (factory_fn): Pass NULL for the new args - @create_folder_fn and @remove_folder_fn. - (create_view): Updated to match the new - `EvolutionShellComponentCreateViewFn'. Return - `EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE' if type is not - "calendar". - -2000-06-09 Federico Mena Quintero <federico@helixcode.com> - - * idl/evolution-calendar.idl (Cal): Added a get_n_objects() - method. - - * pcs/cal-backend.c (cal_backend_get_n_objects): New function. - - * pcs/cal-backend-imc.c (cal_backend_imc_get_n_objects): - Implemented. - - * pcs/cal.c (Cal_get_n_objects): Implemented. - - * cal-client/cal-client.c (cal_client_get_uids): Free the ev. - (cal_client_get_n_objects): Implemented. - - * cal-util/calobj.h (iCalObjectField): New enumeration to identify - the fields in an iCalObject. - -2000-06-08 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (event_editor_destroy): Free the private - structure. - -2000-06-08 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/calobj.c (ical_object_to_vobject): Allow for NULL - summaries. - -2000-06-07 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (toolbar): Added missing tooltips. We still - need icons, though. - -2000-06-07 Seth Alves <alves@hungry.com> - - * cal-util/calobj.c (ical_object_find_in_string): put this back in, - it's still used in cal-backend-imc.c:cal_backend_imc_update_object - - * cal-client/cal-client.c (cal_client_get_object): instead of - returning a text representation, decode the text and return an - iCalObject. Also added CalClientGetStatus which indicates - success or type of failure. - - * cal-util/calobj.c (ical_object_find_in_string): #ifed out - ical_object_find_in_string since it is unused now. - - * cal-client/client-test.c (list_uids): track get_object change - * gui/calendar-commands.c (calendar_iterate): same - * gui/e-day-view.c (e_day_view_update_event): same - * gui/e-week-view.c (e_week_view_update_event): same - * gui/print.c (print_day_details): same - (print_day_summary): same - (print_todo_details): same - * gui/gnome-cal.c (trigger_alarm_cb): same - * gui/gncal-todo.c (gncal_todo_update): same - -2000-06-06 Seth Alves <alves@hungry.com> - - * cal-util/icalendar.c, icalendar-save.c: fixed a bunch of problems - * cal-util/calobj.c (ical_object_find_in_string): use libical - instead of libversit - (ical_object_to_string): same - (dump_icalobject): prints the contents of an icalobject for debugging - - * gui/Makefile.am (LINK_FLAGS): link libical.a instead of libical.la - so we don't have to modify the build system of the released libical - * cal-client/Makefile.am (client_test_LDADD): same - * cal-util/Makefile.am (icalendar_test_LDADD): same - -2000-06-06 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/calobj.c (ical_object_destroy): Removed from the public - header; made static. Now everyone should use refcounting. - - * pcs/cal-backend-imc.c (free_ical_object): Use - ical_object_unref(). - (remove_object): Likewise. - -2000-06-02 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-commands.c (print): New function to call the print - engine. - (calendar_toolbar): Added the Print button. - (calendar_control_activate): Added the File/Print item. - - * gui/e-day-view.c (e_day_view_get_selected_time_range): Allow - start_time and end_time to be NULL. - - * gui/e-week-view.c (e_week_view_get_selected_time_range): - Likewise. - - * gui/print.c (range_selector_new): Show the range selector - widgets. Use the correct radio group for all of them! - (print_calendar): Do the dialog box here. We may want to split - this function later into smaller chunks. - -2000-06-05 Damon Chaplin <damon@helixcode.com> - - * gui/e-week-view-event-item.c (e_week_view_event_item_button_press): - allow the right button to popup the menu, even when the event is - being edited. - - * gui/e-week-view.c: - * gui/e-day-view.c: Set the keyboard focus to the EDayView/EWeekView - when the right button is clicked, so that any event being edited is - saved before any action (e.g. opening the Event Editor dialog) is - started. Note that this won't work if we switch to asynchronous - notification. - -2000-06-02 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (tb_save_and_close_cb): Implemented. - (toolbar): Added an icon for the Save and Close command. - (save_ical_object): Recompute the title of the window here. Maybe - it would be better to do it when we actually get the - "object_changed" signal from the CalClient. - (file_close_cb): Implemented. - -2000-06-02 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (save_ical_object_cb): Implemented. - (gnome_calendar_add_object): Removed function, since it was - identical to gnome_calendar_update_object(). Modified the rest - of the code to use only the latter. - (gnome_calendar_remove_object): Be more paranoid about the UID. - (gnome_calendar_update_object): Ditto. Also, renamed this - function from gnome_calendar_object_changed(), for consistency - with the lower-level CalClient interface. - - * gui/event-editor.c (event_editor_class_init): New - "save_ical_object" signal to ask that our parent store the - calendar object to the backend. - (save_ical_object): New function to save the calendar object, - actually if just emits the signal. - (file_save_cb): Implemented. - (dialog_to_ical_object): We want priv-> - alarm_program_run_program_entry (i.e. the entry inside the - GnomeFileEntry), not the file entry itself. - (dialog_to_ical_object): Only insert the recurrence ending date if - the event is recurrent! - -2000-06-02 Christopher James Lahey <clahey@helixcode.com> - - * gui/Makefile.am: Fixed EXTRA_DIST. - -2000-06-01 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (editor_closed_cb): Handler for the - "editor_closed" signal of the event editor; we just destroy it - then. - - * gui/event-editor.c (app_delete_event_cb): Callback used when the - dialog is closed. Release the iCalObject here instead of the - event editor's destroy handler, and emit the new "editor_closed" - signal. - -2000-06-01 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor-dialog.glade: Change of plans. The toplevel - GnomeApp is now generated with Glade instead of being created in - the program code. Otherwise we can't migrate the accelerators to - the new toplevel and they won't work. - - * gui/event-editor.[ch]: EventEditor now derives from GtkObject. - This lets us use the GnomeApp created by libglade and still have - signals and stuff. - - * gui/event-editor.c (create_menu): Tell the UI handler that the - menubar is the GnomeApp's existing one, not to create a new one. - (create_toolbar): Tell the UI handler to use the GnomeApp's - existing toolbar. - (event_editor_focus): New function to raise/focus an event editor. - - * gui/gnome-cal.c (gnome_calendar_edit_object): Use - event_editor_focus(). - -2000-06-01 Ettore Perazzoli <ettore@helixcode.com> - - * gui/calendar-commands.c (calendar_control_activate): Put the - toolbar into a frame to make it look like standard GNOME toolbars. - Also, set `GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL' so that it does not - do evil things when its moved to the left or the right of the - window. - -2000-05-31 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.h (GnomeCalendar): Added a hash table to map - calendar objects to their respective event editors. - - * gui/gnome-cal.c (gnome_calendar_init): Create the - object_editor_hash. - (gnome_calendar_destroy): Free the object_editor_hash. - (gnome_calendar_edit_object): New function to centralize the - launching of event editors; if one already exists for a particular - calendar object, we just raise its window. - (edit): Use gnome_calendar_edit_object(). - - * gui/calendar-commands.c (display_objedit): Use - gnome_calendar_edit_object(). - (display_objedit_today): Likewise. - - * gui/e-day-view.c (e_day_view_on_new_appointment): Likewise. - (e_day_view_on_edit_appointment): Likewise. - - * gui/e-week-view.c (e_week_view_on_new_appointment): Likewise. - (e_week_view_on_edit_appointment): Likewise. - - * gui/event-editor.c (event_editor_new): Do not take in an - iCalObject; rather provide an event_editor_set_ical_object() - function. We need this because a single editor may be switched - between different calendar objects. Also, do not show the event - editor; leave it up to the client code. - (event_editor_construct): Likewise. - (clear_widgets): New function to clear the widgets to default - values. - (fill_widgets): New function to fill in the widgets from the - iCalObject. We don't do this in init_widgets() anymore. - (free_exception_clist_data): New function to free the exceptions - clist data. We were leaking the row data. - (init_widgets): Hook to the destroy signal of the exceptions - clist. - (event_editor_set_ical_object): New function. Now it also makes a - copy of the calendar object for the event editor; clients do not - need to copy it anymore. - (event_editor_destroy): Unref the UI handler as well. - (event_editor_class_init): New "ical_object_released" signal to - notify the parent that we are no longer editing the calendar - object. - (make_title_from_ico): Handle NULL objects. - - * gui/event-editor.h (EventEditor): Removed fields that are no - longer used. - -2000-05-31 Damon Chaplin <damon@helixcode.com> - - * cal-util/Makefile.am: added test-recur test program. - - * cal-util/test-recur.c: new file to test the recurrence code. - - * cal-util/.cvsignore: added test-recur. - - * cal-util/cal-recur.c: updated. - -2000-05-30 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor.c (event_editor_construct): Create the UI - handler after we have constructed the parent GnomeApp. - (main_menu): Menu template is now in place. - (toolbar): Tollbar template is now in place. - (create_toolbar): Turn off labels in the toolbar since it sucks; - it should support non-homogeneous buttons with horizontal icons - and text. - -2000-05-29 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (gnome_calendar_object_changed): Removed the - flags argument, since now we just proxy the calendar object to the - calendar client. - - * gui/event-editor.c (alarm_unit_get): Moved over from - event-editor-utils.c. - - * gui/event-editor-utils.[ch]: Removed files, since the two - functions that were left there (i.e. the ones not present in - e-dialog-widgets) can simply be moved to event-editor.c. - - * gui/Makefile.am (evolution_calendar_SOURCES): Removed - event-editor-utils.[ch] from the list of sources. - -2000-05-27 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor-utils.c: Moved many functions to - e-util/e-dialog-widgets.c. - -2000-05-25 Federico Mena Quintero <federico@helixcode.com> - - * gui/event-editor-dialog.glade: Put the main notebook directly - under a simple GtkWindow. We are going to pull out the notebook - and slap it into our custom-built GnomeApp, anwyays. - - * gui/event-editor.c: Made the EventEditor derive from GnomeApp. - Added a BonoboUIHandler for its menu and toolbar. - (make_title_from_ico): Create a nice title for the window. - (get_widgets): Fetch the Glade widgets here instead of all over - the place. - (event_editor_new): Temporary hack to show the dialog here, just - so that I can test it. - - * gui/Makefile.am (EXTRA_DIST): Added the Glade messages file. - -2000-05-25 Federico Mena Quintero <federico@helixcode.com> - - * gui/main.c (init_bonobo): Do not initialize libglade twice. - - * gui/component-factory.c (create_view): Set the folder_uri - property, otherwise the calendar will not get loaded into the - view. - -2000-05-25 Christopher James Lahey <clahey@helixcode.com> - - * gui/main.c: Make it so that warnings don't crash calendar. - -2000-05-25 Ettore Perazzoli <ettore@helixcode.com> - - * gui/evolution-calendar-control.c: Removed. - - * gui/main.c: New. - - * gui/control-factory.c: New. - * gui/control-factory.h: New. - - * gui/calendar-component-factory.c: New. - * gui/calendar-component-factory.c: New. - - * gui/evolution-calendar-control.c (calendar_control_factory): - Renamed from `calendar_factory'. - (calendar_control_factory_init): Renamed from - `calendar_factory_init'. - - * gui/Makefile.am: Link with the files from `$(builddir)/shell'. - - * gui/evolution-calendar.gnorba: New. - * gui/evolution-calendar.oafinfo: New. - -2000-05-24 Federico Mena Quintero <federico@helixcode.com> - - * gui/print.c (range_selector_new): New function to create the - custom range selector. - (print_dialog): New function to show the print dialog. - (print_calendar): Use the print dialog. - -2000-05-24 Christopher James Lahey <clahey@helixcode.com> - - * gui/Makefile.am: Added libepaned.a. - - * gui/gnome-cal.c: Switched from GtkPaned to EPaned. - -2000-05-22 Federico Mena Quintero <federico@helixcode.com> - - * gui/calendar-commands.c (calendar_get_events_in_range): Removed - function. - - * gui/mark.c (mark_month_item): Use - cal_client_get_events_in_range(). - - * gui/calendar-commands.c (show_year_view_clicked): Comment out, - since we don't have a year view. - - * gui/gnome-cal.c (setup_widgets): Removed the year view stuff. - (gnome_calendar_get_current_view_name): Likewise. - (gnome_calendar_update_view_times): Likewise. - (gnome_calendar_direction): Likewise. - (gnome_calendar_set_view): Likewise. - (gnome_calendar_update_all): Likewise. - (gnome_calendar_object_updated_cb): Likewise. - (gnome_calendar_object_removed_cb): Likewise. - (gnome_calendar_time_format_changed): Likewise. - (gnome_calendar_get_current_time_range): Likewise. - - * gui/gnome-cal.h (GnomeCalendar): Removed the year view stuff. - - * gui/Makefile.am (evolution_calendar_SOURCES): Added layout.[ch], - print.[ch]. Removed quick-view.[ch], year-view.[ch] since they - are no longer used. Removed all the old Pilot crap. - -2000-05-20 Damon Chaplin <damon@helixcode.com> - - * cal-util/cal-recur.[hc]: new files to implement iCalendar recurrence - rules. These are only part finished, but people may like to check that - the architecture seems OK. - -2000-05-17 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view.c (e_day_view_on_delete_occurrence): - * gui/e-week-view.c (e_week_view_on_delete_occurrence): use a copy of - the iCalObject so we detect the change in the "update_event" callback. - Maybe we should just update the view ourselves and then we wouldn't - need to detect any change in the callback. - - * cal-util/calobj.c (ical_object_reset_recurrence): new function to - get rid of any recurrence rules. Used when we 'unrecur' an event. - - * gui/e-day-view.c (e_day_view_key_press): don't add a new event if it - won't fit, or we end up adding a new event for each key press. - (e_day_view_update_event_label): don't update it if it doesn't have - an EText item (i.e. it isn't visible). - - * gui/e-day-view-time-item.c: allow selection of times using this - column. - -2000-05-19 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/timeutil.c (time_add_minutes): Fixed warning message. - (time_add_day): Likewise. - (time_add_month): Likewise. - (time_add_year): Likewise. - (time_from_day): Of all functions, *this* one had to have a bug. - Set the tm.tm_isdst to -1 to specify that we don't know whether - the time is in DST or not. This fixes *many* bugs upstream. - (time_week_begin): Likewise. We never noticed this since the week - functions are never used. - (time_week_end): Likewise. - -2000-05-17 Seth Alves <alves@hungry.com> - - * gui/event-editor.c: hooked up more widget signals to callbacks - to the gladified dialog acts more like the original one. - -2000-05-16 Seth Alves <alves@hungry.com> - - * gui/event-editor.c (recurrence_toggled): hook the radio buttons - to the pages of the notebook. - (append_exception): - (recurrence_exception_added): - (recurrence_exception_deleted): - (recurrence_exception_changed): code to deal with the recurrence - exception list. - -2000-05-15 Seth Alves <alves@hungry.com> - - * gui/event-editor.[ch]: gladeified replacement for eventedit.c - - * gui/event-editor-utils.[ch]: utilities used by event-editor.c - - * gui/event-editor-dialog.glade: glade file used by event-editor.c - -2000-05-14 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (display_notification): Use the alarm - notification dialog. - (display_notification_cb): New callback for the result of the - alarm notification dialog. - - * gui/dialogs/alarm-notify.glade: New file with the alarm - notification dialog. - - * gui/dialogs/alarm-notify-dialog.[ch]: New file. - - * gui/dialogs/Makefile.am: New file. - - * gui/Makefile.am (SUBDIRS): Added the dialogs directory. - -2000-05-13 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (trigger_alarm_cb): Better error checking, and - plug leaks of str_ico and ico. - - * gui/evolution-calendar-control.c (main): Initialize libglade. - -2000-05-13 Ettore Perazzoli <ettore@helixcode.com> - - * pcs/Makefile.am (INCLUDES): Add - `-I$(top_builddir)/libical/src/libical'. - -2000-05-12 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/calobj.c (generate): Use a (dtend - dtstart) offset to - compute the ending time of the occurrence. This takes care of - recurring events that span multiple days. Also, removed the DST - condition since it did not look right at all: if you have a daily - appointment at 18:00, it still should happen at 18:00 even during - daylight savings. - - * gui/gnome-cal.c (gnome_calendar_tag_calendar): Use the timeutil - functions instead of calculating the month's times by hand. Use - cal_obj_instance_list_free() instead of freeing the list by hand. - Clip the range we pass to mark_gtk_calendar_day(). - (mark_gtk_calendar_day): Fixed off-by-one error at the end of the - month by adding real day offsets. - -2000-05-11 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (add_alarms_for_object): New function to add - today's alarms for a single object. - (gnome_calendar_object_updated_cb): Update the object's alarms. - - * idl/evolution-calendar.idl (Cal): Added a - get_alarms_for_object() method. - - * pcs/cal.c (Cal_get_alarms_for_object): Implemented method. - - * pcs/cal-backend.c (cal_backend_get_alarms_for_object): New - function. - - * pcs/cal-backend-imc.c (cal_backend_imc_get_alarms_for_object): - Implemented. - - * cal-client/cal-client.c (cal_client_get_alarms_for_object): New - function. - -2000-05-11 Dan Winship <danw@helixcode.com> - - * gui/calendar-commands.c (calendar_control_activate): Now that we - depend on current gnome-libs we can make the toolbar detachable - again. - - * pcs/icalendar-save.c (timet_to_icaltime): remove unused timezone - variable to make this compile on BSD systems (where timezone is - the name of a function) - -2000-05-11 Federico Mena Quintero <federico@helixcode.com> - - * gui/gnome-cal.c (gnome_calendar_update_all): Removed unused - arguments. Load the initial alarms here. - (load_alarms): New function to load a day's worth of alarms. - (gnome_calendar_class_init): Eeeek! This was taking in an - incorrect argument type. - (gnome_calendar_init): Now the calendar keeps a hash table of - UIDs->queued alarms. Create the hash table here. - (gnome_calendar_destroy): Destroy the alarms hash table. - (gnome_calendar_object_updated_cb): Remove the alarms for the - object and regenerate them. - (gnome_calendar_object_removed_cb): Remove the alarms for the - object. - - * gui/alarm.c (alarm_add): Do not take in a CalendarAlarm, just - the trigger time, the callback and the closure data. Return an - opaque identifier for the alarm so that it can be removed by the - client code if needed. Use the queue_alarm() helper function. - (queue_alarm): Helper function to actually queue the alarm and set - up the itimer. Deal with a nonzero return value from - setitimer(). - (alarm_remove): New function to remove an alarm based on its ID. - (pop_alarm): New helper function; pops the first alarm of the - queue and resets the timer as appropriate. - (alarm_ready): Simplified a lot by using pop_alarm(). - - * idl/evolution-calendar.idl (Cal): Added get_alarms_in_range(). - - * pcs/cal.c (build_instance_seq): New function to build a CORBA - sequence from the internal list of instances. - (Cal_get_events_in_range): Use build_instance_seq(). - (Cal_get_alarms_in_range): Implemented new method. - - * pcs/cal-backend.c (cal_backend_get_alarms_in_range): New - function with the get_alarms_in_range() engine. - - * pcs/cal-backend-imc.c (cal_backend_imc_get_alarms_in_range): - Implemented the get_alarms_in_range() method. - - * cal-client/cal-client.c (cal_client_get_alarms_in_range): New - client-side function for getting the alarms. - (build_instance_list): New helper function to build the - CalObjInstance list from the CORBA sequence. - (cal_client_get_events_in_range): Use build_instance_list(). - - * gui/calendar-commands.h: #include <cal-util/calobj.h>. #include - "gnome-cal.h". - - * gui/e-week-view.c: #include "calendar-commands.h" instead of - main.h; the latter is an obsolete file and will be killed. - - * gui/evolution-calendar-control.c (main): Call init_bonobo() - before anything else. We need the GTK+ object system initialized. - - * gui/Makefile.am (evolution_calendar_SOURCES): Do not use main.h. - - * cal-util/cal-util.c (cal_alarm_instance_list_free): New function. - -2000-05-10 Matt Loper <matt@helixcode.com> - - * gui/calendar-commands.c (calendar_control_activate): Move - "about" menuitem to the help menu. - -2000-05-10 Christopher James Lahey <clahey@helixcode.com> - - * gui/Makefile.am: Added main.h. Combined the two EXTRA_DIST - sections. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * pcs/cal-backend-imc.c: Set the format when creating a new - calendar. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * pcs/cal-factory.c: Removed double free of method_string in - uri->method_string. - -2000-05-08 Ettore Perazzoli <ettore@helixcode.com> - - * pcs/cal.h: Include "calendar/pcs/evolution-calendar.h" instead - of "evolution-calendar.h". - - * pcs/cal-backend.h: Include "calendar/pcs/evolution-calendar.h" - instead of "evolution-calendar.h". - -2000-05-08 Seth Alves <alves@hungry.com> - - * gui/e-day-view.c (e_day_view_on_delete_appointment): call - e_day_view_stop_editing_event here to avoid a divide by zero - a bit further on. i'm not sure if this is the best fix for this. - -2000-05-08 Federico Mena Quintero <federico@helixcode.com> - - * pcs/cal-backend.h (CalBackendClass): CalBackendClass now is just - an interface for calendar backends; this is an abstract class. - Put in the vtable for the backend methods. - - * pcs/cal-backend.c (cal_backend_new): Removed function, since - CalBackend is not just an abstract class. - Removed implementation-specific functions and made public - functions call the virtual methods instead. - - * pcs/cal-backend-imc.[ch]: New files with the CalBackendIMC - implementation; this implements a backend for iCalendar and - vCalendar files. Moved the implementation-specific stuff from - cal-backend.[ch] to here. - - * pcs/cal-backend-imc.c (CalendarFormat): Moved enumeration to - here. Added a CAL_UNKNOWN value for when the backend is not - loaded yet. - (cal_backend_imc_init): Initialize priv->format as CAL_UNKNOWN. - (save_to_vcal): Use the same VCProdIdProp value as in - cal-util/calobj.c. Use "1.0" as the VCVersionProp as per the - vCalendar spec. - (ensure_uid): Return nothing, since the result value need not be - used anymore. - (add_object): Since we mark the calendar as dirty anyways, we do - not need to check the result value of ensure_uid() anymore. - (remove_object): Asssert that we know how to handle the object's - type. We do this in add_object() anyways. - - * pcs/Makefile.am (libpcs_a_SOURCES): Added cal-backend-imc.[ch]. - - * gui/gnome-cal.c: Replaced debugging printf()s with g_message() - so that we can see the line number where they occur. - - * gui/gnome-cal.c (gnome_calendar_load_cb): Sort of handle the - LOAD_METHOD_NOT_SUPPORTED result code, and added a default for the - switch. - - * cal-client/cal-listener.h (CalListenerLoadStatus): Removed - enumeration; it is stupid to translate all values for the - CalClient when it is going to translate them again. - (CalListenerClass::cal_loaded): This signal now passes the - LoadStatus directly from the CORBA side. - - * cal-client/cal-listener.c (Listener_cal_loaded): Do not - translate the status value. - - * cal-client/cal-client.h (CalClientLoadStatus): Added the - CAL_CLIENT_LOAD_METHOD_NOT_SUPPORTED error code. - - * cal-client/cal-client.c (cal_loaded_cb): Translate the CORBA - version of the LoadStatus result code. - - * pcs/cal-factory.c (CalFactoryPrivate): New methods field for the - hash table from method strings to the GtkTypes for backend class - types. - (cal_factory_init): Create the priv->methods hash table. - (cal_factory_destroy): Free the priv->methods hash table. - (cal_factory_register_method): New function to register a backend - class for a particular URI method. - (launch_backend_for_uri): New function to launch a backend for a - particular URI's method. - (load_backend): Use launch_backend_for_uri(). Move the error - notification code from load_fn() to here. - (create_backend): Use launch_backend_for_uri(). Move the error - notification code form create_fn() to here; it is #ifdefed out - since currently cal_backend_create() does not have any error - reporting capabilities. - - * idl/evolution-calendar.idl (Listener::LoadStatus): Added a - PROTOCOL_NOT_SUPPORTED error code. - - * pcs/cal-factory.c (cal_factory_load cal_factory_create): Removed - functions, since they were supposed to be internal only. - (CalFactory_load): Call queue_load_create_job() directly. - (CalFactory_create): Likewise. - -2000-05-08 Damon Chaplin <damon@helixcode.com> - - * gui/e-week-view.c (e_week_view_remove_event_cb): - * gui/e-day-view.c (e_day_view_remove_event_cb): don't set the ico->uid - to NULL or we won't find any other occurrences of the event. Set the - editing_event_day/num to -1 instead. - - * gui/e-week-view-event-item.c (e_week_view_event_item_draw): fixed the - positioning of the icons for long events. - - * cal-util/calobj.c (ical_object_normalize_summary): forgot to - terminate the string. - -2000-05-07 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view.c (e_day_view_on_main_canvas_drag_data_received): - (e_day_view_on_top_canvas_drag_data_received): show the EText item, - just in case it hasn't moved, otherwise it won't appear. - - * gui/e-day-view.h (E_DAY_VIEW_BAR_WIDTH): increased from 6 to 8 to - make it easier to drag an event. Also increased E_DAY_VIEW_GAP_WIDTH - since it must be >= the BAR_WIDTH. - -2000-05-07 Matt Loper <matt@helixcode.com> - - * gui/evolution-calendar-control.c (PROPERTY_CALENDAR_URI): - Changed to "folder_uri" from "calendar_uri". - (set_prop): The uri given to us is a directory, so we append a - filename onto the end before we use it. - -2000-05-06 Damon Chaplin <damon@helixcode.com> - - * cal-util/timeutil.c (time_day_begin): - (time_day_end): changed these so they just do a simple localtime(), - update the struct tm, then do a mktime(). I don't know why it used to - look at the tm_isdst flags etc. From a little test program I wrote - which steps through testing every hour for a year it wasn't working - correctly, and the new code does. - (time_add_day): also got rid of the stuff that looked at tm_isdst here. - My test program now works better. - -2000-05-06 Chris Toshok <toshok@helixcode.com> - * gui/.cvsignore: ignore evolution-calendar.pure - - * gui/Makefile.am: add support for building evolution-calendar.pure - -2000-05-06 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view.c: - * gui/e-week-view.c: finish editing event when user hits Return key. - (e_week_view_on_text_item_event): stop event signals after doing any - other calls, since otherwise it will also stop any other resulting - event signals. - - * gui/e-week-view-event-item.c (e_week_view_event_item_draw): don't - draw the start/end times while editing. - - * gui/eventedit.c: changed the Summary field to a GtkEntry, since we - now only want a single line of text. - - * cal-util/calobj.c (ical_object_normalize_summary): new function to - convert the summary field to a single line of text, by converting any - sequence of CR & LF characters to a single space. - (ical_object_create_from_vobject): call the above function. I think - all functions that load iCalObjects go through this. - (ical_new): called it here as well just in case. - -2000-05-06 Damon Chaplin <damon@helixcode.com> - - * gui/week-view.[hc]: removed. - -2000-05-06 Damon Chaplin <damon@helixcode.com> - - * gui/gncal-day-panel.[hc]: - * gui/gncal-day-view.[hc]: - * gui/gncal-full-day.[hc]: - * gui/gncal-week-view.[hc]: - * gui/layout.[hc]: - * gui/view-utils.[hc]: removed old calendar view files. - -2000-05-06 Damon Chaplin <damon@helixcode.com> - - * cal-util/calobj.[hc]: added guint ref_count to iCalObject struct, - and ical_object_ref/unref() functions. I've updated all the gui/ - stuff to use ref_counts but I haven't touched the pcs/ stuff. Maybe - just using ical_object_destroy() is OK there. - - * gui/gncal-todo.c: - * gui/calendar-commands.c: - * gui/eventedit.c: - * gui/e-week-view.c: - * gui/e-day-view.c: use refcounting for iCalObjects. - - * gui/e-day-view-main-item.c: - * gui/e-day-view-top-item.c: - * gui/e-day-view.c: try not to ever draw outside the event, even when - the event is very small. - -2000-05-05 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view.c: don't allow recurring events to be resized or - dragged, and don't show the resize/drag cursors. Actually it may be - better to let the user do the resize/drag and then ask them what they - want to do - change the single occurrence or the entire series. - - * gui/e-day-view-time-item.c (e_day_view_time_item_show_popup_menu): - use e_auto_kill_popup_menu_on_hide() to destroy the popup menu. - - * gui/popup-menu.c: include e-gui-utils.h - -2000-05-04 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view.c (e_day_view_foreach_event_with_uid): for the long - events pass E_DAY_VIEW_LONG_EVENT as the day. Fixes SEGV. - - * gui/calendar-commands.c: when we switch views, grab the focus. - - * gui/gnome-cal.c (gnome_calendar_tag_calendar): - (gnome_calendar_mark_gtk_calendar_day): changed this so it uses - cal_client_get_events_in_range(), and doesn't load any objects. - Also just return if it isn't visible. - - * gui/calendar-commands.c (calendar_get_events_in_range): call - g_list_sort() to sort the list rather than g_list_insert_sorted() for - each element. It is much more efficient. - Also changed it so that the co->ev_start/end fields are copied from - the CalObjInstance rather than the parameters to the function - (that is right, isn't it?) - Also freed the list elements, and finally the list. - (calendar_iterate): changed this to use cal_client_get_events_in_range - since that is more efficient than getting all the uids and then loading - and parsing all the events. - - * pcs/cal-backend.c (save): output the '... saved' message before - freeing the string! - - * gui/gncal-todo.c (gncal_todo_update): - * gui/e-week-view.c (e_week_view_update_event): - * gui/e-day-view.c (e_day_view_update_event): - * gui/calendar-commands.c (calendar_get_events_in_range): - (calendar_iterate): free obj_string after it is parsed. - -2000-05-02 Damon Chaplin <damon@helixcode.com> - - * gui/calendar-commands.c (calendar_control_activate): set the active - radio button here. Oops - it wasn't a Bonobo problem after all. - - * gui/popup-menu.c (popup_menu): added call to - e_auto_kill_popup_menu_on_hide() to destroy the menu. - - * gui/e-week-view.c (e_week_view_show_popup_menu): - * gui/e-day-view.c (e_day_view_on_event_right_click): ico->user_data - isn't useful any more, since the event editor keeps its own iCalObject. - So for now we make the menu commands available even when the event is - being edited in the event editor. - Also corrected misspellings of 'occurance' -> 'occurrence'. - - * gui/eventedit.c (event_editor_destroy): destroy the iCalObject. - The event editor now uses its own independent iCalObject. - - * gui/e-week-view.c (e_week_view_on_unrecur_appointment): - * gui/e-day-view.c (e_day_view_on_unrecur_appointment): create a new - uid for the new single instance. I'm not sure what we should do about - the creation/last modification times of the objects. - - * gui/e-week-view.c (e_week_view_on_edit_appointment): - * gui/e-day-view.c (e_day_view_on_edit_appointment): duplicate the - iCalObject before passing it to the event editor, since it will change - the fields. If we don't duplicate it we won't know what has changed - when we get the "update_event" callback. - - * gui/e-week-view.c (e_week_view_key_press): - * gui/e-day-view.c (e_day_view_key_press): set the created and last_mod - times of the new iCalObject. We may want to set the default alarm as - well. - - * cal-util/calobj.c (ical_gen_uid): made this function public so we - can generate new uids if necessary. - -2000-05-01 Damon Chaplin <damon@helixcode.com> - - * gui/gnome-cal.[hc] (gnome_calendar_get_current_time_range): new - function to get the currently seleted time range form the current view. - - * gui/calendar-commands.c (display_objedit): use the above function - to get the time for the new appointment. - - * gui/e-week-view.c: - * gui/e-day-view.c: use a shallow copy of the ico when we update the - times (when resizing/dragging). Otherwise we won't detect that the - time has changed in the "update_event" callback. - - Also added functions to get the currently selected time range. - -2000-04-30 Seth Alves <alves@hungry.com> - - * pcs/icalendar-save.c (icalcomponent_create_from_ical_object): set - attendee and contact address correctly. - - * pcs/cal-backend.c (icalendar_calendar_load): init priv->object_hash - when loading. - (cal_get_type_from_filename): if file extension is .ical, consider - the file an ical file. - -2000-05-01 Damon Chaplin <damon@helixcode.com> - - * cal-util/calobj.c (ical_object_compare_dates): new function to see - if the event dates have changed (including any recurrence rules). - It is used for optimization when we get the "object_changed" signal. - We have to do far less work if the dates are unchanged. - - * gui/e-week-view.c: - * gui/e-day-view.c: only draw the selection when we have the keyboard - focus, since the user expects to be able to type in a new event when - the selection is shown. Also keep the selection when we lose focus, - but just don't show it. - - Also quite a few changes to cope with the new client/server - architecture. - - * gui/e-day-view-top-item.c (e_day_view_top_item_draw): - * gui/e-day-view-main-item.c (e_day_view_main_item_draw): - * gui/e-week-view-main-item.c (e_week_view_main_item_draw_day): - only draw the selection if the widget has the keyboard focus. - - * gui/gnome-cal.c (mark_gtk_calendar_day): fixed so it works with - events longer than one day. And changed the code for updating events - in the new views. - -2000-04-27 Ettore Perazzoli <ettore@helixcode.com> - - * gui/evolution-calendar-control.c - (init_bonobo): OAFized. - - * gui/main.c (main): Initialize with OAF if `USING_OAF'. - - * gui/evolution-calendar-control.c: New #define - `CONTROL_FACTORY_ID', varying according to whether we are - `USING_OAF'. - (calendar_factory_init): Use `CONTROL_FACTORY_ID'. - - * gui/Makefile.am: Updated for OAF. - - * pcs/cal-factory.h: Explicitly #include - "calendar/pcs/evolution-calendar.h" instead of just - "evolution-calendar.h". - - * cal-client/cal-client.c (cal_client_construct) [USING_OAF]: Use - OAF. - - * cal-client/client-test.c (init_corba): New function, implemented - differently depending on `USING_OAF'. - -2000-04-27 <alves@hungry.com> - - * pcs/cal-backend.c (cal_backend_load): fix memory leak - (save_to_vcal): same - (save): same - (cal_backend_load): same - -2000-04-26 Christopher James Lahey <clahey@helixcode.com> - - * cal-util/.cvsignore: Replaced libcal-util.la with *.la - - * pcs/.cvsignore: Added *.la and *.lo. - -2000-04-25 Federico Mena Quintero <federico@helixcode.com> - - * pcs/cal-factory.c (backend_last_client_gone_cb): Renamed from - backend_destroy_cb. Now we use it for the "last_client_gone" - signal from the backend. Also, unref the backend to destroy it. - (add_backend): Connect to the "last_client_gone" signal of the - backend. - (cal_factory_get_n_backends): New function to query the number of - running backends. - - * pcs/cal-backend.c (cal_backend_class_init): Register the new - "last_client_gone" signal. It is emitted when the last Cal client - goes away. It is used to notify the factory when a backend may be - safely destroyed. - (cal_destroy_cb): Emit the "last_client_gone" signal when the last - client disconnects from the backend. - -2000-04-25 Seth Alves <alves@hungry.com> - - * gui/e-day-view.c (e_day_view_find_event_from_ico): compare - iCalObjects by their UIDs instead of by their pointers. - - * pcs/cal-backend.c (cal_backend_destroy): don't save on destroy. - -2000-04-25 Ettore Perazzoli <ettore@helixcode.com> - - * cal-client/Makefile.am: Add `$(datadir)/idl'. - - * pcs/Makefile.am (idl_flags): Add `$(datadir)/idl'. - (INCLUDES): Use `$(BONOBO_GNOME_CFLAGS)'. - -2000-04-25 Seth Alves <alves@hungry.com> - - * gui/gnome-cal.c (gnome_calendar_destroy): hook for widget - destroy -- used to unref the CalClient so wombat knows we are gone. - (gnome_calendar_class_init): added a class init for this widget. - - * gui/e-day-view.c (e_day_view_update_event): allow for null ico - - * gui/e-week-view.c (e_week_view_update_event): allow for null ico - -2000-04-24 Federico Mena Quintero <federico@helixcode.com> - - * cal-client/client-test.c (main): The path to the test calendar - changed when we moved stuff around. Users will have to tweak this - for their CVS setup, anyways. - (create_client): Create or load the calendar as appropriate. - (client_destroy_cb): Exit the main loop if both clients are gone. - (main): Connect to the "destroy" signal of the clients so that we - can terminate the test program. - -2000-04-24 Seth Alves <alves@hungry.com> - - * pcs/icalendar.c (parse_person): allow for null CN - (parse_person): allow for null sent_by - - * pcs/Makefile.am: build icalendar-test - - * pcs/icalendar-test.c: a test which loads an ical file and - converts it to our internal format, and then saves it back out. - -2000-04-24 Damon Chaplin <damon@helixcode.com> - - * gui/Makefile.am: added new source files and pixmaps, and removed - old source files, which can be deleted. - - * gui/e-week-view-titles-item.[hc]: - * gui/e-week-view-main-item.[hc]: - * gui/e-week-view-event-item.[hc]: - * gui/e-week-view.[hc]: new files implementing the week/month views. - - * gui/yearview.xpm: - * gui/monthview.xpm: - * gui/weekview.xpm: - * gui/workweekview.xpm: - * gui/dayview.xpm: new pixmaps for the toolbar buttons. These aren't - intended to be the final pixmaps. - - * gui/calendar-commands.c: added radio buttons to the toolbar to - switch between the calendar views, and moved the am_pm_flag here so we - can get rid of view-utils.c. - - * gui/gnome-cal.[hc]: made it a subclass of GtkVBox, rearranged the - widgets into 2 notebooks, and added the selection_start_time and - selection_end_time fields. - - * gui/goto.c: updated to use new selection time range. - - * gui/quick-view.c: added '#include <gtk/gtkwindow.h>' so it compiles. - - * gui/e-day-view.[hc]: changed the interface to support the new - selection time range, got rid of a few debugging messages and changed - a few bits. - -2000-04-21 Seth Alves <alves@hungry.com> - - * pcs/icalendar-save.c: start on code to do the opposite of - icalendar.c (convert from iCalObjects to libical's icalcomponents). - - * gui/calendar-commands.c (calendar_control_activate): moved - "About Calendar" into the View menu so it shows up. - -2000-04-20 Seth Alves <alves@hungry.com> - - * gui/gnome-cal.c (gnome_calendar_changed_cb): new function: callback - for listener's object updated signal. - (gnome_calendar_object_removed_cb): new function: callback for - listener's object removed signal. - (gnome_calendar_new): hook up listener's "obj_updated" and - "obj_removed" signals so if evolution is running twice, - they will both see changes right away. - (gnome_calendar_object_changed): don't call update_all, since - it will be called by the listener. - (gnome_calendar_remove_object): don't call update_all - (gnome_calendar_add_object): don't call update_all - - * gui/gncal-full-day.c (child_realize): create fullday's gcs - even if pixmap_bell has already been created. this was - causing crashes if the calendar was run twice. - -2000-04-19 Seth Alves <alves@hungry.com> - - * gui/eventedit.c (ee_rp_init_rule): changed the order around - a bit to avoid a Gtk-CRITICAL crash - - * gui/gncal-todo.c (gncal_todo_update): fixed code to populate - the todo clist - - * cal-client/cal-client.c (cal_client_get_uids): don't check - type against CALOBJ_TYPE_ANY since it will always match. - (cal_client_get_uids): same (re: CALOBJ_TYPE_ANY) - - * pcs/cal-backend.c (build_uids_list): same (re: CALOBJ_TYPE_ANY) - - * pcs/cal.c (Cal_get_uids): same (re: CALOBJ_TYPE_ANY) - - * pcs/cal-backend.c (remove_object): don't call save from here - because in all cases the caller of remove_object calls save - - * gui/calendar-commands.c (calendar_set_uri): calls gnome_calendar_open - instead of checking on disk and calling load or create. - - * gui/gnome-cal.c (gnome_calendar_object_changed): fixed to use - cal_client_update_object -- editing and dragging events works again - (gnome_calendar_open): collapsed gnome_calendar_load and - gnome_calendar_create into this function. added new type - GnomeCalendarOpenMode which has the value CALENDAR_OPEN or - CALENDAR_OPEN_OR_CREATE. - - * gui/evolution-calendar-control.c (calendar_properties_init): create - a property bag for this control - (set_prop): callback for property sets - (get_prop): callback for proprety gets - - * gui/calendar-commands.c (calendar_set_uri): new function, - called when the "calendar_uri" property is set on the calendar- - control's property bag. - -2000-04-18 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/Makefile.am (INCLUDES): Fix include path. - -2000-04-16 Federico Mena Quintero <federico@helixcode.com> - - * pcs/cal-factory.h (CalFactoryClass): We have a new - "last_calendar_gone" signal that Wombat can use to terminate - itself properly. - - * pcs/cal-factory.c (cal_factory_class_init): Register the - "last_calendar_gone" signal. - (backend_destroy_cb): Emit the "last_calendar_gone" signal instead - of killing the factory. - - * pcs/Makefile.am: Added $(CORBA_GENERATED) to BUILT_SOURCES. - (INCLUDES): Make the log domain be "wombat-pcs". - -2000-04-17 Seth Alves <alves@hungry.com> - - * pcs/cal-backend.c (add_object): removed implicit save, since - we don't want to save as we load from disk. - (cal_backend_update_object): added a call to save, since it - isn't done by add_object now. - -2000-04-16 Federico Mena Quintero <federico@helixcode.com> - - * cal-util/Makefile.am: Renamed library from libcalutil to - libcal-util, to be consistent with libcal-client. Install header - files in $(includedir)/evolution/cal-util. - (INCLUDES): Add "cal-util" log domain for glib. - (libcal_clientincludedir): The header files are now installed in - $(includedir)/evolution/cal-client. - - * cal-util/cal-util.h: Fix includes. - - * cal-client/client-test.c: Fix includes. - - * pcs/Makefile.am: Create libpcs.a, not a shared library, because - it is for internal use by Wombat only. The header files should - not be installed, either. Removed all the old Tlacuache stuff. - - * gui/Makefile.am (EXTRA_DIST): We no longer distribute - gncal.desktop. - (evolution_calendar_INCLUDES): Add "calendar-gui" for the glib log - domain. - - * gui/*.[ch]: Fix cal-util and cal-client includes. - - * pcs/Makefile.am (INCLUDES): Added "pcs" log domain for glib. - - * pcs/*.[ch]: Fix cal-util includes. - -2000-04-11 Chris Toshok <toshok@helixcode.com> - - * pcs/icalendar.c (icaltime_to_timet): use HAVE_TIMEZONE to switch - between linux's timezone variable and *bsd's method of getting the - gmt offset. - -2000-04-10 Seth Alves <alves@hungry.com> - - * pcs/cal-backend.c (save_to_vcal): create and save an actual - vcalendar instead of a list of vcal objects. - -2000-04-10 Damon Chaplin <damon@helixcode.com> - - * gui/Makefile.am (INCLUDES): moved srcdir directories to the top so - we search headers in the evolution tree before installed headers. - (Otherwise when you do 'make install' lots of files in gui/ get - rebuilt, since they depend on the installed cal-client.h which has just - been updated.) - -2000-04-09 Seth Alves <alves@hungry.com> - - * gui/gnome-cal.c (gnome_calendar_load): catch cal_loaded signal - on the cal client. - (gnome_calendar_load_cb): callback for cal_loaded signal. moved - gnome_calendar_update_all from gnome_calendar_load to here. - - * gui/calendar-commands.c: minor cleanups - - * pcs/cal-backend.c (save_to_vcal): copied code from gnome-pim - to write vcal to a file - (save): filled it with more gnome-pim code - (add_object): call save () after changing - (remove_object): same - (cal_backend_create): same - (cal_backend_remove_object): same - -2000-04-08 Christopher James Lahey <clahey@helixcode.com> - - * gui/Makefile.am: Removed linking with libetable and libeminicard - since they weren't being used. - -2000-04-08 Seth Alves <alves@hungry.com> - - * gui/gnome-cal.c (gnome_calendar_create): new function: - friendly wrapper for cal_client_create_calendar - - * gui/calendar-commands.c (new_calendar): call gnome_calendar_create - if no filename is provided - - * gui/prop.c (properties): calendar is a frame - - * gui/calendar-commands.c (calendar_control_activate): sort out the - menus a bit, more of them show up now. - - * gui/Makefile.am: don't build library or test, just the bonobo control - - * gui/gncal-todo.c (simple_todo_editor): calendar is a frame instead - of a window, now. - - * gui/gnome-cal.c (gnome_calendar_new): same - - * gui/goto.c (goto_dialog): same - -2000-04-06 Seth Alves <alves@hungry.com> - - * gui/calendar-commands.c (calendar_control_activate): removed - uih from the argument list, added cal. use cal as user_data - in callbacks rather than the control. - (calendar_control_deactivate): removed uih from argument list - -2000-04-05 Seth Alves <alves@hungry.com> - - * gui/calendar-commands.c (setup_menu): removed - (setup_appbar): removed - (calendar_control_activate): new function -- does the work - that setup_appbar and setup_menu used to do. - (calendar_control_deactivate): undoes what calendar_control_activate - does by removing the toolbar items and menu items. - - * gui/Makefile.am: build test-calendar-widget and evolution-calendar, - common stuff is in a library - - * gui/gnome-cal.c (gnome_calendar_get_type): made the calendar widget - based on a gtk_frame rather than a gnome_app - - * gui/calendar-commands.c: split out some of main.c - - * gui/evolution-calendar-control.c: bonobo bung so evolution - can use the calendar widget - -2000-04-01 Matt Loper <matt@helixcode.com> - - * pcs/.cvsignore: Added *.lo. - -2000-03-30 Seth Alves <alves@hungry.com> - - * gui/main.c (calendar_get_events_in_range): - cal_client_get_events_in_range returns a list of CalObjInstance *, not - a list of (char *) uid. - - * Makefile.am (SUBDIRS): readded the gui directory - - * gui/main.c: temporarily added alarm_defaults back in, - since the calendar doesn't link without it - -2000-03-29 Matt Loper <matt@helixcode.com> - - * Makefile.am: remove the gui directory, which doesn't compile. - -2000-03-28 Matt Loper <matt@helixcode.com> - - * pcs/Makefile.am: create a libpcs.la library, for use in the - wombat. - -2000-03-28 Seth Alves <alves@hungry.com> - - * gui/Makefile.am (LINK_FLAGS): added libeutil.la and libetext.a - - * gui/main.c (calendar_iterate): switch from string_to_ical_object to - ical_object_find_in_string - (calendar_get_events_in_range): same - (session_save_state): commented out references - to gcal->client->filename - -2000-03-27 Federico Mena Quintero <federico@helixcode.com> - - * pcs/cal-backend.c (cal_backend_get_object): Use - ical_object_to_string(). - - * cal-util/calobj.c (ical_object_to_string): Moved over from - pcs/cal-backend.c (was string_from_ical_object). - (get_calendar_base_vobject): Likewise, moved over from - pcs/cal-backend.c. - - * cal-util/cal-util.c: Removed string_to_ical_object(); the - correct function is in calobj.[ch], called - ical_object_find_in_string(). Removed ical_object_to_string, - since we now implement it in calobj.c. - - * cal-util/calobj.c: Removed ical_object_new_from_string(); see - above. - - * idl/evolution-calendar.idl (CalObjInstance): Calendar object - instances now contain only the UID for the object, not the whole - string representation of the object. This allows clients to - implement caching of objects if they wish. - - * pcs/cal.c (Cal_get_events_in_range): Likewise. - - * pcs/cal-backend.c (build_event_list): Likewise. - - * cal-client/cal-client.c (cal_client_get_events_in_range): - Likewise. - - * cal-util/cal-util.h (CalObjInstance): Likewise. - - * cal-util/cal-util.c (cal_obj_instance_list_free): Likewise. - (cal_obj_uid_list_free): Assert that the UIDs in the list are not - NULL. - - * pcs/tlacuache.gnorba (repo_id): The calendar factory also - supports the Unknown interface. - -2000-03-17 Federico Mena Quintero <federico@helixcode.com> - - * gui/e-day-view.c: Fix includes. - (e_day_view_on_delete_occurance): Do not call save_default_calendar(). - (e_day_view_on_delete_appointment): Likewise. - (e_day_view_on_unrecur_appointment): Likewise. - (e_day_view_finish_long_event_resize): Likewise. - (e_day_view_finish_resize): Likewise. - (e_day_view_key_press): Likewise. - (e_day_view_on_editing_stopped): Likewise. - (e_day_view_on_top_canvas_drag_data_received): Likewise. - (e_day_view_on_main_canvas_drag_data_received): Likewise. - -2000-03-13 Damon Chaplin <damon@helixcode.com> - - * gui/e-day-view*.[hc]: new files for the Day/Work-Week views. - -2000-03-12 Federico Mena Quintero <federico@helixcode.com> - - * gui/main.c (gnome_calendar_locate): Removed function now that it - is no CORBA server in the GUI. - (save_default_calendar): Removed function. Now the personal - calendar server will take care of saving modified calendars when - appropriate. - (close_cmd): Do not call unregister_calendar_services(). - - * gui/eventedit.c (ee_ok): Do not save the calendar. - - * gui/gncal-day-panel.c (day_view_range_activated): Likewise. - - * gui/gncal-todo.c (ok_button): Likewise. - (delete_todo): Likewise. - - * gui/gncal-full-day.c (delete_occurance): Likewise. - (delete_appointment): Likewise. - (unrecur_appointment): Likewise. - (child_focus_out): Likewise. - (update_from_drag_info): Likewise. - - * gui/gnome-cal.c (gnome_calendar_new): Removed obsolete call to - create the CORBA server. - - * gui/gnome-cal.h (GnomeCalendar): Renamed `calc' field to - `client'. - - * cal-client/cal-client.h (CalClient): Removed filename and - corba_server fields. - -2000-03-10 Federico Mena Quintero <federico@helixcode.com> - - * gui/main.c (main): Do not pass the INIT_SERVER flag to - gnome_CORBA_init_with_popt_table(). Check for exceptions - properly. - (main): Initialize Bonobo. - (main): Call process_dates() to parse the dates from the command - line before we dump the events or the TODOs. - (main): Use bonobo_main() instead of gtk_main(). - - * cal-util/calobj.c (ical_new): Initialize the alarm types here. - Do not call default_alarm() anymore, since that is a GUI issue. - (default_alarm): Removed function. - (alarm_defaults): Removed defaults data. - - * pcs/tlacuache.c (calendar_notify): Removed stubs for - alarm_defaults, calendar_notify(), debug_alarms. - -2000-03-09 Federico Mena Quintero <federico@helixcode.com> - - * gui/Makefile.am: Removed the corba-cal stuff. Commented out the - Pilot conduit stuff for now. - - * gui/calendar.c: Random #ifdefs to make it build, although this - file is going away. - - * gui/Makefile.am: Removed referenes to calobj.[ch] and timeutil.[ch]. - - * gui/calendar-conduit.c: Fixup includes. - - * gui/calendar-conduit.h: Fixup includes. - -2000-03-09 Seth Alves <alves@hungry.com> - - * gui/gnome-cal.h: replaced "Calendar *cal" with "CalClient *calc" - in the GnomeCalendar struct. - - * gui/*.c: tracked change from Calendar * to CalClient - - * gui/main.c: moved alarm_defaults from here to cal-util/calobj.c - (calendar_get_events_in_range): pulled this out of calendar.c and - fixed it up to use cal-client stuff. i'm not sure where to put it yet. - - * gui/main.c (calendar_iterate): pulled this one out of calendar.c also - -2000-03-07 Federico Mena Quintero <federico@helixcode.com> - - * cal-client/Makefile.am: Removed cal-client-alarm.[ch] from the - list of sources. This was a miscommunication on our part. - -2000-03-05 Seth Alves <alves@hungry.com> - - * cal-client/cal-client-alarm.c: stubs for client side - access to alarm structures. this will probably change, - since i don't know what i'm doing. - - * cal-util/alarm-enums.h: enums for alarms needed by - both the client and the server - - * remaining source files in calendar/... have been moved - to calendar/gui. - - * gui/alarm.c: start to decouple the view from the model - in the alarm editing code - -2000-03-03 Seth Alves <alves@hungry.com> - - * cal-util/Makefile.am: new file -- things shared between - the client and server go in this directory - - * calobj.c calobj.h icalendar.c icalendar.h - timeutil.c timeutil.h cal-util.c cal-util.h where moved - backend stuff went into pcs. shared stuff went into - cal-util. - -2000-03-02 Federico Mena Quintero <federico@helixcode.com> - - At this point the calendar client and personal calendar server - files were moved to the idl/, cal-client/, and pcs/ directories. - - * idl/Makefile.am: New file. - - * cal-client/Makefile.am: New file. Moved the libcal-client stuff - from calendar/Makefile.am to here. - - * pcs/Makefile.am: New file. Moved the tlacuache stuff from - calendar/Makefile.am to here. - - * Makefile.am (SUBDIRS): Added the idl and cal-client directories. - - * calendar.h: Removed the references to cal-backend.h and its - stuff. This file is going away soon! - - * icalendar.c: #include <config.h>. Also, we don't need to - include cal-backend.h or gnome.h. - - * icalendar.h: Protect from multiple inclusions. - -2000-03-01 Federico Mena Quintero <federico@helixcode.com> - - * Makefile.am: Use the gnome-config flags for orbit-idl. - Create a libcal-client library with the calendar client object. - -2000-02-29 Federico Mena Quintero <federico@helixcode.com> - - * Makefile.am: Removed stale rule for the conduit. - -2000-02-21 Matt Loper <matt@helixcode.com> - - * .cvsignore: Added *.lo. - -2000-02-19 Matt Loper <matt@helixcode.com> - - * .cvsignore: Added tlacuache and tl-test. - -2000-02-18 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * Makefile.am (INCLUDES): Use BONOBO_VFS_GNOME_CFLAGS instead of - GNOMEUI_INCLUDES, as we use Bonobo and VFS. - -2000-02-17 Seth Alves <alves@hungry.com> - - * cal-backend.h: moved CalendarFormat type def here - - * cal-backend.c (cal_backend_load): if extension suggests - an ical file, attempt to load an iCal file. - (cal_get_type_from_filename): returns CAL_ICAL if file - extension is 'ics' or 'ifb', else returns CAL_VCAL - (icalendar_calendar_load): moved this here from - icalendar.c because it needs to call the static function - add_object. - -2000-02-17 Federico Mena Quintero <federico@helixcode.com> - - * cal-client.c (cal_client_remove_object): Implemented. - - * cal.c (cal_notify_remove): Implemented. - (Cal_remove_object): Implemented. - (cal_get_epv): Fill in the remove_object field in the epv. - - * cal-backend.c (cal_backend_remove_object): Implemented. - (notify_remove): New function to notify clients that an object was - removed. - -2000-02-16 Russell Steinthal <rms39@columbia.edu> - - * calobj.[ch], eventedit.c, main.c: Change iCalObject.organizer - from char* to iCalPerson* - - * calobj.[ch]: Change iCalObject.related from list of char* to - list of iCalRelation*; assorted related fixes - - * icalendar.c: interface between libical and the gnomecal - internal representation - -2000-02-11 Federico Mena Quintero <federico@helixcode.com> - - * cal-client.c (cal_client_update_object): Implemented. - - * cal.c (cal_notify_update): New function to notify the listener - about an updated object. - (Cal_update_object): Implemented. - (Cal_get_uids): set_release() the sequence to TRUE. - (Cal_get_events_in_range): Likewise. - - * cal-backend.c (remove_object): New function to remove objects - from a calendar backend. - (cal_backend_update_object): New public function to update an - object and notify clients about it. - - * evolution-calendar.idl (Cal): Added update_object() and - delete_object() methods. - (Listener): Removed the obj_changed method and renamed obj_added - to obj_updated. We now only have updated and removed notifiers. - - * cal-listener.[ch]: Removed the "changed" notification code. - Changed the "added" notification code to the "updated" - notification. - - * cal-client.c: Likewise. - - * tlacuache.c (create_cal_factory): Connect to "destroy" on the - factory and exit the main loop when the factory is destroyed. - - * cal-factory.c (backend_destroy_cb): New callback used when a - backend is destroyed. Removes the backend from the factory's hash - table and unrefs the factory if all backends go away. - (add_calendar_client): Free the environment. - - * cal.c (cal_new): Use bonobo_object_unref() if we fail to - initialize. - - * cal-listener.c (cal_listener_new): Likewise. - - * layout.c (layout_events): Plug li.partition memory leak. - -2000-02-10 Federico Mena Quintero <federico@helixcode.com> - - * cal-backend.c (cal_backend_add_cal): Connect to the Cal's - destroy signal. - (cal_backend_remove_cal): Killed function now that removal of Cal - objects is done in their destroy callback. - (cal_destroy_cb): New callback to remove a Cal from the backend's - list of clients. Also, the backend destroys itself when there are - no more clients connected to it. - (save): New placeholder function to save a backend. - (destroy): New function to destroy a backend's data. - (cal_backend_destroy): Save the calendar and destroy it. - - * cal.c (cal_destroy): Reset the priv->backend to NULL. - - * cal-factory.c (add_calendar_client): There is no need to call - cal_backend_remove_cal(); we can now just destroy the Cal object. - (create_fn): Make sure we always unref the URI. - (load_fn): Move the URI unref to the end of the function for - safety. - - * cal-factory.c (add_calendar_client): Unref the Cal only if - notification of the listener was unsuccessful. Otherwise, the - calendar user agent (Listener side) keeps the reference. - - * tl-test.c (list_uids): Free the calobj. - - * cal-client.c (cal_loaded_cb): Use bonobo_object_unref() to get - rid of the listener. - (load_or_create): Likewise. - (destroy_factory): New function to get rid of the factory. - (destroy_listener): New function to get rid of the listener. - (destroy_cal): New function to get rid of the calendar client - interface object. - (cal_client_destroy): Free all resources. - (cal_client_get_object): CORBA_free() the calobj string. Boy, I - love memprof. - - * cal-listener.c (cal_listener_destroy): Reset the priv->cal to - CORBA_OBJECT_NIL. - - * cal-backend.c (cal_backend_remove_cal): Do not unref the Cal, - since the calendar user agent owns it. - (cal_backend_add_cal): Do not ref the Cal, since the calendar user - agent owns it. - - * cal-factory.c (add_calendar_client): Use bonobo_object_unref() - to get rid of the calendar client interface object. - - * calobj.c (ical_object_create_from_vobject): Duplicate the - default "PUBLIC" string. - -2000-02-09 Federico Mena Quintero <federico@helixcode.com> - - * cal-factory.c (cal_factory_load): Added documentation comment. - (load_fn): Do not print a message if the backend could not be - loaded due to a non-fatal error. - (queue_load_create_job): Moved the stuff from cal_factory_load() - to here. Now this function serves to queue load or create - requests. - (cal_factory_load): Use queue_load_create_job(). - (cal_factory_create): Implemented; use queue_load_create_job(). - (create_fn): New job handler for creating new calendars. - (create_backend): New function to create a new backend with a new - calendar. - (add_backend): New helper function to add backends to the - factory's hash table. - (load_backend): Use add_backend() instead of adding the backend by - ourselves. - - * cal-client.c (load_or_create): Moved the functionality from - cal_client_load_calendar() to here, and added an option to create - a new calendar instead of loading an existing one. - (cal_client_load_calendar): Use load_or_create(). - (cal_client_create_calendar): Implemented. - - * cal-backend.c (cal_backend_create): Implemented. - - * evolution-calendar.idl (LoadStatus): Added an IN_USE error for - create requests. - - * cal-listener.h (CalListenerLoadStatus): Added CAL_LISTENER_LOAD_IN_USE. - - * cal-listener.c (Listener_cal_loaded): Convert the IN_USE error. - - * cal-client.h (CalClientLoadStatus): Added CAL_CLIENT_LOAD_IN_USE. - - * cal-client.c (cal_loaded_cb): Handle CAL_LISTENER_LOAD_IN_USE. - - * tl-test.c: New test program for the calendar client side; it - also exercises the server side by sending commands to it. - - * Makefile.am: Added the tl-test program. - - * tlacuache.gnorba: Updated. - - * tlacuache.c (create_cal_factory): Use the right GOAD id. - - * cal-client.c (cal_client_construct): Use the right GOAD id. - -2000-02-08 Federico Mena Quintero <federico@helixcode.com> - - * evolution-calendar.idl (Cal): Added get_uids() method to get a - list of UIDs based on object types. - - * cal-backend.c (cal_backend_get_uids): Implemented get_uids() in - the backend. - - * cal.c (Cal_get_uids): Implemented get_uids() method. - - * cal-client.c (cal_client_get_uids): Implemented client-side - function. - - * cal-util.c (cal_obj_instance_list_free): Doh. Free the list, - not the last link. - (cal_obj_uid_list_free): New function to free a list of UIDs. - - * GnomeCal.idl (Repository): Removed unused method - get_object_by_id_list(). This is just for cleanup purposes and to - remind me exactly of what needs to be moved over to - evolution-calendar.idl. - (Repository): Removed unused get_objects() method. - - * corba-cal.c (init_calendar_repo_class): Removed the unused - get_objects method. - - * calobj.h (CalObjFindStatus): New status value enumeration for - the find function. - - * calobj.c (ical_object_find_in_string): New function to parse a - complete calendar and find a calendar object in it. This should - be used instead ical_object_new_from_string() in the future. - - * evolution-calendar.idl (CalObjInstance): Added an uid field. - Now the idea is that whenever calendar object strings are passed - around, their UIDs are passed along with them so that the actual - object can be pulled from the whole VCAL object using its UID to - identify it. - - * cal-util.h (CalObjInstance): Added uid field. - - * cal-util.c (cal_obj_instance_list_free): Free the UIDs. - - * cal-backend.c (build_event_list): Store the object's UID in the - instance structure. - - * cal.c (Cal_get_events_in_range): Copy the UID field to the CORBA - structure. - - * cal-client.c (cal_client_get_events_in_range): Copy the UID - field from the CORBA structure. - - * main.c (gnome_cal_file_menu): Removed unfinished html-month stuff. - - * Makefile.am (gnomecal_SOURCES): Removed html-month.c. - - * gnome-cal.c: #include "alarm.h" - (mail_notify): Made static. - - * alarm.h: #include "calobj.h" - - * corba-cal-factory.h (init_corba_server): Fixed prototype. - - * quick-view.c (create_items_for_event): Made static. - - * gncal-todo.c (column_resized): Made static. - - * layout.c (find_index): Made static. - -2000-02-08 Federico Mena Quintero <federico@helixcode.com> - - * evolution-calendar.idl (CalObjInstance): New struct to wrap - instances of calendar objects for recurrencies and alarms. - (Cal::get_events_in_range): New method to get ocurring and - recurring events by time range. - - * cal-backend.c (cal_backend_get_events_in_range): New function to - get a list of event instances in a time range. - (string_from_ical_object): New internal function. - (cal_backend_get_object): Use string_from_ical_object() instead of - doing everything ourselves. - (cal_backend_get_events_in_range): New function to get a list of - the events that occur or recur in a specified time range. - - * cal-client.c (cal_client_get_events_in_range): Implemented - client-side function. - - * cal-util.h: - * cal-util.c: New files with utilities and types common to the - client and server parts. - (CalObjInstance): New structure to hold an instance of an actual - occurrence, recurrence, or alarm trigger of a calendar object. - (cal_obj_instance_list_free): New function to free a list of - calendar object instances. - - * cal.c (Cal_get_events_in_range): Implemented new method. - - * corba-cal.c (cal_repo_get_updated_objects): Free `str' with - free(), not g_free(), since calendar_get_as_vcal_string() uses - writeMemVObject(), which uses realloc(). Fixed in gnome-pim as - well. - -2000-02-04 Federico Mena Quintero <federico@helixcode.com> - - * cal-backend.c (get_calendar_base_vobject): New function to - create the base VObject for a calendar. - (cal_backend_get_object): Create the base calendar and add the - sought object to it, then stringify it. - - * evolution-calendar.idl (Listener::obj_added - Listener::obj_changed): Now these pass in just the UIDs, not the - complete objects. - - * cal-listener.c (Listener_obj_added): Changed to pass in the uid, - not the object. - (Listener_obj_changed): Likewise. - - * cal-client.h (CalClientClass): Made the obj_added and - obj_changed signals take in the UIDs, not the full objects. - - * cal-client.c (obj_added_cb): Likewise. - (obj_changed_cb): Likewise. - -2000-02-04 Federico Mena Quintero <federico@helixcode.com> - - * cal-backend.c (CalBackendPrivate): Renamed the event_hash field - to object_hash. Now we hash all the calendar's objects here based - on their UIDs. - (ensure_uid): New function to create UIDs for calendar objects - that don't have them. - (add_object): Ensure the object has an UID before inserting it in - the calendar. - (cal_backend_get_object): New function. - -2000-02-03 Federico Mena Quintero <federico@helixcode.com> - - * evolution-calendar.idl (Cal): Added the get_object() method. - - * cal-client.c (cal_client_get_object): New function to get a - calendar object by its UID. - - * cal.c (Cal_get_object): Implemented. - - * cal-backend.c (cal_backend_get_object): New unfinished backend - function. We need some reorganizing of how the calendar objects - are stored. - -2000-02-02 Federico Mena Quintero <federico@helixcode.com> - - * Makefile.am (gnomecal_SOURCES): Added the CORBA generated - sources. - -2000-02-01 Federico Mena Quintero <federico@helixcode.com> - - * cal-client.c (cal_loaded): Handle the cal_loaded signal from the - listener. Store the calendar client interface object, and emit - our own cal_loaded signal. - (cal_client_load_calendar): Connect to the listener's signals. - (cal_client_class_init): Added the "obj_added", "obj_removed", - öbj_changed" signals. - (obj_added_cb): Handle the signal from the listener. - (obj_removed_cb): Likewise. - (obj_changed_cb): Likewise. - -2000-01-30 Federico Mena Quintero <federico@helixcode.com> - - * Makefile.am (gnomecal_SOURCES): Added cal-client.[ch] and - cal-listener.[ch]. - -2000-01-30 Federico Mena Quintero <federico@helixcode.com> - - * evolution-calendar.idl: Changed the namespace from - GNOME::Calendar to Evolution::Calendar. - (Listener::LoadStatus): Fixed SUCESSS -> SUCCESS typo. And I - never noticed it in the implementation. Ain't M-/ grand? - - * Makefile.am: Changed ocurrences of gnome-calendar.idl to - evolution-calendar.idl. - - * *.[ch]: Changed GNOME_Calendar_foo identifiers to - Evolution_Calendar_foo. - -2000-01-25 Federico Mena Quintero <federico@helixcode.com> - - * cal-client.c cal-client.h: New files with the calendar client - object. - -2000-01-25 Federico Mena Quintero <federico@helixcode.com> - - * cal-factory.c (CalFactory_load): Check that the listener is not - nil and emit and exception if it is. - - * gnome-calendar.idl (CalFactory::load CalFactory::create): Now - these raise the NilListener exception. - - * tlacuache.c (calendar_notify): Error stub for alarms. - (alarm_defaults): Stub array. - (debug_alarms): Stub variable. - (main): Initialize gnome-vfs. - -2000-01-24 Federico Mena Quintero <federico@helixcode.com> - - * tlacuache.c: New main module for the Tlacuache personal calendar - server. - - * tlacuache.gnorba: New gnorba file for Tlacuache, the GNOME - personal calendar server. - - * Makefile.am: Added the stuff necessary to build Tlacuache. - - * cal.c (Cal_get_uri): Convert the URI to a string before - returning it. - - * cal-factory.c (CalFactory_create): Doh, this function is void. - - * job.c (job_add): Use g_idle_add(), not gtk_idle_add(). - -2000-01-24 Federico Mena Quintero <federico@helixcode.com> - - * cal-backend.c (cal_backend_remove_cal): New function to remove a - calendar client interface object from a backend. - (cal_backend_load): Convert the URI to string and use - Parse_MIME_FromFileName(). The conversion is not very smart, - though. - - * cal-factory.c (load_backend): Moved most of the error handling - upstream to load_fn(). - (load_fn): Handle failure in case the backend could not be loaded. - (cal_factory_destroy): Free the backends and the backend hash - table. - (add_calendar_client): Implemented. We create a Cal client - interface object and attach it to the backend, and we notify the - listener. - -2000-01-22 Federico Mena Quintero <federico@helixcode.com> - - * cal-factory.c (lookup_backend): Renamed from lookup_calendar(). - Also, return a backend instead of a Cal client object. - - * cal-backend.c (cal_backend_load): Take in a GnomeVFSURI, not a - string. - - * cal-listener.c (Listener_cal_loaded): Pass the load status to - the signal. - (cal_listener_destroy): Better error checking. - (cal_listener_new): Better error checking. - - * cal-listener.h (CalListenerLoadStatus): New enum for the load - status of a calendar. - (CalListenerClass): Added the status argument to the cal_loaded - signal. - - * gnome-calendar.idl (cal_loaded): Added a load status code. - - * cal-backend.h (CalBackendLoadStatus): Renamed from - CalBackendLoadResult. - -2000-01-18 Federico Mena Quintero <federico@helixcode.com> - - * cal-backend.c cal-backend.h: Moved the calendar backend here. - This is the actual calendar-handling object. - (load_from_vobject): Moved over from calendar.c. Modified to use - a CalBackend instead of the old Calendar structure. - (add_object): Likewise. - - * cal.c: Now the Cal object is just a calendar client interface - object; we use it as a "viewport" onto a CalBackend. This also - lets us do correct resource management. - - * cal-common.h: New file with common forward declarations; we - can't have circular dependencies between headers. - -2000-01-18 Federico Mena Quintero <federico@helixcode.com> - - * cal-factory.c (cal_factory_load): Queue a load job. - (load_fn): Load job handler. Lookup the calendar by URI, load it - if it is not loaded, or just report it to the new listener if it is. - - * job.c job.h: New files with a simple job queue manager. - - * gnome-calendar.idl (Listener::cal_loaded): Do not return the - whole calendar object string. The client will be able to query - the calendar for the events it needs. - - * cal-listener.c (Listener_cal_loaded): Ref the calendar GNOME - object. We unref it when the listener is destroyed. - -2000-01-17 Federico Mena Quintero <federico@helixcode.com> - - The files from the gncal directory of the gnome-pim module on CVS - were moved here, to evolution/calendar, in preparation for the - Evolution work. The calendar is being split into a model/view - architecture. The model is a personal calendar server (PAS): it - provides storage, notification, and event generation; the - views/controllers are the calendar user agents and things like - Pilot synchronizers. - -2000-01-11 Federico Mena Quintero <federico@helixcode.com> - - * cal.c: Removed the CORBA listener methods, adjusted for the new - IDL. - - * cal-listener.c (cal_listener_init): Create the private - structure. In it we hold a reference to the calendar the listener - is watching. - (cal_listener_destroy): Destroy the private structure and unref - the calendar. - (Listener_cal_loaded): Stuff the calendar into our private data. - (Listener_obj_added): Adjusted for new IDL. - (Listener_obj_removed): Likewise. - - * gnome-calendar.idl: New IDL for the personal calendar server. - - * cal.h cal.c: New files with the calendar object. - - * cal-listener.h cal-listener.c: New files with the calendar - listener object. - - * cal-factory.h cal-factory.c: New files with the calendar factory - object. - -2000-01-09 Eskil Heyn Olsen <deity@eskil.dk> - - * Makefile.am: Changes to remove todo capplet stuff from distro. - -2000-01-08 Vadim Strizhevsky <vadim@optonline.net> - - * calendar-conduit-control-applet.c: Added pilotID argument to - gpilotd_conduit_mgmt_new. - - -2000-01-05 Eskil Heyn Olsen <deity@eskil.dk> - - * GnomeCal.idl: Added an argument to get_number_of_objects, so you - can choose which state the object should have - (any/new/modified/...). Will also add one to choose type - (event/journal etc). - - * corba-cal.c (cal_repo_get_number_of_objects): Implemented the - new version of get_number_of_objects. - - * calendar-conduit.c (pre_sync): Calls various - gnome_pilot_conduit_standard_abs_set_num_yadayda to get progress bars. - -2000-01-04 Eskil Heyn Olsen <deity@eskil.dk> - - * calendar-conduit.c (start_calendar_server): Let's not call - g_error, but g_warning instead. - (pre_sync): Get record numbers info, total, new, deleted etc, and - tell gpilotd. - -1999-12-31 Eskil Heyn Olsen <deity@eskil.dk> - - * eventedit.c (ee_store_recur_end_to_ical): Adds 86400 secs (1 - day) to the date chooses by the user. This ensures the recurrence - also occurs on that date. - (ee_rp_init_ending_date): And subtracts 86400 secs when about to - redisplay the box. - - * calendar.h: Added an argument to calendar_new, to enable certain - features, such as initing alarms or nor. - - * calendar.c (calendar_new): Implemented support for the - CALENDAR_INIT_ALARMS option to calendar_new. - - * corba-cal.c (cal_repo_get_updated_objects): Added - CALENDAR_INIT_ALARMS to calendar_new calls. - - * main.c: Added CALENDAR_INIT_ALARMS to calendar_new calls. This - should probably be CALENDAR_INIT_NIL, but I'm not sure, guess - steintr should check it. - - * gnome-cal.c: Added CALENDAR_INIT_ALARMS to calendar_new calls. - - * calendar-pilot-sync.c: Added CALENDAR_INIT_NIL to calendar_new calls. - -1999-12-10 Russell Steinthal <rms39@columbia.edu> - - * eventedit.c (ee_create_ae): Fix sensitivity bug when used to - create default alarm box (widgets in that box should always be - sensitive, even if the enabled checkbutton is not set) - -1999-12-08 Eskil Heyn Olsen <deity@eskil.dk> - - * calendar-conduit-control-applet.c (setSettings): Capplets now - sets first_sync on enable, this should make the conduit copy old - entries from the pilot to gnomecal. - -1999-12-07 Eskil Heyn Olsen <deity@eskil.dk> - - * calendar-conduit.c (pre_sync): Check if local store is - empty. If, force slow sync. - - * GnomeCal.idl (GNOME): Added get_number_of_objects. - - * corba-cal.c (cal_repo_get_number_of_objects): implemented the - get_number_of_objects. - - * calendar-conduit-control-applet.c (setStateCfg): Fixed bug that - caused the capplet to always set the sync action to Disable upon start. - -1999-12-05 Eskil Heyn Olsen <deity@eskil.dk> - - * Makefile.am (Conduits_second_DATA): Also install .desktop files - for conduit capplets in the gnome/apps menu dir. - -1999-12-04 Eskil Heyn Olsen <deity@eskil.dk> - - * Makefile.am (EXTRA_DIST): Added .desktop files to EXTRA_DIST. - -1999-10-12 Clifford R. Conover <rusty@zootweb.com> - - * gncal-todo.c Todo List improvements. - - Cleaned up todo item highlighting, added support for highlighting - events due today, and events not due yet. Colors are configurable - on the Colors Tab of the properties window. - - Renamed Frame in Properties window to Colors rather then Month - Colors since we are now asking for Todo item colors. - - Added ability to display time until todo item is due in list, it - automatically selects the best denomination of time (up to weeks) - and down to seconds to display. This should be made configurable - in a future version. - - Changed Todo dialog to ask for time that event is due. This - allows more accurate tracking of then the item is due, before the - dialog was only asking for the date of the todo item. - -1999-12-03 Eskil Heyn Olsen <deity@eskil.dk> - - * calendar-conduit.c: undef DEBUG_CALCONDUT, suppresses debug output. - -1999-12-02 Russell Steinthal <rms39@columbia.edu> - - * alarm.c: Enhanced debug support: can be toggled on and off by - SIGUSR1, reports alarms which could not be added - - * gnome-cal.c, main.[ch], prop.c: Add snooze capability for audio - and display alarms. Snooze interval can be configured in the - Properties box. - -1999-11-30 Eskil Heyn Olsen <deity@eskil.dk> - - * calendar-conduit.c (compare): Fixed compare bug. Also neated up - some of the if's in set_status. - -1999-11-22 Russell Steinthal <rms39@columbia.edu> - - * Merged todo list coloring patch from stable - * Added myself to AUTHORS, about box (per Miguel) - -1999-11-22 Eskil Heyn Olsen <deity@eskil.dk> - - * calendar-conduit.c (pre_sync): Writes some warning - messages when pre_sync fails. - -1999-11-14 Eskil Heyn Olsen <deity@eskil.dk> - - * Makefile.am: Stupid misplaced endif cause gncal to depend on an - install gnome-pilot... fixed... sorry. - -1999-11-12 Eskil Heyn Olsen <deity@eskil.dk> - - * Makefile.am (extra_pilot_bins): Fixed the if then else problem, - using solution suggested by James Henstridge, appears to be caused - by a (by now fixed) bug in my automake. - -1999-11-12 Russell Steinthal <rms39@columbia.edu> - - * prop.c: Config code for timeout, make Alarms property page use a - vbox instead of an hbox so that the propbox stays a reasonable width. - - * gnome-cal.c, main.[ch]: Add timeout for audio alarms, code to load - from config file - - * eventedit.c: Give some static functions external linkage so they - can be used elsewhere (make_spin_button); add some prototypes to - appease gcc. - -1999-11-11 Russell Steinthal <rms39@columbia.edu> - - * calendar.c (calendar_day_change): Add call to - calendar_init_alarms() to schedule another day change alarm. - -1999-11-09 Eskil Heyn Olsen <deity@eskil.dk> - - * calendar-conduit.c: Enabled debug output. Sets a g_log_domain, - now version 0.8.5. Consistent use of GSList/GList. Implemented - compare, default uses one that compares the contents of a struct - Appointment, but also has #ifdeffed code that does a field level - comparison, not complete, but perhaps educational. - - * Makefile.am (#todo_conduit_control_applet_SOURCES): Fixed an - unwanted conditional on libcalendar_conduit_la_LDFLAGS - -1999-11-05 Eskil Heyn Olsen <deity@eskil.dk> - - * calendar-conduit-control-applet.c (readStateCfg): Commented the - code out, thus the capplet works again. - -1999-11-04 Eskil Olsen <deity@eskil.dk> - - * Makefile.am: Uses the PISOCK_LIBDIR, for people with odd install - dirs for their pilot-link. Also install a pretty icon for the - calendar-conduit. - - * calendar-conduit-control-applet.c: Modfied the - try/revert/ok/cancel scheme to be more intuitive, also uses a - GtkOptionMenu for the possible sync methods. - - * calendar-conduit-control-applet.desktop: use the nice icon... - - * calendar-conduit.c: Ack, had to define debug_alarms and - alarm_default, otherwise they are undefined. Is gncal code messy - or is this considered a way of configuring the cal engine ? - Implemented delete_all syncabs methods. - - * calendar-pilot-sync.c: also had to declare debug_alarms and - alarm_defaults, just as ugly. - -1999-11-02 Russell Steinthal <rms39@columbia.edu> - - * prop.c: Add new alarm page to properties box - - * prop.c, calobj.c, main.[ch] eventedit.c: New support for default - alarms, configurable in the properties box. - - * gnome-cal.c, prop.c, main.[ch]: add option to beep on Display - alarms - -1999-10-23 Russell Steinthal <rms39@columbia.edu> - - * calendar.c (calendar_new): Correctly initialize calendar_day_end - and calendar_day_begin *before* installing day-change alarm. - -1999-10-21 Russell Steinthal <rms39@columbia.edu> - - * alarm.c, main.c: Added alarm debugging code - - * main.c (open_ok): Show an error box if the user tries to open a - non-existent file; fixes bug #1818 - -1999-10-19 Russell Steinthal <rms39@columbia.edu> - - * gnome-cal.c (calendar_notify): Fix typos which were causing - invalid times in audio notification dialogs; fixes Bug #2561 - -1999-10-18 Russell Steinthal <rms39@columbia.edu> - - * gncal-day-panel.c (gncal_day_panel_new): Placed the various - elements of the day view in paned windows so that the user can - adjust the relative sizes of the daily schedule, monthly calendar, - and to-do list. - -1999-10-18 Martin Norbäck <norpan@bigfoot.com> - - * gncal.desktop: Added swedish translation - -1999-10-13 Eskil Olsen <deity@eskil.dk> - - * Makefile.am: Hopefully the fixes the much-hated - gnome-pilot dependency. - -1999-10-07 Eskil Olsen <deity@eskil.dk> - - * calendar.c (calendar_object_changed): moved the pilot_status = - MOD up, so even a CHANGE_SUMMARY will set the modified flag. - - * calendar-conduit.c: more _free calls, vamped the noise on output. - -1999-10-06 Eskil Olsen <deity@eskil.dk> - - * *conduit*[ch]: checks return values from gpilotd_init/connect. - - * calender.c (vcalendar_create_from_calendar): removed a set - of cleanVObject cleanStrTbl, since the freed memory that the - function returned. - -1999-09-27 Timur Bakeyev <mc@bat.ru> - - * timeutil.c (time_from_isodate): Use tm.gmtoff or timezone to get - correct offset from UTC, according to HAVE_TM_GMTOFF or HAVE_TIMEZONE. - See also 1999-07-19 Matt Martin <matt@abacusnet.net> - -1999-09-27 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * month-view.c (add_event): ditto - (mark_current_day): ditto - (month_view_set): ditto - - * goto.c (goto_dialog): ditto. - - * gnome-month-item.c (gnome_month_item_init): ditto. - - * gncal-day-panel.c (gncal_day_panel_new): ditto. - - * getdate.c (RelativeDate): ditto. - - * eventedit.c (set_all_day): ditto. - (ee_rp_init_rule): ditto. - - * calendar.c (vcalendar_create_from_calendar): ditto. - - * calendar-conduit.c (update_record): ditto. - - * calobj.c (ical_object_generate_events): Get rid of pointers to - values returned from localtime, as it uses a static buffer. - -1999-09-26 Eskil Olsen <deity@eskil.dk> - - * corba-cal.c: the g_free that was commented out since glib said - was a duplicate free, was supposed to be a free. - - * GnomeCal.idl/corba-cal.c: added a get_object_id_list and a - get_objects_by_id_list. Latter is not done. - - * calendar-conduit.c: rewrote the way the conduit iterates over - records. It no longers fetches all entries (since that didn't work - with more then 285 entries. It now fetches the id list, and gets - each record. (will be using get_objects_by_id_list to get records - in amounts of 10 or so later, to reduce amount of corba calls). - - * calendar-conduit.c: now sets alarm parameters when transferring - from gnomecal to pilot. - -1999-09-23 Eskil Olsen <deity@eskil.dk> - - * calendar-conduit.c: better merge of summary/description - when doing ical_from_remote (update_record), also handles - import from gnomecal to pilot better, and on both ways, repeat - events are much better now. - -1999-09-22 Eskil Olsen <deity@eskil.dk> - - * corba-cal.c: commented out a g_free that glib reported - as being a duplicate free. - * calendar-conduit.c: got gnomecal->pilot up and runnning. - -1999-02-06 Lauris Kaplinski <lauris@ariman.ee> - - * gncal.desktop: Added Estonian translations. - -1999-09-14 Federico Mena Quintero <federico@redhat.com> - - * gncal-full-day.c (child_popup_menu): Set the data pointers for - all the items. - -1999-09-14 Kjartan Maraas <kmaraas@online.no> - - * doc/C/gnomecal.sgml: Merge from gnome-pim-1-0. Synced with newest - user-guide. - -1999-09-01 Miguel de Icaza <miguel@gnu.org> - - * eventedit.c (ee_create_buttons): Make the OK button the default - button per Russell's suggestion. - -1999-08-30 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * calendar.c (calendar_object_changed): Modify the - object->last_mod field. - (calendar_add_object): Ditto. - - Closes bug #676 - - * main.c (save_calendar_cmd): Fix problem in which we warned the - user about the calendar being modified the first time the calendar - was used. - -1999-08-22 Tomas Ogren <stric@ing.umu.se> - - * gnomecal.gnorba: "GenericFactoy" is wrong... - -1999-08-15 Miguel de Icaza <miguel@gnu.org> - - * calobj.c (ical_gen_uid): Fix the hostname part. - -1999-08-07 Peter Teichman <pat4@acpub.duke.edu> - - * calendar-pilot-sync.c (sync_pilot): sync correctly for objects - created on the pilot, but not dirty (because they have been synced - with some other program in the past) - -1999-07-30 Miguel de Icaza <miguel@gnu.org> - - * month-view.c (month_view_init): Release points here. - -1999-08-02 Peter Teichman <pat4@acpub.duke.edu> - - * Makefile.am (libcalendar_conduit_la_LDFLAGS): - libcalendar_conduit now installs - - * calendar-pilot-sync.c (sync_pilot): do deletion of appointments - correctly, when they are deleted on the pilot - (conduit_free_Appointment): protect against double-freeing parts - of the Appointment structure - (update_record): all-day events from the pilot are handled a bit - more reasonably - -1999-08-01 Peter Teichman <pat4@acpub.duke.edu> - - * calendar-pilot-sync.c (sync_object_to_pilot): The multi-day - appointment corruption bug is dead. Whoo! - -1999-07-31 Peter Teichman <pat4@acpub.duke.edu> - - * Makefile.am: fixed this up slightly with respect to pilot conduits - -1999-07-30 Jonathan Blandford <jrb@redhat.com> - - * Makefile.am (libcalendar_conduit_la_LIBADD): More autoconf-stuff - -1999-07-29 Jonathan Blandford <jrb@redhat.com> - - * gnome-cal.c (setup_widgets): Add scrolling to the yearview. - -1999-07-28 Miguel de Icaza <miguel@gnu.org> - - * calendar-pilot-sync.c: (sync_object_to_pilot): If the enddate is - not set, set the repeatForever to 1. This fixes all of the - birthdays problems I had. - - Make the code not take arguments - (sync_cal_to_pilot): Nice event update information - - * calendar.c (calendar_new): Add Event UID hash table. - (calendar_add_object): Add events to the hash table here. - (calendar_remove_object): Remove events here. - (calendar_object_find_event): Use the hash table here. - - * main.c (save_calendar_cmd): The object is already destroyed by - gnome_dialog_run. - - * calendar-pilot-sync.c (sync_object_to_pilot): Do not turn - archived bit on. - - * calobj.c (ical_gen_uid): Use the hostname, not the domain name. - (ical_gen_uid): Add a serial number. Isodates can be small. - - * corba-cal.c (cal_repo_update_pilot_id): New method to update the - pilot status. - (cal_repo_get_updated_objects): New method. Returns a list of - modified and not-sycned objects - - * calendar-pilot-sync.c (sync_cal_to_pilot): New function to sync - from the GnomeCalendar to the pilot. - (sync_object_to_pilot): Sync a single event to the pilot. - (try_alarm): Alarm syncing code. - -1999-07-27 Miguel de Icaza <miguel@gnu.org> - - * calendar-pilot-sync.c: New file. Implements PalmPilot - syncronization with the Gnome Calendar. - - * calobj.c (ical_object_new_from_string): New function. Creates - an iCalObject from a vCalendar string that is supposed to contain - only one vEvent. - - * calendar.c: - (calendar_save): Split this routine in two. - - * gnome-cal.c (gnome_calendar_new): Create the corba server here. - - * main.c: Include gnorba.h, and corba-cal-factory.h here - (close_cmd): Kill the calendar server on shutdown. - - * calobj.c (load_recur_yearly_day): Added a fixme comment. WE - need to handle intervals in the years. - - * calendar.c (calendar_object_find_in_list, calendar_object_find, - calendar_object_find_todo, calendar_object_find_event): New - functions for looking up information. - - * main.c (gnome_calendar_locate): New function. - - * corba-cal.c (calendar_create_object): New file. Implements the - corba server. - - * calendar.c (calendar_object_changed): Flag pilot-status as changed. - - * calobj.c (ical_object_to_vobject): Save pilot information for syncing. - (ical_object_create_from_vobject): Load syncing information for - pilot. Do it in a way compatible with KOrganizer. - -1999-07-26 Miguel de Icaza <miguel@gnu.org> - - * calobj.c (ical_object_create_from_vobject): Generate unique IDs - on Vevents we load that lack it. WE need this for the old - gnome calendar generated files (ie, before now :-). - - Required to sync with the Palm - -1999-07-26 Miguel de Icaza <miguel@gnu.org> - - * calobj.c (ical_object_create_from_vobject): Generate unique IDs - on Vevents we load that lack it. WE need this for the old - gnome calendar generated files (ie, before now :-). - - Required to sync with the Palm - -1999-07-19 Matt Martin <matt@abacusnet.net> - - * timeutil.c (time_from_isodate): Handle the 'Z' parameter to the - ISO date format to convert from GMT time. - -1999-07-17 Nat Friedman <nat@gnome-support.com> - - * calendar.c (calendar_add_object): Copy the new UID into the - iCalObject structure. - -1999-07-16 Miguel de Icaza <miguel@gnu.org> - - * gnome-month-item.c (gnome_month_item_set_arg): Merge fix from - gnome-pim-1-0: Fixed cut&paste bug for day fontsets. - -1999-07-14 Miguel de Icaza <miguel@gnu.org> - - * calobj.c (ical_gen_uid): Returns a UID. - (ical_object_new): Use a UID when creating an event. Should get - syncing done easier. - -1999-07-14 Nicholas J Kreucher <nick@poetic.com> - - * calobj.c (skip_numbers): Actually skip over the numbers. - (ical_object_to_vobject): Test the proper variable for storing the - proper information. - -1999-07-14 Jean-Noel Guiheneuf <jean-noel.guiheneuf@wanadoo.fr> - - * timeutil.c (time_add_month): Fixed the problem with next month - going from a 31-day to a 30-day by adjusting the date to the - closest day at the end of the month. - -1999-06-07 Mike McEwan <mike@lotusland.demon.co.uk> - - * timeutil.c (time_add_month): Tell ktime' that we don't know - about daylight saving time so that it does *not* make adjustments - when we traverse a DST boundary. - (time_year_begin): ditto. - (time_year_end): ditto. - (time_month_begin): ditto. - (time_month_end): ditto. - -1999-06-16 Anders Carlsson <anders.carlsson@tordata.se> - - * main.c (new_calendar): Realize the toplevel widget when - --hidden is passed to gnomecal. This fixes a segfault. - -1999-06-04 Robert Brady <rwb197@ecs.soton.ac.uk> - - * gnome-cal.h, gnome-cal.c: Fix abort() problem with the year view. - (Bug #1367). Thanks to Owen Cliffe <oc197@ecs.soton.ac.uk> for - helping track it down. - -1999-06-03 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * calobj.c (daynumberlist): One line bug fix from Sergey I Panov. - -1999-06-02 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * view-utils.c (nicetime): Use %H instead of %k, as %k is a GNU - extension, not available in other systems. - -1999-06-01 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * calobj.c (daynumberlist): Work around broken software that - writes a broken month-of-day as "zero". Use the dtstart date for - this on this event. - -1999-05-28 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * Makefile.am (install-data-local): help files be gone. They are - now installed from the Docbook stuff. - -1999-05-26 Russell Steinthal <steintr@condor.penguinpowered.com> - - * gncal-todo.c main.c main.h prop.c: Added support for priorities - for todo items. Doesn't do much, but you can set them and sort by - them. (Use the properties box to enable them; should they be on - by default?) - -1999-05-25 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * main.c (parse_an_arg): Added missing break here. It was causing - core dumps when invoked with --userfile. - - * gnome-cal.c (gnome_calendar_set_view): Add some assertions here, - to pin point the bug reported on gnome-list. - - * calobj.c (load_recurrence): Make intervals always exist. a 0 - interval is wrong. - -1999-05-25 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * year-view.c: Removed unused macro CALENDAR_HEIGHT. - -1999-05-25 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * year-view.c (idle_handler): Set the canvas scroll region here, - not in size_allocate(). Also, use the correct width and height - based on the allocation and the precomputed minimum width/height - values. - - * gnome-cal.c (setup_widgets): Set the scrollbar policy of the - scrolled window. - - * main.c (setup_appbar): Use the correct type for the appbar. - - * gncal-day-view.c: Removed unused function switch_to_day(). - - * gncal-day-panel.c (calendar_day_selected): Removed unused variable. - -1999-05-25 Nat Friedman <nat@nat.org> - - * doc/C/gnomecal.sgml: Fixed a typo. - - * gnome-cal.c (setup_widgets): Added a scrolled window widget into - which the year view is placed. - - * year-view.c (CALENDAR_HEIGHT): The height of the total year view - inside the scrolled window. - (idle_handler): Set the height of the year view to - CALENDAR_HEIGHT. - (year_view_size_allocate): Set the scroll region of the year view - canvas to allocation->width, CALENDAR_HEIGHT. - -1999-04-25 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * main.c (dump_todo): Add --todo flag to dump the todo contents. - -1999-04-19 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-todo.c (add_activated): Use same hack used in edit_activated - -1999-04-16 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-todo.c (edit_activated): Kill all grabs from the CList - before running the new dialog box. - - This fixes the problem of button-3/Edit on the todo item blocking - the GUI (actually, the main window responds, but not the todo - window). - -1999-04-08 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-todo.c (gncal_todo_init): Make sure we can get events for - button3. The code for the nice popup menu was there but was not - getting invoked. - -1999-04-01 Steve Murphy <murf@e-tools.com> - - * calobj.c (weekdaynum): Added this routine so Monthly recurrences - use the weekday field as a simple integer for a single weekday. - - * calobj.c (load_recur_monthly_pos): Call weekdaynum instead of - weekdaylist. The interface only lets the user input a single value - anyway. - - * calobj.c (ical_object_to_vobject): instead of code to output day - names from a bit array, use instead the value as an int and output - a single dayname. - - * calobj.c (ical_object_generate_events): first_week_day gets the - day int instead of the first entry in the bit field. I inserted a - fair chunk of code to avoid calling generate if the day is out of - range for a month. It may be unneccessary, because mktime will - turn the extra days into a valid date the next month. But not all - mktimes are equal, I fear. - - * eventedit.c (ee_store_recur_rule_to_ical): For case 3, - (Monthly), I added code to set the interval slot of the recur - struct; without this value, selecting a monthly recursing, by - date, would lead to an infinite loop broken only by a failure to - alloc more memory. Also, in the "by position" case, both - u.month_pos and u.month_day were being assigned values. This is a - mistake, as they are both part of an union, and the same - thing. The weekday field should get the recur_rr_month_weekday - value. - - * eventedit.c (ee_rp_init_rule): set default day from the weekday - field instead of the u.month_day field, which is really the - month_pos value. - - * gnome-cal.c (gnome_calendar_tag_calendar): Month days start with - 1, not 0; thus, setting tm.tm_mday = 0, and then calling mktime - will generate a time corresponding to the end of the previous - month, which may have a mday anywhere from 28 to 31. The end time - just adds 1 to the month, so your end time may not cover the last - few days of this month, depending on what the biggest mday of last - month was. I changed it so tm_mday is set to 1 instead. - -1999-03-30 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-todo.c (convert_time_t_to_char): Made static. Make it use - the full year format for strftime(). - -1999-03-27 Nuno Ferreira <nmrf@rnl.ist.utl.pt> - - * calobj.c: Include <config.h> So that strings get translated. - -1999-03-26 Tomas Ogren <stric@ing.umu.se> - - * prop.c (build_hours_menu): Made it respect 12/24h settings.. - Doesn't show until next time you open the dialog.. yet.. - -1999-03-24 Tomas Ogren <stric@ing.umu.se> - - * gncal-week-view.c (gncal_week_view_set): Did some i18n work - * eventedit.c (get_exception_string): Did some i18n work - -1999-03-24 Tomas Ogren <stric@ing.umu.se> - - * gncal-todo.c (gncal_todo_init): Made clist titles i18n:able - * main.c (poptOption): Added which views that are possible for - --view in the --help text (closes #367) - * main.c (dump_events): Added (short) month to the strftime and made - the strings i18n:able - -1999-03-23 Tomas Ogren <stric@ing.umu.se> - - * gncal/calobj.c: Added 2 paranthesis.. - "foobar = d / 60*60" is _NOT_ the same as "foobar = d / (60*60)" - which caused heavy alarm-corruption with alarms between 2 hrs and - 2 days. - -1999-03-23 Nat Friedman <nat@nat.org> - - * eventedit.c (ee_store_recur_rule_to_ical): Set the - recur->interval to the value of the recur_rr_month_period spin - button if the event is being set "by day." This closes bug #675 - as reported by bagfors@hpc2n.umu.se. Thanks for the report! - -1999-03-10 Clifford R. Conover <rconover@montana.edu> - - * gncal-todo.c (simple_todo_editor): Add support for Due Date when - adding a TODO item here. - (column_resized): New function - (init_column_sorting): New function. - (todo_click_column): New function. - (convert_time_t_to_char, make_overdue_todo_style): New functions. - - * gnome-cal.c (gnome_calendar_todo_properties_changed): New - function used to update the TODO when the properties have been - chagned for it. - - * prop.c (prop_apply_todo): Apply TODO properties. - - * gncal-day-panel.c (todo_list_properties_changed): Update the - TODO display here. - - * eventedit.c (date_edit_new): Made public - -1999-03-10 Craig A Soules (soules+@andrew.cmu.edu) - - * timeutil.c, calendar.c, calobj.c, gncal-day-panel.c: Add support - for daylight time savings. - -1999-02-28 Martin Baulig <martin@home-of-linux.org> - - * gncal-full-day.c (recompute_motion): For DRAG_MOVE, DRAG_SIZE_TOP - and DRAG_SIZE_BOTTOM: call child_focus_out () if the child currently - has the focus. - -1999-02-27 Changwoo Ryu <cwryu@adam.kaist.ac.kr> - - * quick-view.c (QUICK_VIEW_FONTSET): Added Korean font to the - fontset string. - * mark.h (*_FONTSET): Likewise. - -1999-02-23 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * calobj.c (ical_object_to_vobject): Save the owner/organizer of - the event. - (ical_object_create_from_vobject): Load the owner/organizer of the event. - - * gncal-full-day.c (delete_occurance): Assign child to data (fixes - crash on "delete this occurrance"). - -1999-02-22 Timur Bakeyev <mc@bat.ru> - - * calendar.c: According to configured values, use either tm.tm_zone - or tzname. In last case, also declare it extern. - - * prop.c: langinfo.h not available everywhere. Wrapped. BTW, works - fine without it. - -1999-02-20 Tomas Ogren <stric@ing.umu.se> - - * main.c (init_username): Made use of g_get_{user,real}_name() instead - of our own home-brew... - -1999-02-17 Sergey Panov <sipan@mit.edu> - - * gnome-month-item.c,gnome-month-item.h,goto.c,mark.h, - month-view.c,prop.c,quick-view.c,year-view.c: will define - fonts via fontset. Friendlier to locales that use iso8859-[^1] - and koi8-r encodings. Does not solve problem for Asian languiges - --- better solution is needed (e.g. standart GNOME fontstyles - defined in gtkrc). - -1999-02-16 Sergey Panov <sipan@mit.edu> - - * main.c: Use N_() macro for color settings labels in - color_props structure. - -1999-02-15 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * goto.c (goto_dialog): Indentation fixes. - -1999-02-15 Tomas Ogren <stric@ing.umu.se> - - * goto.c: Made a private copy of what localtime() returns, to be able - to keep the data after more calls to localtime(). - -1999-02-11 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * main.c (save_default_calendar): New function. Saves the - calendar if it is the user's default calendar - - * gncal-full-day.c (unrecur_appointment): - * gncal-day-panel.c (day_view_range_activated): - * eventedit.c (ee_ok): - * gncal-todo.c (ok_button): Added autosave for the default - calendar. - -1999-02-09 Tomas Ogren <stric@ing.umu.se> - - * main.c: Removed the gtk_widget_realize call. - -1999-02-06 Changwoo Ryu <cwryu@adam.kaist.ac.kr> - - * gncal.desktop: Added Korean translations. - -1999-02-04 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * eventedit.c (date_edit_new): New convenience function to create - a properly-configured date editor widget. - -1999-02-03 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-week-view.c (gncal_week_view_new): Make the calendar start - weeks on Monday if appropriate. - (gncal_week_view_time_format_changed): New function to notify the - week view that the time format has changed. - - * gncal-day-panel.c (gncal_day_panel_new): Make the calendar start - weeks on Monday if appropriate. - (gncal_day_panel_time_format_changed): New function to notify the - day panel that the time format has changed. - - * gnome-cal.c (gnome_calendar_time_format_changed): Tell the day - and week views that the time format has changed. - -1999-02-01 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * eventedit.c (event_editor_init): Set the title of the event - editor window. - -1999-01-31 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-day-view.c (gncal_day_view_expose): Do not remove the - clipping rectangle here. - - * view-utils.c (view_utils_draw_events): Remove the clipping - rectangle here, since the user of this function should not know - about it. - -1999-01-30 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * view-utils.c (view_utils_draw_events): Improve this draw - routine. Now it can split the text in lines and fit as many - events as possible. - (nicetime): Return strings without spaces at the beginning. - - * gncal-day-view.c (gncal_day_view_expose): Move clip-clear - operation here. - -1999-01-29 Jason Tackaberry <tack@dok.org> - - * gncal-full-day.c (child_popup_menu): if the user clicks on an - event that is an occurance, the menu will allow the user to delete - all occurances of this event, or just the selected occurance. - (delete_occurance): added. - - * eventedit.c (append_exception): force the clist to select the - new exception. (fixes segfault) - (delete_exception): if the last exception in the clist is deleted, - move the selection index up. (fixes segfault) - -1999-01-28 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * main.c (parse_an_arg): Add --hidden key to hide the calendar at - startup. Only works with GNOME window managers though :-( - - * calendar.c (calendar_day_change): Reschedule alarms for the new day. - - (calendar_init_alarms): Schedule an alarm for midnight to change - the calendar_day_begin/calendar_day_end. - - * alarm.c (alarm_ready): If we reschedule, there is no need to - activate any pending alarms. - -1999-01-28 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c (child_new): Insert the summary text here. - (child_focus_in): No need to raise the window, since we have - Spiffo(tm) layout code. Boy, this is old code. - (gncal_full_day_focus_child): Now that GtkText works better, we - can avoid synthesizing a click which was causing grief, anyway. - (child_button_press): Grab the focus before popping up the menu. - - * layout.c (find_index): Added a sanity check. - - * gncal-full-day.c (child_destroy): Unmap and unrealize the child - before unparenting/destroying it. - (child_unrealize): Unrealize the widget. What was I thinking? - (child_new): Save the focus_out_event signal connection id in - Child structure (in a new field). - (child_destroy): Disconnect from the focus_out_event signal, since - we don't want to get such an event when the widget is destroyed. - (gncal_full_day_destroy): Destroy the children properly; it was - leaking memory. - -1999-01-27 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * main.c (save_calendar_cmd): Warn if the calendar file has - changed. - - * calendar.c (calendar_load, calendar_save): Keep track of the - modification time for the calendar file. - -1999-01-20 Nat Friedman <nat@nat.org> - - * gncal-full-day.c (gncal_full_day_key_press): Only trap printable - characters such that hotkeys work. - (UNSELECT_TIMEOUT): Changed to 0. Much saner behavior. - - * prop.c (properties): Connect gnome_help_pbox_display to the - GnomePropertyBox help button. - -1999-01-19 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * quick-view.c (quick_view_do_popup): Do not grab the mouse here - (it was being grabbed incorrectly, anyways). - (quick_view_map_event): Grab the mouse when the window is mapped. - This avoids the ugly "while (xGrabPointer () != Success)" hack. - (quick_view_button_release): Handle button releases here. - -1999-01-19 Tomas Ogren <stric@ing.umu.se> - - * main.c: do gtk_widget_realize on the toplevel window.. - -1999-01-13 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-day-panel.c (gncal_day_panel_new): Make the little - calendar start up with the correct date. - - * gncal-week-view.c (gncal_week_view_set): Add the month to the - date range display label. - -1999-01-08 Nat Friedman <nat@nat.org> - - * main.c: Converted some more stuff to use the standards. - -1999-01-08 Nat Friedman <nat@nat.org> - - * main.c (setup_appbar): New function to create the status bar. - (setup_menu): Install menu hints. - - Menu items updated to match the standards. New Settings menu - created. - -1998-12-30 Jeff Garzik <jgarzik@pobox.com> - - * gncal/calendar.c, gncal/gnome-cal.c, gncal/main.c, - gncal/quick-view.c: - s/g_copy_strings/g_strconcat/ - -1998-12-16 Miguel de Icaza <miguel@nuclecu.unam.mx> - - Rewrote the old and broken alarm system. It never actually - worked properly. Now it works properly, and I figured a nice way - to get the Audio alarm do something nicer (it is now like an alarm - clock :-). - - * gnome-cal.c (calendar_notify): Now we take a CalendarAlarm to - actually distinguish which alarm was triggered. - - * alarm.c (alarm_ready): The code was only activating the first - alarm. Reschedule the timer upon delivery of an alarm. - -1998-12-14 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * year-view.c (idle_handler): Use the allocation size instead of - the old fields in the canvas structure. - - * goto.c (create_days): Use gtk_widget_set_usize() instead of - gnome_canvas_set_size(). - * quick-view.c (setup_event_list): Likewise. - -1998-12-09 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-todo.c (simple_todo_editor): Use gnome_dialog_set_parent. - * goto.c (goto_dialog): ditto - * prop.c (properties): ditto. - -1998-11-23 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * eventedit.c (ee_rp_init_exceptions): Update GtkClist usage. - -1998-11-23 Andrew T. Veliath <andrewtv@usa.net> - - * gncal-day-panel.c (gncal_day_panel_new): Use - gtk_scrolled_window_add_with_viewport instead of - gtk_container_add (gtk changes). - -1998-11-23 Herbert V. Riedel <hvr@hvrlab.ml.org> - - * eventedit.c: use GPOINTER_TO_INT - - * gncal-todo.c: same. - -1998-11-22 Matthew Wilson <msw@redhat.com> - - * main.c: Fixed the popt event parsing callback to have the - correct number of arguments. This stops it from segfaulting. - -1998-11-16 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * eventedit.c (ee_classification_widgets): Doh. Fixed stupid bug - where the classification buttons were not being set correctly. - (ee_store_general_values_to_ical): Take into account the fact that - radio group lists are stored in reverse order of insertion. - - * gncal-todo.c (gncal_todo_init): Use a scrolled window to put the - clist into. - -1998-11-11 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * calendar.c (calendar_save): Backup the old file before saving - the caledar. - -1998-11-06 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * calobj.c: Add ctype.h - -1998-10-31 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gnome-cal.c (gnome_calendar_direction): Add the offset from the - beginning of the current time unit (day/month/etc), otherwise it - does not work right, for example, you are on the 31st day of a - month and the next month is a 30-day one and you jump to the next - month. - -1998-10-16 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * month-view.c: Changed a lot of stuff not to use the layout code - -- the month view's days are too small to display layout - usefully. Now they display a little list of the events in each - day. We also have a popup menu for the days in the month view. - - * calendar.c (calendar_get_objects_in_range): Reverse the list so - that it is returned in increasing order. - - * eventedit.c (event_editor_new_whole_day): New public function to - create an event for the complete span of day_begin to day_end. - - * year-view.c (new_appointment): Use event_editor_new_whole_day(). - - * year-view.c (yv_popup_menu): Mark strings for i18n. - -1998-10-12 Ji Lee <g@ucsd.edu> - - * eventedit.c (ee_store_recur_rule_to_ical): The interval was - never being loaded from the spin button. - -1998-10-09 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * month-view.c (month_view_update): Create a list of children and - lay them out nicely. Lots of functions added for this purpose. - (adjust_segment): Main event segment adjustment routine. - (adjust_children): Adjusts all the children in the month view. - (child_create_segments): Creates the segments for a particular event. - (layout_children): Uses the generic layout engine to organize the children. - -1998-10-08 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-todo.c (clist_row_selected): Set the sensitivity of the - edit/delete buttons. - (gncal_todo_update): Likewise. Thanks to Dirk Luetjens for the - bug report. - - * layout.c: Do some cleanup; now we pass a struct with the layout - algorithm's state instead of passing a trillion parameters around. - - * gncal-full-day.c (layout_children): Use the new generic layout - engine. - (child_compare): Sort keys are start time then end time, not just - start time. This produces somewhat nicer results for the layout - algorithm. - - The new layout code uses a partition of the time range occupied by - the events, rather than using a fixed time granularity. This is - better since the different parts of the program that use the - layout module will have different semantics regarding snapping the - event bounds to a fixed "time grid". - -1998-10-07 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * layout.[ch]: New files that abstract the event layout code from - gncal-full-day.c into something useful for other parts of the - program. Now all event layout is done here. - - * Makefile.am (gnomecal_SOURCES): Added layout.[ch] to the list of - sources. - -1998-10-07 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de> - - * main.c (main): Replaced the 'gnome_client_new_default' call with - 'gnome_master_client'. - -1998-10-02 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * timeutil.c (time_day_begin): Changed name from - time_start_of_day() to be consistent with the other begin/end functions. - (time_day_end): Likewise. - - * calobj.c (ical_object_get_first_weekday): New public function to - get the first toggled day in a weekday mask. Since we do not - support multiple weekdays in a monthly-by-pos rule, we just fetch - the first toggled one. - (ical_object_generate_events): Added a missing break statement. - - * timeutil.c (time_month_end): Made it consistent with the rest of - the time begin/end functions -- now it returns the first second of - the *next* month. - (time_week_end): Actually implemented this function. It will be - used when the week view is rewritten. - - * calobj.c (time_in_range): Fix off-by-one in the comparison of - the time against the end time. - - * gncal-full-day.c (expand_space): Fixed bug where the columns not - were being expanded due to a missing "slot + j". - -1998-10-01 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * month-view.c (month_view_init): Use the font #defines. - (month_view_new): Set the colors of the month view upon creation. - (mark_current_day): New function to mark the current day in the - month view. - (month_view_set): Mark the current day. - (month_view_colors_changed): Mark the current day and colorify the - month item appropriately. - - * month-view.h: Added year and month fields to the MonthView - structure. - - * main.c: Renamed the Appointments color property, since it will - be used by the month view as well. - - * goto.c (update): Set the current day's font and color. - - * year-view.c (year_view_init): Set the fonts of the month items - when creating them. - - * mark.h: Added new #defines for HEADING_FONT and TITLE_FONT. - - * year-view.c (year_view_init): Use the new font #defines. - - * prop.c (prop_apply_colors): Fixed to work with the - I-am-paranoid-and-I-need-to-size-my-ints changes to - GnomeColorPicker. - (color_spec_from_picker): Likewise. - -1998-09-30 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * goto.c (create_days): Colorify the month item and prepare it for - prelighting here. - - * main.c (color_props): Changed the default colors to something - not dull. - - * year-view.c (compute_min_size): New function to compute the - minimum size of the year view properly. - (year_view_size_request): Added two new fields to the year view - structure that contain the minimum size. Return this in the - size_request method. - (year_view_new): Call compute_min_size to save the minimum size - for later use. - (idle_handler): Make it resize the items correctly. - - * gnome-month-item.c (gnome_month_item_set_arg): Reshape when - necessary. This is needed becaues we now actually calculate a - minimum size for the month item based on the font sizes and paddings. - (check_heading_sizes): New function to calculate a minimum size - based on the headings' dimensions. - (check_day_sizes): New function to calculate a minimum size based - on the day number labels' dimensions. - (check_sizes): New function that computes a minimum size for the - month item. - (reshape): Now calls check_sizes() to ensure a minimum size for - the month item. - - * year-view.c (mark_current_day): New function to mark the current - day in the year view. - - * mark.c: Removed mark_current_day from here. - -1998-09-29 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * prop.c (fetch_color_spec): Changed name from fetch_prelight_spec - and made it conform to the new prelighting mechanism. - (fake_mark_days): Set the proper day attributes. - (reconfigure_month): Use colorify_month_item(). - (fake_mark_days): Use mark_month_item_index(). - - * mark.c (colorify_month_item): New public function to reset the - colors in a month item. - (get_attributes): New internal function that creates an array of - attributes for the days in a month item. This is the basis of all - the new optimizations to month item marking. - (unmark_month_item): Now it uses the attributes array to unmark - only the days that need unmarking. - (mark_event_in_month): Update the day attributes array. - (month_item_prepare_prelight): Changed the definition of the - prelight color query function. Use the new function. - (day_event): Do color changes based on the day attributes array. - (mark_month_item_index): New public function to mark a single day - by index. - (mark_event_in_month): Use mark_month_item_index(). - - * gnome-month-item.c (gnome_month_item_num2child): Now takes an - int, not a GnomeMonthItemChild. - (gnome_month_item_child2num): Now returns an int, not a - GnomeMonthItemChild. - (gnome_month_item_num2day): Now takes an int, not a - GnomeMonthItemChild. - - * goto.c (goto_dialog): Create the days before the year spin - button, because the year_changed callback expects the month item - to be created. The new semantics of the spin button cause it to - emit a value_changed signal on the adjustment upon creation -- is - this the behavior we want from it? - (goto_dialog): Use gtk_window_set_modal() instead of the - deprectaed gnome_dialog_set_modal(). - - * quick-view.c (quick_view_new): Make it look not as crappy by - putting the title inside the frame. - (quick_view_do_popup): Fixed the pointer grab and added a cursor. - (create_items_for_event): Query the text width/height from the - text item using the new object arguments, so that the size of the - popup window can be set properly. - - * year-view.c (do_quick_view_popup): Calculate a nice date string - for the popup window. - -1998-09-28 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * quick-view.[ch]: New file that presents a quick view of the - events in a particular day when the mouse is clicked on the year - view. Work in progress. - - * year-view.c (do_quick_view_popup): New function that creates a - quick view for the events in a day. - - * Makefile.am (gnomecal_SOURCES): Added quick-view.[ch] to the - list of sources. - -1998-09-27 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * main.c: Hotkey for File/Exit should be C-q, not C-x. - -1998-09-24 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * year-view.c (do_popup_menu): New function to execute the popup - menu in the year view. - (day_event): Invoke the popup menu with the context set to days. - (new_appointment): New function to create a new appointment from - the year view. - (do_jump): New function to do the appropriate view/date jumping - from the popup menu. - - * main.c: Fixed two icons in the File menu. - -1998-09-21 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * main.c: Added underlined shortcuts and accelerators to the main menu. - -1998-09-16 Raja R Harinath <harinath@cs.umn.edu> - - * gncal-week-view.c (<gtk/gtklabel.h>): Include. - * gncal-week-view.h (<gtk/gtkvbox.h>): Include. - -1998-09-06 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gnome-cal.c (mail_notify): Fixed the bug reported about the mail - notification not beint sent until the program was terminated. - -1998-09-03 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c (gncal_full_day_forall): Updated foreach -> - forall from Gtk changes, bleah. - - * year-view.c (day_event): New function to handle events from - days. Jumps to the day that is clicked. - - * main.c: Use a watch cursor while the previous/today/next - functions are doing their job. - - * mark.c (month_item_prepare_prelight): New public utility - function to prepare a month item for prelighting. It will store - the proper prelight information and attach the appropriate signals. - (mark_current_day): Make the current day bold as well (useful for - color-blind people, I guess). - - * prop.c (set_current_day): Reset the date in the sample calendar - and mark the current day. - (fake_mark_days): Mark fake events in the sample calendar. - - * year-view.c (year_view_set): Use the general prelighting engine. - - * goto.c (day_event): Just process button presses, as prelighting - is done behind the scenes now. - (update): Use the general prelighting engine. - - * prop.c (create_colors_page): We can now configure the colors of - the monthly calendars! Wheeeeee! There are still some nits to be - fixed, which are listed in the TODO file. - (build_color_spec): New function to build color specifications. - (parse_color_spec): New function to parse color specifications. - - * mark.c: Modified all functions to use the configured colors. - * goto.c: Likewise. - - * main.c (colors_changed): New function that notifies all - calendars that colors have changed. - - * gnome-cal.c (gnome_calendar_colors_changed): New function that - notifies all the views that the colors have changed. - - * month-view.c (month_view_colors_changed): New function that - notifies the month view that colors have changed. - - * year-view.c (year_view_colors_changed): New function that - notifies the year view that colors have changed. - - * gnome-month-item.h (struct _GnomeMonthItem): Added fields for - outline and day box colors. - - * gnome-month-item.c (gnome_month_item_set_arg): Added - outline_color, outline_color_gdk, day_box_color, and - day_box_color_gdk arguments to month items. These are convenient - to quickly set the colors of the month item. - (gnome_month_item_get_arg): Likewise. - - * main.[ch]: Added a global array of structures for color preferences. - -1998-08-31 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * goto.c: Small code cleanup. - (day_event): Upon receiving a LeaveNotify event, Reset the day's - background to the correct color. - -1998-08-29 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * mark.[ch]: New files with utility functions to mark calendars - with their events. - - * mark.c (mark_month_item): New public function to mark a month - item with events. - (unmark_month_item): New public function to unmark all the days in - a month item to their default appearance. - - * year-view.c (year_view_set): Use the new unmark_month_item() and - mark_month_item() to mark the months with events. - - * goto.c (update): New function that updates the calendar in the - Go-to dialog by marking the days. - - * timeutil.c (time_year_begin): Modified to take a time_t value. - (time_year_end): Likewise. - (time_month_begin): Actually implemented this function, which was - in the header file but not here. - (time_days_in_month): New public function that returns the number - of days in a month. - - * Makefile.am (gnomecal_SOURCES): Added mark.[ch] to the sources. - - * year-view.c (unmark_days): Use unmark_month_item(). - - * gncal-full-day.c (gncal_full_day_destroy): Fixed crash when - destroying the full day view. The full day's destroy method is - unusual in that it destroys the list of child widgets itself, as - it does not have a remove method, so it needs to reset the list to - NULL. - -1998-08-27 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gnome-month-item.c (build_month): Now does the correct thing - when the user wants weeks to start on Monday. Now all the Monday - special casing, as far as day numbering is concerned, is only in - this function. - - * year-view.c (mark_days): This function marks the days that have - events in them. It also fixes a memory leak in the old - implementation (it was leaking the whole list). - (unmark_days): New function used to unmark all the days in the - year view. - (mark_event): New function that marks all the days that are - spanned by a time range. It also fixes the bug in the old - implementation where it could possibly mark days past the ends of - the year (if the event crosses year boundaries, for example). - - * timeutil.c (time_year_begin): Take the year parameter since year - 1, not 1900. - (time_year_end): Likewise. - - * year-view.c (year_view_size_allocate): Now changing the size of - the calendars is done in the idle loop. - (idle_handler): This function actually does the resizing of the items. - - * year-view.h (struct _YearView): Added idle_id and need_resize - fields. - -1998-08-26 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * year-view.c: Beginning of the new year view. Sizing and event - marking needs to be finished. - - * gnome-cal.c: Updated for year-view. - (gnome_calendar_time_format_changed): Use year_view_time_format_changed(). - - * year-view.[ch]: Renamed the gncal-year-view.[ch] files to - year-view.[ch]. - - * Makefile.am (gnomecal_SOURCES): Updated year-view.[ch] in the - list of source files. - -1998-08-25 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * goto.c (create_days): Set the heading color of the month item. - - * main.c: Use GNOME_STOCK_PIXMAP_JUMP_TO, now that it exists, - instead of goto.xpm. Also, removed goto.xpm from cvs. - - * gnome-month-item.h (struct _GnomeMonthItem): Added fields for - the heading and day number fonts. Added fields for heading and - day number label colors. - - * gnome-month-item.c (gnome_month_item_class_init): ARG_DAY_NAMES - should be write-only. Also, added arguments for heading and day - number fonts. Added arguments for heading and day number colors. - -1998-08-24 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * prop.c (build_two_radio_group): Doh. Set the state of the radio - buttons properly. - - * month-view.c (month_view_time_format_changed): New public - function that notifies the month view of a time format change. - - * gnome-cal.c (gnome_calendar_time_format_changed): New public - function that notifies the calendar of a time format change. - - * main.c (time_format_changed): Use gnome_calendar_time_format_changed(). - - * month-view.c (month_view_update): New public function to update - the month view when an event changes. This is still unfinished. - (month_view_set): New public function to set the month in the - month view. - - * gnome-cal.c (gnome_calendar_direction): Add case for month view. - (gnome_calendar_set_view): Likewise. - (gnome_calendar_update_all): Likewise. - - * timeutil.c (time_add_week): Implemented the time_add_week() - function, which was on the header file. - (time_add_month): Added public month-adding routine. - - * gnome-cal.c (gnome_calendar_get_current_view_name): Add case for - month view. - (gnome_calendar_goto): Likewise, and set the time on the month view. - - * month-view.c (month_view_new): Now it takes the calendar plus - the time_t representing the month. - - * gnome-month-item.h: Added documentation on the object arguments - for the month item. - - * month-view.c (month_view_init): Added a month/year heading to - the month view. - - * TODO: Updated the TODO list a bit. - - * main.c (gnome_cal_file_menu): The preferences menu option should - go in the File menu. - (gnome_cal_edit_menu): Added stock pixmaps to the menu items. - (gnome_cal_menu): Renamed the Calendar menu to Edit. - (gnome_cal_help_menu): Use "About Gnomecal", not just "About". - - * prop.c (hour_activated): Notify the property box that it has changed. - - * main.c: Changed the Properties menu item to Preferences. These - are global application preferences, not a single calendar's - properties. - - * prop.c (prop_apply): Save the week_starts_on_monday flag to the - configuration file. - (properties): Added a check button for weeks starting on Monday. - (properties): Beautified the Preferences dialog. - - * month-view.c (month_view_init): - * goto.c (create_days): Set the month item to start weeks on - Monday if appropriate. - - * main.c (init_calendar): A boolean is not an hour, so don't - range_check_hour() on it. - (init_calendar): Added a global week_starts_on_monday flag. - - * main.h: Added global week_starts_on_monday flag. - -1998-08-21 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * calobj.c (ical_object_create_from_vobject): If mail alarm or - program alarm are missing the action, then set an empty default. - -1998-08-18 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gnome-month-item.c (gnome_month_item_day2index): New public - function to get the displayed day index of the specified date. - - * gnome-cal.c (gnome_calendar_goto_today): New public function to - jump to the current day. - - * goto.c (day_event): Jump to the selected day when the user - clicks the mouse, and prelight days as appropriate. - - * timeutil.c (time_from_day): New public function to build a - time_t from a year/month/day triplet. - - * gnome-month-item.c (gnome_month_item_num2child): - (gnome_month_item_child2num): New public functions to convert an - index into a child and vice-versa, respectively. - (gnome_month_item_num2day): New public function to convert a child - number into a displayed day number. - - * goto.c (goto_dialog): Doh, use gnome-dialog properly :-) - - * gnome-month-item.c (create_items): Use g_strdup()ed day names - from the start. - -1998-08-17 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * main.c (gnome_toolbar): Made it use goto.xpm. - - * Makefile.am (EXTRA_DIST): Added goto.xpm to the list of files. - -1998-08-13 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gnome-month-item.c (gnome_month_item_set_arg): Doh. Actually - recalculate the days using the month and year. - - * main.c: Added "Go to" button to quickly jump to a specific date. - - * goto.c: New file that defines the quick go-to date dialog. - - * Makefile.am (gnomecal_SOURCES): Added goto.c to the sources. - -1998-08-11 Nuno Ferreira <nmrf@rnl.ist.utl.pt> - - * main.c (new_calendar): Made title i18n friendly. This was bug - #215. - - * eventedit.c (ee_store_recur_end_to_ical): Set recur->enddate to - recur->_enddate, not to itself, when adding recurring event and - supplying an end date. This fixes (at least part of) bug #99. - -1998-08-10 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * month-view.[ch]: Start of the month view widget. This will use - the generic month item and extend it to have the semantics desired - for the gnomecal month view. - - * gnome-month-item.[ch]: New generic canvas item for the month - view and the "small calendars". This is intended to be a - high-level display engine for monthly calendars. This is a work - in progress. - - * gnome-cal.h (GnomeCalendar): Added a month_view field. - - * gnome-cal.c (setup_widgets): Create the month view and insert it - into the notebook. - - * Makefile.am: Added month-view.[ch] and gnome-month-item.[ch] to - the sources. - -1998-08-03 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * main.c (about_calendar_cmd): Use an array of const strings to - keep gcc happy. - - * alarm.c (alarm_compare_by_time): Use gconstpointer to keep gcc happy. - * calendar.c (calendar_object_compare_by_start): Likewise. - * gncal-full-day.c (child_compare_by_start): Likewise. - -1998-07-07 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * main.c: Add support for --view flag. - (session_save_state): Save the view mode; - (new_calendar): Now takes a view mode flag. - - * gnome-cal.c (gnome_calendar_get_current_view_name): New - function for enhancing the session management support for - gnomecal. - (gnome_calendar_set_view): New function that makes a given page - active. - -1998-07-01 Nuno Ferreira <nmrf@rnl.ist.utl.pt> - - * gncal.desktop: Added Portuguese translation. - -Mon Jun 22 13:01:16 1998 Havoc Pennington <hp@pobox.com> - - * main.c (session_save_state): Use gnome_geometry_string to get - the geometry string. - -1998-06-04 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * eventedit.c (ee_rp_init_rule): Do not subtract 1 from - tm->tm_mday for the default_day. - - * gnome-cal.c (gnome_calendar_new): - (gnome_calendar_goto): Use the start of the day -- things expect - it to be that way. - -1998-05-27 Nuno Ferreira <nmrf@rnl.ist.utl.pt> - - * eventedit.c (ee_store_recur_rule_to_ical): Fill in - ical->recur->interval from value in spin_button. This ixed an - infinnite loop. - -1998-05-30 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c (child_draw): Paint the decorations correctly. - (child_draw_decor): Paint the recurrence/bell icons correctly. - -1998-05-25 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * eventedit.c (ee_rp_init_rule): Use the contents of - ee->ical->dtstart for computing the predefined values of the recurrence. - - * gncal-full-day.c (gncal_full_day_unrealize): Fix the gc - destruction in the unrealization code and fix the pixmap unrefing. - - * main.c (close_cmd): Remove a bad hack that disabled calendar - widget destruction. - - * calobj.c (ical_object_generate_events): Fix for the weekly event - generation. Was reported on the bug tracking system. - -1998-05-18 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-full-day.c (layout_children): Implemented ultra-cool - layout for the events that share the same time range. Gals and - guys you can now drop Outlook on the recycle bin. - - Which reminds me. We do not have a recycle bin. How could that - happen in a project as cool as this one? Someone explain this to - me. - -1998-05-18 Federico Mena <federico@nuclecu.unam.mx> - - * gncal-full-day.c (paint_back): Eliminated unnecessary border repainting. - -Sun May 17 17:55:03 1998 Havoc Pennington <hp@pobox.com> - - * gncal-todo.c (simple_todo_editor): Close dialog when return is pressed. - -1998-05-15 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gnome-cal.c (mark_gtk_calendar_day): Bug free version of the - range computation in place. - - * gncal-year-view.c (year_view_mark_day): Use the same new version - of the range computation here. - - * calobj.c (ical_object_generate_events): Fix the begin/end - condition. - -1998-05-14 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * timeutil.c (isodate_from_time_t): Do not add the spurious - padding. - - * calobj.c (store_date_list): Bug fix: I was using the wrong - pointer when saving the exception date list. - (set_date_list): Bug fix: load correctly the complete exception - date list. - (set_date_list): Use ',' for the exception date separator as the - versit people can not get their standard right. - - * gncal-full-day.c (unrecur_appointment): Support for making an - existing recurrent event `movable' for a day. - - * calobj.c (ical_object_add_exdate): New routine, used to add - exception dates. - (ical_object_duplicate): New routine: used to do the magic - recur->no-recur event. - -1998-05-08 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-full-day.c (new_appointment): Use gtk_calendar freeze/thaw - - * gncal-year-view.c (gncal_year_view_set_year): Use gtkcalendar freeze/thaw. - - * eventedit.c (event_editor_init): Use gnome_dialog_set_close to - avoid the ugly warning. - - * main.c (display_objedit): Default to the day the user is looking - at. - -1998-05-05 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-day-panel.c (full_day_size_allocated): Do not emit a value - changed signal if the value is the same. - -1998-05-04 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * prop.c (prop_apply): Only run the apply code once. - -1998-05-03 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-day-panel.c (update): Draw the day at startup. - (gncal_day_panel_set): Fix selected-day display. - (gncal_day_panel_new): Switch day on double clicks, not on single - clicks. - - * calobj.c (ical_object_compute_end): Removed debug messages. - -1998-04-30 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * prop.c (prop_apply): Do not call prop_cancel, ths is now using - GnomePropertyDialog. - -1998-04-29 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-week-view.c (sync_week): Use gnome_calendar_tag_calendar. - - * gnome-cal.c (gnome_calendar_tag_calendar): New routine used to - fill a gtk_calendar with the events on a GnomeCalendar object. - - * gncal-week-view.c (gncal_week_view_new): Set the week to the day - we double clicked. - -1998-04-28 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gnome-cal.c (calendar_notify): Apply black magic to get mail - notifications to work. - - * gncal-full-day.c (child_focus_out): Temporary optimization, the - child_focus_out is constantly calling the - gnome_calendar_object_changed when the property editor has been - invoked. This happens every time the mouse moves crosses the main - window. - - * calendar.c (calendar_object_changed): Reschedule alarms when a - calendar object has changed its times. - -Sat Apr 25 22:20:45 1998 Havoc Pennington <hp@pobox.com> - - * eventedit.c, eventedit.h: Descend from GnomeDialog. Took vbox - out of class structure; use GnomeDialog vbox - instead. gnome_dialog_set_destroy instead of destroying in button - callbacks. Don't create buttons, separator, or vbox manually. - #include <libgnomeui/gnome-dialog.h>. - -1998-04-24 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * calobj.c (ical_object_create_from_vobject): Fixed alarm loading; - Load snooze time and snooze count - -1998-04-23 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * calendar.c (calendar_save): Actually save the to-do entries. - - * gncal-todo.c (simple_todo_editor): Now you can add and edit - to-do entries. - -1998-04-22 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c: Made it use popup_menu(). - - * popup-menu.c: New file with utility functions for creating popup - menus. Maybe such a thing would be useful in libgnomeui, a la - gnome-app-helper? - - * Makefile.am (gnomecal_SOURCES): Added popup-menu.[ch] to the sources. - -1998-04-22 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * prop.c (properties): Added Calendar properties editor. - (properties): Make the code use a propery box. - - * main.c: Save/load properties (fix to old commit). - -1998-04-21 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-todo.c: New widget for editing TODO lists. This will be - worked on a lot. - - * Makefile.am (gnomecal_SOURCES): Added gncal-todo.[ch] to the sources. - - * gncal-day-panel.c: Make it use the new TODO widget. - -1998-04-21 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * timeutil.c (isodate_from_time_t): Do not save with the global - time flag (Z at the end of the isodate). When we figure out a way - to load times in GMT time, we will add this back - - * view-utils.c (popup_menu): Moved this routine here as there are - more users of this code. - - * gncal-day-view.c (gncal_day_view_class_init): Add button press - handler. - (new_appointment): New routine for creating appointments on a day. - - - - * main.c (save_ok): Added call to gtk_window_set_wmclass. - - * gncal-day-panel.c (calendar_day_selected): Fix, years for mktime - should substract 1900 and gtk_calendar stores years relative to - year 0. - - * gncal-week-view.c (gncal_week_view_new): Make the week view - descend from VBox so that we can add a label to it. - (gncal_week_view_set): Display the ending day of the week - correctly. - - Added a label that displays the week range. - -1998-04-21 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gnome-cal.c: Made it use GncalDayPanel. - - * gncal-day-panel.c: New widget for the day view in the main - calendar toplevel. It basically takes care of everything - gnome-cal did by hand with respect to the day view. - - * Makefile.am (gnomecal_SOURCES): Added gncal-day-panel.[ch] to - the rules. - - * main.c: Added a separator between the About menu item and the - help topics. - -1998-04-20 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * eventedit.c (ee_ok): Mark the event as non-new after accepting changes. - -1998-04-20 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c (gncal_full_day_get_day_start_yoffset): New - public function that returns the y offset for the row - corresponding to the "day begin" time. - - * gncal-full-day.c (gncal_full_day_key_press): Now any printable - keystroke (not just Return) will activate the selected range. - - * gncal-full-day.c (paint_back): Made it use the new paint_row - function instead of painting everything directly. We calculate - areas in a smarter way so there is even less flicker than before, - especially when selecting regions. - - * eventedit.c: Sensitize recurrence widgets properly. - - * calobj.c (duration_callback): Pass the correct pointer type to - is_date_in_list(). - -1998-04-20 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * calobj.c (duration_callback): Take exception dates into - account. - - * gncal-full-day.c (new_appointment): Setup the event editor dates - to those of the currently displayed day. - (gncal_full_day_selection_range): Use sensible values in the case - no range is selected. - (new_appointment): Events now use the current day for event creation. - - * view-utils.c: Pretty up the time display. - - * calobj.c (ical_object_compute_end): Initialize - ico->recur->enddate, otherwise we loop forever during final date computation. - - * eventedit.c: Now recurrence is toggled by a radio button in the - recurrence page, as the checkbox is confusing. - - * calobj.c (is_date_in_list): Add support for the exclussion - dates. - -1998-04-18 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-year-view.c (double_click): Fix this routine as well. - - * gncal-week-view.c (jump_to_day): Bind the gtkcalendar signals to - the week. - - * gncal-year-view.c (gncal_year_view_set_year): Put things in the - proper range. Now the year view actually matches this year. - - * gnome-cal.html: Added small documentation. - - * main.c: Add more icons to the menus; Rename some menubar - entries; Add `new' icon to the toolbar. - (dump_events): Added argument handling and dumping of events from - the command line. Extremely cool. - - * getdate.y: Taken from the CVS source code. Used for date - parsing in the command line. - - Internationalized getdate.y. Wee! It even works with spanish. - - * calobj.c (ical_object_to_vobject): Add Quoted printable property - to items containing new lines. - (duration): Use unsigned integers, to work around buggy calendar - files generated by korganizer. - - * main.c (save_calendar_cmd): Do not ask for file name if we are - saving. - (save_as_calendar_cmd): New command. - - -1998-04-17 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * alarm.c (alarm_kill, alarm_init, alarm_add): Implement the alarm - management framework. - -1998-04-17 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * calobj.c (ical_new): Added mandatory status property. - (ical_object_to_vobject): Only store "related" list if it exists. - (store_list): Add terminating null char and free the correct data. - - * main.c (save_calendar_cmd): Implemented calendar saving. - (open_calendar_cmd): Implemented calendar loading. - (new_calendar_cmd): Implemented calendar creation. - (new_calendar): Don't load our test calendar by default. - - * gncal-full-day.c (delete_appointment): Delete appointment implemented. - - * eventedit.c (ee_store_recur_values_to_ical): Free/create - ical's recurrence appropriately. - (ee_rp_init_rule): Initialize all missing parameters from ical. - (ee_rp_init_ending_date): Initialize missing fields from ical. - -1998-04-17 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gnome-cal.c (gnome_calendar_remove_object): Add support for - removing objects. - -1998-04-17 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * eventedit.c (ee_init_recurrence_page): New function that creates - the recurrence page in the toplevel notebook. - (ee_store_recur_values_to_ical): Now we can also store the recurrences. - -1998-04-17 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * calobj.c (ical_object_generate_events): Implement - RECUR_MONTHLY_BY_POS implemented. - (ical_object_create_from_vobject): Fix the alarm - initialization code. - (save_alarm): Save alarms. - (ical_object_generate_events): Fixed the recurrent code to take - into account the recur->endate field (if at all specified). - - (ical_object_to_vobject): Implement recurrence rule saving. - -1998-04-16 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * eventedit.c (ee_store_alarm): Use menu_shell->children, not - menu->children. Why does GtkMenu have a children field in the - object structure? - (check_dates): New function that insures that start_date < end_date. - (check_times): In addition to checking whether the event spans the - whole day, now it insures that start_time < end_time. - - * gncal-full-day.c (child_set_size): Now children get bigger - temporarily while they are focused. This allows the handles not - to "overlap" the rows used by the child and thus allow editing of - very thin events. - (recompute_motion): Fix for new child coordinates. - (gncal_full_day_expose): Make it use find_child_by_window() - instead of looking for it by hand. - - * bell.xpm recur.xpm: XPM files for events with alarm and - recurrence, respectively. - -1998-04-15 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c (button_1): Preserve the up/down cursor while dragging. - - * gncal-full-day.c (child_draw): Now children have a vertical - handle as well. This can be used to move the child anytime, not - only when it is focused. - (recompute_motion): Modified for new drag behavior. - - * eventedit.c (ee_init_general_page): The general_owner may be - null. Do the proper thing when creating the label. - (ee_ok): Update the gnome calendar appropriately. - - * timeutil.h: - * gncal-year-view.h: Add some missing prototypes. - - * gncal-full-day.c (child_popup_menu): Set the sensitivity of menu - items according to whether the ical object is being edited or not. - - * eventedit.c (event_editor_new): Set the "being edited" flag on - the ical object (stored as the ical object's user data). - (event_editor_destroy): Release the flag. - - * calobj.h: The iCalObject structure now has a generic user_data pointer. - * calobj.c (ical_object_set_user_data ical_object_get_user_data): - Functions to set this data. - - * gncal-full-day.c (child_button_press): Do child popup menu correctly. - - * main.c (about_calendar_cmd): Fixed my address and added Arturo - to the authors in the about box. - - * gncal-full-day.c (find_child_by_window): Compare child's widget - windows by user_data (which will be the parent widget, that is, - the text widget). We cannot assume that child->widget->window - will be *the* window we are interested on because there may be - child widgets with multiple windows. - -1998-04-15 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * calobj.c (ical_foreach): Define iterator routine. - -1998-04-15 Arturo Espinosa Aldama <arturo@nuclecu.unam.mx> - - * gncal-year-view.[hc]: Now using time_t for new and set. - Random fixes, as well. - -1998-04-15 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c (button_3): New popup menus activated with - mouse button 3. - (create_appointment): Create a new appointment from the popup - menus. See the FIXME. - -1998-04-15 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-full-day.c (layout_kill_rows): Routine to destory rows - array properly. - - * gncal-year-view.c (gncal_year_view_new): Add missing year in - call to strftime. - - * calobj.c (ical_object_create_from_vobject): Fixed memory leaks - from the return values of versit's fakeCString. - -1998-04-14 Arturo Espinosa Aldama <arturo@nuclecu.unam.mx> - - * gncal-year-view.[hc]: New widget for the year view. - * Makefile.am: added required compilation of the new files. - -1998-04-14 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * eventedit.c (event_editor_setup_time_frame): Fixed some table - expansions to make the dialog look nicer when resized. - - * calobj.c (ignore_space): Fixed compiler warning about unused - computed value. - (ocurrencelist): Replace str by p confusion. Removed unused - variables value and q. - (daynumber): Fixed a couple of warnings about unused values. - (load_recurrence): Removed unused variable c. Added a default - clause to the switch(type). - - * eventedit.c (ee_rp_init_frequency): Removed unused variable content. - Fixed a compiler warning by adding a missing cast. - - * calobj.c (ical_object_create_from_vobject): Make the - load_recurrence() part work correctly. Eliminated use of - syntax_error variable. - -1998-04-13 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c (child_key_press): Unfocus the child and focus - the parent fullday widget when the user presses Esc. - - * gncal-week-view.c (gncal_week_view_update): Now takes object and - flags parameters. - * gncal-day-view.c (gncal_day_view_update): Likewise. - * gncal-full-day.c (gncal_full_day_update): Likewise. - (child_focus_in): New function. In conjunction with - child_focus_out(), these only display the handles in the child - when it is focused. The result is that the user can see more of - the child's text when nothing is focused, and we can also display - fatter and nicer drag handles. - - * gnome-cal.c (gnome_calendar_object_changed): Now takes an - additional flags parameter - (gnome_calendar_update_all): Made function static. Now takes - changed object and flags parameters as well. - (gnome_calendar_object_changed): Now takes additional flags - parameter to indicate what changed in the specified object. - - * calobj.h (CalObjectChange): New enum with flags to describe what - has been changed in an object. - - * gncal-full-day.h: - * gncal-full-day.c (gncal_full_day_focus_child): New function to - let the outside world decide which child to focus. - (gncal_full_day_focus_child): Bleah. We have to synthesize a - click because GtkText will not set the cursor when you focus it. - - * gnome-cal.c (day_view_range_activated): Focus the new child in - the full day widget. - - * eventedit.c (event_editor_setup_time_frame): Re-aligned some - widgets to make it look prettier. - (ee_alarm_widgets): Likewise. - (ee_init_general_page): Likewise. - (ee_classification_widgets): Likewise. - (event_editor_init_widgets): Likewise. - - * gnome-cal.c (day_view_range_activated): Create new object and - add it to the calendar. You can now select a range in the - full-day view, hit Return, and a new event will be added at the - selected range. I still have to figure out how to focus this new child. - - * gncal-full-day.c (paint_back): Rewrote function to avoid - painting an area more than once -- eliminate flicker. - (paint_back_rows): New function that calls paint_back() only for - the area of the specified rows. - (gncal_full_day_button_press): - (gncal_full_day_button_release): - (gncal_full_day_motion): Made these functions use - paint_back_rows() instead of paint_back(), to eliminate flicker. Wheee! - -1998-04-12 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gnome-cal.c (setup_day_view): We now connect to the - range_activated signal of the fullday widget instead of catching - key presses ourselves. - (day_view_range_activated): New function that creates a new - iCalObject and inserts it into the calendar, not finished yet. - -1998-04-11 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c (get_time_from_rows): New function, calculates - a pair of time_t values from the specified start and number of rows. - - * gncal-full-day.h (GncalFullDayClass): New signal - "range_activated". It is emitted when a range is selected and the - user hits Return. - (gncal_full_day_selection_range): New function, returns the - selected range. - - * gncal-full-day.c (struct drag_info): Moved selection information - to their own fields instead of sharing the child's drag fields. - This allows us to keep the selection when a child is moved. - (recompute_motion): Made the case when (row < di->sel_click_row) - work correctly. - -1998-04-11 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gnome-cal.c (gnome_calendar_goto): Add support for navigating - on the day view. - - * timeutil.c (time_start_of_day, time_end_of_day, time_day_hour): - New time manipulation functions. - - * eventedit.c (ee_rp_init_frequency): Add the different frequency - editors to a notebook. Make the notebook startup on the entry - selected recurrence type; - -1998-04-11 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c (recompute_motion): Now we support selecting a - range in the main window (by clicking+dragging). It flickers - horribly and is not perfect, but it is a start. - -1998-04-09 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c: #include <string.h> - - * gncal-full-day.c (child_map): Show instead of just map the child - widget (otherwise the text widget gets confused and will not focus). - - * calobj.c (ical_object_to_vobject): Quote chars as 'x', not "x". - - * calobj.h: Added prototype for ical_object_to_vobject(). - - * gnome-cal.c (gnome_calendar_object_changed): New function. This - should be called when a calendar object is changed. - - * gncal-full-day.c (update_from_drag_info): Call - gnome_calendar_object_changed() instead of updating manually. - - * calendar.c (calendar_add_object): - (calendar_remove_object): Set the modified flag to true. - - * gncal-full-day.c (gncal_full_day_draw): Finished implementing - this function. - -1998-04-08 Raja R Harinath <harinath@cs.umn.edu> - - * gncal.c (update_calendar): Say `#if 0', not `#ifdef 0'. - -1998-04-07 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * eventedit.c: Removed unused global variable parent_class. - - * eventedit.h: Renamed gtk_window field to window. - Made the parent_class field in the EventEditorClass structure be a - GtkWindowClass, not a gnome property box class. - Added prototype for event_editor_get_type(). - -1998-04-06 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-week-view.c (gncal_week_view_new): Use the new - gtk_table_set_homogeneous() instead of setting the variable directly. - -1998-04-03 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * eventedit.c (ee_create_ae): Make it return void. - (ee_alarm_widgets): Remove some unused variables. - (ee_store_alarm): Make it return void. - #include <string.h> - - * eventedit.h: #include "gnome-cal.h" - - * calobj.c (list_free): Don't use g_free in the g_list_foreach. - - * calendar.h: Add prototype for calendar_load(). - - * timeutil.h: Add prototypes for time_add_*(). - - * calendar.c: - * calobj.c: - * eventedit.c: - * gnome-cal.c: #include "timeutil.h" - - * gncal-day-view.c (gncal_day_view_size_request): Make the minimum - width equal or larger to the title width. - - * main.c: #include "eventedit.h" - (main): Add a return statement. - (new_calendar): Show stuff *after* the calendar has been loaded. - - * gnome-cal.c (gnome_calendar_load): Update the day view. - (setup_widgets): Hackish setup of a day view widget - will fix later. - (gnome_calendar_init): Initialize all fields. - - * gnome-cal.h: Added day_view field. Maybe this should be changed - when the a complete day view panel is complete. - - * gncal-day-view.c (gncal_day_view_update): Draw after update, not - before. - -1998-04-06 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de> - - * versit/.cvsignore: New file. - -Fri Apr 3 22:31:54 1998 Tom Tromey <tromey@cygnus.com> - - * calendar.c: Include <config.h>. - -1998-04-03 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * timeutil.c (time_add_year, time_add_year, time_add_week): - Routines for time manipulation. - - * calobj.c (ical_object_destroy): Full destruction of the object. - - * eventedit.c: Finished the main event editor form; It still - lacks the details and the recurrence bits. It now adds events - and cancels. - -1998-04-03 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * view-utils.c (view_utils_draw_events): The "better" format - string for strftime() wasn't better, after all :-( - -1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-full-day.c: New full-day widget. It is still a work in - progress. It will be similar to M$ Schedule's nifty full day view - widget, but with Gtk's elegance :-) - - * Makefile.am (gnomecal_SOURCES): Added gncal-full-day.[ch] to the sources. - -1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * eventedit.c: Object editor widget. We dropped ObjEdit. - - * timeutil.c (time_from_isodate): Fix. - - * view-utils.c (view_utils_draw_events): Changed the display - formats. - -1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * view-utils.c (view_utils_draw_events): Use better format - specifier for strftime(). - (view_utils_draw_textured_frame): Ultra-nifty function to draw - textured "metal" frames, like Netscape's handles. - -1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * gncal-day-view.c (gncal_day_view_update): Day events are now - cached inside the widget. They get initialized at this time. - - * view-utils.c (view_utils_draw_events): Use the list of events. - -1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-day-view.c (gncal_day_view_set_shadow): New customization - function. We can't decide on a stupid border type :-) - (gncal_day_view_init): Made GTK_SHADOW_ETCHED_IN be the default - shadow type. Looks good. - -1998-04-02 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * main.c: New main program that uses our new datatypes and - objects. - - * calendar.c (calendar_load_from_vobject, calendar_load): - Implement loading of vCalendar objects and vCalendar files. - - * calobj.c (ical_object_create_from_vobject): Implement loading of - vCalendar event and todo objects. - - * timeutil.c (isodate_from_time_t): New function. - - * gnome-cal.c, gnome-cal.h: Implement a toplevel widget, derived - from GnomeApp. It holds all of the day views and arbitrates the - display. - -1998-04-02 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-week-view.[ch]: New week view composite widget. This - provides a full week view (7 day views plus busy time display -- - the latter is currently unimplemented). - -1998-04-01 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal-day-view.c: New day view widget. It is intended to be a - child widget of the week view composite widget. - - * calendar.c (calendar_get_objects_in_range): - (calendar_get_events_in_range): - (calendar_get_journal_in_range): - (calendar_get_journal_in_range): These functions now take a - sort_func parameter, which is of type GCompareFunc. If the - specified value is non-NULL, it will return a sorted list. - Otherwise, it will return an unordered list. - (calendar_compare_by_dtstart): Provide a generic sorting routine - for calendar objects. - -1998-04-01 Miguel de Icaza <miguel@kernel.org> - - * Start from scratch - -Tue Mar 31 23:46:50 1998 Tom Tromey <tromey@cygnus.com> - - * timeutil.c (format_simple_hour): `buf' now static. - -1998-03-31 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal.c: Removed #include "gtkcalendar.h", because it now comes - from libgnomeui. - - * Makefile.am (gncal_SOURCES): Added new source files to the rules. - - * timeutil.c (format_simple_hour): New function, formats an - hour/am_pm pair into a string of the form "3am", "12pm", "05h", - "19h", etc. It is used by the day view widget for its labels. - -1998-03-31 Craig Small <csmall@small.dropbear.id.au> - - * Now has (non working) session maangement - * Uses a clist for the dailylist like gtt - -Sat Mar 21 15:43:20 1998 Tom Tromey <tromey@cygnus.com> - - * gncal.c: Use gnome_message_box_*, not gnome_messagebox_*. - -1998-03-12 Craig Small <csmall@small.dropbear.id.au> - - * Now linked (in some horrible way) to the gtkcalendar widget. - -Sun Mar 8 16:38:10 1998 Tom Tromey <tromey@cygnus.com> - - * Makefile.am (INCLUDES): Added GNOME_INCLUDEDIR. - (gncal_LDADD): Don't include libsupport.a. - - * gncal.c (main): Use new gnome_init. - -1998-02-19 Federico Mena Quintero <federico@nuclecu.unam.mx> - - * gncal.c (main): Added app_id "gncal". - -1998-02-19 Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de> - - * Makefile.am (gncal_LDADD): Added '$(INTLLIBS)' - -1998-02-18 Raja R Harinath <harinath@cs.umn.edu> - - * Makefile.am (gncal_LDADD): Include `libsupport.a'. - - * calcs.c (month_atoi): Replace buggy explicit loop string compare - with strcasecmp. - (day_atoi): Likewise. - -Sun Jan 25 23:38:30 1998 Miguel de Icaza <miguel@nuclecu.unam.mx> - - * menus.c: Replace "Quit" with "Exit". diff --git a/calendar/Makefile.am b/calendar/Makefile.am deleted file mode 100644 index 89cea775bd..0000000000 --- a/calendar/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -if ENABLE_PILOT_CONDUITS -CONDUIT_DIR = conduits -else -CONDUIT_DIR = -endif - -SUBDIRS = idl cal-util pcs cal-client gui importers $(CONDUIT_DIR) - -EXTRA_DIST = zones.h diff --git a/calendar/TODO b/calendar/TODO deleted file mode 100644 index 4a5dd6c6ff..0000000000 --- a/calendar/TODO +++ /dev/null @@ -1,88 +0,0 @@ -Cal-util: - -- calobj.h depends on libversit/vcc.h, because it uses a VObject for - ical_object_create_from_vobject(). This should be an internal - function in the PCS and nothing else (we do not install libversit, - so our public libraries should not depend on it). - -- Or maybe we *should* install libversit, since the addressbook code - uses it as well. - -- timeutil has a lot of crap and some namespace pollution. Clean it - up. - -PCS: - -- When loading a calendar, substitute duplicated UIDs by new ones, and - possibly print out a warning message. - ------ Old Gnomecal TODO starts here ----- - -Pilot: - -* Better support for untimed events (we have none now). - -* Hash objects based on their UIDs. - -* Add placeholders for deleted events, so that we can kill those - when syncing to the pilot. - -BUGS: - -- Recurrence end date is wrong. An event that repeats daily will not - be included in the ending date of the recurrence (off-by-one - error?). - -- X-fields (extensions) are stripped from a vCal file when it is - saved. They should be preserved. - -Features: - -- Add a calendar-week so that people know which week of the year it is - -Year view: - -- See why it is so fucking slow when opening its notebook page for the - first time. - -Month view: - -- Popup menu like in the year view. - -- Double click on a day takes you to the day view. - -- DnD of appointments to move them around. - -Week view: - -- Nice display as in the Palm Pilot. - -Day view: - -- Rewrite in terms of the canvas and make it pretty. - -Preferences: - -- BUG: 12/24 hours stuff is not consistent - I remember that on editing - new appointment you get the time-selectors always on 12-hr format - -Event editor dialog: - -- Make it figure out whether the alarm is in - minutes/hours/days/etc. (via a cascade of conditions) and set the - widgets appropriately. - -Gnome date selection widget: - -- Make the displayed date be localized properly -- use strftime(). - -General: - -- Write online help. Nice help. Lots of help. - -- If you leave the calendar running overnight, the "current day" - marker in the GnomeMonthItems does not get updated. - -- Add categories support. Color-coded categories. - -- Untimed events diff --git a/calendar/TODO.port b/calendar/TODO.port deleted file mode 100644 index 8ef8e66473..0000000000 --- a/calendar/TODO.port +++ /dev/null @@ -1,2 +0,0 @@ -* gui/alarm-notify/alarm-notify-dialog.c: - replace missing gnome_win_hints_* calls. diff --git a/calendar/cal-client/.cvsignore b/calendar/cal-client/.cvsignore deleted file mode 100644 index 1537e6e01d..0000000000 --- a/calendar/cal-client/.cvsignore +++ /dev/null @@ -1,15 +0,0 @@ -Makefile.in -.deps -.libs -.pure -Makefile -evolution-calendar-stubs.c -evolution-calendar-skels.c -evolution-calendar-common.c -evolution-calendar.h -evolution-calendar-common.lo -evolution-calendar-skels.lo -evolution-calendar-stubs.lo -*.lo -*.la -client-test diff --git a/calendar/cal-client/Makefile.am b/calendar/cal-client/Makefile.am deleted file mode 100644 index 1d8d9203ab..0000000000 --- a/calendar/cal-client/Makefile.am +++ /dev/null @@ -1,91 +0,0 @@ -# -# libcal-client -# - -CORBA_GENERATED = \ - evolution-calendar-common.c \ - evolution-calendar-skels.c \ - evolution-calendar-stubs.c - -CORBA_HEADERS_GENERATED = \ - evolution-calendar.h - -idls = \ - $(srcdir)/../idl/evolution-calendar.idl - -idl_flags = $(IDL_INCLUDES) - -$(CORBA_GENERATED): $(idls) - $(ORBIT_IDL) $(idl_flags) $(srcdir)/../idl/evolution-calendar.idl - -INCLUDES = \ - -DGNOMELOCALEDIR=\""$(localedir)"\" \ - -DG_LOG_DOMAIN=\"cal-client\" \ - -I$(top_srcdir)/calendar \ - -I$(srcdir) -I$(top_srcdir) \ - -I. \ - -I.. \ - -I$(top_builddir) \ - -I$(top_builddir)/libical/src/libical \ - -I$(top_srcdir)/libical/src/libical \ - -I$(top_builddir)/libwombat \ - -I$(top_srcdir)/libwombat \ - $(EVOLUTION_CALENDAR_CFLAGS) - -lib_LTLIBRARIES = libcal-client.la - -libcal_clientincludedir = $(includedir)/evolution/cal-client - -libcal_client_la_SOURCES = \ - $(CORBA_GENERATED) \ - cal-client-multi.c \ - cal-client-types.c \ - cal-client.c \ - cal-listener.c \ - cal-listener.h \ - cal-query.c \ - query-listener.c \ - query-listener.h - -libcal_clientinclude_HEADERS = \ - $(CORBA_HEADERS_GENERATED) \ - cal-client-multi.h \ - cal-client-types.h \ - cal-client.h \ - cal-query.h - -# -# make a static library for use by calendar conduit's shared library -# -noinst_LTLIBRARIES = libcal-client-static.la -libcal_client_static_la_SOURCES = $(libcal_client_la_SOURCES) -libcal_client_static_la_LDFLAGS = --all-static - - -# -# client-test program -# - -noinst_PROGRAMS = client-test - -client_test_SOURCES = \ - client-test.c - -client_test_INCLUDES = \ - $(INCLUDES) \ - -DG_LOG_DOMAIN=\"client-test\" - -client_test_LDADD = \ - $(EVOLUTION_CALENDAR_LIBS) \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/calendar/cal-util/libcal-util.la \ - $(top_builddir)/libversit/libversit.a \ - $(top_builddir)/libical/src/libical/libical-evolution.la \ - $(top_builddir)/libwombat/libwombat.la \ - libcal-client.la - -BUILT_SOURCES = $(CORBA_GENERATED) -CLEANFILES = $(BUILT_SOURCES) - -dist-hook: - cd $(distdir); rm -f $(BUILT_SOURCES) diff --git a/calendar/cal-client/cal-client-multi.c b/calendar/cal-client/cal-client-multi.c deleted file mode 100644 index 18b03c46ff..0000000000 --- a/calendar/cal-client/cal-client-multi.c +++ /dev/null @@ -1,712 +0,0 @@ -/* Evolution calendar client - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Rodrigo Moya <rodrigo@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include "cal-util/cal-util-marshal.h" -#include "cal-client-multi.h" - -/* Private part of the CalClientMulti structure */ -struct _CalClientMultiPrivate { - GHashTable *calendars; - GList *uris; -}; - -static void cal_client_multi_class_init (CalClientMultiClass *klass); -static void cal_client_multi_init (CalClientMulti *multi, CalClientMultiClass *klass); -static void cal_client_multi_finalize (GObject *object); - -/* signal IDs */ -enum { - CAL_OPENED, - OBJ_UPDATED, - OBJ_REMOVED, - CATEGORIES_CHANGED, - FORGET_PASSWORD, - LAST_SIGNAL -}; - -static guint cal_multi_signals[LAST_SIGNAL]; -static GObjectClass *parent_class = NULL; - -/* - * Private functions - */ - -/** - * cal_client_multi_get_type - * - * Registers the #CalClientMulti class if necessary, and returns the type ID - * assigned to it. - * - * Returns: The type ID of the #CalClientMulti class - */ -GType -cal_client_multi_get_type (void) -{ - static GType type = 0; - - if (!type) { - static GTypeInfo info = { - sizeof (CalClientMultiClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_client_multi_class_init, - NULL, NULL, - sizeof (CalClientMulti), - 0, - (GInstanceInitFunc) cal_client_multi_init - }; - type = g_type_register_static (G_TYPE_OBJECT, "CalClientMulti", &info, 0); - } - - return type; -} - -/* class initialization function for the multi calendar client */ -static void -cal_client_multi_class_init (CalClientMultiClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - cal_multi_signals[CAL_OPENED] = - g_signal_new ("cal_opened", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientMultiClass, cal_opened), - NULL, NULL, - cal_util_marshal_VOID__POINTER_ENUM, - G_TYPE_NONE, 2, - G_TYPE_POINTER, G_TYPE_ENUM); - cal_multi_signals[OBJ_UPDATED] = - g_signal_new ("obj_updated", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientMultiClass, obj_updated), - NULL, NULL, - cal_util_marshal_VOID__POINTER_STRING, - G_TYPE_NONE, 2, - G_TYPE_POINTER, G_TYPE_STRING); - cal_multi_signals[OBJ_REMOVED] = - g_signal_new ("obj_removed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientMultiClass, obj_removed), - NULL, NULL, - cal_util_marshal_VOID__POINTER_STRING, - G_TYPE_NONE, 2, - G_TYPE_POINTER, G_TYPE_STRING); - cal_multi_signals[CATEGORIES_CHANGED] = - g_signal_new ("categories_changed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientMultiClass, categories_changed), - NULL, NULL, - cal_util_marshal_VOID__POINTER_POINTER, - G_TYPE_NONE, 2, - G_TYPE_POINTER, G_TYPE_POINTER); - cal_multi_signals[FORGET_PASSWORD] = - g_signal_new ("forget_password", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientMultiClass, forget_password), - NULL, NULL, - cal_util_marshal_VOID__STRING_STRING, - G_TYPE_NONE, 2, - G_TYPE_STRING, G_TYPE_STRING); - - object_class->finalize = cal_client_multi_finalize; -} - -/* object initialization function for the multi calendar client */ -static void -cal_client_multi_init (CalClientMulti *multi, CalClientMultiClass *klass) -{ - multi->priv = g_new0 (CalClientMultiPrivate, 1); - multi->priv->calendars = g_hash_table_new (g_str_hash, g_str_equal); - multi->priv->uris = NULL; -} - -static void -free_calendar (gpointer key, gpointer value, gpointer data) -{ - CalClientMulti *multi = (CalClientMulti *) data; - - g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - - multi->priv->uris = g_list_remove (multi->priv->uris, key); - - g_free (key); - g_object_unref (G_OBJECT (value)); -} - -/* finalize handler for the multi calendar client */ -static void -cal_client_multi_finalize (GObject *object) -{ - CalClientMulti *multi = (CalClientMulti *) object; - - g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - - /* free memory */ - g_hash_table_foreach (multi->priv->calendars, free_calendar, multi); - g_hash_table_destroy (multi->priv->calendars); - g_list_free (multi->priv->uris); - - g_free (multi->priv); - multi->priv = NULL; - - /* chain to parent class' destroy handler */ - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - -/** - * cal_client_multi_new - * - * Creates a new multi-calendar client. This allows you to merge several - * #CalClient objects into one entity, making it easier to manage - * multiple calendars. - * - * Returns: A newly-created multi-calendar client. - */ -CalClientMulti * -cal_client_multi_new (void) -{ - CalClientMulti *multi; - - multi = g_object_new (CAL_CLIENT_MULTI_TYPE, NULL); - return multi; -} - -/* CalClient's signal handlers */ -static void -client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer user_data) -{ - CalClientMulti *multi = (CalClientMulti *) user_data; - - g_return_if_fail (IS_CAL_CLIENT (client)); - g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - - g_signal_emit (G_OBJECT (multi), - cal_multi_signals[CAL_OPENED], 0, - client, status); -} - -static void -client_obj_updated_cb (CalClient *client, const char *uid, gpointer user_data) -{ - CalClientMulti *multi = (CalClientMulti *) user_data; - - g_return_if_fail (IS_CAL_CLIENT (client)); - g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - - g_signal_emit (G_OBJECT (multi), - cal_multi_signals[OBJ_UPDATED], 0, - client, uid); -} - -static void -client_obj_removed_cb (CalClient *client, const char *uid, gpointer user_data) -{ - CalClientMulti *multi = (CalClientMulti *) user_data; - - g_return_if_fail (IS_CAL_CLIENT (client)); - g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - - g_signal_emit (G_OBJECT (multi), - cal_multi_signals[OBJ_REMOVED], 0, - client, uid); -} - -static void -client_categories_changed_cb (CalClient *client, GPtrArray *categories, gpointer user_data) -{ - CalClientMulti *multi = (CalClientMulti *) user_data; - - g_return_if_fail (IS_CAL_CLIENT (client)); - g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - - g_signal_emit (G_OBJECT (multi), - cal_multi_signals[CATEGORIES_CHANGED], 0, - client, categories); -} - -static void -client_forget_password_cb (CalClient *client, const char *key, gpointer user_data) -{ - CalClientMulti *multi = (CalClientMulti *) user_data; - - g_return_if_fail (IS_CAL_CLIENT (client)); - g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - - g_signal_emit (G_OBJECT (multi), - cal_multi_signals[FORGET_PASSWORD], 0, - client, key); -} -/** - * cal_client_multi_add_client - * @multi: A #CalClientMulti object. - * @client: The #CalClient object to be added. - * - * Aggregates the given #CalClient to a #CalClientMulti object, - * thus adding it to the list of managed calendars. - */ -void -cal_client_multi_add_client (CalClientMulti *multi, CalClient *client) -{ - char *uri; - CalClient *old_client; - - g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - g_return_if_fail (IS_CAL_CLIENT (client)); - - uri = g_strdup (cal_client_get_uri (client)); - old_client = g_hash_table_lookup (multi->priv->calendars, uri); - if (old_client) { - g_free (uri); - return; - } - - g_object_ref (G_OBJECT (client)); - multi->priv->uris = g_list_append (multi->priv->uris, uri); - g_hash_table_insert (multi->priv->calendars, uri, client); - - /* set up CalClient's signal handlers */ - g_signal_handlers_disconnect_matched (G_OBJECT (client), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, multi); - g_signal_connect (G_OBJECT (client), - "cal_opened", - G_CALLBACK (client_cal_opened_cb), - multi); - g_signal_connect (G_OBJECT (client), - "obj_updated", - G_CALLBACK (client_obj_updated_cb), - multi); - g_signal_connect (G_OBJECT (client), - "obj_removed", - G_CALLBACK (client_obj_removed_cb), - multi); - g_signal_connect (G_OBJECT (client), - "categories_changed", - G_CALLBACK (client_categories_changed_cb), - multi); - g_signal_connect (G_OBJECT (client), - "forget_password", - G_CALLBACK (client_forget_password_cb), - multi); -} - -typedef struct { - CalClientAuthFunc func; - gpointer user_data; -} AuthFuncData; - -static void -set_auth_func (gpointer key, gpointer value, gpointer user_data) -{ - AuthFuncData *cb_data = (AuthFuncData *) user_data; - CalClient *client = (CalClient *) value; - - g_return_if_fail (IS_CAL_CLIENT (client)); - g_return_if_fail (cb_data != NULL); - - cal_client_set_auth_func (client, cb_data->func, cb_data->user_data); -} - -/** - * cal_client_multi_set_auth_func - * @multi: A #CalClientMulti object. - * @func: The authentication function. - * @user_data: Data to be passed to the authentication function. - * - * Sets the authentication function for all the clients in the - * given #CalClientMulti. - */ -void -cal_client_multi_set_auth_func (CalClientMulti *multi, - CalClientAuthFunc func, - gpointer user_data) -{ - AuthFuncData *cb_data; - - g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - - cb_data = g_new0 (AuthFuncData, 1); - cb_data->func = func; - cb_data->user_data = user_data; - g_hash_table_foreach (multi->priv->calendars, set_auth_func, cb_data); - - g_free (cb_data); -} - -/** - * cal_client_multi_open_calendar - * @multi: A #CalClientMulti object. - * @str_uri: The URI of the calendar to be open - * @only_if_exists: - * - * Open a new calendar in the given #CalClientMulti object. - * - * Returns: a pointer to the new #CalClient - */ -CalClient * -cal_client_multi_open_calendar (CalClientMulti *multi, - const char *str_uri, - gboolean only_if_exists) -{ - CalClient *client; - gboolean result; - - g_return_val_if_fail (IS_CAL_CLIENT_MULTI (multi), FALSE); - - client = cal_client_new (); - - result = cal_client_open_calendar (client, str_uri, only_if_exists); - if (result) { - cal_client_multi_add_client (multi, client); - g_object_unref (G_OBJECT (client)); - return client; - } - - g_object_unref (G_OBJECT (client)); - - return NULL; -} - -/** - * cal_client_multi_get_client_for_uri - * @multi: A #CalClientMulti object. - * @uri: The URI for the client. - * - * Returns the #CalClient object associated with the given - * @uri for the given #CalClientMulti object. - * - * Returns: a pointer to the client or NULL if no client is - * associated with that URI. - */ -CalClient * -cal_client_multi_get_client_for_uri (CalClientMulti *multi, const char *uri) -{ - g_return_val_if_fail (IS_CAL_CLIENT_MULTI (multi), NULL); - g_return_val_if_fail (uri != NULL, NULL); - - return g_hash_table_lookup (multi->priv->calendars, uri); -} - -/** - * cal_client_multi_get_n_objects - * @multi: A #CalClientMulti object. - * @type: Type for objects - * - * Get the count of objects of the given type(s) for a #CalClientMulti - * object. - * - * Returns: The count of objects of the given type(s). - */ -int -cal_client_multi_get_n_objects (CalClientMulti *multi, - CalObjType type) -{ - CalClient *client; - GList *l; - int count = 0; - - g_return_val_if_fail (IS_CAL_CLIENT_MULTI (multi), -1); - - for (l = multi->priv->uris; l; l = l->next) { - client = cal_client_multi_get_client_for_uri (multi, - (const char *) l->data); - if (IS_CAL_CLIENT (client)) - count += cal_client_get_n_objects (client, type); - } - - return count; -} - -/** - * cal_client_multi_get_object - */ -CalClientGetStatus -cal_client_multi_get_object (CalClientMulti *multi, - const char *uid, - CalComponent **comp) -{ - CalClient *client; - GList *l; - - g_return_val_if_fail (IS_CAL_CLIENT_MULTI (multi), CAL_CLIENT_GET_NOT_FOUND); - g_return_val_if_fail (uid != NULL, CAL_CLIENT_GET_NOT_FOUND); - - for (l = multi->priv->uris; l; l = l->next) { - client = cal_client_multi_get_client_for_uri (multi, - (const char *) l->data); - if (IS_CAL_CLIENT (client)) { - CalClientGetStatus status; - - status = cal_client_get_object (client, uid, comp); - if (status == CAL_CLIENT_GET_SUCCESS) - return status; - } - } - - return CAL_CLIENT_GET_NOT_FOUND; -} - -/** - * cal_client_multi_get_timezone - * @multi: A #CalClientMulti object. - * @tzid: ID for the timezone to be retrieved. - * @zone: A pointer to where the icaltimezone object will be copied. - */ -CalClientGetStatus -cal_client_multi_get_timezone (CalClientMulti *multi, - const char *tzid, - icaltimezone **zone) -{ - CalClient *client; - GList *l; - - g_return_val_if_fail (IS_CAL_CLIENT_MULTI (multi), CAL_CLIENT_GET_NOT_FOUND); - g_return_val_if_fail (tzid != NULL, CAL_CLIENT_GET_NOT_FOUND); - - for (l = multi->priv->uris; l; l = l->next) { - client = cal_client_multi_get_client_for_uri (multi, - (const char *) l->data); - if (IS_CAL_CLIENT (client)) { - CalClientGetStatus status; - - status = cal_client_get_timezone (client, tzid, zone); - if (status == CAL_CLIENT_GET_SUCCESS) - return status; - } - } - - return CAL_CLIENT_GET_NOT_FOUND; -} - -/** - * cal_client_multi_get_uids - * @multi: A #CalClientMulti object. - * @type: Type of objects whose IDs will be returned. - * - * Returns a list of UIDs for all the objects of the given - * type(s) that are in the calendars managed by a - * #CalClientMulti object - * - * Returns: a GList of UIDs. - */ -GList * -cal_client_multi_get_uids (CalClientMulti *multi, CalObjType type) -{ - CalClient *client; - GList *l; - GList *result = NULL; - - g_return_val_if_fail (IS_CAL_CLIENT_MULTI (multi), NULL); - - for (l = multi->priv->uris; l; l = l->next) { - client = cal_client_multi_get_client_for_uri (multi, - (const char *) l->data); - if (IS_CAL_CLIENT (client)) { - GList *tmp; - - tmp = cal_client_get_uids (client, type); - if (tmp) - result = g_list_concat (result, tmp); - } - } - - return result; -} - -/** - * cal_client_multi_get_changes - * @multi: A #CalClientMulti object. - * @type: Object type. - * @change_id: Change ID. - * - * Returns a list of changes for the given #CalClientMulti - * object. - */ -GList * -cal_client_multi_get_changes (CalClientMulti *multi, - CalObjType type, - const char *change_id) -{ - CalClient *client; - GList *l; - GList *result = NULL; - - g_return_val_if_fail (IS_CAL_CLIENT_MULTI (multi), NULL); - - for (l = multi->priv->uris; l; l = l->next) { - client = cal_client_multi_get_client_for_uri (multi, - (const char *) l->data); - if (IS_CAL_CLIENT (client)) { - GList *tmp; - - tmp = cal_client_get_changes (client, type, change_id); - if (tmp) - result = g_list_concat (result, tmp); - } - } - - return result; -} - -/** - * cal_client_multi_get_objects_in_range - * @multi: A #CalClientMulti object. - * @type: Type for objects. - * @start: Start time. - * @end: End time. - * - * Retrieves a list of all calendar components that are - * scheduled within the given time range. The information is - * retrieved from all the calendars being managed by the - * given #CalClientMulti object. - * - * Returns: A list of UID strings. This should be freed using the - * #cal_obj_uid_list_free() function. - **/ -GList * -cal_client_multi_get_objects_in_range (CalClientMulti *multi, - CalObjType type, - time_t start, - time_t end) -{ - CalClient *client; - GList *l; - GList *result = NULL; - - g_return_val_if_fail (IS_CAL_CLIENT_MULTI (multi), NULL); - - for (l = multi->priv->uris; l; l = l->next) { - client = cal_client_multi_get_client_for_uri (multi, - (const char *) l->data); - if (IS_CAL_CLIENT (client)) { - GList *tmp; - - tmp = cal_client_get_objects_in_range (client, type, start, end); - if (tmp) - result = g_list_concat (result, tmp); - } - } - - return result; -} - -/** - * cal_client_multi_get_free_busy - * @multi: A #CalClientMulti object. - * @users: List of users to retrieve F/B information for. - * @start: Start time. - * @end: End time. - * - * Retrieves Free/Busy information for the given users in all - * the calendars being managed by the given #CalClient multi - * object. - * - * Returns: A GList of VFREEBUSY CalComponents - */ -GList * -cal_client_multi_get_free_busy (CalClientMulti *multi, - GList *users, - time_t start, - time_t end) -{ - CalClient *client; - GList *l; - GList *result = NULL; - - g_return_val_if_fail (IS_CAL_CLIENT_MULTI (multi), NULL); - - for (l = multi->priv->uris; l; l = l->next) { - client = cal_client_multi_get_client_for_uri (multi, - (const char *) l->data); - if (IS_CAL_CLIENT (client)) { - GList *tmp; - - tmp = cal_client_get_free_busy (client, users, start, end); - if (tmp) - result = g_list_concat (result, tmp); - } - } - - return result; -} - -/** - * cal_client_multi_generate_instances - */ -void -cal_client_multi_generate_instances (CalClientMulti *multi, - CalObjType type, - time_t start, - time_t end, - CalRecurInstanceFn cb, - gpointer cb_data) -{ - CalClient *client; - GList *l; - - g_return_if_fail (IS_CAL_CLIENT_MULTI (multi)); - - for (l = multi->priv->uris; l; l = l->next) { - client = cal_client_multi_get_client_for_uri (multi, - (const char *) l->data); - if (IS_CAL_CLIENT (client)) { - cal_client_generate_instances ( - client, type, start, end, cb, cb_data); - } - } -} - -/** - * cal_client_multi_get_alarms_in_range - */ -GSList * -cal_client_multi_get_alarms_in_range (CalClientMulti *multi, time_t start, time_t end) -{ - CalClient *client; - GList *l; - GSList *result = NULL; - - g_return_val_if_fail (IS_CAL_CLIENT_MULTI (multi), NULL); - - for (l = multi->priv->uris; l; l = l->next) { - client = cal_client_multi_get_client_for_uri (multi, - (const char *) l->data); - if (IS_CAL_CLIENT (client)) { - GSList *tmp; - - tmp = cal_client_get_alarms_in_range (client, start, end); - if (tmp) - result = g_slist_concat (result, tmp); - } - } - - return result; -} diff --git a/calendar/cal-client/cal-client-multi.h b/calendar/cal-client/cal-client-multi.h deleted file mode 100644 index dd4248bd80..0000000000 --- a/calendar/cal-client/cal-client-multi.h +++ /dev/null @@ -1,104 +0,0 @@ -/* Evolution calendar client - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Rodrigo Moya <rodrigo@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_CLIENT_MULTI_H -#define CAL_CLIENT_MULTI_H - -#include <cal-client/cal-client.h> - -G_BEGIN_DECLS - -#define CAL_CLIENT_MULTI_TYPE (cal_client_multi_get_type ()) -#define CAL_CLIENT_MULTI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_CLIENT_MULTI_TYPE, CalClientMulti)) -#define CAL_CLIENT_MULTI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_CLIENT_MULTI_TYPE, CalClientMultiClass)) -#define IS_CAL_CLIENT_MULTI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_CLIENT_MULTI_TYPE)) -#define IS_CAL_CLIENT_MULTI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_MULTI_TYPE)) - -typedef struct _CalClientMulti CalClientMulti; -typedef struct _CalClientMultiClass CalClientMultiClass; -typedef struct _CalClientMultiPrivate CalClientMultiPrivate; - -struct _CalClientMulti { - GObject object; - - /* Private data */ - CalClientMultiPrivate *priv; -}; - -struct _CalClientMultiClass { - GObjectClass parent_class; - - /* notification signals */ - void (* cal_opened) (CalClientMulti *multi, CalClient *client, CalClientOpenStatus status); - - void (* obj_updated) (CalClientMulti *multi, CalClient *client, const char *uid); - void (* obj_removed) (CalClientMulti *multi, CalClient *client, const char *uid); - - void (* categories_changed) (CalClientMulti *multi, CalClient *client, GPtrArray *categories); - - void (* forget_password) (CalClientMulti *multi, CalClient *client, const char *key); -}; - -GType cal_client_multi_get_type (void); - -CalClientMulti *cal_client_multi_new (void); - -void cal_client_multi_add_client (CalClientMulti *multi, CalClient *client); -void cal_client_multi_set_auth_func (CalClientMulti *multi, - CalClientAuthFunc func, - gpointer user_data); - -CalClient *cal_client_multi_open_calendar (CalClientMulti *multi, - const char *str_uri, - gboolean only_if_exists); -CalClient *cal_client_multi_get_client_for_uri (CalClientMulti *multi, - const char *uri); - -int cal_client_multi_get_n_objects (CalClientMulti *multi, CalObjType type); -CalClientGetStatus cal_client_multi_get_object (CalClientMulti *multi, - const char *uid, - CalComponent **comp); -CalClientGetStatus cal_client_multi_get_timezone (CalClientMulti *multi, - const char *tzid, - icaltimezone **zone); -GList *cal_client_multi_get_uids (CalClientMulti *multi, CalObjType type); -GList *cal_client_multi_get_changes (CalClientMulti *multi, - CalObjType type, - const char *change_id); -GList *cal_client_multi_get_objects_in_range (CalClientMulti *multi, - CalObjType type, - time_t start, - time_t end); -GList *cal_client_multi_get_free_busy (CalClientMulti *multi, - GList *users, - time_t start, - time_t end); -void cal_client_multi_generate_instances (CalClientMulti *multi, - CalObjType type, - time_t start, - time_t end, - CalRecurInstanceFn cb, - gpointer cb_data); -GSList *cal_client_multi_get_alarms_in_range (CalClientMulti *multi, - time_t start, time_t end); - -G_END_DECLS - -#endif diff --git a/calendar/cal-client/cal-client-types.c b/calendar/cal-client/cal-client-types.c deleted file mode 100644 index 36a524ec99..0000000000 --- a/calendar/cal-client/cal-client-types.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Evolution calendar utilities and types - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * JP Rosevear <jpr@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <stdlib.h> -#include "cal-client-types.h" - - - -/** - * cal_client_change_list_free: - * @list: List of #CalClientChange structures. - * - * Frees a list of #CalClientChange structures. - **/ -void -cal_client_change_list_free (GList *list) -{ - CalClientChange *c; - GList *l; - - for (l = list; l; l = l->next) { - c = l->data; - - g_assert (c != NULL); - g_assert (c->comp != NULL); - - g_object_unref (G_OBJECT (c->comp)); - g_free (c); - } - - g_list_free (list); -} diff --git a/calendar/cal-client/cal-client-types.h b/calendar/cal-client/cal-client-types.h deleted file mode 100644 index c160a1fa94..0000000000 --- a/calendar/cal-client/cal-client-types.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Evolution calendar utilities and types - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * JP Rosevear <jpr@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_CLIENT_TYPES_H -#define CAL_CLIENT_TYPES_H - -#include <cal-util/cal-component.h> - -G_BEGIN_DECLS - - - -typedef enum { - CAL_CLIENT_CHANGE_ADDED = 1 << 0, - CAL_CLIENT_CHANGE_MODIFIED = 1 << 1, - CAL_CLIENT_CHANGE_DELETED = 1 << 2 -} CalClientChangeType; - -typedef struct -{ - CalComponent *comp; - CalClientChangeType type; -} CalClientChange; - -void cal_client_change_list_free (GList *list); - -G_END_DECLS - -#endif - diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c deleted file mode 100644 index b1c36653fe..0000000000 --- a/calendar/cal-client/cal-client.c +++ /dev/null @@ -1,2747 +0,0 @@ -/* Evolution calendar client - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo-activation/bonobo-activation.h> -#include <bonobo/bonobo-exception.h> -#include <libgnome/gnome-util.h> - -#include "e-util/e-component-listener.h" -#include "e-util/e-config-listener.h" -#include "cal-util/cal-util-marshal.h" -#include "cal-client-types.h" -#include "cal-client.h" -#include "cal-listener.h" -#include "wombat-client.h" - - - -/* Private part of the CalClient structure */ -struct _CalClientPrivate { - /* Load state to avoid multiple loads */ - CalClientLoadState load_state; - - /* URI of the calendar that is being loaded or is already loaded, or - * NULL if we are not loaded. - */ - char *uri; - - /* Email address associated with this calendar, or NULL */ - char *email_address; - - /* The calendar factories we are contacting */ - GList *factories; - - /* Our calendar listener implementation */ - CalListener *listener; - - /* The calendar client interface object we are contacting */ - GNOME_Evolution_Calendar_Cal cal; - - /* The authentication function */ - CalClientAuthFunc auth_func; - gpointer auth_user_data; - - /* The WombatClient */ - WombatClient *w_client; - - /* A cache of timezones retrieved from the server, to avoid getting - them repeatedly for each get_object() call. */ - GHashTable *timezones; - - /* The default timezone to use to resolve DATE and floating DATE-TIME - values. */ - icaltimezone *default_zone; - - /* The component listener to keep track of the lifetime of backends */ - EComponentListener *comp_listener; -}; - - - -/* Signal IDs */ -enum { - CAL_OPENED, - CAL_SET_MODE, - OBJ_UPDATED, - OBJ_REMOVED, - BACKEND_ERROR, - CATEGORIES_CHANGED, - FORGET_PASSWORD, - BACKEND_DIED, - LAST_SIGNAL -}; - -static void cal_client_class_init (CalClientClass *klass); -static void cal_client_init (CalClient *client, CalClientClass *klass); -static void cal_client_finalize (GObject *object); - -static char *client_get_password_cb (WombatClient *w_client, - const gchar *prompt, - const gchar *key, - gpointer user_data); -static void client_forget_password_cb (WombatClient *w_client, - const gchar *key, - gpointer user_data); -static void cal_client_get_object_timezones_cb (icalparameter *param, - void *data); - -static guint cal_client_signals[LAST_SIGNAL]; - -static GObjectClass *parent_class; - - - -/** - * cal_client_get_type: - * - * Registers the #CalClient class if necessary, and returns the type ID assigned - * to it. - * - * Return value: The type ID of the #CalClient class. - **/ -GType -cal_client_get_type (void) -{ - static GType cal_client_type = 0; - - if (!cal_client_type) { - static GTypeInfo info = { - sizeof (CalClientClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_client_class_init, - NULL, NULL, - sizeof (CalClient), - 0, - (GInstanceInitFunc) cal_client_init - }; - cal_client_type = g_type_register_static (G_TYPE_OBJECT, "CalClient", &info, 0); - } - - return cal_client_type; -} - -/* Class initialization function for the calendar client */ -static void -cal_client_class_init (CalClientClass *klass) -{ - GObjectClass *object_class; - - object_class = (GObjectClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - cal_client_signals[CAL_OPENED] = - g_signal_new ("cal_opened", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, cal_opened), - NULL, NULL, - g_cclosure_marshal_VOID__ENUM, - G_TYPE_NONE, 1, - G_TYPE_ENUM); - cal_client_signals[CAL_SET_MODE] = - g_signal_new ("cal_set_mode", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, cal_set_mode), - NULL, NULL, - cal_util_marshal_VOID__ENUM_ENUM, - G_TYPE_NONE, 2, - G_TYPE_ENUM, - G_TYPE_ENUM); - cal_client_signals[OBJ_UPDATED] = - g_signal_new ("obj_updated", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, obj_updated), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); - cal_client_signals[OBJ_REMOVED] = - g_signal_new ("obj_removed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, obj_removed), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); - cal_client_signals[BACKEND_ERROR] = - g_signal_new ("backend_error", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, backend_error), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); - cal_client_signals[CATEGORIES_CHANGED] = - g_signal_new ("categories_changed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, categories_changed), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, - G_TYPE_POINTER); - cal_client_signals[FORGET_PASSWORD] = - g_signal_new ("forget_password", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, forget_password), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); - cal_client_signals[BACKEND_DIED] = - g_signal_new ("backend_died", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalClientClass, backend_died), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - klass->cal_opened = NULL; - klass->obj_updated = NULL; - klass->obj_removed = NULL; - klass->categories_changed = NULL; - klass->forget_password = NULL; - klass->backend_died = NULL; - - object_class->finalize = cal_client_finalize; -} - -/* Object initialization function for the calendar client */ -static void -cal_client_init (CalClient *client, CalClientClass *klass) -{ - CalClientPrivate *priv; - - priv = g_new0 (CalClientPrivate, 1); - client->priv = priv; - - priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED; - priv->uri = NULL; - priv->email_address = NULL; - priv->factories = NULL; - priv->timezones = g_hash_table_new (g_str_hash, g_str_equal); - priv->w_client = NULL; - priv->default_zone = icaltimezone_get_utc_timezone (); - priv->comp_listener = NULL; -} - -/* Gets rid of the factories that a client knows about */ -static void -destroy_factories (CalClient *client) -{ - CalClientPrivate *priv; - CORBA_Object factory; - CORBA_Environment ev; - int result; - GList *f; - - priv = client->priv; - - CORBA_exception_init (&ev); - - for (f = priv->factories; f; f = f->next) { - factory = f->data; - - result = CORBA_Object_is_nil (factory, &ev); - if (BONOBO_EX (&ev)) { - g_message ("destroy_factories(): could not see if a factory was nil"); - CORBA_exception_free (&ev); - - continue; - } - - if (result) - continue; - - CORBA_Object_release (factory, &ev); - if (BONOBO_EX (&ev)) { - g_message ("destroy_factories(): could not release a factory"); - CORBA_exception_free (&ev); - } - } - - g_list_free (priv->factories); - priv->factories = NULL; -} - -/* Gets rid of the calendar client interface object that a client knows about */ -static void -destroy_cal (CalClient *client) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - int result; - - priv = client->priv; - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (priv->cal, &ev); - if (BONOBO_EX (&ev)) { - g_message ("destroy_cal(): could not see if the " - "calendar client interface object was nil"); - priv->cal = CORBA_OBJECT_NIL; - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); - - if (result) - return; - - CORBA_exception_init (&ev); - GNOME_Evolution_Calendar_Cal_unref (priv->cal, &ev); - if (BONOBO_EX (&ev)) - g_message ("destroy_cal(): could not unref the calendar client interface object"); - - CORBA_exception_free (&ev); - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->cal, &ev); - if (BONOBO_EX (&ev)) - g_message ("destroy_cal(): could not release the calendar client interface object"); - - CORBA_exception_free (&ev); - priv->cal = CORBA_OBJECT_NIL; - -} - -static void -free_timezone (gpointer key, gpointer value, gpointer data) -{ - /* Note that the key comes from within the icaltimezone value, so we - don't free that. */ - icaltimezone_free (value, TRUE); -} - -/* Finalize handler for the calendar client */ -static void -cal_client_finalize (GObject *object) -{ - CalClient *client; - CalClientPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_CLIENT (object)); - - client = CAL_CLIENT (object); - priv = client->priv; - - /* The server unrefs the query listener, so we just NULL it out here */ - if (priv->listener) { - cal_listener_stop_notification (priv->listener); - priv->listener = NULL; - } - - if (priv->comp_listener) { - g_signal_handlers_disconnect_matched (G_OBJECT (priv->comp_listener), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, - client); - g_object_unref (G_OBJECT (priv->comp_listener)); - priv->comp_listener = NULL; - } - - priv->w_client = NULL; - destroy_factories (client); - destroy_cal (client); - - priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED; - - if (priv->uri) { - g_free (priv->uri); - priv->uri = NULL; - } - - if (priv->email_address) { - g_free (priv->email_address); - priv->email_address = NULL; - } - - g_hash_table_foreach (priv->timezones, free_timezone, NULL); - g_hash_table_destroy (priv->timezones); - priv->timezones = NULL; - - g_free (priv); - client->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - - -static void -backend_died_cb (EComponentListener *cl, gpointer user_data) -{ - CalClientPrivate *priv; - CalClient *client = (CalClient *) user_data; - - g_return_if_fail (IS_CAL_CLIENT (client)); - - priv = client->priv; - priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED; - g_signal_emit (G_OBJECT (client), cal_client_signals[BACKEND_DIED], 0); -} - -/* Signal handlers for the listener's signals */ -/* Handle the cal_opened notification from the listener */ -static void -cal_opened_cb (CalListener *listener, - GNOME_Evolution_Calendar_Listener_OpenStatus status, - GNOME_Evolution_Calendar_Cal cal, - gpointer data) -{ - CalClient *client; - CalClientPrivate *priv; - CORBA_Environment ev; - GNOME_Evolution_Calendar_Cal cal_copy; - CalClientOpenStatus client_status; - - client = CAL_CLIENT (data); - priv = client->priv; - - g_assert (priv->load_state == CAL_CLIENT_LOAD_LOADING); - g_assert (priv->uri != NULL); - - client_status = CAL_CLIENT_OPEN_ERROR; - - switch (status) { - case GNOME_Evolution_Calendar_Listener_SUCCESS: - CORBA_exception_init (&ev); - cal_copy = CORBA_Object_duplicate (cal, &ev); - if (BONOBO_EX (&ev)) { - g_message ("cal_opened_cb(): could not duplicate the " - "calendar client interface"); - CORBA_exception_free (&ev); - goto error; - } - CORBA_exception_free (&ev); - - priv->cal = cal_copy; - priv->load_state = CAL_CLIENT_LOAD_LOADED; - - client_status = CAL_CLIENT_OPEN_SUCCESS; - - /* setup component listener */ - priv->comp_listener = e_component_listener_new (priv->cal, 0); - g_signal_connect (G_OBJECT (priv->comp_listener), "component_died", - G_CALLBACK (backend_died_cb), client); - goto out; - - case GNOME_Evolution_Calendar_Listener_ERROR: - client_status = CAL_CLIENT_OPEN_ERROR; - goto error; - - case GNOME_Evolution_Calendar_Listener_NOT_FOUND: - client_status = CAL_CLIENT_OPEN_NOT_FOUND; - goto error; - - case GNOME_Evolution_Calendar_Listener_METHOD_NOT_SUPPORTED: - client_status = CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED; - goto error; - - case GNOME_Evolution_Calendar_Listener_PERMISSION_DENIED : - client_status = CAL_CLIENT_OPEN_PERMISSION_DENIED; - goto error; - - default: - g_assert_not_reached (); - } - - error: - - bonobo_object_unref (BONOBO_OBJECT (priv->listener)); - priv->listener = NULL; - - /* We free the priv->uri and set the priv->load_state until after the - * "cal_opened" signal has been emitted so that handlers will be able to - * access this information. - */ - - out: - - /* We are *not* inside a signal handler (this is just a simple callback - * called from the listener), so there is not a temporary reference to - * the client object. We ref() so that we can safely emit our own - * signal and clean up. - */ - - g_object_ref (G_OBJECT (client)); - - g_signal_emit (G_OBJECT (client), cal_client_signals[CAL_OPENED], - 0, client_status); - - if (client_status != CAL_CLIENT_OPEN_SUCCESS) { - priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED; - g_free (priv->uri); - priv->uri = NULL; - } - - g_assert (priv->load_state != CAL_CLIENT_LOAD_LOADING); - - g_object_unref (G_OBJECT (client)); -} - -/* Handle the cal_set_mode notification from the listener */ -static void -cal_set_mode_cb (CalListener *listener, - GNOME_Evolution_Calendar_Listener_SetModeStatus status, - GNOME_Evolution_Calendar_CalMode mode, - gpointer data) -{ - CalClient *client; - CalClientPrivate *priv; - CalClientSetModeStatus client_status; - - client = CAL_CLIENT (data); - priv = client->priv; - - client_status = CAL_CLIENT_OPEN_ERROR; - - switch (status) { - case GNOME_Evolution_Calendar_Listener_MODE_SET: - client_status = CAL_CLIENT_SET_MODE_SUCCESS; - break; - case GNOME_Evolution_Calendar_Listener_MODE_NOT_SET: - client_status = CAL_CLIENT_SET_MODE_ERROR; - break; - case GNOME_Evolution_Calendar_Listener_MODE_NOT_SUPPORTED: - client_status = CAL_CLIENT_SET_MODE_NOT_SUPPORTED; - break; - default: - g_assert_not_reached (); - } - - /* We are *not* inside a signal handler (this is just a simple callback - * called from the listener), so there is not a temporary reference to - * the client object. We ref() so that we can safely emit our own - * signal and clean up. - */ - - g_object_ref (G_OBJECT (client)); - - g_signal_emit (G_OBJECT (client), cal_client_signals[CAL_SET_MODE], - 0, client_status, mode); - - g_object_unref (G_OBJECT (client)); -} - -/* Handle the obj_updated signal from the listener */ -static void -obj_updated_cb (CalListener *listener, const CORBA_char *uid, gpointer data) -{ - CalClient *client; - - client = CAL_CLIENT (data); - g_signal_emit (G_OBJECT (client), cal_client_signals[OBJ_UPDATED], 0, uid); -} - -/* Handle the obj_removed signal from the listener */ -static void -obj_removed_cb (CalListener *listener, const CORBA_char *uid, gpointer data) -{ - CalClient *client; - - client = CAL_CLIENT (data); - g_signal_emit (G_OBJECT (client), cal_client_signals[OBJ_REMOVED], 0, uid); -} - -/* Handle the error_occurred signal from the listener */ -static void -backend_error_cb (CalListener *listener, const char *message, gpointer data) -{ - CalClient *client; - - client = CAL_CLIENT (data); - g_signal_emit (G_OBJECT (client), cal_client_signals[BACKEND_ERROR], 0, message); -} - -/* Handle the categories_changed signal from the listener */ -static void -categories_changed_cb (CalListener *listener, const GNOME_Evolution_Calendar_StringSeq *categories, - gpointer data) -{ - CalClient *client; - GPtrArray *cats; - int i; - - client = CAL_CLIENT (data); - - cats = g_ptr_array_new (); - g_ptr_array_set_size (cats, categories->_length); - - for (i = 0; i < categories->_length; i++) - cats->pdata[i] = categories->_buffer[i]; - - g_signal_emit (G_OBJECT (client), cal_client_signals[CATEGORIES_CHANGED], 0, cats); - - g_ptr_array_free (cats, TRUE); -} - - -/* Handle the get_password signal from the Wombatclient */ -static gchar * -client_get_password_cb (WombatClient *w_client, - const gchar *prompt, - const gchar *key, - gpointer user_data) -{ - CalClient *client; - - client = CAL_CLIENT (user_data); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - if (client->priv->auth_func) - return client->priv->auth_func (client, prompt, key, client->priv->auth_user_data); - - return NULL; -} - -/* Handle the forget_password signal from the WombatClient */ -static void -client_forget_password_cb (WombatClient *w_client, - const gchar *key, - gpointer user_data) -{ - CalClient *client; - - client = CAL_CLIENT (user_data); - g_return_if_fail (IS_CAL_CLIENT (client)); - - g_signal_emit (G_OBJECT (client), - cal_client_signals [FORGET_PASSWORD], - 0, key); -} - - - -/** - * cal_client_construct: - * @client: A calendar client. - * - * Constructs a calendar client object by contacting all available - * calendar factories. - * - * Return value: The same object as the @client argument, or NULL if the - * calendar factory could not be contacted. - **/ -CalClient * -cal_client_construct (CalClient *client) -{ - CalClientPrivate *priv; - GNOME_Evolution_Calendar_CalFactory factory; - Bonobo_ServerInfoList *servers; - CORBA_Environment ev; - int i; - - CORBA_exception_init (&ev); - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - - CORBA_exception_init (&ev); - - servers = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Evolution/Calendar/CalFactory:1.0')", NULL, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("Cannot perform OAF query for Calendar servers."); - CORBA_exception_free (&ev); - return NULL; - } - - if (servers->_length == 0) - g_warning ("No Calendar servers installed."); - - for (i = 0; i < servers->_length; i++) { - const Bonobo_ServerInfo *info; - - info = servers->_buffer + i; - - factory = (GNOME_Evolution_Calendar_CalFactory) - bonobo_activation_activate_from_id (info->iid, 0, NULL, &ev); - if (BONOBO_EX (&ev)) { - g_warning ("cal_client_construct: Could not activate calendar server %s", info->iid); - CORBA_free (servers); - CORBA_exception_free (&ev); - return NULL; - } - - priv->factories = g_list_prepend (priv->factories, factory); - } - - CORBA_free (servers); - - CORBA_exception_free (&ev); - return client; -} - -/** - * cal_client_new: - * - * Creates a new calendar client. It should be initialized by calling - * cal_client_open_calendar(). - * - * Return value: A newly-created calendar client, or NULL if the client could - * not be constructed because it could not contact the calendar server. - **/ -CalClient * -cal_client_new (void) -{ - CalClient *client; - - client = g_object_new (CAL_CLIENT_TYPE, NULL); - - if (!cal_client_construct (client)) { - g_message ("cal_client_new(): could not construct the calendar client"); - g_object_unref (G_OBJECT (client)); - return NULL; - } - - return client; -} - -/** - * cal_client_set_auth_func - * @client: A calendar client. - * @func: The authentication function - * @data: User data to be used when calling the authentication function - * - * Associates the given authentication function with a calendar client. This - * function will be called any time the calendar server needs a password - * from the client. So, calendar clients should provide such authentication - * function, which, when called, should act accordingly (by showing a dialog - * box, for example, to ask the user for the password). - * - * The authentication function must have the following form: - * char * auth_func (CalClient *client, - * const gchar *prompt, - * const gchar *key, - * gpointer user_data) - */ -void -cal_client_set_auth_func (CalClient *client, CalClientAuthFunc func, gpointer data) -{ - g_return_if_fail (client != NULL); - g_return_if_fail (IS_CAL_CLIENT (client)); - - client->priv->auth_func = func; - client->priv->auth_user_data = data; -} - -static gboolean -real_open_calendar (CalClient *client, const char *str_uri, gboolean only_if_exists, gboolean *supported) -{ - CalClientPrivate *priv; - GNOME_Evolution_Calendar_Listener corba_listener; - int unsupported; - GList *f; - CORBA_Environment ev; - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_NOT_LOADED, FALSE); - g_assert (priv->uri == NULL); - - g_return_val_if_fail (str_uri != NULL, FALSE); - - priv->listener = cal_listener_new (cal_opened_cb, - cal_set_mode_cb, - obj_updated_cb, - obj_removed_cb, - backend_error_cb, - categories_changed_cb, - client); - if (!priv->listener) { - g_message ("cal_client_open_calendar(): could not create the listener"); - return FALSE; - } - - /* create the WombatClient */ - priv->w_client = wombat_client_new ( - (WombatClientGetPasswordFn) client_get_password_cb, - (WombatClientForgetPasswordFn) client_forget_password_cb, - (gpointer) client); - bonobo_object_add_interface (BONOBO_OBJECT (priv->listener), - BONOBO_OBJECT (priv->w_client)); - - corba_listener = (GNOME_Evolution_Calendar_Listener) (BONOBO_OBJREF (priv->listener)); - - priv->load_state = CAL_CLIENT_LOAD_LOADING; - priv->uri = g_strdup (str_uri); - - unsupported = 0; - for (f = priv->factories; f; f = f->next) { - CORBA_exception_init (&ev); - - GNOME_Evolution_Calendar_CalFactory_open (f->data, str_uri, - only_if_exists, - corba_listener, &ev); - if (!BONOBO_EX (&ev)) - break; - else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_CalFactory_UnsupportedMethod)) - unsupported++; - } - - if (supported != NULL) { - if (unsupported == g_list_length (priv->factories)) - *supported = FALSE; - else - *supported = TRUE; - } - - if (BONOBO_EX (&ev)) { - bonobo_object_unref (BONOBO_OBJECT (priv->listener)); - priv->listener = NULL; - priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED; - g_free (priv->uri); - priv->uri = NULL; - - return FALSE; - } - - return TRUE; -} - -/** - * cal_client_open_calendar: - * @client: A calendar client. - * @str_uri: URI of calendar to open. - * @only_if_exists: FALSE if the calendar should be opened even if there - * was no storage for it, i.e. to create a new calendar or load an existing - * one if it already exists. TRUE if it should only try to load calendars - * that already exist. - * - * Makes a calendar client initiate a request to open a calendar. The calendar - * client will emit the "cal_opened" signal when the response from the server is - * received. - * - * Return value: TRUE on success, FALSE on failure to issue the open request. - **/ -gboolean -cal_client_open_calendar (CalClient *client, const char *str_uri, gboolean only_if_exists) -{ - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - return real_open_calendar (client, str_uri, only_if_exists, NULL); -} - -static char * -get_fall_back_uri (gboolean tasks) -{ - if (tasks) - return g_concat_dir_and_file (g_get_home_dir (), - "evolution/local/" - "Tasks/tasks.ics"); - else - return g_concat_dir_and_file (g_get_home_dir (), - "evolution/local/" - "Calendar/calendar.ics"); -} - -static char * -get_default_uri (gboolean tasks) -{ - EConfigListener *db; - char *uri; - - db = e_config_listener_new (); - - if (tasks) - uri = e_config_listener_get_string (db, "/apps/Evolution/DefaultFolders/tasks_uri"); - else - uri = e_config_listener_get_string (db, "/apps/Evolution/DefaultFolders/calendar_uri"); - g_object_unref (G_OBJECT (db)); - - if (!uri) - uri = get_fall_back_uri (tasks); - else - uri = cal_util_expand_uri (uri, tasks); - - return uri; -} - -gboolean -cal_client_open_default_calendar (CalClient *client, gboolean only_if_exists) -{ - char *default_uri, *fall_back; - gboolean result, supported; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - default_uri = get_default_uri (FALSE); - fall_back = get_fall_back_uri (FALSE); - - result = real_open_calendar (client, default_uri, only_if_exists, &supported); - if (!supported && strcmp (fall_back, default_uri)) - result = real_open_calendar (client, fall_back, only_if_exists, NULL); - - g_free (default_uri); - g_free (fall_back); - - return result; -} - -gboolean -cal_client_open_default_tasks (CalClient *client, gboolean only_if_exists) -{ - char *default_uri, *fall_back; - gboolean result, supported; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - default_uri = get_default_uri (TRUE); - fall_back = get_fall_back_uri (TRUE); - - result = real_open_calendar (client, default_uri, only_if_exists, &supported); - if (!supported && strcmp (fall_back, default_uri)) - result = real_open_calendar (client, fall_back, only_if_exists, NULL); - - g_free (default_uri); - g_free (fall_back); - - return result; -} - -/* Builds an URI list out of a CORBA string sequence */ -static GList * -build_uri_list (GNOME_Evolution_Calendar_StringSeq *seq) -{ - GList *uris = NULL; - int i; - - for (i = 0; i < seq->_length; i++) - uris = g_list_prepend (uris, g_strdup (seq->_buffer[i])); - - return uris; -} - -/** - * cal_client_uri_list: - * @client: A calendar client - * @type: type of uri's to get - * - * - * Return value: A list of URI's open on the wombat - **/ -GList * -cal_client_uri_list (CalClient *client, CalMode mode) -{ - CalClientPrivate *priv; - GNOME_Evolution_Calendar_StringSeq *uri_seq; - GList *uris = NULL; - CORBA_Environment ev; - GList *f; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - priv = client->priv; - - for (f = priv->factories; f; f = f->next) { - CORBA_exception_init (&ev); - uri_seq = GNOME_Evolution_Calendar_CalFactory_uriList (f->data, mode, &ev); - - if (BONOBO_EX (&ev)) { - g_message ("cal_client_uri_list(): request failed"); - - /* free memory and return */ - g_list_foreach (uris, (GFunc) g_free, NULL); - g_list_free (uris); - uris = NULL; - break; - } - else - uris = g_list_concat (uris, build_uri_list (uri_seq)); - - CORBA_exception_free (&ev); - } - - return uris; -} - -/** - * cal_client_get_load_state: - * @client: A calendar client. - * - * Queries the state of loading of a calendar client. - * - * Return value: A #CalClientLoadState value indicating whether the client has - * not been loaded with cal_client_open_calendar() yet, whether it is being - * loaded, or whether it is already loaded. - **/ -CalClientLoadState -cal_client_get_load_state (CalClient *client) -{ - CalClientPrivate *priv; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - priv = client->priv; - return priv->load_state; -} - -/** - * cal_client_get_uri: - * @client: A calendar client. - * - * Queries the URI that is open in a calendar client. - * - * Return value: The URI of the calendar that is already loaded or is being - * loaded, or NULL if the client has not started a load request yet. - **/ -const char * -cal_client_get_uri (CalClient *client) -{ - CalClientPrivate *priv; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - return priv->uri; -} - -/** - * cal_client_is_read_only: - * @client: A calendar client. - * - * Queries whether the calendar client can perform modifications - * on the calendar or not. - * - * Return value: TRUE if the calendar is read-only, FALSE otherwise. - */ -gboolean -cal_client_is_read_only (CalClient *client) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - CORBA_boolean read_only; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - priv = client->priv; - - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, FALSE); - - CORBA_exception_init (&ev); - read_only = GNOME_Evolution_Calendar_Cal_isReadOnly (priv->cal, &ev); - if (BONOBO_EX (&ev)) { - g_message ("cal_client_is_read_only: could not call isReadOnly method"); - } - CORBA_exception_free (&ev); - - return read_only; -} - -/** - * cal_client_get_email_address: - * @client: A calendar client. - * - * Queries the email address associated with a calendar client. - * - * Return value: The email address associated with the calendar that - * is loaded or being loaded, or %NULL if the client has not started a - * load request yet or the calendar has no associated email address. - **/ -const char * -cal_client_get_email_address (CalClient *client) -{ - CalClientPrivate *priv; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, NULL); - - if (priv->email_address == NULL) { - CORBA_Environment ev; - CORBA_char *email_address; - - CORBA_exception_init (&ev); - email_address = GNOME_Evolution_Calendar_Cal_getEmailAddress (priv->cal, &ev); - if (!BONOBO_EX (&ev)) { - priv->email_address = g_strdup (email_address); - CORBA_free (email_address); - } - CORBA_exception_free (&ev); - } - - return priv->email_address; -} - -/* Converts our representation of a calendar component type into its CORBA representation */ -static GNOME_Evolution_Calendar_CalObjType -corba_obj_type (CalObjType type) -{ - return (((type & CALOBJ_TYPE_EVENT) ? GNOME_Evolution_Calendar_TYPE_EVENT : 0) - | ((type & CALOBJ_TYPE_TODO) ? GNOME_Evolution_Calendar_TYPE_TODO : 0) - | ((type & CALOBJ_TYPE_JOURNAL) ? GNOME_Evolution_Calendar_TYPE_JOURNAL : 0)); -} - -gboolean -cal_client_set_mode (CalClient *client, CalMode mode) -{ - CalClientPrivate *priv; - gboolean retval = TRUE; - CORBA_Environment ev; - - g_return_val_if_fail (client != NULL, -1); - g_return_val_if_fail (IS_CAL_CLIENT (client), -1); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, -1); - - CORBA_exception_init (&ev); - GNOME_Evolution_Calendar_Cal_setMode (priv->cal, mode, &ev); - - if (BONOBO_EX (&ev)) - retval = FALSE; - - CORBA_exception_free (&ev); - - return retval; -} - -/** - * cal_client_get_n_objects: - * @client: A calendar client. - * @type: Type of objects that will be counted. - * - * Counts the number of calendar components of the specified @type. This can be - * used to count how many events, to-dos, or journals there are, for example. - * - * Return value: Number of components. - **/ -int -cal_client_get_n_objects (CalClient *client, CalObjType type) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - int n; - int t; - - g_return_val_if_fail (client != NULL, -1); - g_return_val_if_fail (IS_CAL_CLIENT (client), -1); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, -1); - - t = corba_obj_type (type); - - CORBA_exception_init (&ev); - n = GNOME_Evolution_Calendar_Cal_countObjects (priv->cal, t, &ev); - - if (BONOBO_EX (&ev)) { - g_message ("cal_client_get_n_objects(): could not get the number of objects"); - CORBA_exception_free (&ev); - return -1; - } - - CORBA_exception_free (&ev); - return n; -} - - -/* This is used in the callback which fetches all the timezones needed for an - object. */ -typedef struct _CalClientGetTimezonesData CalClientGetTimezonesData; -struct _CalClientGetTimezonesData { - CalClient *client; - - /* This starts out at CAL_CLIENT_GET_SUCCESS. If an error occurs this - contains the last error. */ - CalClientGetStatus status; -}; - - -/** - * cal_client_get_object: - * @client: A calendar client. - * @uid: Unique identifier for a calendar component. - * @comp: Return value for the calendar component object. - * - * Queries a calendar for a calendar component object based on its unique - * identifier. - * - * Return value: Result code based on the status of the operation. - **/ -CalClientGetStatus -cal_client_get_object (CalClient *client, const char *uid, CalComponent **comp) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - GNOME_Evolution_Calendar_CalObj comp_str; - CalClientGetStatus retval; - icalcomponent *icalcomp; - CalClientGetTimezonesData cb_data; - - g_return_val_if_fail (client != NULL, CAL_CLIENT_GET_NOT_FOUND); - g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_GET_NOT_FOUND); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, CAL_CLIENT_GET_NOT_FOUND); - - g_return_val_if_fail (uid != NULL, CAL_CLIENT_GET_NOT_FOUND); - g_return_val_if_fail (comp != NULL, CAL_CLIENT_GET_NOT_FOUND); - - retval = CAL_CLIENT_GET_NOT_FOUND; - *comp = NULL; - - CORBA_exception_init (&ev); - comp_str = GNOME_Evolution_Calendar_Cal_getObject (priv->cal, (char *) uid, &ev); - - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound)) - goto out; - else if (BONOBO_EX (&ev)) { - g_message ("cal_client_get_object(): could not get the object"); - goto out; - } - - icalcomp = icalparser_parse_string (comp_str); - CORBA_free (comp_str); - - if (!icalcomp) { - retval = CAL_CLIENT_GET_SYNTAX_ERROR; - goto out; - } - - *comp = cal_component_new (); - if (!cal_component_set_icalcomponent (*comp, icalcomp)) { - icalcomponent_free (icalcomp); - g_object_unref (G_OBJECT (*comp)); - *comp = NULL; - - retval = CAL_CLIENT_GET_SYNTAX_ERROR; - goto out; - } - - /* Now make sure we have all timezones needed for this object. - We do this to try to avoid any problems caused by getting a timezone - in the middle of other code. Any calls to ORBit result in a - recursive call of the GLib main loop, which can cause problems for - code that doesn't expect it. Currently GnomeCanvas has problems if - we try to get a timezone in the middle of a redraw, and there is a - resize pending, which leads to an assert failure and an abort. */ - cb_data.client = client; - cb_data.status = CAL_CLIENT_GET_SUCCESS; - icalcomponent_foreach_tzid (icalcomp, - cal_client_get_object_timezones_cb, - &cb_data); - - retval = cb_data.status; - - out: - - CORBA_exception_free (&ev); - return retval; -} - - -static void -cal_client_get_object_timezones_cb (icalparameter *param, - void *data) -{ - CalClientGetTimezonesData *cb_data = data; - const char *tzid; - icaltimezone *zone; - CalClientGetStatus status; - - tzid = icalparameter_get_tzid (param); - if (!tzid) { - cb_data->status = CAL_CLIENT_GET_SYNTAX_ERROR; - return; - } - - status = cal_client_get_timezone (cb_data->client, tzid, &zone); - if (status != CAL_CLIENT_GET_SUCCESS) - cb_data->status = status; -} - - -CalClientGetStatus -cal_client_get_timezone (CalClient *client, - const char *tzid, - icaltimezone **zone) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - GNOME_Evolution_Calendar_CalObj comp_str; - CalClientGetStatus retval; - icalcomponent *icalcomp; - icaltimezone *tmp_zone; - - g_return_val_if_fail (client != NULL, CAL_CLIENT_GET_NOT_FOUND); - g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_GET_NOT_FOUND); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, - CAL_CLIENT_GET_NOT_FOUND); - - g_return_val_if_fail (zone != NULL, CAL_CLIENT_GET_NOT_FOUND); - - /* If tzid is NULL or "" we return NULL, since it is a 'local time'. */ - if (!tzid || !tzid[0]) { - *zone = NULL; - return CAL_CLIENT_GET_SUCCESS; - } - - /* If it is UTC, we return the special UTC timezone. */ - if (!strcmp (tzid, "UTC")) { - *zone = icaltimezone_get_utc_timezone (); - return CAL_CLIENT_GET_SUCCESS; - } - - /* See if we already have it in the cache. */ - tmp_zone = g_hash_table_lookup (priv->timezones, tzid); - if (tmp_zone) { - *zone = tmp_zone; - return CAL_CLIENT_GET_SUCCESS; - } - - retval = CAL_CLIENT_GET_NOT_FOUND; - *zone = NULL; - - /* We don't already have it, so we try to get it from the server. */ - CORBA_exception_init (&ev); - comp_str = GNOME_Evolution_Calendar_Cal_getTimezoneObject (priv->cal, (char *) tzid, &ev); - - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound)) - goto out; - else if (BONOBO_EX (&ev)) { - g_message ("cal_client_get_timezone(): could not get the object"); - goto out; - } - - icalcomp = icalparser_parse_string (comp_str); - CORBA_free (comp_str); - - if (!icalcomp) { - retval = CAL_CLIENT_GET_SYNTAX_ERROR; - goto out; - } - - tmp_zone = icaltimezone_new (); - if (!tmp_zone) { - /* FIXME: Needs better error code - out of memory. Or just - abort like GLib does? */ - retval = CAL_CLIENT_GET_NOT_FOUND; - goto out; - } - - if (!icaltimezone_set_component (tmp_zone, icalcomp)) { - retval = CAL_CLIENT_GET_SYNTAX_ERROR; - goto out; - } - - /* Now add it to the cache, to avoid the server call in future. */ - g_hash_table_insert (priv->timezones, icaltimezone_get_tzid (tmp_zone), - tmp_zone); - - *zone = tmp_zone; - retval = CAL_CLIENT_GET_SUCCESS; - - out: - - CORBA_exception_free (&ev); - return retval; -} - -/* Resolves TZIDs for the recurrence generator. */ -icaltimezone* -cal_client_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); - - client = CAL_CLIENT (data); - - /* FIXME: Handle errors. */ - status = cal_client_get_timezone (client, tzid, &zone); - - return zone; -} - - -/* Builds an UID list out of a CORBA UID sequence */ -static GList * -build_uid_list (GNOME_Evolution_Calendar_CalObjUIDSeq *seq) -{ - GList *uids; - int i; - - uids = NULL; - - for (i = 0; i < seq->_length; i++) - uids = g_list_prepend (uids, g_strdup (seq->_buffer[i])); - - return uids; -} - -/** - * cal_client_get_uids: - * @client: A calendar client. - * @type: Bitmask with types of objects to return. - * - * Queries a calendar for a list of unique identifiers corresponding to calendar - * objects whose type matches one of the types specified in the @type flags. - * - * Return value: A list of strings that are the sought UIDs. This should be - * freed using the cal_obj_uid_list_free() function. - **/ -GList * -cal_client_get_uids (CalClient *client, CalObjType type) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - GNOME_Evolution_Calendar_CalObjUIDSeq *seq; - int t; - GList *uids; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, NULL); - - t = corba_obj_type (type); - - CORBA_exception_init (&ev); - - seq = GNOME_Evolution_Calendar_Cal_getUIDs (priv->cal, t, &ev); - if (BONOBO_EX (&ev)) { - g_message ("cal_client_get_uids(): could not get the list of UIDs"); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - uids = build_uid_list (seq); - CORBA_free (seq); - - return uids; -} - -/* Builds a GList of CalClientChange structures from the CORBA sequence */ -static GList * -build_change_list (GNOME_Evolution_Calendar_CalObjChangeSeq *seq) -{ - GList *list = NULL; - icalcomponent *icalcomp; - int i; - - /* Create the list in reverse order */ - for (i = 0; i < seq->_length; i++) { - GNOME_Evolution_Calendar_CalObjChange *corba_coc; - CalClientChange *ccc; - - corba_coc = &seq->_buffer[i]; - ccc = g_new (CalClientChange, 1); - - icalcomp = icalparser_parse_string (corba_coc->calobj); - if (!icalcomp) - continue; - - ccc->comp = cal_component_new (); - if (!cal_component_set_icalcomponent (ccc->comp, icalcomp)) { - icalcomponent_free (icalcomp); - g_object_unref (G_OBJECT (ccc->comp)); - continue; - } - ccc->type = corba_coc->type; - - list = g_list_prepend (list, ccc); - } - - list = g_list_reverse (list); - - return list; -} - -GList * -cal_client_get_changes (CalClient *client, CalObjType type, const char *change_id) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - GNOME_Evolution_Calendar_CalObjChangeSeq *seq; - int t; - GList *changes; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, NULL); - - t = corba_obj_type (type); - CORBA_exception_init (&ev); - - seq = GNOME_Evolution_Calendar_Cal_getChanges (priv->cal, t, change_id, &ev); - if (BONOBO_EX (&ev)) { - g_message ("cal_client_get_changes(): could not get the list of changes"); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - changes = build_change_list (seq); - CORBA_free (seq); - - return changes; -} - -/* FIXME: Not used? */ -#if 0 -/* Builds a GList of CalObjInstance structures from the CORBA sequence */ -static GList * -build_object_instance_list (GNOME_Evolution_Calendar_CalObjInstanceSeq *seq) -{ - GList *list; - int i; - - /* Create the list in reverse order */ - - list = NULL; - for (i = 0; i < seq->_length; i++) { - GNOME_Evolution_Calendar_CalObjInstance *corba_icoi; - CalObjInstance *icoi; - - corba_icoi = &seq->_buffer[i]; - icoi = g_new (CalObjInstance, 1); - - icoi->uid = g_strdup (corba_icoi->uid); - icoi->start = corba_icoi->start; - icoi->end = corba_icoi->end; - - list = g_list_prepend (list, icoi); - } - - list = g_list_reverse (list); - return list; -} -#endif - -/** - * cal_client_get_objects_in_range: - * @client: A calendar client. - * @type: Bitmask with types of objects to return. - * @start: Start time for query. - * @end: End time for query. - * - * Queries a calendar for the objects that occur or recur in the specified range - * of time. - * - * Return value: A list of UID strings. This should be freed using the - * cal_obj_uid_list_free() function. - **/ -GList * -cal_client_get_objects_in_range (CalClient *client, CalObjType type, time_t start, time_t end) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - GNOME_Evolution_Calendar_CalObjUIDSeq *seq; - GList *uids; - int t; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, NULL); - - g_return_val_if_fail (start != -1 && end != -1, NULL); - g_return_val_if_fail (start <= end, NULL); - - CORBA_exception_init (&ev); - - t = corba_obj_type (type); - - seq = GNOME_Evolution_Calendar_Cal_getObjectsInRange (priv->cal, t, start, end, &ev); - if (BONOBO_EX (&ev)) { - g_message ("cal_client_get_objects_in_range(): could not get the objects"); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - uids = build_uid_list (seq); - CORBA_free (seq); - - return uids; -} - -/** - * cal_client_get_free_busy - * @client:: A calendar client. - * @users: List of users to retrieve free/busy information for. - * @start: Start time for query. - * @end: End time for query. - * - * Gets free/busy information from the calendar server. - * - * Returns: a GList of VFREEBUSY CalComponents - */ -GList * -cal_client_get_free_busy (CalClient *client, GList *users, - time_t start, time_t end) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - GNOME_Evolution_Calendar_UserList *corba_list; - GNOME_Evolution_Calendar_CalObjSeq *calobj_list; - GList *l; - GList *comp_list = NULL; - int len, i; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, NULL); - - g_return_val_if_fail (start != -1 && end != -1, NULL); - g_return_val_if_fail (start <= end, NULL); - - /* create the CORBA user list to be passed to the backend */ - len = g_list_length (users); - - corba_list = GNOME_Evolution_Calendar_UserList__alloc (); - CORBA_sequence_set_release (corba_list, TRUE); - corba_list->_length = len; - corba_list->_buffer = CORBA_sequence_GNOME_Evolution_Calendar_User_allocbuf (len); - - for (l = g_list_first (users), i = 0; l; l = l->next, i++) - corba_list->_buffer[i] = CORBA_string_dup ((CORBA_char *) l->data); - - /* call the method on the backend */ - CORBA_exception_init (&ev); - - calobj_list = GNOME_Evolution_Calendar_Cal_getFreeBusy (priv->cal, corba_list, - start, end, &ev); - CORBA_free (corba_list); - if (BONOBO_EX (&ev) || !calobj_list) { - g_message ("cal_client_get_free_busy(): could not get the objects"); - CORBA_exception_free (&ev); - return NULL; - } - - for (i = 0; i < calobj_list->_length; i++) { - CalComponent *comp; - icalcomponent *icalcomp; - icalcomponent_kind kind; - - icalcomp = icalparser_parse_string (calobj_list->_buffer[i]); - if (!icalcomp) - continue; - - kind = icalcomponent_isa (icalcomp); - if (kind == ICAL_VFREEBUSY_COMPONENT) { - comp = cal_component_new (); - if (!cal_component_set_icalcomponent (comp, icalcomp)) { - icalcomponent_free (icalcomp); - g_object_unref (G_OBJECT (comp)); - continue; - } - - comp_list = g_list_append (comp_list, comp); - } - else - icalcomponent_free (icalcomp); - } - - CORBA_exception_free (&ev); - CORBA_free (calobj_list); - - return comp_list; -} - -/* Callback used when an object is updated and we must update the copy we have */ -static void -generate_instances_obj_updated_cb (CalClient *client, const char *uid, gpointer data) -{ - GHashTable *uid_comp_hash; - CalComponent *comp; - CalClientGetStatus status; - const char *comp_uid; - - uid_comp_hash = data; - - comp = g_hash_table_lookup (uid_comp_hash, uid); - if (!comp) - /* OK, so we don't care about new objects that may indeed be in - * the requested time range. We only care about the ones that - * were returned by the first query to - * cal_client_get_objects_in_range(). - */ - return; - - g_hash_table_remove (uid_comp_hash, uid); - g_object_unref (G_OBJECT (comp)); - - status = cal_client_get_object (client, uid, &comp); - - switch (status) { - case CAL_CLIENT_GET_SUCCESS: - /* The hash key comes from the component's internal data */ - cal_component_get_uid (comp, &comp_uid); - g_hash_table_insert (uid_comp_hash, (char *) comp_uid, comp); - break; - - case CAL_CLIENT_GET_NOT_FOUND: - /* No longer in the server, too bad */ - break; - - case CAL_CLIENT_GET_SYNTAX_ERROR: - g_message ("obj_updated_cb(): Syntax error when getting " - "object `%s'; ignoring...", uid); - break; - - } -} - -/* Callback used when an object is removed and we must delete the copy we have */ -static void -generate_instances_obj_removed_cb (CalClient *client, const char *uid, gpointer data) -{ - GHashTable *uid_comp_hash; - CalComponent *comp; - - uid_comp_hash = data; - - comp = g_hash_table_lookup (uid_comp_hash, uid); - if (!comp) - return; - - g_hash_table_remove (uid_comp_hash, uid); - g_object_unref (G_OBJECT (comp)); -} - -/* Adds a component to the list; called from g_hash_table_foreach() */ -static void -add_component (gpointer key, gpointer value, gpointer data) -{ - CalComponent *comp; - GList **list; - - comp = CAL_COMPONENT (value); - list = data; - - *list = g_list_prepend (*list, comp); -} - -/* Gets a list of components that recur within the specified range of time. It - * ensures that the resulting list of CalComponent objects contains only objects - * that are actually in the server at the time the initial - * cal_client_get_objects_in_range() query ends. - */ -static GList * -get_objects_atomically (CalClient *client, CalObjType type, time_t start, time_t end) -{ - GList *uids; - GHashTable *uid_comp_hash; - GList *objects; - guint obj_updated_id; - guint obj_removed_id; - GList *l; - - uids = cal_client_get_objects_in_range (client, type, start, end); - - uid_comp_hash = g_hash_table_new (g_str_hash, g_str_equal); - - /* While we are getting the actual object data, keep track of changes */ - - obj_updated_id = g_signal_connect (G_OBJECT (client), "obj_updated", - G_CALLBACK (generate_instances_obj_updated_cb), - uid_comp_hash); - - obj_removed_id = g_signal_connect (G_OBJECT (client), "obj_removed", - G_CALLBACK (generate_instances_obj_removed_cb), - uid_comp_hash); - - /* Get the objects */ - - for (l = uids; l; l = l->next) { - CalComponent *comp; - CalClientGetStatus status; - char *uid; - const char *comp_uid; - - uid = l->data; - - status = cal_client_get_object (client, uid, &comp); - - switch (status) { - case CAL_CLIENT_GET_SUCCESS: - /* The hash key comes from the component's internal data - * instead of the duped UID from the list of UIDS. - */ - cal_component_get_uid (comp, &comp_uid); - g_hash_table_insert (uid_comp_hash, (char *) comp_uid, comp); - break; - - case CAL_CLIENT_GET_NOT_FOUND: - /* Object disappeared from the server, so don't log it */ - break; - - case CAL_CLIENT_GET_SYNTAX_ERROR: - g_message ("get_objects_atomically(): Syntax error when getting " - "object `%s'; ignoring...", uid); - break; - - default: - g_assert_not_reached (); - } - } - - cal_obj_uid_list_free (uids); - - /* Now our state is consistent with the server, so disconnect from the - * notification signals and generate the final list of components. - */ - - g_signal_handlers_disconnect_by_func (G_OBJECT (client), obj_updated_id, client); - g_signal_handlers_disconnect_by_func (G_OBJECT (client), obj_removed_id, client); - - objects = NULL; - g_hash_table_foreach (uid_comp_hash, add_component, &objects); - g_hash_table_destroy (uid_comp_hash); - - return objects; -} - -struct comp_instance { - CalComponent *comp; - time_t start; - time_t end; -}; - -/* Called from cal_recur_generate_instances(); adds an instance to the list */ -static gboolean -add_instance (CalComponent *comp, time_t start, time_t end, gpointer data) -{ - GList **list; - struct comp_instance *ci; - - list = data; - - ci = g_new (struct comp_instance, 1); - - ci->comp = comp; - g_object_ref (G_OBJECT (ci->comp)); - - ci->start = start; - ci->end = end; - - *list = g_list_prepend (*list, ci); - - return TRUE; -} - -/* Used from g_list_sort(); compares two struct comp_instance structures */ -static gint -compare_comp_instance (gconstpointer a, gconstpointer b) -{ - const struct comp_instance *cia, *cib; - time_t diff; - - cia = a; - cib = b; - - diff = cia->start - cib->start; - return (diff < 0) ? -1 : (diff > 0) ? 1 : 0; -} - -/** - * cal_client_generate_instances: - * @client: A calendar client. - * @type: Bitmask with types of objects to return. - * @start: Start time for query. - * @end: End time for query. - * @cb: Callback for each generated instance. - * @cb_data: Closure data for the callback. - * - * Does a combination of cal_client_get_objects_in_range() and - * cal_recur_generate_instances(). It fetches the list of objects in an atomic - * way so that the generated instances are actually in the server at the time - * the initial cal_client_get_objects_in_range() query ends. - * - * The callback function should do a g_object_ref() of the calendar component - * it gets passed if it intends to keep it around. - **/ -void -cal_client_generate_instances (CalClient *client, CalObjType type, - time_t start, time_t end, - CalRecurInstanceFn cb, gpointer cb_data) -{ - CalClientPrivate *priv; - GList *objects; - GList *instances; - GList *l; - - g_return_if_fail (client != NULL); - g_return_if_fail (IS_CAL_CLIENT (client)); - - priv = client->priv; - g_return_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED); - - g_return_if_fail (start != -1 && end != -1); - g_return_if_fail (start <= end); - g_return_if_fail (cb != NULL); - - /* Generate objects */ - - objects = get_objects_atomically (client, type, start, end); - instances = NULL; - - for (l = objects; l; l = l->next) { - CalComponent *comp; - - comp = l->data; - cal_recur_generate_instances (comp, start, end, add_instance, &instances, - cal_client_resolve_tzid_cb, client, - priv->default_zone); - g_object_unref (G_OBJECT (comp)); - } - - g_list_free (objects); - - /* Generate instances and spew them out */ - - instances = g_list_sort (instances, compare_comp_instance); - - for (l = instances; l; l = l->next) { - struct comp_instance *ci; - gboolean result; - - ci = l->data; - - result = (* cb) (ci->comp, ci->start, ci->end, cb_data); - - if (!result) - break; - } - - /* Clean up */ - - for (l = instances; l; l = l->next) { - struct comp_instance *ci; - - ci = l->data; - g_object_unref (G_OBJECT (ci->comp)); - g_free (ci); - } - - g_list_free (instances); -} - -/* Builds a list of CalAlarmInstance structures */ -static GSList * -build_alarm_instance_list (CalComponent *comp, GNOME_Evolution_Calendar_CalAlarmInstanceSeq *seq) -{ - GSList *alarms; - int i; - - alarms = NULL; - - for (i = 0; i < seq->_length; i++) { - GNOME_Evolution_Calendar_CalAlarmInstance *corba_instance; - CalComponentAlarm *alarm; - const char *auid; - CalAlarmInstance *instance; - - corba_instance = seq->_buffer + i; - - /* Since we want the in-commponent auid, we look for the alarm - * in the component and fetch its "real" auid. - */ - - alarm = cal_component_get_alarm (comp, corba_instance->auid); - if (!alarm) - continue; - - auid = cal_component_alarm_get_uid (alarm); - cal_component_alarm_free (alarm); - - instance = g_new (CalAlarmInstance, 1); - instance->auid = auid; - instance->trigger = corba_instance->trigger; - instance->occur_start = corba_instance->occur_start; - instance->occur_end = corba_instance->occur_end; - - alarms = g_slist_prepend (alarms, instance); - } - - return g_slist_reverse (alarms); -} - -/* Builds a list of CalComponentAlarms structures */ -static GSList * -build_component_alarms_list (GNOME_Evolution_Calendar_CalComponentAlarmsSeq *seq) -{ - GSList *comp_alarms; - int i; - - comp_alarms = NULL; - - for (i = 0; i < seq->_length; i++) { - GNOME_Evolution_Calendar_CalComponentAlarms *corba_alarms; - CalComponent *comp; - CalComponentAlarms *alarms; - icalcomponent *icalcomp; - - corba_alarms = seq->_buffer + i; - - icalcomp = icalparser_parse_string (corba_alarms->calobj); - if (!icalcomp) - continue; - - comp = cal_component_new (); - if (!cal_component_set_icalcomponent (comp, icalcomp)) { - icalcomponent_free (icalcomp); - g_object_unref (G_OBJECT (comp)); - continue; - } - - alarms = g_new (CalComponentAlarms, 1); - alarms->comp = comp; - alarms->alarms = build_alarm_instance_list (comp, &corba_alarms->alarms); - - comp_alarms = g_slist_prepend (comp_alarms, alarms); - } - - return comp_alarms; -} - -/** - * cal_client_get_alarms_in_range: - * @client: A calendar client. - * @start: Start time for query. - * @end: End time for query. - * - * Queries a calendar for the alarms that trigger in the specified range of - * time. - * - * Return value: A list of #CalComponentAlarms structures. This should be freed - * using the cal_client_free_alarms() function, or by freeing each element - * separately with cal_component_alarms_free() and then freeing the list with - * g_slist_free(). - **/ -GSList * -cal_client_get_alarms_in_range (CalClient *client, time_t start, time_t end) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - GNOME_Evolution_Calendar_CalComponentAlarmsSeq *seq; - GSList *alarms; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, NULL); - - g_return_val_if_fail (start != -1 && end != -1, NULL); - g_return_val_if_fail (start <= end, NULL); - - CORBA_exception_init (&ev); - - seq = GNOME_Evolution_Calendar_Cal_getAlarmsInRange (priv->cal, start, end, &ev); - if (BONOBO_EX (&ev)) { - g_message ("cal_client_get_alarms_in_range(): could not get the alarm range"); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - alarms = build_component_alarms_list (seq); - CORBA_free (seq); - - return alarms; -} - -/** - * cal_client_free_alarms: - * @comp_alarms: A list of #CalComponentAlarms structures. - * - * Frees a list of #CalComponentAlarms structures as returned by - * cal_client_get_alarms_in_range(). - **/ -void -cal_client_free_alarms (GSList *comp_alarms) -{ - GSList *l; - - for (l = comp_alarms; l; l = l->next) { - CalComponentAlarms *alarms; - - alarms = l->data; - g_assert (alarms != NULL); - - cal_component_alarms_free (alarms); - } - - g_slist_free (comp_alarms); -} - -/** - * cal_client_get_alarms_for_object: - * @client: A calendar client. - * @uid: Unique identifier for a calendar component. - * @start: Start time for query. - * @end: End time for query. - * @alarms: Return value for the component's alarm instances. Will return NULL - * if no instances occur within the specified time range. This should be freed - * using the cal_component_alarms_free() function. - * - * Queries a calendar for the alarms of a particular object that trigger in the - * specified range of time. - * - * Return value: TRUE on success, FALSE if the object was not found. - **/ -gboolean -cal_client_get_alarms_for_object (CalClient *client, const char *uid, - time_t start, time_t end, - CalComponentAlarms **alarms) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - GNOME_Evolution_Calendar_CalComponentAlarms *corba_alarms; - gboolean retval; - icalcomponent *icalcomp; - CalComponent *comp; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, FALSE); - - g_return_val_if_fail (uid != NULL, FALSE); - g_return_val_if_fail (start != -1 && end != -1, FALSE); - g_return_val_if_fail (start <= end, FALSE); - g_return_val_if_fail (alarms != NULL, FALSE); - - *alarms = NULL; - retval = FALSE; - - CORBA_exception_init (&ev); - - corba_alarms = GNOME_Evolution_Calendar_Cal_getAlarmsForObject (priv->cal, (char *) uid, - start, end, &ev); - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound)) - goto out; - else if (BONOBO_EX (&ev)) { - g_message ("cal_client_get_alarms_for_object(): could not get the alarm range"); - goto out; - } - - icalcomp = icalparser_parse_string (corba_alarms->calobj); - if (!icalcomp) - goto out; - - comp = cal_component_new (); - if (!cal_component_set_icalcomponent (comp, icalcomp)) { - icalcomponent_free (icalcomp); - g_object_unref (G_OBJECT (comp)); - goto out; - } - - retval = TRUE; - - *alarms = g_new (CalComponentAlarms, 1); - (*alarms)->comp = comp; - (*alarms)->alarms = build_alarm_instance_list (comp, &corba_alarms->alarms); - CORBA_free (corba_alarms); - - out: - CORBA_exception_free (&ev); - return retval; -} - -typedef struct _ForeachTZIDCallbackData ForeachTZIDCallbackData; -struct _ForeachTZIDCallbackData { - CalClient *client; - GHashTable *timezone_hash; - gboolean include_all_timezones; - gboolean success; -}; - -/* This adds the VTIMEZONE given by the TZID parameter to the GHashTable in - data. */ -static void -foreach_tzid_callback (icalparameter *param, void *cbdata) -{ - ForeachTZIDCallbackData *data = cbdata; - CalClientPrivate *priv; - const char *tzid; - icaltimezone *zone; - icalcomponent *vtimezone_comp; - char *vtimezone_as_string; - - priv = data->client->priv; - - /* Get the TZID string from the parameter. */ - tzid = icalparameter_get_tzid (param); - if (!tzid) - return; - - /* Check if we've already added it to the GHashTable. */ - if (g_hash_table_lookup (data->timezone_hash, tzid)) - return; - - if (data->include_all_timezones) { - CalClientGetStatus status; - - status = cal_client_get_timezone (data->client, tzid, &zone); - if (status != CAL_CLIENT_GET_SUCCESS) { - data->success = FALSE; - return; - } - } else { - /* Check if it is in our cache. If it is, it must already be - on the server so return. */ - if (g_hash_table_lookup (priv->timezones, tzid)) - return; - - /* Check if it is a builtin timezone. If it isn't, return. */ - zone = icaltimezone_get_builtin_timezone_from_tzid (tzid); - if (!zone) - return; - } - - /* Convert it to a string and add it to the hash. */ - vtimezone_comp = icaltimezone_get_component (zone); - if (!vtimezone_comp) - return; - - vtimezone_as_string = icalcomponent_as_ical_string (vtimezone_comp); - - g_hash_table_insert (data->timezone_hash, (char*) tzid, - g_strdup (vtimezone_as_string)); -} - -/* This appends the value string to the GString given in data. */ -static void -append_timezone_string (gpointer key, gpointer value, gpointer data) -{ - GString *vcal_string = data; - - g_string_append (vcal_string, value); - g_free (value); -} - - -/* This simply frees the hash values. */ -static void -free_timezone_string (gpointer key, gpointer value, gpointer data) -{ - g_free (value); -} - - -/* This converts the VEVENT/VTODO to a string. If include_all_timezones is - TRUE, it includes all the VTIMEZONE components needed for the VEVENT/VTODO. - If not, it only includes builtin timezones that may not be on the server. - - To do that we check every TZID in the component to see if it is a builtin - timezone. If it is, we see if it it in our cache. If it is in our cache, - then we know the server already has it and we don't need to send it. - If it isn't in our cache, then we need to send it to the server. - If we need to send any timezones to the server, then we have to create a - complete VCALENDAR object, otherwise we can just send a single VEVENT/VTODO - as before. */ -static char* -cal_client_get_component_as_string_internal (CalClient *client, - CalComponent *comp, - gboolean include_all_timezones) -{ - GHashTable *timezone_hash; - GString *vcal_string; - int initial_vcal_string_len; - ForeachTZIDCallbackData cbdata; - char *obj_string; - - CalClientPrivate *priv; - - priv = client->priv; - - timezone_hash = g_hash_table_new (g_str_hash, g_str_equal); - - /* Add any timezones needed to the hash. We use a hash since we only - want to add each timezone once at most. */ - cbdata.client = client; - cbdata.timezone_hash = timezone_hash; - cbdata.include_all_timezones = include_all_timezones; - cbdata.success = TRUE; - icalcomponent_foreach_tzid (cal_component_get_icalcomponent (comp), - foreach_tzid_callback, &cbdata); - if (!cbdata.success) { - g_hash_table_foreach (timezone_hash, free_timezone_string, - NULL); - return NULL; - } - - /* Create the start of a VCALENDAR, to add the VTIMEZONES to, - and remember its length so we know if any VTIMEZONEs get added. */ - vcal_string = g_string_new (NULL); - g_string_append (vcal_string, - "BEGIN:VCALENDAR\n" - "PRODID:-//Ximian//NONSGML Evolution Calendar//EN\n" - "VERSION:2.0\n" - "METHOD:PUBLISH\n"); - initial_vcal_string_len = vcal_string->len; - - /* Now concatenate all the timezone strings. This also frees the - timezone strings as it goes. */ - g_hash_table_foreach (timezone_hash, append_timezone_string, - vcal_string); - - /* Get the string for the VEVENT/VTODO. */ - obj_string = cal_component_get_as_string (comp); - - /* If there were any timezones to send, create a complete VCALENDAR, - else just send the VEVENT/VTODO string. */ - if (!include_all_timezones - && vcal_string->len == initial_vcal_string_len) { - g_string_free (vcal_string, TRUE); - } else { - g_string_append (vcal_string, obj_string); - g_string_append (vcal_string, "END:VCALENDAR\n"); - g_free (obj_string); - obj_string = vcal_string->str; - g_string_free (vcal_string, FALSE); - } - - g_hash_table_destroy (timezone_hash); - - return obj_string; -} - -/** - * cal_client_get_component_as_string: - * @client: A calendar client. - * @comp: A calendar component object. - * - * Gets a calendar component as an iCalendar string, with a toplevel - * VCALENDAR component and all VTIMEZONEs needed for the component. - * - * Return value: the component as a complete iCalendar string, or NULL on - * failure. The string should be freed after use. - **/ -char* -cal_client_get_component_as_string (CalClient *client, - CalComponent *comp) -{ - return cal_client_get_component_as_string_internal (client, comp, - TRUE); -} - -/** - * cal_client_update_object: - * @client: A calendar client. - * @comp: A calendar component object. - * - * Asks a calendar to update a component. Any existing component with the - * specified component's UID will be replaced. The client program should not - * assume that the object is actually in the server's storage until it has - * received the "obj_updated" notification signal. - * - * Return value: a #CalClientResult value indicating the result of the - * operation. - **/ -CalClientResult -cal_client_update_object (CalClient *client, CalComponent *comp) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - CalClientResult retval; - char *obj_string; - - g_return_val_if_fail (client != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT); - g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_RESULT_INVALID_OBJECT); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, CAL_CLIENT_RESULT_INVALID_OBJECT); - - g_return_val_if_fail (comp != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT); - - cal_component_commit_sequence (comp); - - obj_string = cal_client_get_component_as_string_internal (client, - comp, FALSE); - if (obj_string == NULL) - return CAL_CLIENT_RESULT_INVALID_OBJECT; - - CORBA_exception_init (&ev); - GNOME_Evolution_Calendar_Cal_updateObjects (priv->cal, obj_string, &ev); - g_free (obj_string); - - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject)) - retval = CAL_CLIENT_RESULT_INVALID_OBJECT; - else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound)) - retval = CAL_CLIENT_RESULT_NOT_FOUND; - else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied)) - retval = CAL_CLIENT_RESULT_PERMISSION_DENIED; - else if (BONOBO_EX (&ev)) { - g_message ("cal_client_update_object(): could not update the object"); - retval = CAL_CLIENT_RESULT_CORBA_ERROR; - } - else - retval = CAL_CLIENT_RESULT_SUCCESS; - - CORBA_exception_free (&ev); - return retval; -} - -/** - * cal_client_update_objects: - * @client: A calendar client. - * @icalcomp: A toplevel VCALENDAR libical component. - * - * Asks a calendar to add or update one or more components, possibly including - * VTIMEZONE data. Any existing components with the same UIDs will be - * replaced. The VTIMEZONE data will be compared to existing VTIMEZONEs in - * the calendar, and the VTIMEZONEs may possibly be renamed, as well as all - * references to them throughout the VCALENDAR. - * - * The client program should not assume that the objects are actually in the - * server's storage until it has received the "obj_updated" notification - * signal. - * - * Return value: a #CalClientResult value indicating the result of the - * operation. - **/ -CalClientResult -cal_client_update_objects (CalClient *client, icalcomponent *icalcomp) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - CalClientResult retval; - char *obj_string; - - g_return_val_if_fail (client != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT); - g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_RESULT_INVALID_OBJECT); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, - CAL_CLIENT_RESULT_INVALID_OBJECT); - - g_return_val_if_fail (icalcomp != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT); - - /* Libical owns this memory, using one of its temporary buffers. */ - obj_string = icalcomponent_as_ical_string (icalcomp); - - CORBA_exception_init (&ev); - GNOME_Evolution_Calendar_Cal_updateObjects (priv->cal, obj_string, &ev); - - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject)) - retval = CAL_CLIENT_RESULT_INVALID_OBJECT; - else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound)) - retval = CAL_CLIENT_RESULT_NOT_FOUND; - else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied)) - retval = CAL_CLIENT_RESULT_PERMISSION_DENIED; - else if (BONOBO_EX (&ev)) { - g_message ("cal_client_update_objects(): could not update the objects"); - retval = CAL_CLIENT_RESULT_CORBA_ERROR; - } - else - retval = CAL_CLIENT_RESULT_SUCCESS; - - CORBA_exception_free (&ev); - return retval; -} - - -/** - * cal_client_remove_object: - * @client: A calendar client. - * @uid: Unique identifier of the calendar component to remove. - * - * Asks a calendar to remove a component. If the server is able to remove the - * component, all clients will be notified and they will emit the "obj_removed" - * signal. - * - * Return value: a #CalClientResult value indicating the result of the - * operation. - **/ -CalClientResult -cal_client_remove_object (CalClient *client, const char *uid) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - CalClientResult retval; - - g_return_val_if_fail (client != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT); - g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_RESULT_INVALID_OBJECT); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, CAL_CLIENT_RESULT_INVALID_OBJECT); - - g_return_val_if_fail (uid != NULL, CAL_CLIENT_RESULT_NOT_FOUND); - - CORBA_exception_init (&ev); - GNOME_Evolution_Calendar_Cal_removeObject (priv->cal, (char *) uid, &ev); - - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject)) - retval = CAL_CLIENT_RESULT_INVALID_OBJECT; - else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound)) - retval = CAL_CLIENT_RESULT_NOT_FOUND; - else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied)) - retval = CAL_CLIENT_RESULT_PERMISSION_DENIED; - else if (BONOBO_EX (&ev)) { - g_message ("cal_client_remove_object(): could not remove the object"); - retval = CAL_CLIENT_RESULT_CORBA_ERROR; - } - else - retval = CAL_CLIENT_RESULT_SUCCESS; - - CORBA_exception_free (&ev); - return retval; -} - -CalClientResult -cal_client_send_object (CalClient *client, icalcomponent *icalcomp, - icalcomponent **new_icalcomp, GList **users, - char error_msg[256]) -{ - CalClientPrivate *priv; - CORBA_Environment ev; - CalClientResult retval; - GNOME_Evolution_Calendar_UserList *user_list; - char *obj_string; - int i; - - g_return_val_if_fail (client != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT); - g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_RESULT_INVALID_OBJECT); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, - CAL_CLIENT_RESULT_INVALID_OBJECT); - - g_return_val_if_fail (icalcomp != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT); - - /* Libical owns this memory, using one of its temporary buffers. */ - obj_string = icalcomponent_as_ical_string (icalcomp); - - CORBA_exception_init (&ev); - obj_string = GNOME_Evolution_Calendar_Cal_sendObject (priv->cal, obj_string, &user_list, &ev); - - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject)) { - retval = CAL_CLIENT_SEND_INVALID_OBJECT; - } else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_Busy)) { - retval = CAL_CLIENT_SEND_BUSY; - strcpy (error_msg, - ((GNOME_Evolution_Calendar_Cal_Busy *)(CORBA_exception_value (&ev)))->errorMsg); - } else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied)) { - retval = CAL_CLIENT_SEND_PERMISSION_DENIED; - } else if (BONOBO_EX (&ev)) { - g_message ("cal_client_update_objects(): could not send the objects"); - retval = CAL_CLIENT_SEND_CORBA_ERROR; - } else { - retval = CAL_CLIENT_RESULT_SUCCESS; - - *new_icalcomp = icalparser_parse_string (obj_string); - CORBA_free (obj_string); - - if (*new_icalcomp == NULL) { - retval = CAL_CLIENT_RESULT_INVALID_OBJECT; - } else { - *users = NULL; - for (i = 0; i < user_list->_length; i++) - *users = g_list_append (*users, g_strdup (user_list->_buffer[i])); - CORBA_free (user_list); - } - } - - CORBA_exception_free (&ev); - - return retval; -} - -/** - * cal_client_get_query: - * @client: A calendar client. - * @sexp: S-expression representing the query. - * - * Creates a live query object from a loaded calendar. - * - * Return value: A query object that will emit notification signals as calendar - * components are added and removed from the query in the server. - **/ -CalQuery * -cal_client_get_query (CalClient *client, const char *sexp) -{ - CalClientPrivate *priv; - - g_return_val_if_fail (client != NULL, NULL); - g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); - - priv = client->priv; - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, FALSE); - - g_return_val_if_fail (sexp != NULL, NULL); - - return cal_query_new (priv->cal, sexp); -} - - -/* This ensures that the given timezone is on the server. We use this to pass - the default timezone to the server, so it can resolve DATE and floating - DATE-TIME values into specific times. (Most of our IDL interface uses - time_t values to pass specific times from the server to the client.) */ -static gboolean -cal_client_ensure_timezone_on_server (CalClient *client, icaltimezone *zone) -{ - CalClientPrivate *priv; - char *tzid, *obj_string; - icaltimezone *tmp_zone; - GString *vcal_string; - gboolean retval = FALSE; - icalcomponent *vtimezone_comp; - char *vtimezone_as_string; - CORBA_Environment ev; - - priv = client->priv; - - /* If the zone is NULL or UTC we don't need to do anything. */ - if (!zone) - return TRUE; - - tzid = icaltimezone_get_tzid (zone); - - if (!strcmp (tzid, "UTC")) - return TRUE; - - /* See if we already have it in the cache. If we do, it must be on - the server already. */ - tmp_zone = g_hash_table_lookup (priv->timezones, tzid); - if (tmp_zone) - return TRUE; - - /* Now we have to send it to the server, in case it doesn't already - have it. */ - - vcal_string = g_string_new (NULL); - g_string_append (vcal_string, - "BEGIN:VCALENDAR\n" - "PRODID:-//Ximian//NONSGML Evolution Calendar//EN\n" - "VERSION:2.0\n"); - - /* Convert the timezone to a string and add it. */ - vtimezone_comp = icaltimezone_get_component (zone); - if (!vtimezone_comp) { - g_string_free (vcal_string, TRUE); - return FALSE; - } - - /* We don't need to free this string as libical owns it. */ - vtimezone_as_string = icalcomponent_as_ical_string (vtimezone_comp); - g_string_append (vcal_string, vtimezone_as_string); - - g_string_append (vcal_string, "END:VCALENDAR\n"); - - obj_string = vcal_string->str; - g_string_free (vcal_string, FALSE); - - CORBA_exception_init (&ev); - GNOME_Evolution_Calendar_Cal_updateObjects (priv->cal, obj_string, &ev); - g_free (obj_string); - - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject)) - goto out; - else if (BONOBO_EX (&ev)) { - g_message ("cal_client_ensure_timezone_on_server(): could not add the timezone to the server"); - goto out; - } - - retval = TRUE; - - out: - CORBA_exception_free (&ev); - return retval; -} - - -gboolean -cal_client_set_default_timezone (CalClient *client, icaltimezone *zone) -{ - CalClientPrivate *priv; - gboolean retval = FALSE; - CORBA_Environment ev; - const char *tzid; - - g_return_val_if_fail (client != NULL, FALSE); - g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); - g_return_val_if_fail (zone != NULL, FALSE); - - priv = client->priv; - - g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, - FALSE); - - /* Make sure the server has the VTIMEZONE data. */ - if (!cal_client_ensure_timezone_on_server (client, zone)) - return FALSE; - - /* Now set the default timezone on the server. */ - CORBA_exception_init (&ev); - tzid = icaltimezone_get_tzid (zone); - GNOME_Evolution_Calendar_Cal_setDefaultTimezone (priv->cal, - (char *) tzid, &ev); - - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound)) - goto out; - else if (BONOBO_EX (&ev)) { - g_message ("cal_client_set_default_timezone(): could not set the default timezone"); - goto out; - } - - retval = TRUE; - - priv->default_zone = zone; - - out: - - CORBA_exception_free (&ev); - return retval; -} - diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h deleted file mode 100644 index 3d6a4fe85d..0000000000 --- a/calendar/cal-client/cal-client.h +++ /dev/null @@ -1,212 +0,0 @@ -/* Evolution calendar client - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_CLIENT_H -#define CAL_CLIENT_H - -#include <glib-object.h> -#include <cal-util/cal-recur.h> -#include <cal-util/cal-util.h> -#include <cal-client/cal-query.h> - -G_BEGIN_DECLS - - - -#define CAL_CLIENT_TYPE (cal_client_get_type ()) -#define CAL_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_CLIENT_TYPE, CalClient)) -#define CAL_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_CLIENT_TYPE, CalClientClass)) -#define IS_CAL_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_CLIENT_TYPE)) -#define IS_CAL_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_TYPE)) - -typedef struct _CalClient CalClient; -typedef struct _CalClientClass CalClientClass; - -typedef struct _CalClientPrivate CalClientPrivate; - -/* Open status for the cal_opened signal */ -typedef enum { - CAL_CLIENT_OPEN_SUCCESS, - CAL_CLIENT_OPEN_ERROR, - CAL_CLIENT_OPEN_NOT_FOUND, - CAL_CLIENT_OPEN_PERMISSION_DENIED, - CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED -} CalClientOpenStatus; - -/* Set mode status for the cal_client_set_mode function */ -typedef enum { - CAL_CLIENT_SET_MODE_SUCCESS, - CAL_CLIENT_SET_MODE_ERROR, - CAL_CLIENT_SET_MODE_NOT_SUPPORTED -} CalClientSetModeStatus; - -/* Get status for the cal_client_get_object() function */ -typedef enum { - CAL_CLIENT_GET_SUCCESS, - CAL_CLIENT_GET_NOT_FOUND, - CAL_CLIENT_GET_SYNTAX_ERROR -} CalClientGetStatus; - -/* Status for update_object(s) and remove_object */ -typedef enum { - CAL_CLIENT_RESULT_SUCCESS, - CAL_CLIENT_RESULT_CORBA_ERROR, - CAL_CLIENT_RESULT_INVALID_OBJECT, - CAL_CLIENT_RESULT_NOT_FOUND, - CAL_CLIENT_RESULT_PERMISSION_DENIED -} CalClientResult; - -typedef enum { - CAL_CLIENT_SEND_SUCCESS, - CAL_CLIENT_SEND_CORBA_ERROR, - CAL_CLIENT_SEND_INVALID_OBJECT, - CAL_CLIENT_SEND_BUSY, - CAL_CLIENT_SEND_PERMISSION_DENIED -} CalClientSendResult; - -/* Whether the client is not loaded, is being loaded, or is already loaded */ -typedef enum { - CAL_CLIENT_LOAD_NOT_LOADED, - CAL_CLIENT_LOAD_LOADING, - CAL_CLIENT_LOAD_LOADED -} CalClientLoadState; - -struct _CalClient { - GObject object; - - /* Private data */ - CalClientPrivate *priv; -}; - -struct _CalClientClass { - GObjectClass parent_class; - - /* Notification signals */ - - void (* cal_opened) (CalClient *client, CalClientOpenStatus status); - void (* cal_set_mode) (CalClient *client, CalClientSetModeStatus status, CalMode mode); - - void (* obj_updated) (CalClient *client, const char *uid); - void (* obj_removed) (CalClient *client, const char *uid); - - void (* backend_error) (CalClient *client, const char *message); - - void (* categories_changed) (CalClient *client, GPtrArray *categories); - - void (* forget_password) (CalClient *client, const char *key); - - void (* backend_died) (CalClient *client); -}; - -typedef gchar * (* CalClientAuthFunc) (CalClient *client, - const gchar *prompt, - const gchar *key, - gpointer user_data); - -GType cal_client_get_type (void); - -CalClient *cal_client_construct (CalClient *client); - -CalClient *cal_client_new (void); - -void cal_client_set_auth_func (CalClient *client, CalClientAuthFunc func, gpointer data); - -/* Sets the default timezone to use to resolve DATE and floating DATE-TIME - values. This will typically be from the user's timezone setting. Call this - before using any other functions. It will pass the default timezone on to - the server. Returns TRUE on success. */ -gboolean cal_client_set_default_timezone (CalClient *client, icaltimezone *zone); - -gboolean cal_client_open_calendar (CalClient *client, const char *str_uri, gboolean only_if_exists); -gboolean cal_client_open_default_calendar (CalClient *client, gboolean only_if_exists); -gboolean cal_client_open_default_tasks (CalClient *client, gboolean only_if_exists); - -GList *cal_client_uri_list (CalClient *client, CalMode mode); - -CalClientLoadState cal_client_get_load_state (CalClient *client); - -const char *cal_client_get_uri (CalClient *client); - -gboolean cal_client_is_read_only (CalClient *client); - -const char *cal_client_get_email_address (CalClient *client); - -gboolean cal_client_set_mode (CalClient *client, CalMode mode); - -int cal_client_get_n_objects (CalClient *client, CalObjType type); - -CalClientGetStatus cal_client_get_object (CalClient *client, - const char *uid, - CalComponent **comp); - -CalClientGetStatus cal_client_get_timezone (CalClient *client, - const char *tzid, - icaltimezone **zone); - -GList *cal_client_get_uids (CalClient *client, CalObjType type); -GList *cal_client_get_changes (CalClient *client, CalObjType type, const char *change_id); - -GList *cal_client_get_objects_in_range (CalClient *client, CalObjType type, - time_t start, time_t end); - -GList *cal_client_get_free_busy (CalClient *client, GList *users, - time_t start, time_t end); - -void cal_client_generate_instances (CalClient *client, CalObjType type, - time_t start, time_t end, - CalRecurInstanceFn cb, gpointer cb_data); - -GSList *cal_client_get_alarms_in_range (CalClient *client, time_t start, time_t end); - -void cal_client_free_alarms (GSList *comp_alarms); - -gboolean cal_client_get_alarms_for_object (CalClient *client, const char *uid, - time_t start, time_t end, - CalComponentAlarms **alarms); - -/* Add or update a single object. When adding an object only builtin timezones - are allowed. To use external VTIMEZONE data call update_objects() instead.*/ -CalClientResult cal_client_update_object (CalClient *client, CalComponent *comp); - -/* Add or update multiple objects, possibly including VTIMEZONE data. */ -CalClientResult cal_client_update_objects (CalClient *client, icalcomponent *icalcomp); - -CalClientResult cal_client_remove_object (CalClient *client, const char *uid); - -CalClientSendResult cal_client_send_object (CalClient *client, icalcomponent *icalcomp, - icalcomponent **new_icalcomp, GList **users, - char error_msg[256]); - -CalQuery *cal_client_get_query (CalClient *client, const char *sexp); - -/* Resolves TZIDs for the recurrence generator. */ -icaltimezone *cal_client_resolve_tzid_cb (const char *tzid, gpointer data); - -/* Returns a complete VCALENDAR for a VEVENT/VTODO including all VTIMEZONEs - used by the component. It also includes a 'METHOD:PUBLISH' property. */ -char* cal_client_get_component_as_string (CalClient *client, - CalComponent *comp); - - - - -G_END_DECLS - -#endif diff --git a/calendar/cal-client/cal-listener.c b/calendar/cal-client/cal-listener.c deleted file mode 100644 index c7beef8c97..0000000000 --- a/calendar/cal-client/cal-listener.c +++ /dev/null @@ -1,398 +0,0 @@ -/* Evolution calendar listener - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include "cal-listener.h" - - - -/* Private part of the CalListener structure */ -struct CalListenerPrivate { - /* Notification functions and their closure data */ - CalListenerCalOpenedFn cal_opened_fn; - CalListenerCalSetModeFn cal_set_mode_fn; - CalListenerObjUpdatedFn obj_updated_fn; - CalListenerObjRemovedFn obj_removed_fn; - CalListenerErrorOccurredFn error_occurred_fn; - CalListenerCategoriesChangedFn categories_changed_fn; - gpointer fn_data; - - /* Whether notification is desired */ - gboolean notify : 1; -}; - - - -static void cal_listener_class_init (CalListenerClass *klass); -static void cal_listener_init (CalListener *listener, CalListenerClass *klass); -static void cal_listener_finalize (GObject *object); - -static void impl_notifyCalOpened (PortableServer_Servant servant, - GNOME_Evolution_Calendar_Listener_OpenStatus status, - GNOME_Evolution_Calendar_Cal cal, - CORBA_Environment *ev); -static void impl_notifyCalSetMode (PortableServer_Servant servant, - GNOME_Evolution_Calendar_Listener_SetModeStatus status, - GNOME_Evolution_Calendar_CalMode mode, - CORBA_Environment *ev); -static void impl_notifyObjUpdated (PortableServer_Servant servant, - const CORBA_char *uid, - CORBA_Environment *ev); -static void impl_notifyObjRemoved (PortableServer_Servant servant, - const CORBA_char *uid, - CORBA_Environment *ev); -static void impl_notifyErrorOccurred (PortableServer_Servant servant, - const CORBA_char *message, - CORBA_Environment *ev); -static void impl_notifyCategoriesChanged (PortableServer_Servant servant, - const GNOME_Evolution_Calendar_StringSeq *categories, - CORBA_Environment *ev); - -static BonoboObjectClass *parent_class; - - - -BONOBO_TYPE_FUNC_FULL (CalListener, - GNOME_Evolution_Calendar_Listener, - BONOBO_TYPE_OBJECT, - cal_listener); - -/* Class initialization function for the calendar listener */ -static void -cal_listener_class_init (CalListenerClass *klass) -{ - GObjectClass *object_class; - - object_class = (GObjectClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - klass->epv.notifyCalOpened = impl_notifyCalOpened; - klass->epv.notifyCalSetMode = impl_notifyCalSetMode; - klass->epv.notifyObjUpdated = impl_notifyObjUpdated; - klass->epv.notifyObjRemoved = impl_notifyObjRemoved; - klass->epv.notifyErrorOccurred = impl_notifyErrorOccurred; - klass->epv.notifyCategoriesChanged = impl_notifyCategoriesChanged; - - object_class->finalize = cal_listener_finalize; -} - -/* Object initialization function for the calendar listener */ -static void -cal_listener_init (CalListener *listener, CalListenerClass *klass) -{ - CalListenerPrivate *priv; - - priv = g_new0 (CalListenerPrivate, 1); - listener->priv = priv; - - priv->cal_opened_fn = NULL; - priv->obj_updated_fn = NULL; - priv->obj_removed_fn = NULL; - priv->error_occurred_fn = NULL; - priv->categories_changed_fn = NULL; - - priv->notify = TRUE; -} - -/* Finalize handler for the calendar listener */ -static void -cal_listener_finalize (GObject *object) -{ - CalListener *listener; - CalListenerPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_LISTENER (object)); - - listener = CAL_LISTENER (object); - priv = listener->priv; - - priv->cal_opened_fn = NULL; - priv->obj_updated_fn = NULL; - priv->obj_removed_fn = NULL; - priv->error_occurred_fn = NULL; - priv->categories_changed_fn = NULL; - priv->fn_data = NULL; - - priv->notify = FALSE; - - g_free (priv); - listener->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - - -/* CORBA servant implementation */ - -/* ::notifyCalOpened method */ -static void -impl_notifyCalOpened (PortableServer_Servant servant, - GNOME_Evolution_Calendar_Listener_OpenStatus status, - GNOME_Evolution_Calendar_Cal cal, - CORBA_Environment *ev) -{ - CalListener *listener; - CalListenerPrivate *priv; - CORBA_Environment aev; - GNOME_Evolution_Calendar_Cal cal_copy; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - priv = listener->priv; - - if (!priv->notify) - return; - - CORBA_exception_init (&aev); - cal_copy = CORBA_Object_duplicate (cal, &aev); - - if (aev._major != CORBA_NO_EXCEPTION) { - g_message ("Listener_notifyCalOpened(): could not duplicate the calendar"); - CORBA_exception_free (&aev); - return; - } - CORBA_exception_free (&aev); - - g_assert (priv->cal_opened_fn != NULL); - (* priv->cal_opened_fn) (listener, status, cal, priv->fn_data); -} - -/* ::notifyCalSetMode method */ -static void -impl_notifyCalSetMode (PortableServer_Servant servant, - GNOME_Evolution_Calendar_Listener_SetModeStatus status, - GNOME_Evolution_Calendar_CalMode mode, - CORBA_Environment *ev) -{ - CalListener *listener; - CalListenerPrivate *priv; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - priv = listener->priv; - - if (!priv->notify) - return; - - g_assert (priv->cal_set_mode_fn != NULL); - (* priv->cal_set_mode_fn) (listener, status, mode, priv->fn_data); -} - -/* ::notifyObjUpdated method */ -static void -impl_notifyObjUpdated (PortableServer_Servant servant, - const CORBA_char *uid, - CORBA_Environment *ev) -{ - CalListener *listener; - CalListenerPrivate *priv; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - priv = listener->priv; - - if (!priv->notify) - return; - - g_assert (priv->obj_updated_fn != NULL); - (* priv->obj_updated_fn) (listener, uid, priv->fn_data); -} - -/* ::notifyObjRemoved method */ -static void -impl_notifyObjRemoved (PortableServer_Servant servant, - const CORBA_char *uid, - CORBA_Environment *ev) -{ - CalListener *listener; - CalListenerPrivate *priv; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - priv = listener->priv; - - if (!priv->notify) - return; - - g_assert (priv->obj_removed_fn != NULL); - (* priv->obj_removed_fn) (listener, uid, priv->fn_data); -} - -/* ::notifyErrorOccurred method */ -static void -impl_notifyErrorOccurred (PortableServer_Servant servant, - const CORBA_char *message, - CORBA_Environment *ev) -{ - CalListener *listener; - CalListenerPrivate *priv; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - priv = listener->priv; - - if (!priv->notify) - return; - - g_assert (priv->error_occurred_fn != NULL); - (* priv->error_occurred_fn) (listener, message, priv->fn_data); -} - -/* ::notifyCategoriesChanged method */ -static void -impl_notifyCategoriesChanged (PortableServer_Servant servant, - const GNOME_Evolution_Calendar_StringSeq *categories, - CORBA_Environment *ev) -{ - CalListener *listener; - CalListenerPrivate *priv; - - listener = CAL_LISTENER (bonobo_object_from_servant (servant)); - priv = listener->priv; - - if (!priv->notify) - return; - - g_assert (priv->categories_changed_fn != NULL); - (* priv->categories_changed_fn) (listener, categories, priv->fn_data); -} - - - -/** - * cal_listener_construct: - * @listener: A calendar listener. - * @cal_opened_fn: Function that will be called to notify that a calendar was - * opened. - * @obj_updated_fn: Function that will be called to notify that an object in the - * calendar was updated. - * @obj_removed_fn: Function that will be called to notify that an object in the - * calendar was removed. - * @error_occurred_fn: Function that will be called to notify errors. - * @categories_changed_fn: Function that will be called to notify that the list - * of categories that are present in the calendar's objects has changed. - * @fn_data: Closure data pointer that will be passed to the notification - * functions. - * - * Constructs a calendar listener by setting the callbacks that it will use for - * notification from the calendar server. - * - * Return value: the same object as the @listener argument. - **/ -CalListener * -cal_listener_construct (CalListener *listener, - CalListenerCalOpenedFn cal_opened_fn, - CalListenerCalSetModeFn cal_set_mode_fn, - CalListenerObjUpdatedFn obj_updated_fn, - CalListenerObjRemovedFn obj_removed_fn, - CalListenerErrorOccurredFn error_occurred_fn, - CalListenerCategoriesChangedFn categories_changed_fn, - gpointer fn_data) -{ - CalListenerPrivate *priv; - - g_return_val_if_fail (listener != NULL, NULL); - g_return_val_if_fail (IS_CAL_LISTENER (listener), NULL); - g_return_val_if_fail (cal_opened_fn != NULL, NULL); - g_return_val_if_fail (cal_set_mode_fn != NULL, NULL); - g_return_val_if_fail (obj_updated_fn != NULL, NULL); - g_return_val_if_fail (obj_removed_fn != NULL, NULL); - g_return_val_if_fail (error_occurred_fn != NULL, NULL); - g_return_val_if_fail (categories_changed_fn != NULL, NULL); - - priv = listener->priv; - - priv->cal_opened_fn = cal_opened_fn; - priv->cal_set_mode_fn = cal_set_mode_fn; - priv->obj_updated_fn = obj_updated_fn; - priv->obj_removed_fn = obj_removed_fn; - priv->error_occurred_fn = error_occurred_fn; - priv->categories_changed_fn = categories_changed_fn; - priv->fn_data = fn_data; - - return listener; -} - -/** - * cal_listener_new: - * @cal_opened_fn: Function that will be called to notify that a calendar was - * opened. - * @obj_updated_fn: Function that will be called to notify that an object in the - * calendar was updated. - * @obj_removed_fn: Function that will be called to notify that an object in the - * calendar was removed. - * @error_occurred_fn: Function that will be called to notify errors. - * @categories_changed_fn: Function that will be called to notify that the list - * of categories that are present in the calendar's objects has changed. - * @fn_data: Closure data pointer that will be passed to the notification - * functions. - * - * Creates a new #CalListener object. - * - * Return value: A newly-created #CalListener object. - **/ -CalListener * -cal_listener_new (CalListenerCalOpenedFn cal_opened_fn, - CalListenerCalSetModeFn cal_set_mode_fn, - CalListenerObjUpdatedFn obj_updated_fn, - CalListenerObjRemovedFn obj_removed_fn, - CalListenerErrorOccurredFn error_occurred_fn, - CalListenerCategoriesChangedFn categories_changed_fn, - gpointer fn_data) -{ - CalListener *listener; - - g_return_val_if_fail (cal_opened_fn != NULL, NULL); - g_return_val_if_fail (obj_updated_fn != NULL, NULL); - g_return_val_if_fail (obj_removed_fn != NULL, NULL); - g_return_val_if_fail (error_occurred_fn != NULL, NULL); - g_return_val_if_fail (categories_changed_fn != NULL, NULL); - - listener = g_object_new (CAL_LISTENER_TYPE, NULL); - return cal_listener_construct (listener, - cal_opened_fn, - cal_set_mode_fn, - obj_updated_fn, - obj_removed_fn, - error_occurred_fn, - categories_changed_fn, - fn_data); -} - -/** - * cal_listener_stop_notification: - * @listener: A calendar listener. - * - * Informs a calendar listener that no further notification is desired. The - * callbacks specified when the listener was created will no longer be invoked - * after this function is called. - **/ -void -cal_listener_stop_notification (CalListener *listener) -{ - CalListenerPrivate *priv; - - g_return_if_fail (listener != NULL); - g_return_if_fail (IS_CAL_LISTENER (listener)); - - priv = listener->priv; - g_return_if_fail (priv->notify != FALSE); - - priv->notify = FALSE; -} diff --git a/calendar/cal-client/cal-listener.h b/calendar/cal-client/cal-listener.h deleted file mode 100644 index d0f9a718a4..0000000000 --- a/calendar/cal-client/cal-listener.h +++ /dev/null @@ -1,105 +0,0 @@ -/* Evolution calendar listener - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_LISTENER_H -#define CAL_LISTENER_H - -#include <bonobo/bonobo-object.h> -#include "evolution-calendar.h" - -G_BEGIN_DECLS - - - -#define CAL_LISTENER_TYPE (cal_listener_get_type ()) -#define CAL_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_LISTENER_TYPE, CalListener)) -#define CAL_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_LISTENER_TYPE, \ - CalListenerClass)) -#define IS_CAL_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_LISTENER_TYPE)) -#define IS_CAL_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_LISTENER_TYPE)) - -typedef struct CalListenerPrivate CalListenerPrivate; - -typedef struct { - BonoboObject xobject; - - /* Private data */ - CalListenerPrivate *priv; -} CalListener; - -typedef struct { - BonoboObjectClass parent_class; - - POA_GNOME_Evolution_Calendar_Listener__epv epv; -} CalListenerClass; - -/* Notification functions */ -typedef void (* CalListenerCalOpenedFn) (CalListener *listener, - GNOME_Evolution_Calendar_Listener_OpenStatus status, - GNOME_Evolution_Calendar_Cal cal, - gpointer data); - -typedef void (* CalListenerCalSetModeFn) (CalListener *listener, - GNOME_Evolution_Calendar_Listener_SetModeStatus status, - GNOME_Evolution_Calendar_CalMode mode, - gpointer data); - -typedef void (* CalListenerObjUpdatedFn) (CalListener *listener, - const CORBA_char *uid, - gpointer data); -typedef void (* CalListenerObjRemovedFn) (CalListener *listener, - const CORBA_char *uid, - gpointer data); - -typedef void (* CalListenerErrorOccurredFn) (CalListener *listener, - const char *message, - gpointer data); - -typedef void (* CalListenerCategoriesChangedFn) (CalListener *listener, - const GNOME_Evolution_Calendar_StringSeq *categories, - gpointer data); - - -GType cal_listener_get_type (void); - -CalListener *cal_listener_construct (CalListener *listener, - CalListenerCalOpenedFn cal_opened_fn, - CalListenerCalSetModeFn cal_set_mode_fn, - CalListenerObjUpdatedFn obj_updated_fn, - CalListenerObjRemovedFn obj_removed_fn, - CalListenerErrorOccurredFn error_occurred_fn, - CalListenerCategoriesChangedFn categories_changed_fn, - gpointer fn_data); - -CalListener *cal_listener_new (CalListenerCalOpenedFn cal_opened_fn, - CalListenerCalSetModeFn cal_set_mode_fn, - CalListenerObjUpdatedFn obj_updated_fn, - CalListenerObjRemovedFn obj_removed_fn, - CalListenerErrorOccurredFn error_occurred_fn, - CalListenerCategoriesChangedFn categories_changed_fn, - gpointer fn_data); - -void cal_listener_stop_notification (CalListener *listener); - - - -G_END_DECLS - -#endif diff --git a/calendar/cal-client/cal-query.c b/calendar/cal-client/cal-query.c deleted file mode 100644 index 7f29952f04..0000000000 --- a/calendar/cal-client/cal-query.c +++ /dev/null @@ -1,371 +0,0 @@ -/* Evolution calendar - Live query client object - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-exception.h> -#include "cal-util/cal-util-marshal.h" -#include "cal-query.h" -#include "query-listener.h" - - - -/* Private part of the CalQuery structure */ -struct _CalQueryPrivate { - /* Our query listener implementation */ - QueryListener *ql; - - /* Handle to the query in the server */ - GNOME_Evolution_Calendar_Query corba_query; -}; - - - -static void cal_query_class_init (CalQueryClass *klass); -static void cal_query_init (CalQuery *query, CalQueryClass *klass); -static void cal_query_finalize (GObject *object); - -/* Signal IDs */ -enum { - OBJ_UPDATED, - OBJ_REMOVED, - QUERY_DONE, - EVAL_ERROR, - LAST_SIGNAL -}; - -static guint query_signals[LAST_SIGNAL]; - -static GObjectClass *parent_class; - - - -/** - * cal_query_get_type: - * - * Registers the #CalQuery class if necessary, and returns the type ID assigned - * to it. - * - * Return value: The type ID of the #CalQuery class. - **/ -GType -cal_query_get_type (void) -{ - static GType cal_query_type = 0; - - if (!cal_query_type) { - static GTypeInfo info = { - sizeof (CalQueryClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_query_class_init, - NULL, NULL, - sizeof (CalQuery), - 0, - (GInstanceInitFunc) cal_query_init - }; - cal_query_type = g_type_register_static (G_TYPE_OBJECT, "CalQuery", &info, 0); - } - - return cal_query_type; -} - -/* Class initialization function for the calendar query */ -static void -cal_query_class_init (CalQueryClass *klass) -{ - GObjectClass *object_class; - - object_class = (GObjectClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - query_signals[OBJ_UPDATED] = - g_signal_new ("obj_updated", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalQueryClass, obj_updated), - NULL, NULL, - cal_util_marshal_VOID__STRING_BOOLEAN_INT_INT, - G_TYPE_NONE, 4, - G_TYPE_STRING, - G_TYPE_BOOLEAN, - G_TYPE_INT, - G_TYPE_INT); - query_signals[OBJ_REMOVED] = - g_signal_new ("obj_removed", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalQueryClass, obj_removed), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); - query_signals[QUERY_DONE] = - g_signal_new ("query_done", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalQueryClass, query_done), - NULL, NULL, - cal_util_marshal_VOID__ENUM_STRING, - G_TYPE_NONE, 2, - G_TYPE_ENUM, - G_TYPE_STRING); - query_signals[EVAL_ERROR] = - g_signal_new ("eval_error", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (CalQueryClass, eval_error), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); - - klass->obj_updated = NULL; - klass->obj_removed = NULL; - klass->query_done = NULL; - klass->eval_error = NULL; - - object_class->finalize = cal_query_finalize; -} - -/* Object initialization function for the calendar query */ -static void -cal_query_init (CalQuery *query, CalQueryClass *klass) -{ - CalQueryPrivate *priv; - - priv = g_new0 (CalQueryPrivate, 1); - query->priv = priv; - - priv->ql = NULL; - priv->corba_query = CORBA_OBJECT_NIL; -} - -/* Finalize handler for the calendar query */ -static void -cal_query_finalize (GObject *object) -{ - CalQuery *query; - CalQueryPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_QUERY (object)); - - query = CAL_QUERY (object); - priv = query->priv; - - /* The server keeps a copy of the query listener, so we must unref it */ - query_listener_stop_notification (priv->ql); - bonobo_object_unref (BONOBO_OBJECT (priv->ql)); - priv->ql = NULL; - - if (priv->corba_query != CORBA_OBJECT_NIL) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - bonobo_object_release_unref (priv->corba_query, &ev); - - if (BONOBO_EX (&ev)) - g_message ("cal_query_destroy(): Could not release/unref the query"); - - CORBA_exception_free (&ev); - priv->corba_query = CORBA_OBJECT_NIL; - } - - g_free (priv); - query->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - - -/* Callback used when an object is updated in the query */ -static void -obj_updated_cb (QueryListener *ql, - const GNOME_Evolution_Calendar_CalObjUIDSeq *uids, - CORBA_boolean query_in_progress, - CORBA_long n_scanned, - CORBA_long total, - gpointer data) -{ - CalQuery *query; - int n; - - query = CAL_QUERY (data); - - for (n = 0; n < uids->_length; n++) { - g_signal_emit (G_OBJECT (query), query_signals[OBJ_UPDATED], 0, - uids->_buffer[n], query_in_progress, - (int) n_scanned, (int) total); - } -} - -/* Callback used when an object is removed from the query */ -static void -obj_removed_cb (QueryListener *ql, - const GNOME_Evolution_Calendar_CalObjUID uid, - gpointer data) -{ - CalQuery *query; - - query = CAL_QUERY (data); - - g_signal_emit (G_OBJECT (query), query_signals[OBJ_REMOVED], - 0, uid); -} - -/* Callback used when the query terminates */ -static void -query_done_cb (QueryListener *ql, - GNOME_Evolution_Calendar_QueryListener_QueryDoneStatus corba_status, - const CORBA_char *error_str, - gpointer data) -{ - CalQuery *query; - CalQueryDoneStatus status; - - query = CAL_QUERY (data); - - switch (corba_status) { - case GNOME_Evolution_Calendar_QueryListener_SUCCESS: - status = CAL_QUERY_DONE_SUCCESS; - break; - - case GNOME_Evolution_Calendar_QueryListener_PARSE_ERROR: - status = CAL_QUERY_DONE_PARSE_ERROR; - break; - - default: - g_assert_not_reached (); - return; - } - - g_signal_emit (G_OBJECT (query), query_signals[QUERY_DONE], 0, - status, error_str); -} - -/* Callback used when an error occurs when evaluating the query */ -static void -eval_error_cb (QueryListener *ql, - const CORBA_char *error_str, - gpointer data) -{ - CalQuery *query; - - query = CAL_QUERY (data); - - g_signal_emit (G_OBJECT (query), query_signals[EVAL_ERROR], 0, - error_str); -} - -/** - * cal_query_construct: - * @query: A calendar query. - * @cal: Handle to an open calendar. - * @sexp: S-expression that defines the query. - * - * Constructs a query object by issuing the query creation request to the - * calendar server. - * - * Return value: The same value as @query on success, or NULL if the request - * failed. - **/ -CalQuery * -cal_query_construct (CalQuery *query, - GNOME_Evolution_Calendar_Cal cal, - const char *sexp) -{ - CalQueryPrivate *priv; - GNOME_Evolution_Calendar_QueryListener corba_ql; - CORBA_Environment ev; - - g_return_val_if_fail (query != NULL, NULL); - g_return_val_if_fail (IS_CAL_QUERY (query), NULL); - g_return_val_if_fail (sexp != NULL, NULL); - - priv = query->priv; - - priv->ql = query_listener_new (obj_updated_cb, - obj_removed_cb, - query_done_cb, - eval_error_cb, - query); - if (!priv->ql) { - g_message ("cal_query_construct(): Could not create the query listener"); - return NULL; - } - - corba_ql = BONOBO_OBJREF (priv->ql); - - CORBA_exception_init (&ev); - priv->corba_query = GNOME_Evolution_Calendar_Cal_getQuery (cal, sexp, corba_ql, &ev); - - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_CouldNotCreate)) { - g_message ("cal_query_construct(): The server could not create the query"); - goto error; - } else if (BONOBO_EX (&ev)) { - g_message ("cal_query_construct(): Could not issue the getQuery() request"); - goto error; - } - - CORBA_exception_free (&ev); - - return query; - - error: - - CORBA_exception_free (&ev); - - bonobo_object_unref (BONOBO_OBJECT (priv->ql)); - priv->ql = NULL; - priv->corba_query = CORBA_OBJECT_NIL; - return NULL; -} - -/** - * cal_query_new: - * @cal: Handle to an open calendar. - * @sexp: S-expression that defines the query. - * - * Creates a new query object by issuing the query creation request to the - * calendar server. - * - * Return value: A newly-created query object, or NULL if the request failed. - **/ -CalQuery * -cal_query_new (GNOME_Evolution_Calendar_Cal cal, - const char *sexp) -{ - CalQuery *query; - - query = g_object_new (CAL_QUERY_TYPE, NULL); - - if (!cal_query_construct (query, cal, sexp)) { - g_object_unref (G_OBJECT (query)); - return NULL; - } - - return query; -} diff --git a/calendar/cal-client/cal-query.h b/calendar/cal-client/cal-query.h deleted file mode 100644 index b75836cd96..0000000000 --- a/calendar/cal-client/cal-query.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Evolution calendar - Live query client object - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_QUERY_H -#define CAL_QUERY_H - -#include <glib-object.h> - -#include "evolution-calendar.h" - -G_BEGIN_DECLS - - - -#define CAL_QUERY_TYPE (cal_query_get_type ()) -#define CAL_QUERY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_QUERY_TYPE, CalQuery)) -#define CAL_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_QUERY_TYPE, CalQueryClass)) -#define IS_CAL_QUERY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_QUERY_TYPE)) -#define IS_CAL_QUERY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_QUERY_TYPE)) - -/* Status values when a query terminates */ -typedef enum { - CAL_QUERY_DONE_SUCCESS, - CAL_QUERY_DONE_PARSE_ERROR -} CalQueryDoneStatus; - -typedef struct _CalQueryPrivate CalQueryPrivate; - -typedef struct { - GObject object; - - /* Private data */ - CalQueryPrivate *priv; -} CalQuery; - -typedef struct { - GObjectClass parent_class; - - /* Notification signals */ - - void (* obj_updated) (CalQuery *query, const char *uid, - gboolean query_in_progress, int n_scanned, int total); - void (* obj_removed) (CalQuery *query, const char *uid); - - void (* query_done) (CalQuery *query, CalQueryDoneStatus status, const char *error_str); - - void (* eval_error) (CalQuery *query, const char *error_str); -} CalQueryClass; - -GType cal_query_get_type (void); - -CalQuery *cal_query_construct (CalQuery *query, - GNOME_Evolution_Calendar_Cal cal, - const char *sexp); - -CalQuery *cal_query_new (GNOME_Evolution_Calendar_Cal cal, - const char *sexp); - - - -G_END_DECLS - -#endif diff --git a/calendar/cal-client/client-test.c b/calendar/cal-client/client-test.c deleted file mode 100644 index 4a649e0428..0000000000 --- a/calendar/cal-client/client-test.c +++ /dev/null @@ -1,238 +0,0 @@ -/* Evolution calendar client - test program - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <stdlib.h> -#include <gtk/gtkmain.h> -#include <gtk/gtksignal.h> -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-init.h> -#include <bonobo-activation/bonobo-activation.h> -#include <bonobo/bonobo-main.h> -#include "cal-client.h" -#include "cal-util/cal-component.h" - -static CalClient *client1; -static CalClient *client2; - -/* Prints a message with a client identifier */ -static void -cl_printf (CalClient *client, const char *format, ...) -{ - va_list args; - - va_start (args, format); - printf ("Client %s: ", - client == client1 ? "1" : - client == client2 ? "2" : - "UNKNOWN"); - vprintf (format, args); - va_end (args); -} - -/* Dumps some interesting data from a component */ -static void -dump_component (CalComponent *comp) -{ - const char *uid; - CalComponentText summary; - - cal_component_get_uid (comp, &uid); - - printf ("UID %s\n", uid); - - cal_component_get_summary (comp, &summary); - if (summary.value) - printf ("\tSummary: `%s', altrep `%s'\n", - summary.value, - summary.altrep ? summary.altrep : "NONE"); - else - printf ("\tNo summary\n"); -} - -/* Lists the UIDs of objects in a calendar, called as an idle handler */ -static gboolean -list_uids (gpointer data) -{ - CalClient *client; - GList *uids; - GList *l; - - client = CAL_CLIENT (data); - - uids = cal_client_get_uids (client, CALOBJ_TYPE_ANY); - - cl_printf (client, "UIDs: "); - - if (!uids) - printf ("none\n"); - else { - for (l = uids; l; l = l->next) { - char *uid; - - uid = l->data; - printf ("`%s' ", uid); - } - - printf ("\n"); - - for (l = uids; l; l = l->next) { - char *uid; - CalComponent *comp; - CalClientGetStatus status; - - uid = l->data; - status = cal_client_get_object (client, uid, &comp); - - if (status == CAL_CLIENT_GET_SUCCESS) { - printf ("------------------------------\n"); - dump_component (comp); - printf ("------------------------------\n"); - gtk_object_unref (GTK_OBJECT (comp)); - } else { - printf ("FAILED: %d\n", status); - } - } - } - - cal_obj_uid_list_free (uids); - - gtk_object_unref (GTK_OBJECT (client)); - - return FALSE; -} - -/* Callback used when a calendar is opened */ -static void -cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) -{ - cl_printf (client, "Load/create %s\n", - ((status == CAL_CLIENT_OPEN_SUCCESS) ? "success" : - (status == CAL_CLIENT_OPEN_ERROR) ? "error" : - (status == CAL_CLIENT_OPEN_NOT_FOUND) ? "not found" : - (status == CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED) ? "method not supported" : - "unknown status value")); - - if (status == CAL_CLIENT_OPEN_SUCCESS) { - GList *comp_list; - - /* get free/busy information */ - comp_list = cal_client_get_free_busy (client, NULL, 0, time (NULL)); - if (comp_list) { - GList *l; - - for (l = comp_list; l; l = l->next) { - char *comp_str; - - comp_str = cal_component_get_as_string (CAL_COMPONENT (l->data)); - gtk_object_unref (GTK_OBJECT (l->data)); - cl_printf (client, "Free/Busy -> %s\n", comp_str); - g_free (comp_str); - } - g_list_free (comp_list); - } - - g_idle_add (list_uids, client); - } - else - gtk_object_unref (GTK_OBJECT (client)); -} - -/* Callback used when an object is updated */ -static void -obj_updated_cb (CalClient *client, const char *uid, gpointer data) -{ - cl_printf (client, "Object updated: %s\n", uid); -} - -/* Callback used when a client is destroyed */ -static void -client_destroy_cb (GtkObject *object, gpointer data) -{ - if (CAL_CLIENT (object) == client1) - client1 = NULL; - else if (CAL_CLIENT (object) == client2) - client2 = NULL; - else - g_assert_not_reached (); - - if (!client1 && !client2) - gtk_main_quit (); -} - -/* Creates a calendar client and tries to load the specified URI into it */ -static void -create_client (CalClient **client, const char *uri, gboolean only_if_exists) -{ - gboolean result; - - *client = cal_client_new (); - if (!*client) { - g_message ("create_client(): could not create the client"); - exit (1); - } - - gtk_signal_connect (GTK_OBJECT (*client), "destroy", - client_destroy_cb, - NULL); - - gtk_signal_connect (GTK_OBJECT (*client), "cal_opened", - GTK_SIGNAL_FUNC (cal_opened_cb), - NULL); - gtk_signal_connect (GTK_OBJECT (*client), "obj_updated", - GTK_SIGNAL_FUNC (obj_updated_cb), - NULL); - - printf ("Calendar loading `%s'...\n", uri); - - result = cal_client_open_calendar (*client, uri, only_if_exists); - - if (!result) { - g_message ("create_client(): failure when issuing calendar open request `%s'", - uri); - exit (1); - } -} - -int -main (int argc, char **argv) -{ - char *dir; - - bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE); - - gnome_program_init ("tl-test", VERSION, LIBGNOME_MODULE, argc, argv, NULL); - bonobo_activation_init (argc, argv); - - if (!bonobo_init (&argc, argv)) { - g_message ("main(): could not initialize Bonobo"); - exit (1); - } - - dir = g_strdup_printf ("%s/evolution/local/Calendar/calendar.ics", g_get_home_dir ()); - create_client (&client1, dir, FALSE); - g_free (dir); - create_client (&client2, "/cvs/evolution/calendar/cal-client/test.ics", TRUE); - - bonobo_main (); - return 0; -} diff --git a/calendar/cal-client/query-listener.c b/calendar/cal-client/query-listener.c deleted file mode 100644 index 6f090717d7..0000000000 --- a/calendar/cal-client/query-listener.c +++ /dev/null @@ -1,321 +0,0 @@ -/* Evolution calendar - Live search query listener convenience object - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "query-listener.h" - - - -/* Private part of the QueryListener structure */ - -struct _QueryListenerPrivate { - /* Callbacks for notification and their closure data */ - QueryListenerObjUpdatedFn obj_updated_fn; - QueryListenerObjRemovedFn obj_removed_fn; - QueryListenerQueryDoneFn query_done_fn; - QueryListenerEvalErrorFn eval_error_fn; - gpointer fn_data; - - /* Whether notification is desired */ - gboolean notify : 1; -}; - - - -static void query_listener_class_init (QueryListenerClass *class); -static void query_listener_init (QueryListener *ql); -static void query_listener_destroy (GtkObject *object); - -static void impl_notifyObjUpdated (PortableServer_Servant servant, - const GNOME_Evolution_Calendar_CalObjUIDSeq *uids, - CORBA_boolean query_in_progress, - CORBA_long n_scanned, - CORBA_long total, - CORBA_Environment *ev); - -static void impl_notifyObjRemoved (PortableServer_Servant servant, - const CORBA_char *uid, - CORBA_Environment *ev); - -static void impl_notifyQueryDone (PortableServer_Servant servant, - GNOME_Evolution_Calendar_QueryListener_QueryDoneStatus corba_status, - const CORBA_char *error_str, - CORBA_Environment *ev); - -static void impl_notifyEvalError (PortableServer_Servant servant, - const CORBA_char *error_str, - CORBA_Environment *ev); - -static BonoboXObjectClass *parent_class; - - - -BONOBO_X_TYPE_FUNC_FULL (QueryListener, - GNOME_Evolution_Calendar_QueryListener, - BONOBO_X_OBJECT_TYPE, - query_listener); - -/* Class initialization function for the live search query listener */ -static void -query_listener_class_init (QueryListenerClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (BONOBO_X_OBJECT_TYPE); - - object_class->destroy = query_listener_destroy; - - class->epv.notifyObjUpdated = impl_notifyObjUpdated; - class->epv.notifyObjRemoved = impl_notifyObjRemoved; - class->epv.notifyQueryDone = impl_notifyQueryDone; - class->epv.notifyEvalError = impl_notifyEvalError; -} - -/* Object initialization function for the live search query listener */ -static void -query_listener_init (QueryListener *ql) -{ - QueryListenerPrivate *priv; - - priv = g_new0 (QueryListenerPrivate, 1); - ql->priv = priv; - - priv->obj_updated_fn = NULL; - priv->obj_removed_fn = NULL; - priv->query_done_fn = NULL; - priv->eval_error_fn = NULL; - priv->fn_data = NULL; - - priv->notify = TRUE; -} - -/* Destroy handler for the live search query listener */ -static void -query_listener_destroy (GtkObject *object) -{ - QueryListener *ql; - QueryListenerPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_QUERY_LISTENER (object)); - - ql = QUERY_LISTENER (object); - priv = ql->priv; - - priv->obj_updated_fn = NULL; - priv->obj_removed_fn = NULL; - priv->query_done_fn = NULL; - priv->eval_error_fn = NULL; - priv->fn_data = NULL; - - priv->notify = FALSE; - - g_free (priv); - ql->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* CORBA method implementations */ - -/* ::notifyObjUpdated() method */ -static void -impl_notifyObjUpdated (PortableServer_Servant servant, - const GNOME_Evolution_Calendar_CalObjUIDSeq *uids, - CORBA_boolean query_in_progress, - CORBA_long n_scanned, - CORBA_long total, - CORBA_Environment *ev) -{ - QueryListener *ql; - QueryListenerPrivate *priv; - - ql = QUERY_LISTENER (bonobo_object_from_servant (servant)); - priv = ql->priv; - - if (!priv->notify) - return; - - g_assert (priv->obj_updated_fn != NULL); - (* priv->obj_updated_fn) (ql, uids, query_in_progress, n_scanned, total, priv->fn_data); -} - -/* ::notifyObjRemoved() method */ -static void -impl_notifyObjRemoved (PortableServer_Servant servant, - const CORBA_char *uid, - CORBA_Environment *ev) -{ - QueryListener *ql; - QueryListenerPrivate *priv; - - ql = QUERY_LISTENER (bonobo_object_from_servant (servant)); - priv = ql->priv; - - if (!priv->notify) - return; - - g_assert (priv->obj_removed_fn != NULL); - (* priv->obj_removed_fn) (ql, uid, priv->fn_data); -} - -/* ::notifyQueryDone() method */ -static void -impl_notifyQueryDone (PortableServer_Servant servant, - GNOME_Evolution_Calendar_QueryListener_QueryDoneStatus corba_status, - const CORBA_char *error_str, - CORBA_Environment *ev) -{ - QueryListener *ql; - QueryListenerPrivate *priv; - - ql = QUERY_LISTENER (bonobo_object_from_servant (servant)); - priv = ql->priv; - - if (!priv->notify) - return; - - g_assert (priv->query_done_fn != NULL); - (* priv->query_done_fn) (ql, corba_status, error_str, priv->fn_data); -} - -/* ::notifyEvalError() method */ -static void -impl_notifyEvalError (PortableServer_Servant servant, - const CORBA_char *error_str, - CORBA_Environment *ev) -{ - QueryListener *ql; - QueryListenerPrivate *priv; - - ql = QUERY_LISTENER (bonobo_object_from_servant (servant)); - priv = ql->priv; - - if (!priv->notify) - return; - - g_assert (priv->eval_error_fn != NULL); - (* priv->eval_error_fn) (ql, error_str, priv->fn_data); -} - - - -/** - * query_listener_construct: - * @ql: A query listener. - * @obj_updated_fn: Callback to use when a component is updated in the query. - * @obj_removed_fn: Callback to use when a component is removed from the query. - * @query_done_fn: Callback to use when a query is done. - * @eval_error_fn: Callback to use when an evaluation error happens during a query. - * @fn_data: Closure data to pass to the callbacks. - * - * Constructs a query listener by setting the callbacks it will use for - * notification from the calendar server. - * - * Return value: The same value as @ql. - **/ -QueryListener * -query_listener_construct (QueryListener *ql, - QueryListenerObjUpdatedFn obj_updated_fn, - QueryListenerObjRemovedFn obj_removed_fn, - QueryListenerQueryDoneFn query_done_fn, - QueryListenerEvalErrorFn eval_error_fn, - gpointer fn_data) -{ - QueryListenerPrivate *priv; - - g_return_val_if_fail (ql != NULL, NULL); - g_return_val_if_fail (IS_QUERY_LISTENER (ql), NULL); - g_return_val_if_fail (obj_updated_fn != NULL, NULL); - g_return_val_if_fail (obj_removed_fn != NULL, NULL); - g_return_val_if_fail (query_done_fn != NULL, NULL); - g_return_val_if_fail (eval_error_fn != NULL, NULL); - - priv = ql->priv; - - priv->obj_updated_fn = obj_updated_fn; - priv->obj_removed_fn = obj_removed_fn; - priv->query_done_fn = query_done_fn; - priv->eval_error_fn = eval_error_fn; - priv->fn_data = fn_data; - - return ql; -} - -/** - * query_listener_new: - * @obj_updated_fn: Callback to use when a component is updated in the query. - * @obj_removed_fn: Callback to use when a component is removed from the query. - * @query_done_fn: Callback to use when a query is done. - * @eval_error_fn: Callback to use when an evaluation error happens during a query. - * @fn_data: Closure data to pass to the callbacks. - * - * Creates a new query listener object. - * - * Return value: A newly-created query listener object. - **/ -QueryListener * -query_listener_new (QueryListenerObjUpdatedFn obj_updated_fn, - QueryListenerObjRemovedFn obj_removed_fn, - QueryListenerQueryDoneFn query_done_fn, - QueryListenerEvalErrorFn eval_error_fn, - gpointer fn_data) -{ - QueryListener *ql; - - ql = gtk_type_new (QUERY_LISTENER_TYPE); - - return query_listener_construct (ql, - obj_updated_fn, - obj_removed_fn, - query_done_fn, - eval_error_fn, - fn_data); -} - -/** - * query_listener_stop_notification: - * @ql: A query listener. - * - * Informs a query listener that no further notification is desired. The - * callbacks specified when the listener was created will no longer be invoked - * after this function is called. - **/ -void -query_listener_stop_notification (QueryListener *ql) -{ - QueryListenerPrivate *priv; - - g_return_if_fail (ql != NULL); - g_return_if_fail (IS_QUERY_LISTENER (ql)); - - priv = ql->priv; - g_return_if_fail (priv->notify != FALSE); - - priv->notify = FALSE; -} diff --git a/calendar/cal-client/query-listener.h b/calendar/cal-client/query-listener.h deleted file mode 100644 index ab59345cf4..0000000000 --- a/calendar/cal-client/query-listener.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Evolution calendar - Live search query listener implementation - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef QUERY_LISTENER_H -#define QUERY_LISTENER_H - -#include <gtk/gtkobject.h> -#include <bonobo/bonobo-xobject.h> -#include "evolution-calendar.h" - -G_BEGIN_DECLS - - - -#define QUERY_LISTENER_TYPE (query_listener_get_type ()) -#define QUERY_LISTENER(obj) (GTK_CHECK_CAST ((obj), QUERY_LISTENER_TYPE, QueryListener)) -#define QUERY_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), QUERY_LISTENER_TYPE, \ - QueryListenerClass)) -#define IS_QUERY_LISTENER(obj) (GTK_CHECK_TYPE ((obj), QUERY_LISTENER_TYPE)) -#define IS_QUERY_LISTENER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), QUERY_LISTENER_TYPE)) - -typedef struct _QueryListenerPrivate QueryListenerPrivate; - -typedef struct { - BonoboXObject xobject; - - /* Private data */ - QueryListenerPrivate *priv; -} QueryListener; - -typedef struct { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_Calendar_QueryListener__epv epv; -} QueryListenerClass; - -/* Notification functions */ - -typedef void (* QueryListenerObjUpdatedFn) (QueryListener *ql, - const GNOME_Evolution_Calendar_CalObjUIDSeq *uids, - CORBA_boolean query_in_progress, - CORBA_long n_scanned, - CORBA_long total, - gpointer data); - -typedef void (* QueryListenerObjRemovedFn) (QueryListener *ql, - const CORBA_char *uid, - gpointer data); - -typedef void (* QueryListenerQueryDoneFn) ( - QueryListener *ql, - GNOME_Evolution_Calendar_QueryListener_QueryDoneStatus status, - const CORBA_char *error_str, - gpointer data); - -typedef void (* QueryListenerEvalErrorFn) (QueryListener *ql, - const CORBA_char *error_str, - gpointer data); - -GtkType query_listener_get_type (void); - -QueryListener *query_listener_construct (QueryListener *ql, - QueryListenerObjUpdatedFn obj_updated_fn, - QueryListenerObjRemovedFn obj_removed_fn, - QueryListenerQueryDoneFn query_done_fn, - QueryListenerEvalErrorFn eval_error_fn, - gpointer fn_data); - -QueryListener *query_listener_new (QueryListenerObjUpdatedFn obj_updated_fn, - QueryListenerObjRemovedFn obj_removed_fn, - QueryListenerQueryDoneFn query_done_fn, - QueryListenerEvalErrorFn eval_error_fn, - gpointer fn_data); - -void query_listener_stop_notification (QueryListener *ql); - - - -G_END_DECLS - -#endif diff --git a/calendar/cal-client/test.ics b/calendar/cal-client/test.ics deleted file mode 100644 index 128251ee11..0000000000 --- a/calendar/cal-client/test.ics +++ /dev/null @@ -1,318 +0,0 @@ -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//hacksw/handcal//NONSGML v1.0//EN - -BEGIN:VEVENT -DTSTART:19970714T170000Z -DTEND:19970715T035959Z -SUMMARY:Bastille Day Party -END:VEVENT - -BEGIN:VEVENT -UID:19970901T130000Z-123401@host.com -DTSTAMP:19970901T1300Z -DTSTART:19970903T163000Z -DTEND:19970903T190000Z -SUMMARY:Annual Employee Review -CLASS:PRIVATE -CATEGORIES:BUSINESS,HUMAN RESOURCES -END:VEVENT - -BEGIN:VEVENT -UID:19970901T130000Z-123402@host.com -DTSTAMP:19970901T1300Z -DTSTART:19970401T163000Z -DTEND:19970402T010000Z -SUMMARY:Laurel is in sensitivity awareness class. -CLASS:PUBLIC -CATEGORIES:BUSINESS,HUMAN RESOURCES -TRANSP:TRANSPARENT -END:VEVENT - -BEGIN:VEVENT -UID:19970901T130000Z-123403@host.com -DTSTAMP:19970901T1300Z -DTSTART:19971102 -SUMMARY:Our Blissful Anniversary -CLASS:CONFIDENTIAL -CATEGORIES:ANNIVERSARY,PERSONAL,SPECIAL OCCASION -RRULE:FREQ=YEARLY -END:VEVENT - -BEGIN:VTODO -UID:19970901T130000Z-123404@host.com -DTSTAMP:19970901T1300Z -DTSTART:19970415T133000Z -DUE:19970416T045959Z -SUMMARY:1996 Income Tax Preparation -CLASS:CONFIDENTIAL -CATEGORIES:FAMILY,FINANCE -PRIORITY:1 -STATUS:NEEDS-ACTION -END:VTODO - -BEGIN:VJOURNAL -UID:19970901T130000Z-123405@host.com -DTSTAMP:19970901T1300Z -DTSTART;VALUE=DATE:19970317 -SUMMARY:Staff meeting minutes -DESCRIPTION:1. Staff meeting: Participants include Joe\, Lisa - and Bob. Aurora project plans were reviewed. There is currently - no budget reserves for this project. Lisa will escalate to - management. Next meeting on Tuesday.\n - 2. Telephone Conference: ABC Corp. sales representative called - to discuss new printer. Promised to get us a demo by Friday.\n - 3. Henry Miller (Handsoff Insurance): Car was totaled by tree. - Is looking into a loaner car. 654-2323 (tel). -END:VJOURNAL - -BEGIN:VFREEBUSY -ORGANIZER:MAILTO:jane_doe@host1.com -ATTENDEE:MAILTO:john_public@host2.com -DTSTART:19971015T050000Z -DTEND:19971016T050000Z -DTSTAMP:19970901T083000Z -END:VFREEBUSY - -BEGIN:VFREEBUSY -ORGANIZER:MAILTO:jane_doe@host1.com -ATTENDEE:MAILTO:john_public@host2.com -DTSTAMP:19970901T100000Z -FREEBUSY;VALUE=PERIOD:19971015T050000Z/PT8H30M, - 19971015T160000Z/PT5H30M,19971015T223000Z/PT6H30M -URL:http://host2.com/pub/busy/jpublic-01.ifb -COMMENT:This iCalendar file contains busy time information for - the next three months. -END:VFREEBUSY - -BEGIN:VFREEBUSY -ORGANIZER:jsmith@host.com -DTSTART:19980313T141711Z -DTEND:19980410T141711Z -FREEBUSY:19980314T233000Z/19980315T003000Z -FREEBUSY:19980316T153000Z/19980316T163000Z -FREEBUSY:19980318T030000Z/19980318T040000Z -URL:http://www.host.com/calendar/busytime/jsmith.ifb -END:VFREEBUSY - -BEGIN:VTIMEZONE -TZID:US-Eastern -LAST-MODIFIED:19870101T000000Z -BEGIN:STANDARD -DTSTART:19971026T020000 -RDATE:19971026T020000 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19971026T020000 -RDATE:19970406T020000 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE - -BEGIN:VTIMEZONE -TZID:US-Eastern -LAST-MODIFIED:19870101T000000Z -TZURL:http://zones.stds_r_us.net/tz/US-Eastern -BEGIN:STANDARD -DTSTART:19671029T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19870405T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE - -BEGIN:VTIMEZONE -TZID:US--Fictitious-Eastern -LAST-MODIFIED:19870101T000000Z -BEGIN:STANDARD -DTSTART:19671029T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19870405T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4;UNTIL=19980404T070000Z -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE - -BEGIN:VTIMEZONE -TZID:US--Fictitious-Eastern -LAST-MODIFIED:19870101T000000Z -BEGIN:STANDARD -DTSTART:19671029T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19870405T020000 -RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4;UNTIL=19980404T070000Z -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -BEGIN:DAYLIGHT -DTSTART:19990424T020000 -RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=4 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE - -BEGIN:VALARM -TRIGGER;VALUE=DATE-TIME:19970317T133000Z -REPEAT:4 -DURATION:PT15M -ACTION:AUDIO -ATTACH;FMTTYPE=audio/basic:ftp://host.com/pub/sounds/bell-01.aud -END:VALARM -BEGIN:VALARM -TRIGGER:-PT30M -REPEAT:2 -DURATION:PT15M -ACTION:DISPLAY -DESCRIPTION:Breakfast meeting with executive\n - team at 8:30 AM EST. -END:VALARM - -BEGIN:VALARM -TRIGGER:-P2D -ACTION:EMAIL -ATTENDEE:MAILTO:john_doe@host.com -SUMMARY:*** REMINDER: SEND AGENDA FOR WEEKLY STAFF MEETING *** -DESCRIPTION:A draft agenda needs to be sent out to the attendees - to the weekly managers meeting (MGR-LIST). Attached is a - pointer the document template for the agenda file. -ATTACH;FMTTYPE=application/binary:http://host.com/templates/agen - da.doc -END:VALARM - -BEGIN:VALARM -TRIGGER;VALUE=DATE-TIME:19980101T050000Z -REPEAT:23 -DURATION:PT1H -ACTION:PROCEDURE -ATTACH;FMTTYPE=application/binary:ftp://host.com/novo- - procs/felizano.exe -END:VALARM - -BEGIN:VTIMEZONE -TZID:US-Eastern -BEGIN:STANDARD -DTSTART:19981025T020000 -RDATE:19981025T020000 -TZOFFSETFROM:-0400 -TZOFFSETTO:-0500 -TZNAME:EST -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:19990404T020000 -RDATE:19990404T020000 -TZOFFSETFROM:-0500 -TZOFFSETTO:-0400 -TZNAME:EDT -END:DAYLIGHT -END:VTIMEZONE - -BEGIN:VEVENT -DTSTAMP:19980309T231000Z -UID:guid-1.host1.com -ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com -ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP: - MAILTO:employee-A@host.com -DESCRIPTION:Project XYZ Review Meeting -CATEGORIES:MEETING -CLASS:PUBLIC -CREATED:19980309T130000Z -SUMMARY:XYZ Project Review -DTSTART;TZID=US-Eastern:19980312T083000 -DTEND;TZID=US-Eastern:19980312T093000 -LOCATION:1CP Conference Room 4350 -END:VEVENT - -BEGIN:VEVENT -DTSTAMP:19970324T1200Z -SEQUENCE:0 -UID:uid3@host1.com -ORGANIZER:MAILTO:jdoe@host1.com -DTSTART:19970324T123000Z -DTEND:19970324T210000Z -CATEGORIES:MEETING,PROJECT -CLASS:PUBLIC -SUMMARY:Calendaring Interoperability Planning Meeting -DESCRIPTION:Discuss how we can test c&s interoperability\n - using iCalendar and other IETF standards. -LOCATION:LDB Lobby -ATTACH;FMTTYPE=application/postscript:ftp://xyzCorp.com/pub/ - conf/bkgrnd.ps -END:VEVENT - -BEGIN:VTODO -DTSTAMP:19980130T134500Z -SEQUENCE:2 -UID:uid4@host1.com -ORGANIZER:MAILTO:unclesam@us.gov -ATTENDEE;PARTSTAT=ACCEPTED:MAILTO:jqpublic@host.com -DUE:19980415T235959 -STATUS:NEEDS-ACTION -SUMMARY:Submit Income Taxes -BEGIN:VALARM -ACTION:AUDIO -TRIGGER:19980403T120000 -ATTACH;FMTTYPE=audio/basic:http://host.com/pub/audio- - files/ssbanner.aud -REPEAT:4 -DURATION:PT1H -END:VALARM -END:VTODO - -BEGIN:VJOURNAL -DTSTAMP:19970324T120000Z -UID:uid5@host1.com -ORGANIZER:MAILTO:jsmith@host.com -STATUS:DRAFT -CLASS:PUBLIC -CATEGORIES:Project Report, XYZ, Weekly Meeting -DESCRIPTION:Project xyz Review Meeting Minutes\n - Agenda\n1. Review of project version 1.0 requirements.\n2. - Definition - of project processes.\n3. Review of project schedule.\n - Participants: John Smith\, Jane Doe\, Jim Dandy\n-It was - decided that the requirements need to be signed off by - product marketing.\n-Project processes were accepted.\n - -Project schedule needs to account for scheduled holidays - and employee vacation time. Check with HR for specific - dates.\n-New schedule will be distributed by Friday.\n- - Next weeks meeting is cancelled. No meeting until 3/23. -END:VJOURNAL - -BEGIN:VFREEBUSY -ORGANIZER:MAILTO:jsmith@host.com -DTSTART:19980313T141711Z -DTEND:19980410T141711Z -FREEBUSY:19980314T233000Z/19980315T003000Z -FREEBUSY:19980316T153000Z/19980316T163000Z -FREEBUSY:19980318T030000Z/19980318T040000Z -URL:http://www.host.com/calendar/busytime/jsmith.ifb -END:VFREEBUSY -END:VCALENDAR diff --git a/calendar/cal-util/.cvsignore b/calendar/cal-util/.cvsignore deleted file mode 100644 index fdcaeeafc5..0000000000 --- a/calendar/cal-util/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -.libs -Makefile.in -Makefile -.deps -*.lo -*.la -test-recur -cal-util-marshal.c -cal-util-marshal.h diff --git a/calendar/cal-util/Makefile.am b/calendar/cal-util/Makefile.am deleted file mode 100644 index f54316e258..0000000000 --- a/calendar/cal-util/Makefile.am +++ /dev/null @@ -1,68 +0,0 @@ -noinst_PROGRAMS = test-recur - -INCLUDES = \ - -DGNOMELOCALEDIR=\""$(localedir)"\" \ - -DG_LOG_DOMAIN=\"cal-util\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/calendar \ - -I. \ - -I.. \ - -I$(top_builddir) \ - -I$(top_srcdir)/libical/src/libical \ - -I$(top_builddir)/libical/src/libical \ - $(EVOLUTION_CALENDAR_CFLAGS) - -# -# cal util library -# - -lib_LTLIBRARIES = libcal-util.la -privlib_LTLIBRARIES = libcal-util-static.la - -libcal_util_la_SOURCES = \ - cal-util-marshal.c \ - cal-util-marshal.h \ - cal-component.c \ - cal-recur.c \ - cal-util.c \ - timeutil.c - -libcal_utilincludedir = $(includedir)/evolution/cal-util - -libcal_utilinclude_HEADERS = \ - cal-component.h \ - cal-recur.h \ - cal-util.h \ - timeutil.h - -# GLib marshalling cruft - -cal-util-marshal.h: cal-util-marshal.list - ( @GLIB_GENMARSHAL@ --prefix=cal_util_marshal cal-util-marshal.list --header > cal-util-marshal.tmp \ - && mv cal-util-marshal.tmp cal-util-marshal.h ) \ - || ( rm -f cal-util-marshal.tmp && exit 1 ) - -cal-util-marshal.c: cal-util-marshal.h - ( @GLIB_GENMARSHAL@ --prefix=cal_util_marshal cal-util-marshal.list --body > cal-util-marshal.tmp \ - && mv cal-util-marshal.tmp cal-util-marshal.c ) \ - || ( rm -f cal-util-marshal.tmp && exit 1 ) - -MARSHAL_GENERATED = cal-util-marshal.c cal-util-marshal.h - -BUILT_SOURCES = $(MARSHAL_GENERATED) - -# -# static library for use in conduits' shared libraries -# -#lib_LTLIBRARIES = libcal-util-static.la -libcal_util_static_la_SOURCES = $(libcal_util_la_SOURCES) -libcal_util_static_la_LDFLAGS = -all-static - -test_recur_SOURCES = \ - test-recur.c - -test_recur_LDADD = \ - libcal-util.la \ - $(top_builddir)/libversit/libversit.a \ - $(top_builddir)/libical/src/libical/libical-evolution.la \ - $(EVOLUTION_CALENDAR_LIBS) diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c deleted file mode 100644 index 50c2ad95d8..0000000000 --- a/calendar/cal-util/cal-component.c +++ /dev/null @@ -1,5425 +0,0 @@ -/* Evolution calendar - iCalendar component object - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <glib.h> -#include <libgnome/gnome-i18n.h> -#include "cal-component.h" -#include "timeutil.h" - - - -/* Extension property for alarm components so that we can reference them by UID */ -#define EVOLUTION_ALARM_UID_PROPERTY "X-EVOLUTION-ALARM-UID" - -/* Private part of the CalComponent structure */ -struct _CalComponentPrivate { - /* The icalcomponent we wrap */ - icalcomponent *icalcomp; - - /* Properties */ - - icalproperty *uid; - - icalproperty *status; - - struct attendee { - icalproperty *prop; - icalparameter *cutype_param; - icalparameter *member_param; - icalparameter *role_param; - icalparameter *partstat_param; - icalparameter *rsvp_param; - icalparameter *delto_param; - icalparameter *delfrom_param; - icalparameter *sentby_param; - icalparameter *cn_param; - icalparameter *language_param; - }; - - GSList *attendee_list; - - icalproperty *categories; - - icalproperty *classification; - - struct text { - icalproperty *prop; - icalparameter *altrep_param; - }; - - GSList *comment_list; /* list of struct text */ - - icalproperty *completed; - - GSList *contact_list; /* list of struct text */ - - icalproperty *created; - - GSList *description_list; /* list of struct text */ - - struct datetime { - icalproperty *prop; - icalparameter *tzid_param; - }; - - struct datetime dtstart; - struct datetime dtend; - - icalproperty *dtstamp; - - /* The DURATION property can be used instead of the VEVENT DTEND or - the VTODO DUE dates. We do not use it directly ourselves, but we - must be able to handle it from incoming data. If a DTEND or DUE - is requested, we convert the DURATION if necessary. If DTEND or - DUE is set, we remove any DURATION. */ - icalproperty *duration; - - struct datetime due; - - GSList *exdate_list; /* list of struct datetime */ - GSList *exrule_list; /* list of icalproperty objects */ - - struct organizer { - icalproperty *prop; - icalparameter *sentby_param; - icalparameter *cn_param; - icalparameter *language_param; - }; - - struct organizer organizer; - - icalproperty *geo; - icalproperty *last_modified; - icalproperty *percent; - icalproperty *priority; - - struct period { - icalproperty *prop; - icalparameter *value_param; - }; - - struct recur_id { - struct datetime recur_time; - - icalparameter *range_param; - }; - - struct recur_id recur_id; - - GSList *rdate_list; /* list of struct period */ - - GSList *rrule_list; /* list of icalproperty objects */ - - icalproperty *sequence; - - struct { - icalproperty *prop; - icalparameter *altrep_param; - } summary; - - icalproperty *transparency; - icalproperty *url; - icalproperty *location; - - /* Subcomponents */ - - GHashTable *alarm_uid_hash; - - /* Whether we should increment the sequence number when piping the - * object over the wire. - */ - guint need_sequence_inc : 1; -}; - -/* Private structure for alarms */ -struct _CalComponentAlarm { - /* Alarm icalcomponent we wrap */ - icalcomponent *icalcomp; - - /* Our extension UID property */ - icalproperty *uid; - - /* Properties */ - - icalproperty *action; - icalproperty *attach; /* FIXME: see scan_alarm_property() below */ - - struct { - icalproperty *prop; - icalparameter *altrep_param; - } description; - - icalproperty *duration; - icalproperty *repeat; - icalproperty *trigger; -}; - - - -static void cal_component_class_init (CalComponentClass *klass); -static void cal_component_init (CalComponent *comp, CalComponentClass *klass); -static void cal_component_finalize (GObject *object); - -static GObjectClass *parent_class; - - - -/** - * cal_component_get_type: - * - * Registers the #CalComponent class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalComponent class. - **/ -GType -cal_component_get_type (void) -{ - static GType cal_component_type = 0; - - if (!cal_component_type) { - static GTypeInfo info = { - sizeof (CalComponentClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) cal_component_class_init, - NULL, NULL, - sizeof (CalComponent), - 0, - (GInstanceInitFunc) cal_component_init - }; - cal_component_type = g_type_register_static (G_TYPE_OBJECT, "CalComponent", &info, 0); - } - - return cal_component_type; -} - -/* Class initialization function for the calendar component object */ -static void -cal_component_class_init (CalComponentClass *klass) -{ - GObjectClass *object_class; - - object_class = (GObjectClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - object_class->finalize = cal_component_finalize; -} - -/* Object initialization function for the calendar component object */ -static void -cal_component_init (CalComponent *comp, CalComponentClass *klass) -{ - CalComponentPrivate *priv; - - priv = g_new0 (CalComponentPrivate, 1); - comp->priv = priv; - - priv->alarm_uid_hash = g_hash_table_new (g_str_hash, g_str_equal); -} - -/* Does a simple g_free() of the elements of a GSList and then frees the list - * itself. Returns NULL. - */ -static GSList * -free_slist (GSList *slist) -{ - GSList *l; - - for (l = slist; l; l = l->next) - g_free (l->data); - - g_slist_free (slist); - return NULL; -} - -/* Used from g_hash_table_foreach_remove() to free the alarm UIDs hash table. - * We do not need to do anything to individual elements since we were storing - * the UID pointers inside the icalproperties themselves. - */ -static gboolean -free_alarm_cb (gpointer key, gpointer value, gpointer data) -{ - return TRUE; -} - -/* Frees the internal icalcomponent only if it does not have a parent. If it - * does, it means we don't own it and we shouldn't free it. - */ -static void -free_icalcomponent (CalComponent *comp, gboolean free) -{ - CalComponentPrivate *priv; - GSList *l; - - priv = comp->priv; - - if (!priv->icalcomp) - return; - - /* Free the icalcomponent */ - - if (free && icalcomponent_get_parent (priv->icalcomp) == NULL) { - icalcomponent_free (priv->icalcomp); - priv->icalcomp = NULL; - } - - /* Free the mappings */ - - priv->uid = NULL; - - priv->status = NULL; - - for (l = priv->attendee_list; l != NULL; l = l->next) - g_free (l->data); - g_slist_free (priv->attendee_list); - priv->attendee_list = NULL; - - priv->categories = NULL; - - priv->classification = NULL; - priv->comment_list = NULL; - priv->completed = NULL; - priv->contact_list = NULL; - priv->created = NULL; - - priv->description_list = free_slist (priv->description_list); - - priv->dtend.prop = NULL; - priv->dtend.tzid_param = NULL; - - priv->dtstamp = NULL; - - priv->dtstart.prop = NULL; - priv->dtstart.tzid_param = NULL; - - priv->due.prop = NULL; - priv->due.tzid_param = NULL; - - priv->duration = NULL; - - priv->exdate_list = free_slist (priv->exdate_list); - - g_slist_free (priv->exrule_list); - priv->exrule_list = NULL; - - priv->geo = NULL; - priv->last_modified = NULL; - priv->percent = NULL; - priv->priority = NULL; - - priv->rdate_list = free_slist (priv->rdate_list); - - g_slist_free (priv->rrule_list); - priv->rrule_list = NULL; - - priv->sequence = NULL; - - priv->summary.prop = NULL; - priv->summary.altrep_param = NULL; - - priv->transparency = NULL; - priv->url = NULL; - priv->location = NULL; - - /* Free the subcomponents */ - - g_hash_table_foreach_remove (priv->alarm_uid_hash, free_alarm_cb, NULL); - - /* Clean up */ - - priv->need_sequence_inc = FALSE; -} - -/* Finalize handler for the calendar component object */ -static void -cal_component_finalize (GObject *object) -{ - CalComponent *comp; - CalComponentPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_COMPONENT (object)); - - comp = CAL_COMPONENT (object); - priv = comp->priv; - - free_icalcomponent (comp, TRUE); - g_hash_table_destroy (priv->alarm_uid_hash); - priv->alarm_uid_hash = NULL; - - g_free (priv); - comp->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - - -/** - * cal_component_gen_uid: - * - * Generates a unique identifier suitable for calendar components. - * - * Return value: A unique identifier string. Every time this function is called - * a different string is returned. - **/ -char * -cal_component_gen_uid (void) -{ - char *iso, *ret; - static char *hostname; - time_t t = time (NULL); - static int serial; - - if (!hostname) { - static char buffer [512]; - - if ((gethostname (buffer, sizeof (buffer) - 1) == 0) && - (buffer [0] != 0)) - hostname = buffer; - else - hostname = "localhost"; - } - - iso = isodate_from_time_t (t); - ret = g_strdup_printf ("%s-%d-%d-%d-%d@%s", - iso, - getpid (), - getgid (), - getppid (), - serial++, - hostname); - g_free (iso); - - return ret; -} - -/** - * cal_component_new: - * - * Creates a new empty calendar component object. You should set it from an - * #icalcomponent structure by using cal_component_set_icalcomponent() or with a - * new empty component type by using cal_component_set_new_vtype(). - * - * Return value: A newly-created calendar component object. - **/ -CalComponent * -cal_component_new (void) -{ - return CAL_COMPONENT (g_object_new (CAL_COMPONENT_TYPE, NULL)); -} - -/** - * cal_component_clone: - * @comp: A calendar component object. - * - * Creates a new calendar component object by copying the information from - * another one. - * - * Return value: A newly-created calendar component with the same values as the - * original one. - **/ -CalComponent * -cal_component_clone (CalComponent *comp) -{ - CalComponentPrivate *priv; - CalComponent *new_comp; - icalcomponent *new_icalcomp; - - g_return_val_if_fail (comp != NULL, NULL); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL); - - priv = comp->priv; - g_return_val_if_fail (priv->need_sequence_inc == FALSE, NULL); - - new_comp = cal_component_new (); - - if (priv->icalcomp) { - new_icalcomp = icalcomponent_new_clone (priv->icalcomp); - cal_component_set_icalcomponent (new_comp, new_icalcomp); - } - - return new_comp; -} - -/* Scans an attendee property */ -static void -scan_attendee (CalComponent *comp, GSList **attendee_list, icalproperty *prop) -{ - struct attendee *attendee; - - attendee = g_new (struct attendee, 1); - attendee->prop = prop; - - attendee->cutype_param = icalproperty_get_first_parameter (prop, ICAL_CUTYPE_PARAMETER); - attendee->member_param = icalproperty_get_first_parameter (prop, ICAL_MEMBER_PARAMETER); - attendee->role_param = icalproperty_get_first_parameter (prop, ICAL_ROLE_PARAMETER); - attendee->partstat_param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER); - attendee->rsvp_param = icalproperty_get_first_parameter (prop, ICAL_RSVP_PARAMETER); - attendee->delto_param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDTO_PARAMETER); - attendee->delfrom_param = icalproperty_get_first_parameter (prop, ICAL_DELEGATEDFROM_PARAMETER); - attendee->sentby_param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER); - attendee->cn_param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER); - attendee->language_param = icalproperty_get_first_parameter (prop, ICAL_LANGUAGE_PARAMETER); - - *attendee_list = g_slist_append (*attendee_list, attendee); -} - -/* Scans a date/time and timezone pair property */ -static void -scan_datetime (CalComponent *comp, struct datetime *datetime, icalproperty *prop) -{ - CalComponentPrivate *priv; - - priv = comp->priv; - - datetime->prop = prop; - datetime->tzid_param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER); -} - -/* Scans an exception date property */ -static void -scan_exdate (CalComponent *comp, icalproperty *prop) -{ - CalComponentPrivate *priv; - struct datetime *dt; - - priv = comp->priv; - - dt = g_new (struct datetime, 1); - dt->prop = prop; - dt->tzid_param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER); - - priv->exdate_list = g_slist_append (priv->exdate_list, dt); -} - -/* Scans and attendee property */ -static void -scan_organizer (CalComponent *comp, struct organizer *organizer, icalproperty *prop) -{ - organizer->prop = prop; - - organizer->sentby_param = icalproperty_get_first_parameter (prop, ICAL_SENTBY_PARAMETER); - organizer->cn_param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER); - organizer->language_param = icalproperty_get_first_parameter (prop, ICAL_LANGUAGE_PARAMETER); -} - -/* Scans an icalperiodtype property */ -static void -scan_period (CalComponent *comp, GSList **list, icalproperty *prop) -{ - struct period *period; - - period = g_new (struct period, 1); - period->prop = prop; - period->value_param = icalproperty_get_first_parameter (prop, ICAL_VALUE_PARAMETER); - - *list = g_slist_append (*list, period); -} - - -/* Scans an icalrecurtype property */ -static void -scan_recur_id (CalComponent *comp, struct recur_id *recur_id, icalproperty *prop) -{ - scan_datetime (comp, &recur_id->recur_time, prop); - - recur_id->range_param = icalproperty_get_first_parameter (prop, ICAL_RANGE_PARAMETER); -} - -/* Scans an icalrecurtype property */ -static void -scan_recur (CalComponent *comp, GSList **list, icalproperty *prop) -{ - *list = g_slist_append (*list, prop); -} - -/* Scans the summary property */ -static void -scan_summary (CalComponent *comp, icalproperty *prop) -{ - CalComponentPrivate *priv; - - priv = comp->priv; - - priv->summary.prop = prop; - priv->summary.altrep_param = icalproperty_get_first_parameter (prop, ICAL_ALTREP_PARAMETER); -} - -/* Scans a text (i.e. text + altrep) property */ -static void -scan_text (CalComponent *comp, GSList **text_list, icalproperty *prop) -{ - struct text *text; - - text = g_new (struct text, 1); - text->prop = prop; - text->altrep_param = icalproperty_get_first_parameter (prop, ICAL_ALTREP_PARAMETER); - - *text_list = g_slist_append (*text_list, text); -} - -/* Scans an icalproperty and adds its mapping to the component */ -static void -scan_property (CalComponent *comp, icalproperty *prop) -{ - CalComponentPrivate *priv; - icalproperty_kind kind; - - priv = comp->priv; - - kind = icalproperty_isa (prop); - - switch (kind) { - case ICAL_STATUS_PROPERTY: - priv->status = prop; - break; - - case ICAL_ATTENDEE_PROPERTY: - scan_attendee (comp, &priv->attendee_list, prop); - break; - - case ICAL_CATEGORIES_PROPERTY: - priv->categories = prop; - break; - - case ICAL_CLASS_PROPERTY: - priv->classification = prop; - break; - - case ICAL_COMMENT_PROPERTY: - scan_text (comp, &priv->comment_list, prop); - break; - - case ICAL_COMPLETED_PROPERTY: - priv->completed = prop; - break; - - case ICAL_CONTACT_PROPERTY: - scan_text (comp, &priv->contact_list, prop); - break; - - case ICAL_CREATED_PROPERTY: - priv->created = prop; - break; - - case ICAL_DESCRIPTION_PROPERTY: - scan_text (comp, &priv->description_list, prop); - break; - - case ICAL_DTEND_PROPERTY: - scan_datetime (comp, &priv->dtend, prop); - break; - - case ICAL_DTSTAMP_PROPERTY: - priv->dtstamp = prop; - break; - - case ICAL_DTSTART_PROPERTY: - scan_datetime (comp, &priv->dtstart, prop); - break; - - case ICAL_DUE_PROPERTY: - scan_datetime (comp, &priv->due, prop); - break; - - case ICAL_DURATION_PROPERTY: - priv->duration = prop; - break; - - case ICAL_EXDATE_PROPERTY: - scan_exdate (comp, prop); - break; - - case ICAL_EXRULE_PROPERTY: - scan_recur (comp, &priv->exrule_list, prop); - break; - - case ICAL_GEO_PROPERTY: - priv->geo = prop; - break; - - case ICAL_LASTMODIFIED_PROPERTY: - priv->last_modified = prop; - break; - - case ICAL_ORGANIZER_PROPERTY: - scan_organizer (comp, &priv->organizer, prop); - break; - - case ICAL_PERCENTCOMPLETE_PROPERTY: - priv->percent = prop; - break; - - case ICAL_PRIORITY_PROPERTY: - priv->priority = prop; - break; - - case ICAL_RECURRENCEID_PROPERTY: - scan_recur_id (comp, &priv->recur_id, prop); - break; - - case ICAL_RDATE_PROPERTY: - scan_period (comp, &priv->rdate_list, prop); - break; - - case ICAL_RRULE_PROPERTY: - scan_recur (comp, &priv->rrule_list, prop); - break; - - case ICAL_SEQUENCE_PROPERTY: - priv->sequence = prop; - break; - - case ICAL_SUMMARY_PROPERTY: - scan_summary (comp, prop); - break; - - case ICAL_TRANSP_PROPERTY: - priv->transparency = prop; - break; - - case ICAL_UID_PROPERTY: - priv->uid = prop; - break; - - case ICAL_URL_PROPERTY: - priv->url = prop; - break; - - case ICAL_LOCATION_PROPERTY : - priv->location = prop; - break; - - default: - break; - } -} - -/* Gets our alarm UID string from a property that is known to contain it */ -static const char * -alarm_uid_from_prop (icalproperty *prop) -{ - const char *xstr; - - g_assert (icalproperty_isa (prop) == ICAL_X_PROPERTY); - - xstr = icalproperty_get_x (prop); - g_assert (xstr != NULL); - - return xstr; -} - -/* Sets our alarm UID extension property on an alarm component. Returns a - * pointer to the UID string inside the property itself. - */ -static const char * -set_alarm_uid (icalcomponent *alarm, const char *auid) -{ - icalproperty *prop; - const char *inprop_auid; - - /* Create the new property */ - - prop = icalproperty_new_x ((char *) auid); - icalproperty_set_x_name (prop, EVOLUTION_ALARM_UID_PROPERTY); - - icalcomponent_add_property (alarm, prop); - - inprop_auid = alarm_uid_from_prop (prop); - return inprop_auid; -} - -/* Removes any alarm UID extension properties from an alarm subcomponent */ -static void -remove_alarm_uid (icalcomponent *alarm) -{ - icalproperty *prop; - GSList *list, *l; - - list = NULL; - - for (prop = icalcomponent_get_first_property (alarm, ICAL_X_PROPERTY); - prop; - prop = icalcomponent_get_next_property (alarm, ICAL_X_PROPERTY)) { - const char *xname; - - xname = icalproperty_get_x_name (prop); - g_assert (xname != NULL); - - if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0) - list = g_slist_prepend (list, prop); - } - - for (l = list; l; l = l->next) { - prop = l->data; - icalcomponent_remove_property (alarm, prop); - icalproperty_free (prop); - } - - g_slist_free (list); -} - -/* Adds an alarm subcomponent to the calendar component's mapping table. The - * actual UID with which it gets added may not be the same as the specified one; - * this function will change it if the table already had an alarm subcomponent - * with the specified UID. Returns the actual UID used. - */ -static const char * -add_alarm (CalComponent *comp, icalcomponent *alarm, const char *auid) -{ - CalComponentPrivate *priv; - icalcomponent *old_alarm; - - priv = comp->priv; - - /* First we see if we already have an alarm with the requested UID. In - * that case, we need to change the new UID to something else. This - * should never happen, but who knows. - */ - - old_alarm = g_hash_table_lookup (priv->alarm_uid_hash, auid); - if (old_alarm != NULL) { - char *new_auid; - - g_message ("add_alarm(): Got alarm with duplicated UID `%s', changing it...", auid); - - remove_alarm_uid (alarm); - - new_auid = cal_component_gen_uid (); - auid = set_alarm_uid (alarm, new_auid); - g_free (new_auid); - } - - g_hash_table_insert (priv->alarm_uid_hash, (char *) auid, alarm); - return auid; -} - -/* Scans an alarm subcomponent, adds an UID extension property to it (so that we - * can reference alarms by unique IDs), and adds its mapping to the component. */ -static void -scan_alarm (CalComponent *comp, icalcomponent *alarm) -{ - CalComponentPrivate *priv; - icalproperty *prop; - const char *auid; - char *new_auid; - - priv = comp->priv; - - for (prop = icalcomponent_get_first_property (alarm, ICAL_X_PROPERTY); - prop; - prop = icalcomponent_get_next_property (alarm, ICAL_X_PROPERTY)) { - const char *xname; - - xname = icalproperty_get_x_name (prop); - g_assert (xname != NULL); - - if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0) { - auid = alarm_uid_from_prop (prop); - add_alarm (comp, alarm, auid); - return; - } - } - - /* The component has no alarm UID property, so we create one. */ - - new_auid = cal_component_gen_uid (); - auid = set_alarm_uid (alarm, new_auid); - g_free (new_auid); - - add_alarm (comp, alarm, auid); -} - -/* Scans an icalcomponent for its properties so that we can provide - * random-access to them. It also builds a hash table of the component's alarm - * subcomponents. - */ -static void -scan_icalcomponent (CalComponent *comp) -{ - CalComponentPrivate *priv; - icalproperty *prop; - icalcompiter iter; - - priv = comp->priv; - - g_assert (priv->icalcomp != NULL); - - /* Scan properties */ - - for (prop = icalcomponent_get_first_property (priv->icalcomp, ICAL_ANY_PROPERTY); - prop; - prop = icalcomponent_get_next_property (priv->icalcomp, ICAL_ANY_PROPERTY)) - scan_property (comp, prop); - - /* Scan subcomponents */ - - for (iter = icalcomponent_begin_component (priv->icalcomp, ICAL_VALARM_COMPONENT); - icalcompiter_deref (&iter) != NULL; - icalcompiter_next (&iter)) { - icalcomponent *subcomp; - - subcomp = icalcompiter_deref (&iter); - scan_alarm (comp, subcomp); - } -} - -/* Ensures that the mandatory calendar component properties (uid, dtstamp) do - * exist. If they don't exist, it creates them automatically. - */ -static void -ensure_mandatory_properties (CalComponent *comp) -{ - CalComponentPrivate *priv; - - priv = comp->priv; - g_assert (priv->icalcomp != NULL); - - if (!priv->uid) { - char *uid; - - uid = cal_component_gen_uid (); - priv->uid = icalproperty_new_uid (uid); - g_free (uid); - - icalcomponent_add_property (priv->icalcomp, priv->uid); - } - - if (!priv->dtstamp) { - struct icaltimetype t; - - t = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ()); - - priv->dtstamp = icalproperty_new_dtstamp (t); - icalcomponent_add_property (priv->icalcomp, priv->dtstamp); - } -} - -/** - * cal_component_set_new_vtype: - * @comp: A calendar component object. - * @type: Type of calendar component to create. - * - * Clears any existing component data from a calendar component object and - * creates a new #icalcomponent of the specified type for it. The only property - * that will be set in the new component will be its unique identifier. - **/ -void -cal_component_set_new_vtype (CalComponent *comp, CalComponentVType type) -{ - CalComponentPrivate *priv; - icalcomponent *icalcomp; - icalcomponent_kind kind; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - - free_icalcomponent (comp, TRUE); - - if (type == CAL_COMPONENT_NO_TYPE) - return; - - /* Figure out the kind and create the icalcomponent */ - - switch (type) { - case CAL_COMPONENT_EVENT: - kind = ICAL_VEVENT_COMPONENT; - break; - - case CAL_COMPONENT_TODO: - kind = ICAL_VTODO_COMPONENT; - break; - - case CAL_COMPONENT_JOURNAL: - kind = ICAL_VJOURNAL_COMPONENT; - break; - - case CAL_COMPONENT_FREEBUSY: - kind = ICAL_VFREEBUSY_COMPONENT; - break; - - case CAL_COMPONENT_TIMEZONE: - kind = ICAL_VTIMEZONE_COMPONENT; - break; - - default: - g_assert_not_reached (); - kind = ICAL_NO_COMPONENT; - } - - icalcomp = icalcomponent_new (kind); - if (!icalcomp) { - g_message ("cal_component_set_new_vtype(): Could not create the icalcomponent!"); - return; - } - - /* Scan the component to build our mapping table */ - - priv->icalcomp = icalcomp; - scan_icalcomponent (comp); - - /* Add missing stuff */ - - ensure_mandatory_properties (comp); -} - -/** - * cal_component_set_icalcomponent: - * @comp: A calendar component object. - * @icalcomp: An #icalcomponent. - * - * Sets the contents of a calendar component object from an #icalcomponent - * structure. If the @comp already had an #icalcomponent set into it, it will - * will be freed automatically if the #icalcomponent does not have a parent - * component itself. - * - * Supported component types are VEVENT, VTODO, VJOURNAL, VFREEBUSY, and VTIMEZONE. - * - * Return value: TRUE on success, FALSE if @icalcomp is an unsupported component - * type. - **/ -gboolean -cal_component_set_icalcomponent (CalComponent *comp, icalcomponent *icalcomp) -{ - CalComponentPrivate *priv; - icalcomponent_kind kind; - - g_return_val_if_fail (comp != NULL, FALSE); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); - - priv = comp->priv; - - if (priv->icalcomp == icalcomp) - return TRUE; - - free_icalcomponent (comp, TRUE); - - if (!icalcomp) { - priv->icalcomp = NULL; - return TRUE; - } - - kind = icalcomponent_isa (icalcomp); - - if (!(kind == ICAL_VEVENT_COMPONENT - || kind == ICAL_VTODO_COMPONENT - || kind == ICAL_VJOURNAL_COMPONENT - || kind == ICAL_VFREEBUSY_COMPONENT - || kind == ICAL_VTIMEZONE_COMPONENT)) - return FALSE; - - priv->icalcomp = icalcomp; - - scan_icalcomponent (comp); - ensure_mandatory_properties (comp); - - return TRUE; -} - -/** - * cal_component_get_icalcomponent: - * @comp: A calendar component object. - * - * Queries the #icalcomponent structure that a calendar component object is - * wrapping. - * - * Return value: An #icalcomponent structure, or NULL if the @comp has no - * #icalcomponent set to it. - **/ -icalcomponent * -cal_component_get_icalcomponent (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_val_if_fail (comp != NULL, NULL); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL); - - priv = comp->priv; - g_return_val_if_fail (priv->need_sequence_inc == FALSE, NULL); - - return priv->icalcomp; -} - -void -cal_component_rescan (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - - /* Clear everything out */ - free_icalcomponent (comp, FALSE); - - /* Rescan */ - scan_icalcomponent (comp); - ensure_mandatory_properties (comp); -} - -void -cal_component_strip_errors (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - - icalcomponent_strip_errors (priv->icalcomp); -} - -/** - * cal_component_get_vtype: - * @comp: A calendar component object. - * - * Queries the type of a calendar component object. - * - * Return value: The type of the component, as defined by RFC 2445. - **/ -CalComponentVType -cal_component_get_vtype (CalComponent *comp) -{ - CalComponentPrivate *priv; - icalcomponent_kind kind; - - g_return_val_if_fail (comp != NULL, CAL_COMPONENT_NO_TYPE); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), CAL_COMPONENT_NO_TYPE); - - priv = comp->priv; - g_return_val_if_fail (priv->icalcomp != NULL, CAL_COMPONENT_NO_TYPE); - - kind = icalcomponent_isa (priv->icalcomp); - switch (kind) { - case ICAL_VEVENT_COMPONENT: - return CAL_COMPONENT_EVENT; - - case ICAL_VTODO_COMPONENT: - return CAL_COMPONENT_TODO; - - case ICAL_VJOURNAL_COMPONENT: - return CAL_COMPONENT_JOURNAL; - - case ICAL_VFREEBUSY_COMPONENT: - return CAL_COMPONENT_FREEBUSY; - - case ICAL_VTIMEZONE_COMPONENT: - return CAL_COMPONENT_TIMEZONE; - - default: - /* We should have been loaded with a supported type! */ - g_assert_not_reached (); - return CAL_COMPONENT_NO_TYPE; - } -} - -/** - * cal_component_get_as_string: - * @comp: A calendar component. - * - * Gets the iCalendar string representation of a calendar component. You should - * call cal_component_commit_sequence() before this function to ensure that the - * component's sequence number is consistent with the state of the object. - * - * Return value: String representation of the calendar component according to - * RFC 2445. - **/ -char * -cal_component_get_as_string (CalComponent *comp) -{ - CalComponentPrivate *priv; - char *str, *buf; - - g_return_val_if_fail (comp != NULL, NULL); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL); - - priv = comp->priv; - g_return_val_if_fail (priv->icalcomp != NULL, NULL); - - /* Ensure that the user has committed the new SEQUENCE */ - g_return_val_if_fail (priv->need_sequence_inc == FALSE, NULL); - - /* We dup the string; libical owns that memory */ - - str = icalcomponent_as_ical_string (priv->icalcomp); - - if (str) - buf = g_strdup (str); - else - buf = NULL; - - return buf; -} - -/* Used from g_hash_table_foreach(); ensures that an alarm subcomponent - * has the mandatory properties it needs. - */ -static void -ensure_alarm_properties_cb (gpointer key, gpointer value, gpointer data) -{ - CalComponent *comp; - CalComponentPrivate *priv; - icalcomponent *alarm; - icalproperty *prop; - enum icalproperty_action action; - const char *str; - - alarm = value; - - comp = CAL_COMPONENT (data); - priv = comp->priv; - - prop = icalcomponent_get_first_property (alarm, ICAL_ACTION_PROPERTY); - if (!prop) - return; - - action = icalproperty_get_action (prop); - - switch (action) { - case ICAL_ACTION_DISPLAY: - /* Ensure we have a DESCRIPTION property */ - prop = icalcomponent_get_first_property (alarm, ICAL_DESCRIPTION_PROPERTY); - if (prop) - break; - - if (!priv->summary.prop) - str = _("Untitled appointment"); - else - str = icalproperty_get_summary (priv->summary.prop); - - prop = icalproperty_new_description (str); - icalcomponent_add_property (alarm, prop); - - break; - - default: - break; - /* FIXME: add other action types here */ - } -} - -/* Ensures that alarm subcomponents have the mandatory properties they need, - * even when clients may not have set them properly. - */ -static void -ensure_alarm_properties (CalComponent *comp) -{ - CalComponentPrivate *priv; - - priv = comp->priv; - - g_hash_table_foreach (priv->alarm_uid_hash, ensure_alarm_properties_cb, comp); -} - -/** - * cal_component_commit_sequence: - * @comp: - * - * Increments the sequence number property in a calendar component object if it - * needs it. This needs to be done when any of a number of properties listed in - * RFC 2445 change values, such as the start and end dates of a component. - * - * This function must be called before calling cal_component_get_as_string() to - * ensure that the component is fully consistent. - **/ -void -cal_component_commit_sequence (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - ensure_alarm_properties (comp); - - if (!priv->need_sequence_inc) - return; - - if (priv->sequence) { - int seq; - - seq = icalproperty_get_sequence (priv->sequence); - icalproperty_set_sequence (priv->sequence, seq + 1); - } else { - /* The component had no SEQUENCE property, so assume that the - * default would have been zero. Since it needed incrementing - * anyways, we use a value of 1 here. - */ - priv->sequence = icalproperty_new_sequence (1); - icalcomponent_add_property (priv->icalcomp, priv->sequence); - } - - priv->need_sequence_inc = FALSE; -} - -void -cal_component_abort_sequence (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - - priv->need_sequence_inc = FALSE; -} - -/** - * cal_component_get_uid: - * @comp: A calendar component object. - * @uid: Return value for the UID string. - * - * Queries the unique identifier of a calendar component object. - **/ -void -cal_component_get_uid (CalComponent *comp, const char **uid) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (uid != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - /* This MUST exist, since we ensured that it did */ - g_assert (priv->uid != NULL); - - *uid = icalproperty_get_uid (priv->uid); -} - -/** - * cal_component_set_uid: - * @comp: A calendar component object. - * @uid: Unique identifier. - * - * Sets the unique identifier string of a calendar component object. - **/ -void -cal_component_set_uid (CalComponent *comp, const char *uid) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (uid != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - /* This MUST exist, since we ensured that it did */ - g_assert (priv->uid != NULL); - - icalproperty_set_uid (priv->uid, (char *) uid); -} - -/** - * cal_component_get_categories: - * @comp: A calendar component object. - * @categories: - * - * - **/ -void -cal_component_get_categories (CalComponent *comp, const char **categories) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (categories != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (priv->categories) - *categories = icalproperty_get_categories (priv->categories); - else - *categories = NULL; -} - -/** - * cal_component_set_categories: - * @comp: A calendar component object. - * @categories: - * - * - **/ -void -cal_component_set_categories (CalComponent *comp, const char *categories) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!categories || !(*categories)) { - if (priv->categories) { - icalcomponent_remove_property (priv->icalcomp, priv->categories); - icalproperty_free (priv->categories); - priv->url = NULL; - } - - return; - } - - if (priv->categories) - icalproperty_set_categories (priv->categories, (char *) categories); - else { - priv->categories = icalproperty_new_categories ((char *) categories); - icalcomponent_add_property (priv->icalcomp, priv->categories); - } -} - - -/** - * cal_component_get_categories_list: - * @comp: A calendar component object. - * @categ_list: Return value for the list of strings, where each string is a - * category. This should be freed using cal_component_free_categories_list(). - * - * Queries the list of categories of a calendar component object. Each element - * in the returned categ_list is a string with the corresponding category. - **/ -void -cal_component_get_categories_list (CalComponent *comp, GSList **categ_list) -{ - CalComponentPrivate *priv; - const char *categories; - const char *p; - const char *cat_start; - char *str; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (categ_list != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!priv->categories) { - *categ_list = NULL; - return; - } - - categories = icalproperty_get_categories (priv->categories); - g_assert (categories != NULL); - - cat_start = categories; - *categ_list = NULL; - - for (p = categories; *p; p++) - if (*p == ',') { - str = g_strndup (cat_start, p - cat_start); - *categ_list = g_slist_prepend (*categ_list, str); - - cat_start = p + 1; - } - - str = g_strndup (cat_start, p - cat_start); - *categ_list = g_slist_prepend (*categ_list, str); - - *categ_list = g_slist_reverse (*categ_list); -} - -/* Creates a comma-delimited string of categories */ -static char * -stringify_categories (GSList *categ_list) -{ - GString *s; - GSList *l; - char *str; - - s = g_string_new (NULL); - - for (l = categ_list; l; l = l->next) { - g_string_append (s, l->data); - - if (l->next != NULL) - g_string_append (s, ","); - } - - str = s->str; - g_string_free (s, FALSE); - - return str; -} - -/** - * cal_component_set_categories_list: - * @comp: A calendar component object. - * @categ_list: List of strings, one for each category. - * - * Sets the list of categories of a calendar component object. - **/ -void -cal_component_set_categories_list (CalComponent *comp, GSList *categ_list) -{ - CalComponentPrivate *priv; - char *categories_str; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!categ_list) { - if (priv->categories) { - icalcomponent_remove_property (priv->icalcomp, priv->categories); - icalproperty_free (priv->categories); - } - - return; - } - - /* Create a single string of categories */ - categories_str = stringify_categories (categ_list); - - /* Set the categories */ - priv->categories = icalproperty_new_categories (categories_str); - g_free (categories_str); - - icalcomponent_add_property (priv->icalcomp, priv->categories); -} - -/** - * cal_component_get_classification: - * @comp: A calendar component object. - * @classif: Return value for the classification. - * - * Queries the classification of a calendar component object. If the - * classification property is not set on this component, this function returns - * #CAL_COMPONENT_CLASS_NONE. - **/ -void -cal_component_get_classification (CalComponent *comp, CalComponentClassification *classif) -{ - CalComponentPrivate *priv; - const char *class; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (classif != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!priv->classification) { - *classif = CAL_COMPONENT_CLASS_NONE; - return; - } - - class = icalproperty_get_class (priv->classification); - - if (strcasecmp (class, "PUBLIC") == 0) - *classif = CAL_COMPONENT_CLASS_PUBLIC; - else if (strcasecmp (class, "PRIVATE") == 0) - *classif = CAL_COMPONENT_CLASS_PRIVATE; - else if (strcasecmp (class, "CONFIDENTIAL") == 0) - *classif = CAL_COMPONENT_CLASS_CONFIDENTIAL; - else - *classif = CAL_COMPONENT_CLASS_UNKNOWN; -} - -/** - * cal_component_set_classification: - * @comp: A calendar component object. - * @classif: Classification to use. - * - * Sets the classification property of a calendar component object. To unset - * the property, specify CAL_COMPONENT_CLASS_NONE for @classif. - **/ -void -cal_component_set_classification (CalComponent *comp, CalComponentClassification classif) -{ - CalComponentPrivate *priv; - char *str; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (classif != CAL_COMPONENT_CLASS_UNKNOWN); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (classif == CAL_COMPONENT_CLASS_NONE) { - if (priv->classification) { - icalcomponent_remove_property (priv->icalcomp, priv->classification); - icalproperty_free (priv->classification); - priv->classification = NULL; - } - - return; - } - - switch (classif) { - case CAL_COMPONENT_CLASS_PUBLIC: - str = "PUBLIC"; - break; - - case CAL_COMPONENT_CLASS_PRIVATE: - str = "PRIVATE"; - break; - - case CAL_COMPONENT_CLASS_CONFIDENTIAL: - str = "CONFIDENTIAL"; - break; - - default: - g_assert_not_reached (); - str = NULL; - } - - if (priv->classification) - icalproperty_set_class (priv->classification, str); - else { - priv->classification = icalproperty_new_class (str); - icalcomponent_add_property (priv->icalcomp, priv->classification); - } -} - -/* Gets a text list value */ -static void -get_text_list (GSList *text_list, - const char *(* get_prop_func) (icalproperty *prop), - GSList **tl) -{ - GSList *l; - - *tl = NULL; - - if (!text_list) - return; - - for (l = text_list; l; l = l->next) { - struct text *text; - CalComponentText *t; - - text = l->data; - g_assert (text->prop != NULL); - - t = g_new (CalComponentText, 1); - t->value = (* get_prop_func) (text->prop); - - if (text->altrep_param) - t->altrep = icalparameter_get_altrep (text->altrep_param); - else - t->altrep = NULL; - - *tl = g_slist_prepend (*tl, t); - } - - *tl = g_slist_reverse (*tl); -} - -/* Sets a text list value */ -static void -set_text_list (CalComponent *comp, - icalproperty *(* new_prop_func) (const char *value), - GSList **text_list, - GSList *tl) -{ - CalComponentPrivate *priv; - GSList *l; - - priv = comp->priv; - - /* Remove old texts */ - - for (l = *text_list; l; l = l->next) { - struct text *text; - - text = l->data; - g_assert (text->prop != NULL); - - icalcomponent_remove_property (priv->icalcomp, text->prop); - icalproperty_free (text->prop); - g_free (text); - } - - g_slist_free (*text_list); - *text_list = NULL; - - /* Add in new texts */ - - for (l = tl; l; l = l->next) { - CalComponentText *t; - struct text *text; - - t = l->data; - g_return_if_fail (t->value != NULL); - - text = g_new (struct text, 1); - - text->prop = (* new_prop_func) ((char *) t->value); - icalcomponent_add_property (priv->icalcomp, text->prop); - - if (t->altrep) { - text->altrep_param = icalparameter_new_altrep ((char *) t->altrep); - icalproperty_add_parameter (text->prop, text->altrep_param); - } else - text->altrep_param = NULL; - - *text_list = g_slist_prepend (*text_list, text); - } - - *text_list = g_slist_reverse (*text_list); -} - -/** - * cal_component_get_comment_list: - * @comp: A calendar component object. - * @text_list: Return value for the comment properties and their parameters, as - * a list of #CalComponentText structures. This should be freed using the - * cal_component_free_text_list() function. - * - * Queries the comment of a calendar component object. The comment property can - * appear several times inside a calendar component, and so a list of - * #CalComponentText is returned. - **/ -void -cal_component_get_comment_list (CalComponent *comp, GSList **text_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (text_list != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_text_list (priv->comment_list, icalproperty_get_comment, text_list); -} - -/** - * cal_component_set_comment_list: - * @comp: A calendar component object. - * @text_list: List of #CalComponentText structures. - * - * Sets the comment of a calendar component object. The comment property can - * appear several times inside a calendar component, and so a list of - * #CalComponentText structures is used. - **/ -void -cal_component_set_comment_list (CalComponent *comp, GSList *text_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_text_list (comp, icalproperty_new_comment, &priv->comment_list, text_list); -} - -/** - * cal_component_get_contact_list: - * @comp: A calendar component object. - * @text_list: Return value for the contact properties and their parameters, as - * a list of #CalComponentText structures. This should be freed using the - * cal_component_free_text_list() function. - * - * Queries the contact of a calendar component object. The contact property can - * appear several times inside a calendar component, and so a list of - * #CalComponentText is returned. - **/ -void -cal_component_get_contact_list (CalComponent *comp, GSList **text_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (text_list != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_text_list (priv->contact_list, icalproperty_get_contact, text_list); -} - -/** - * cal_component_set_contact_list: - * @comp: A calendar component object. - * @text_list: List of #CalComponentText structures. - * - * Sets the contact of a calendar component object. The contact property can - * appear several times inside a calendar component, and so a list of - * #CalComponentText structures is used. - **/ -void -cal_component_set_contact_list (CalComponent *comp, GSList *text_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_text_list (comp, icalproperty_new_contact, &priv->contact_list, text_list); -} - -/* Gets a struct icaltimetype value */ -static void -get_icaltimetype (icalproperty *prop, - struct icaltimetype (* get_prop_func) (icalproperty *prop), - struct icaltimetype **t) -{ - if (!prop) { - *t = NULL; - return; - } - - *t = g_new (struct icaltimetype, 1); - **t = (* get_prop_func) (prop); -} - -/* Sets a struct icaltimetype value */ -static void -set_icaltimetype (CalComponent *comp, icalproperty **prop, - icalproperty *(* prop_new_func) (struct icaltimetype v), - void (* prop_set_func) (icalproperty *prop, struct icaltimetype v), - struct icaltimetype *t) -{ - CalComponentPrivate *priv; - - priv = comp->priv; - - if (!t) { - if (*prop) { - icalcomponent_remove_property (priv->icalcomp, *prop); - icalproperty_free (*prop); - *prop = NULL; - } - - return; - } - - if (*prop) - (* prop_set_func) (*prop, *t); - else { - *prop = (* prop_new_func) (*t); - icalcomponent_add_property (priv->icalcomp, *prop); - } -} - -/** - * cal_component_get_completed: - * @comp: A calendar component object. - * @t: Return value for the completion date. This should be freed using the - * cal_component_free_icaltimetype() function. - * - * Queries the date at which a calendar compoment object was completed. - **/ -void -cal_component_get_completed (CalComponent *comp, struct icaltimetype **t) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (t != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_icaltimetype (priv->completed, icalproperty_get_completed, t); -} - -/** - * cal_component_set_completed: - * @comp: A calendar component object. - * @t: Value for the completion date. - * - * Sets the date at which a calendar component object was completed. - **/ -void -cal_component_set_completed (CalComponent *comp, struct icaltimetype *t) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_icaltimetype (comp, &priv->completed, - icalproperty_new_completed, - icalproperty_set_completed, - t); -} - - -/** - * cal_component_get_created: - * @comp: A calendar component object. - * @t: Return value for the creation date. This should be freed using the - * cal_component_free_icaltimetype() function. - * - * Queries the date in which a calendar component object was created in the - * calendar store. - **/ -void -cal_component_get_created (CalComponent *comp, struct icaltimetype **t) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (t != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_icaltimetype (priv->created, icalproperty_get_created, t); -} - -/** - * cal_component_set_created: - * @comp: A calendar component object. - * @t: Value for the creation date. - * - * Sets the date in which a calendar component object is created in the calendar - * store. This should only be used inside a calendar store application, i.e. - * not by calendar user agents. - **/ -void -cal_component_set_created (CalComponent *comp, struct icaltimetype *t) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_icaltimetype (comp, &priv->created, - icalproperty_new_created, - icalproperty_set_created, - t); -} - -/** - * cal_component_get_description_list: - * @comp: A calendar component object. - * @text_list: Return value for the description properties and their parameters, - * as a list of #CalComponentText structures. This should be freed using the - * cal_component_free_text_list() function. - * - * Queries the description of a calendar component object. Journal components - * may have more than one description, and as such this function returns a list - * of #CalComponentText structures. All other types of components can have at - * most one description. - **/ -void -cal_component_get_description_list (CalComponent *comp, GSList **text_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (text_list != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_text_list (priv->description_list, icalproperty_get_description, text_list); -} - -/** - * cal_component_set_description_list: - * @comp: A calendar component object. - * @text_list: List of #CalComponentSummary structures. - * - * Sets the description of a calendar component object. Journal components may - * have more than one description, and as such this function takes in a list of - * #CalComponentDescription structures. All other types of components can have - * at most one description. - **/ -void -cal_component_set_description_list (CalComponent *comp, GSList *text_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_text_list (comp, icalproperty_new_description, &priv->description_list, text_list); -} - -/* Gets a date/time and timezone pair */ -static void -get_datetime (struct datetime *datetime, - struct icaltimetype (* get_prop_func) (icalproperty *prop), - CalComponentDateTime *dt) -{ - if (datetime->prop) { - dt->value = g_new (struct icaltimetype, 1); - *dt->value = (* get_prop_func) (datetime->prop); - } else - dt->value = NULL; - - /* If the icaltimetype has is_utc set, we set "UTC" as the TZID. - This makes the timezone code simpler. */ - if (datetime->tzid_param) - dt->tzid = g_strdup (icalparameter_get_tzid (datetime->tzid_param)); - else if (dt->value && dt->value->is_utc) - dt->tzid = g_strdup ("UTC"); - else - dt->tzid = NULL; -} - -/* Sets a date/time and timezone pair */ -static void -set_datetime (CalComponent *comp, struct datetime *datetime, - icalproperty *(* prop_new_func) (struct icaltimetype v), - void (* prop_set_func) (icalproperty * prop, struct icaltimetype v), - CalComponentDateTime *dt) -{ - CalComponentPrivate *priv; - - priv = comp->priv; - - /* If we are setting the property to NULL (i.e. removing it), then - we remove it if it exists. */ - if (!dt) { - if (datetime->prop) { - icalcomponent_remove_property (priv->icalcomp, datetime->prop); - icalproperty_free (datetime->prop); - - datetime->prop = NULL; - datetime->tzid_param = NULL; - } - - return; - } - - g_return_if_fail (dt->value != NULL); - - /* If the TZID is set to "UTC", we set the is_utc flag. */ - if (dt->tzid && !strcmp (dt->tzid, "UTC")) - dt->value->is_utc = 1; - else - dt->value->is_utc = 0; - - if (datetime->prop) { - (* prop_set_func) (datetime->prop, *dt->value); - } else { - datetime->prop = (* prop_new_func) (*dt->value); - icalcomponent_add_property (priv->icalcomp, datetime->prop); - } - - /* If the TZID is set to "UTC", we don't want to save the TZID. */ - if (dt->tzid && strcmp (dt->tzid, "UTC")) { - g_assert (datetime->prop != NULL); - - if (datetime->tzid_param) { - icalparameter_set_tzid (datetime->tzid_param, (char *) dt->tzid); - } else { - datetime->tzid_param = icalparameter_new_tzid ((char *) dt->tzid); - icalproperty_add_parameter (datetime->prop, datetime->tzid_param); - } - } else if (datetime->tzid_param) { - icalproperty_remove_parameter (datetime->prop, ICAL_TZID_PARAMETER); - icalparameter_free (datetime->tzid_param); - datetime->tzid_param = NULL; - } -} - - -/* This tries to get the DTSTART + DURATION for a VEVENT or VTODO. In a - VEVENT this is used for the DTEND if no DTEND exists, In a VTOTO it is - used for the DUE date if DUE doesn't exist. */ -static void -cal_component_get_start_plus_duration (CalComponent *comp, - CalComponentDateTime *dt) -{ - CalComponentPrivate *priv; - struct icaldurationtype duration; - - priv = comp->priv; - - if (!priv->duration) - return; - - /* Get the DTSTART time. */ - get_datetime (&priv->dtstart, icalproperty_get_dtstart, dt); - if (!dt->value) - return; - - duration = icalproperty_get_duration (priv->duration); - - /* The DURATION shouldn't be negative, but just return DTSTART if it - is, i.e. assume it is 0. */ - if (duration.is_neg) - return; - - /* If DTSTART is a DATE value, then we need to check if the DURATION - includes any hours, minutes or seconds. If it does, we need to - make the DTEND/DUE a DATE-TIME value. */ - duration.days += duration.weeks * 7; - if (dt->value->is_date) { - if (duration.hours != 0 || duration.minutes != 0 - || duration.seconds != 0) { - dt->value->is_date = 0; - } - } - - /* Add on the DURATION. */ - icaltime_adjust (dt->value, duration.days, duration.hours, - duration.minutes, duration.seconds); -} - - -/** - * cal_component_get_dtend: - * @comp: A calendar component object. - * @dt: Return value for the date/time end. This should be freed with the - * cal_component_free_datetime() function. - * - * Queries the date/time end of a calendar component object. - **/ -void -cal_component_get_dtend (CalComponent *comp, CalComponentDateTime *dt) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (dt != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_datetime (&priv->dtend, icalproperty_get_dtend, dt); - - /* If we don't have a DTEND property, then we try to get DTSTART - + DURATION. */ - if (!dt->value) - cal_component_get_start_plus_duration (comp, dt); -} - -/** - * cal_component_set_dtend: - * @comp: A calendar component object. - * @dt: End date/time. - * - * Sets the date/time end property of a calendar component object. - **/ -void -cal_component_set_dtend (CalComponent *comp, CalComponentDateTime *dt) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_datetime (comp, &priv->dtend, - icalproperty_new_dtend, - icalproperty_set_dtend, - dt); - - /* Make sure we remove any existing DURATION property, as it can't be - used with a DTEND. If DTEND is set to NULL, i.e. removed, we also - want to remove any DURATION. */ - if (priv->duration) { - icalcomponent_remove_property (priv->icalcomp, priv->duration); - icalproperty_free (priv->duration); - priv->duration = NULL; - } - - priv->need_sequence_inc = TRUE; -} - -/** - * cal_component_get_dtstamp: - * @comp: A calendar component object. - * @t: A value for the date/timestamp. - * - * Queries the date/timestamp property of a calendar component object, which is - * the last time at which the object was modified by a calendar user agent. - **/ -void -cal_component_get_dtstamp (CalComponent *comp, struct icaltimetype *t) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (t != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - /* This MUST exist, since we ensured that it did */ - g_assert (priv->dtstamp != NULL); - - *t = icalproperty_get_dtstamp (priv->dtstamp); -} - -/** - * cal_component_set_dtstamp: - * @comp: A calendar component object. - * @t: Date/timestamp value. - * - * Sets the date/timestamp of a calendar component object. This should be - * called whenever a calendar user agent makes a change to a component's - * properties. - **/ -void -cal_component_set_dtstamp (CalComponent *comp, struct icaltimetype *t) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (t != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - /* This MUST exist, since we ensured that it did */ - g_assert (priv->dtstamp != NULL); - - icalproperty_set_dtstamp (priv->dtstamp, *t); -} - -/** - * cal_component_get_dtstart: - * @comp: A calendar component object. - * @dt: Return value for the date/time start. This should be freed with the - * cal_component_free_datetime() function. - * - * Queries the date/time start of a calendar component object. - **/ -void -cal_component_get_dtstart (CalComponent *comp, CalComponentDateTime *dt) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (dt != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_datetime (&priv->dtstart, icalproperty_get_dtstart, dt); -} - -/** - * cal_component_set_dtstart: - * @comp: A calendar component object. - * @dt: Start date/time. - * - * Sets the date/time start property of a calendar component object. - **/ -void -cal_component_set_dtstart (CalComponent *comp, CalComponentDateTime *dt) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_datetime (comp, &priv->dtstart, - icalproperty_new_dtstart, - icalproperty_set_dtstart, - dt); - - priv->need_sequence_inc = TRUE; -} - -/** - * cal_component_get_due: - * @comp: A calendar component object. - * @dt: Return value for the due date/time. This should be freed with the - * cal_component_free_datetime() function. - * - * Queries the due date/time of a calendar component object. - **/ -void -cal_component_get_due (CalComponent *comp, CalComponentDateTime *dt) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (dt != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_datetime (&priv->due, icalproperty_get_due, dt); - - /* If we don't have a DTEND property, then we try to get DTSTART - + DURATION. */ - if (!dt->value) - cal_component_get_start_plus_duration (comp, dt); -} - -/** - * cal_component_set_due: - * @comp: A calendar component object. - * @dt: End date/time. - * - * Sets the due date/time property of a calendar component object. - **/ -void -cal_component_set_due (CalComponent *comp, CalComponentDateTime *dt) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_datetime (comp, &priv->due, - icalproperty_new_due, - icalproperty_set_due, - dt); - - /* Make sure we remove any existing DURATION property, as it can't be - used with a DTEND. If DTEND is set to NULL, i.e. removed, we also - want to remove any DURATION. */ - if (priv->duration) { - icalcomponent_remove_property (priv->icalcomp, priv->duration); - icalproperty_free (priv->duration); - priv->duration = NULL; - } - - priv->need_sequence_inc = TRUE; -} - -/* Builds a list of CalComponentPeriod structures based on a list of icalproperties */ -static void -get_period_list (GSList *period_list, - struct icaldatetimeperiodtype (* get_prop_func) (icalproperty *prop), - GSList **list) -{ - GSList *l; - - *list = NULL; - - if (!period_list) - return; - - for (l = period_list; l; l = l->next) { - struct period *period; - CalComponentPeriod *p; - struct icaldatetimeperiodtype ip; - - period = l->data; - g_assert (period->prop != NULL); - - p = g_new (CalComponentPeriod, 1); - - /* Get value parameter */ - - if (period->value_param) { - icalparameter_value value_type; - - value_type = icalparameter_get_value (period->value_param); - - if (value_type == ICAL_VALUE_DATE || value_type == ICAL_VALUE_DATETIME) - p->type = CAL_COMPONENT_PERIOD_DATETIME; - else if (value_type == ICAL_VALUE_DURATION) - p->type = CAL_COMPONENT_PERIOD_DURATION; - else { - g_message ("get_period_list(): Unknown value for period %d; " - "using DATETIME", value_type); - p->type = CAL_COMPONENT_PERIOD_DATETIME; - } - } else - p->type = CAL_COMPONENT_PERIOD_DATETIME; - - /* Get start and end/duration */ - - ip = (* get_prop_func) (period->prop); - - p->start = ip.period.start; - - if (p->type == CAL_COMPONENT_PERIOD_DATETIME) - p->u.end = ip.period.end; - else if (p->type == CAL_COMPONENT_PERIOD_DURATION) - p->u.duration = ip.period.duration; - else - g_assert_not_reached (); - - /* Put in list */ - - *list = g_slist_prepend (*list, p); - } - - *list = g_slist_reverse (*list); -} - -/* Sets a period list value */ -static void -set_period_list (CalComponent *comp, - icalproperty *(* new_prop_func) (struct icaldatetimeperiodtype period), - GSList **period_list, - GSList *pl) -{ - CalComponentPrivate *priv; - GSList *l; - - priv = comp->priv; - - /* Remove old periods */ - - for (l = *period_list; l; l = l->next) { - struct period *period; - - period = l->data; - g_assert (period->prop != NULL); - - icalcomponent_remove_property (priv->icalcomp, period->prop); - icalproperty_free (period->prop); - g_free (period); - } - - g_slist_free (*period_list); - *period_list = NULL; - - /* Add in new periods */ - - for (l = pl; l; l = l->next) { - CalComponentPeriod *p; - struct period *period; - struct icaldatetimeperiodtype ip; - icalparameter_value value_type; - - g_assert (l->data != NULL); - p = l->data; - - /* Create libical value */ - - ip.period.start = p->start; - - if (p->type == CAL_COMPONENT_PERIOD_DATETIME) { - value_type = ICAL_VALUE_DATETIME; - ip.period.end = p->u.end; - } else if (p->type == CAL_COMPONENT_PERIOD_DURATION) { - value_type = ICAL_VALUE_DURATION; - ip.period.duration = p->u.duration; - } else { - g_assert_not_reached (); - return; - } - - /* Create property */ - - period = g_new (struct period, 1); - - period->prop = (* new_prop_func) (ip); - period->value_param = icalparameter_new_value (value_type); - icalproperty_add_parameter (period->prop, period->value_param); - - /* Add to list */ - - *period_list = g_slist_prepend (*period_list, period); - } - - *period_list = g_slist_reverse (*period_list); -} - -/** - * cal_component_get_exdate_list: - * @comp: A calendar component object. - * @exdate_list: Return value for the list of exception dates, as a list of - * #CalComponentDateTime structures. This should be freed using the - * cal_component_free_exdate_list() function. - * - * Queries the list of exception date properties in a calendar component object. - **/ -void -cal_component_get_exdate_list (CalComponent *comp, GSList **exdate_list) -{ - CalComponentPrivate *priv; - GSList *l; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (exdate_list != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - *exdate_list = NULL; - - for (l = priv->exdate_list; l; l = l->next) { - struct datetime *dt; - CalComponentDateTime *cdt; - - dt = l->data; - - cdt = g_new (CalComponentDateTime, 1); - cdt->value = g_new (struct icaltimetype, 1); - - *cdt->value = icalproperty_get_exdate (dt->prop); - - if (dt->tzid_param) - cdt->tzid = g_strdup (icalparameter_get_tzid (dt->tzid_param)); - else - cdt->tzid = NULL; - - *exdate_list = g_slist_prepend (*exdate_list, cdt); - } - - *exdate_list = g_slist_reverse (*exdate_list); -} - -/** - * cal_component_set_exdate_list: - * @comp: A calendar component object. - * @exdate_list: List of #CalComponentDateTime structures. - * - * Sets the list of exception dates in a calendar component object. - **/ -void -cal_component_set_exdate_list (CalComponent *comp, GSList *exdate_list) -{ - CalComponentPrivate *priv; - GSList *l; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - /* Remove old exception dates */ - - for (l = priv->exdate_list; l; l = l->next) { - struct datetime *dt; - - dt = l->data; - - /* Removing the DATE or DATE-TIME property will also remove - any TZID parameter. */ - icalcomponent_remove_property (priv->icalcomp, dt->prop); - icalproperty_free (dt->prop); - g_free (dt); - } - - g_slist_free (priv->exdate_list); - priv->exdate_list = NULL; - - /* Add in new exception dates */ - - for (l = exdate_list; l; l = l->next) { - CalComponentDateTime *cdt; - struct datetime *dt; - - g_assert (l->data != NULL); - cdt = l->data; - - g_assert (cdt->value != NULL); - - dt = g_new (struct datetime, 1); - dt->prop = icalproperty_new_exdate (*cdt->value); - - if (cdt->tzid) { - dt->tzid_param = icalparameter_new_tzid ((char *) cdt->tzid); - icalproperty_add_parameter (dt->prop, dt->tzid_param); - } else - dt->tzid_param = NULL; - - icalcomponent_add_property (priv->icalcomp, dt->prop); - priv->exdate_list = g_slist_prepend (priv->exdate_list, dt); - } - - priv->exdate_list = g_slist_reverse (priv->exdate_list); - - priv->need_sequence_inc = TRUE; -} - -/** - * cal_component_has_exdates: - * @comp: A calendar component object. - * - * Queries whether a calendar component object has any exception dates defined - * for it. - * - * Return value: TRUE if the component has exception dates, FALSE otherwise. - **/ -gboolean -cal_component_has_exdates (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_val_if_fail (comp != NULL, FALSE); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); - - priv = comp->priv; - g_return_val_if_fail (priv->icalcomp != NULL, FALSE); - - return (priv->exdate_list != NULL); -} - -/* Gets a list of recurrence rules */ -static void -get_recur_list (GSList *recur_list, - struct icalrecurrencetype (* get_prop_func) (icalproperty *prop), - GSList **list) -{ - GSList *l; - - *list = NULL; - - for (l = recur_list; l; l = l->next) { - icalproperty *prop; - struct icalrecurrencetype *r; - - prop = l->data; - - r = g_new (struct icalrecurrencetype, 1); - *r = (* get_prop_func) (prop); - - *list = g_slist_prepend (*list, r); - } - - *list = g_slist_reverse (*list); -} - -/* Sets a list of recurrence rules */ -static void -set_recur_list (CalComponent *comp, - icalproperty *(* new_prop_func) (struct icalrecurrencetype recur), - GSList **recur_list, - GSList *rl) -{ - CalComponentPrivate *priv; - GSList *l; - - priv = comp->priv; - - /* Remove old recurrences */ - - for (l = *recur_list; l; l = l->next) { - icalproperty *prop; - - prop = l->data; - icalcomponent_remove_property (priv->icalcomp, prop); - icalproperty_free (prop); - } - - g_slist_free (*recur_list); - *recur_list = NULL; - - /* Add in new recurrences */ - - for (l = rl; l; l = l->next) { - icalproperty *prop; - struct icalrecurrencetype *recur; - - g_assert (l->data != NULL); - recur = l->data; - - prop = (* new_prop_func) (*recur); - icalcomponent_add_property (priv->icalcomp, prop); - - *recur_list = g_slist_prepend (*recur_list, prop); - } - - *recur_list = g_slist_reverse (*recur_list); -} - -/** - * cal_component_get_exrule_list: - * @comp: A calendar component object. - * @recur_list: List of exception rules as struct #icalrecurrencetype - * structures. This should be freed using the cal_component_free_recur_list() - * function. - * - * Queries the list of exception rule properties of a calendar component - * object. - **/ -void -cal_component_get_exrule_list (CalComponent *comp, GSList **recur_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (recur_list != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_recur_list (priv->exrule_list, icalproperty_get_exrule, recur_list); -} - -/** - * cal_component_get_exrule_property_list: - * @comp: A calendar component object. - * @recur_list: Returns a list of exception rule properties. - * - * Queries the list of exception rule properties of a calendar component object. - **/ -void -cal_component_get_exrule_property_list (CalComponent *comp, GSList **recur_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (recur_list != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - *recur_list = priv->exrule_list; -} - -/** - * cal_component_set_exrule_list: - * @comp: A calendar component object. - * @recur_list: List of struct #icalrecurrencetype structures. - * - * Sets the list of exception rules in a calendar component object. - **/ -void -cal_component_set_exrule_list (CalComponent *comp, GSList *recur_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_recur_list (comp, icalproperty_new_exrule, &priv->exrule_list, recur_list); - - priv->need_sequence_inc = TRUE; -} - -/** - * cal_component_has_exrules: - * @comp: A calendar component object. - * - * Queries whether a calendar component object has any exception rules defined - * for it. - * - * Return value: TRUE if the component has exception rules, FALSE otherwise. - **/ -gboolean -cal_component_has_exrules (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_val_if_fail (comp != NULL, FALSE); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); - - priv = comp->priv; - g_return_val_if_fail (priv->icalcomp != NULL, FALSE); - - return (priv->exrule_list != NULL); -} - -/** - * cal_component_has_exceptions: - * @comp: A calendar component object - * - * Queries whether a calendar component object has any exception dates - * or exception rules. - * - * Return value: TRUE if the component has exceptions, FALSE otherwise. - **/ -gboolean -cal_component_has_exceptions (CalComponent *comp) -{ - return cal_component_has_exdates (comp) || cal_component_has_exrules (comp); -} - -/** - * cal_component_get_geo: - * @comp: A calendar component object. - * @geo: Return value for the geographic position property. This should be - * freed using the cal_component_free_geo() function. - * - * Sets the geographic position property of a calendar component object. - **/ -void -cal_component_get_geo (CalComponent *comp, struct icalgeotype **geo) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (geo != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (priv->geo) { - *geo = g_new (struct icalgeotype, 1); - **geo = icalproperty_get_geo (priv->geo); - } else - *geo = NULL; -} - -/** - * cal_component_set_geo: - * @comp: A calendar component object. - * @geo: Value for the geographic position property. - * - * Sets the geographic position property on a calendar component object. - **/ -void -cal_component_set_geo (CalComponent *comp, struct icalgeotype *geo) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!geo) { - if (priv->geo) { - icalcomponent_remove_property (priv->icalcomp, priv->geo); - icalproperty_free (priv->geo); - priv->geo = NULL; - } - - return; - } - - if (priv->geo) - icalproperty_set_geo (priv->geo, *geo); - else { - priv->geo = icalproperty_new_geo (*geo); - icalcomponent_add_property (priv->icalcomp, priv->geo); - } -} - -/** - * cal_component_get_last_modified: - * @comp: A calendar component object. - * @t: Return value for the last modified time value. - * - * Queries the time at which a calendar component object was last modified in - * the calendar store. - **/ -void -cal_component_get_last_modified (CalComponent *comp, struct icaltimetype **t) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (t != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_icaltimetype (priv->last_modified, icalproperty_get_lastmodified, t); -} - -/** - * cal_component_set_last_modified: - * @comp: A calendar component object. - * @t: Value for the last time modified. - * - * Sets the time at which a calendar component object was last stored in the - * calendar store. This should not be called by plain calendar user agents. - **/ -void -cal_component_set_last_modified (CalComponent *comp, struct icaltimetype *t) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_icaltimetype (comp, &priv->last_modified, - icalproperty_new_lastmodified, - icalproperty_set_lastmodified, - t); -} - -/** - * cal_component_get_organizer: - * @comp: A calendar component object - * @organizer: A value for the organizer - * - * Queries the organizer property of a calendar component object - **/ -void -cal_component_get_organizer (CalComponent *comp, CalComponentOrganizer *organizer) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (organizer != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (priv->organizer.prop) - organizer->value = icalproperty_get_organizer (priv->organizer.prop); - else - organizer->value = NULL; - - if (priv->organizer.sentby_param) - organizer->sentby = icalparameter_get_sentby (priv->organizer.sentby_param); - else - organizer->sentby = NULL; - - if (priv->organizer.cn_param) - organizer->cn = icalparameter_get_sentby (priv->organizer.cn_param); - else - organizer->cn = NULL; - - if (priv->organizer.language_param) - organizer->language = icalparameter_get_sentby (priv->organizer.language_param); - else - organizer->language = NULL; - -} - -/** - * cal_component_set_organizer: - * @comp: A calendar component object. - * @organizer: Value for the organizer property - * - * Sets the organizer of a calendar component object - **/ -void -cal_component_set_organizer (CalComponent *comp, CalComponentOrganizer *organizer) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!organizer) { - if (priv->organizer.prop) { - icalcomponent_remove_property (priv->icalcomp, priv->organizer.prop); - icalproperty_free (priv->organizer.prop); - - priv->organizer.prop = NULL; - priv->organizer.sentby_param = NULL; - priv->organizer.cn_param = NULL; - priv->organizer.language_param = NULL; - } - - return; - } - - g_return_if_fail (organizer->value != NULL); - - if (priv->organizer.prop) - icalproperty_set_organizer (priv->organizer.prop, (char *) organizer->value); - else { - priv->organizer.prop = icalproperty_new_organizer ((char *) organizer->value); - icalcomponent_add_property (priv->icalcomp, priv->organizer.prop); - } - - if (organizer->sentby) { - g_assert (priv->organizer.prop != NULL); - - if (priv->organizer.sentby_param) - icalparameter_set_sentby (priv->organizer.sentby_param, - (char *) organizer->sentby); - else { - priv->organizer.sentby_param = icalparameter_new_sentby ( - (char *) organizer->sentby); - icalproperty_add_parameter (priv->organizer.prop, - priv->organizer.sentby_param); - } - } else if (priv->organizer.sentby_param) { - icalproperty_remove_parameter (priv->organizer.prop, ICAL_SENTBY_PARAMETER); - icalparameter_free (priv->organizer.sentby_param); - priv->organizer.sentby_param = NULL; - } - - if (organizer->cn) { - g_assert (priv->organizer.prop != NULL); - - if (priv->organizer.cn_param) - icalparameter_set_cn (priv->organizer.cn_param, - (char *) organizer->cn); - else { - priv->organizer.cn_param = icalparameter_new_cn ( - (char *) organizer->cn); - icalproperty_add_parameter (priv->organizer.prop, - priv->organizer.cn_param); - } - } else if (priv->organizer.cn_param) { - icalproperty_remove_parameter (priv->organizer.prop, ICAL_CN_PARAMETER); - icalparameter_free (priv->organizer.cn_param); - priv->organizer.cn_param = NULL; - } - - if (organizer->language) { - g_assert (priv->organizer.prop != NULL); - - if (priv->organizer.language_param) - icalparameter_set_language (priv->organizer.language_param, - (char *) organizer->language); - else { - priv->organizer.language_param = icalparameter_new_language ( - (char *) organizer->language); - icalproperty_add_parameter (priv->organizer.prop, - priv->organizer.language_param); - } - } else if (priv->organizer.language_param) { - icalproperty_remove_parameter (priv->organizer.prop, ICAL_LANGUAGE_PARAMETER); - icalparameter_free (priv->organizer.language_param); - priv->organizer.language_param = NULL; - } - - -} - - -/** - * cal_component_has_organizer: - * @comp: - * - * - * - * Return value: - **/ -gboolean -cal_component_has_organizer (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_val_if_fail (comp != NULL, FALSE); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); - - priv = comp->priv; - - return priv->organizer.prop != NULL; -} - -/** - * cal_component_get_percent: - * @comp: A calendar component object. - * @percent: Return value for the percent-complete property. This should be - * freed using the cal_component_free_percent() function. - * - * Queries the percent-complete property of a calendar component object. - **/ -void -cal_component_get_percent (CalComponent *comp, int **percent) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (percent != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (priv->percent) { - *percent = g_new (int, 1); - **percent = icalproperty_get_percentcomplete (priv->percent); - } else - *percent = NULL; -} - -/** - * cal_component_set_percent: - * @comp: A calendar component object. - * @percent: Value for the percent-complete property. - * - * Sets the percent-complete property of a calendar component object. - **/ -void -cal_component_set_percent (CalComponent *comp, int *percent) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!percent) { - if (priv->percent) { - icalcomponent_remove_property (priv->icalcomp, priv->percent); - icalproperty_free (priv->percent); - priv->percent = NULL; - } - - return; - } - - g_return_if_fail (*percent >= 0 && *percent <= 100); - - if (priv->percent) - icalproperty_set_percentcomplete (priv->percent, *percent); - else { - priv->percent = icalproperty_new_percentcomplete (*percent); - icalcomponent_add_property (priv->icalcomp, priv->percent); - } -} - -/** - * cal_component_get_priority: - * @comp: A calendar component object. - * @priority: Return value for the priority property. This should be freed using - * the cal_component_free_priority() function. - * - * Queries the priority property of a calendar component object. - **/ -void -cal_component_get_priority (CalComponent *comp, int **priority) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (priority != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (priv->priority) { - *priority = g_new (int, 1); - **priority = icalproperty_get_priority (priv->priority); - } else - *priority = NULL; -} - -/** - * cal_component_set_priority: - * @comp: A calendar component object. - * @priority: Value for the priority property. - * - * Sets the priority property of a calendar component object. - **/ -void -cal_component_set_priority (CalComponent *comp, int *priority) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!priority) { - if (priv->priority) { - icalcomponent_remove_property (priv->icalcomp, priv->priority); - icalproperty_free (priv->priority); - priv->priority = NULL; - } - - return; - } - - g_return_if_fail (*priority >= 0 && *priority <= 9); - - if (priv->priority) - icalproperty_set_priority (priv->priority, *priority); - else { - priv->priority = icalproperty_new_priority (*priority); - icalcomponent_add_property (priv->icalcomp, priv->priority); - } -} - -/** - * cal_component_get_recurid: - * @comp: A calendar component object. - * @recur_id: Return value for the recurrence id property - * - * Queries the recurrence id property of a calendar component object - **/ -void -cal_component_get_recurid (CalComponent *comp, CalComponentRange *recur_id) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (recur_id != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_datetime (&priv->recur_id.recur_time, - icalproperty_get_recurrenceid, - &recur_id->datetime); -} - -/** - * cal_component_set_recurid: - * @comp: A calendar component object. - * @recur_id: Value for the recurrence id property. - * - * Sets the recurrence id property of a calendar component object. - **/ -void -cal_component_set_recurid (CalComponent *comp, CalComponentRange *recur_id) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_datetime (comp, &priv->recur_id.recur_time, - icalproperty_new_recurrenceid, - icalproperty_set_recurrenceid, - &recur_id->datetime); -} - -/** - * cal_component_get_rdate_list: - * @comp: A calendar component object. - * @period_list: Return value for the list of recurrence dates, as a list of - * #CalComponentPeriod structures. This should be freed using the - * cal_component_free_period_list() function. - * - * Queries the list of recurrence date properties in a calendar component - * object. - **/ -void -cal_component_get_rdate_list (CalComponent *comp, GSList **period_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (period_list != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_period_list (priv->rdate_list, icalproperty_get_rdate, period_list); -} - -/** - * cal_component_set_rdate_list: - * @comp: A calendar component object. - * @period_list: List of #CalComponentPeriod structures. - * - * Sets the list of recurrence dates in a calendar component object. - **/ -void -cal_component_set_rdate_list (CalComponent *comp, GSList *period_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_period_list (comp, icalproperty_new_rdate, &priv->rdate_list, period_list); - - priv->need_sequence_inc = TRUE; -} - -/** - * cal_component_has_rdates: - * @comp: A calendar component object. - * - * Queries whether a calendar component object has any recurrence dates defined - * for it. - * - * Return value: TRUE if the component has recurrence dates, FALSE otherwise. - **/ -gboolean -cal_component_has_rdates (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_val_if_fail (comp != NULL, FALSE); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); - - priv = comp->priv; - g_return_val_if_fail (priv->icalcomp != NULL, FALSE); - - return (priv->rdate_list != NULL); -} - -/** - * cal_component_get_rrule_list: - * @comp: A calendar component object. - * @recur_list: List of recurrence rules as struct #icalrecurrencetype - * structures. This should be freed using the cal_component_free_recur_list() - * function. - * - * Queries the list of recurrence rule properties of a calendar component - * object. - **/ -void -cal_component_get_rrule_list (CalComponent *comp, GSList **recur_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (recur_list != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_recur_list (priv->rrule_list, icalproperty_get_rrule, recur_list); -} - -/** - * cal_component_get_rrule_property_list: - * @comp: A calendar component object. - * @recur_list: Returns a list of recurrence rule properties. - * - * Queries a list of recurrence rule properties of a calendar component object. - **/ -void -cal_component_get_rrule_property_list (CalComponent *comp, GSList **recur_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (recur_list != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - *recur_list = priv->rrule_list; -} - -/** - * cal_component_set_rrule_list: - * @comp: A calendar component object. - * @recur_list: List of struct #icalrecurrencetype structures. - * - * Sets the list of recurrence rules in a calendar component object. - **/ -void -cal_component_set_rrule_list (CalComponent *comp, GSList *recur_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_recur_list (comp, icalproperty_new_rrule, &priv->rrule_list, recur_list); - - priv->need_sequence_inc = TRUE; -} - -/** - * cal_component_has_rrules: - * @comp: A calendar component object. - * - * Queries whether a calendar component object has any recurrence rules defined - * for it. - * - * Return value: TRUE if the component has recurrence rules, FALSE otherwise. - **/ -gboolean -cal_component_has_rrules (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_val_if_fail (comp != NULL, FALSE); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); - - priv = comp->priv; - g_return_val_if_fail (priv->icalcomp != NULL, FALSE); - - return (priv->rrule_list != NULL); -} - -/** - * cal_component_has_recurrences: - * @comp: A calendar component object - * - * Queries whether a calendar component object has any recurrence dates or - * recurrence rules. - * - * Return value: TRUE if the component has recurrences, FALSE otherwise. - **/ -gboolean -cal_component_has_recurrences (CalComponent *comp) -{ - return cal_component_has_rdates (comp) || cal_component_has_rrules (comp); -} - -/* Counts the elements in the by_xxx fields of an icalrecurrencetype */ -static int -count_by_xxx (short *field, int max_elements) -{ - int i; - - for (i = 0; i < max_elements; i++) - if (field[i] == ICAL_RECURRENCE_ARRAY_MAX) - break; - - return i; -} - -gboolean -cal_component_has_simple_recurrence (CalComponent *comp) -{ - GSList *rrule_list; - struct icalrecurrencetype *r; - int n_by_second, n_by_minute, n_by_hour; - int n_by_day, n_by_month_day, n_by_year_day; - int n_by_week_no, n_by_month, n_by_set_pos; - int len, i; - gboolean simple = FALSE; - - if (!cal_component_has_recurrences (comp)) - return TRUE; - - cal_component_get_rrule_list (comp, &rrule_list); - len = g_slist_length (rrule_list); - if (len > 1 - || cal_component_has_rdates (comp) - || cal_component_has_exrules (comp)) - goto cleanup; - - /* Down to one rule, so test that one */ - r = rrule_list->data; - - /* Any funky frequency? */ - if (r->freq == ICAL_SECONDLY_RECURRENCE - || r->freq == ICAL_MINUTELY_RECURRENCE - || r->freq == ICAL_HOURLY_RECURRENCE) - goto cleanup; - - /* Any funky BY_* */ -#define N_HAS_BY(field) (count_by_xxx (field, sizeof (field) / sizeof (field[0]))) - - n_by_second = N_HAS_BY (r->by_second); - n_by_minute = N_HAS_BY (r->by_minute); - n_by_hour = N_HAS_BY (r->by_hour); - n_by_day = N_HAS_BY (r->by_day); - n_by_month_day = N_HAS_BY (r->by_month_day); - n_by_year_day = N_HAS_BY (r->by_year_day); - n_by_week_no = N_HAS_BY (r->by_week_no); - n_by_month = N_HAS_BY (r->by_month); - n_by_set_pos = N_HAS_BY (r->by_set_pos); - - if (n_by_second != 0 - || n_by_minute != 0 - || n_by_hour != 0) - goto cleanup; - - switch (r->freq) { - case ICAL_DAILY_RECURRENCE: - if (n_by_day != 0 - || n_by_month_day != 0 - || n_by_year_day != 0 - || n_by_week_no != 0 - || n_by_month != 0 - || n_by_set_pos != 0) - goto cleanup; - - simple = TRUE; - break; - - case ICAL_WEEKLY_RECURRENCE: - if (n_by_month_day != 0 - || n_by_year_day != 0 - || n_by_week_no != 0 - || n_by_month != 0 - || n_by_set_pos != 0) - goto cleanup; - - for (i = 0; i < 8 && r->by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) { - int pos; - pos = icalrecurrencetype_day_position (r->by_day[i]); - - if (pos != 0) - goto cleanup; - } - - simple = TRUE; - break; - - case ICAL_MONTHLY_RECURRENCE: - if (n_by_year_day != 0 - || n_by_week_no != 0 - || n_by_month != 0 - || n_by_set_pos > 1) - goto cleanup; - - if (n_by_month_day == 1) { - int nth; - - if (n_by_set_pos != 0) - goto cleanup; - - nth = r->by_month_day[0]; - if (nth < 1 && nth != -1) - goto cleanup; - - simple = TRUE; - - } else if (n_by_day == 1) { - enum icalrecurrencetype_weekday weekday; - int pos; - - /* Outlook 2000 uses BYDAY=TU;BYSETPOS=2, and will not - accept BYDAY=2TU. So we now use the same as Outlook - by default. */ - - weekday = icalrecurrencetype_day_day_of_week (r->by_day[0]); - pos = icalrecurrencetype_day_position (r->by_day[0]); - - if (pos == 0) { - if (n_by_set_pos != 1) - goto cleanup; - pos = r->by_set_pos[0]; - } else if (pos < 0) { - goto cleanup; - } - - switch (weekday) { - case ICAL_MONDAY_WEEKDAY: - case ICAL_TUESDAY_WEEKDAY: - case ICAL_WEDNESDAY_WEEKDAY: - case ICAL_THURSDAY_WEEKDAY: - case ICAL_FRIDAY_WEEKDAY: - case ICAL_SATURDAY_WEEKDAY: - case ICAL_SUNDAY_WEEKDAY: - break; - - default: - goto cleanup; - } - } else { - goto cleanup; - } - - simple = TRUE; - break; - - case ICAL_YEARLY_RECURRENCE: - if (n_by_day != 0 - || n_by_month_day != 0 - || n_by_year_day != 0 - || n_by_week_no != 0 - || n_by_month != 0 - || n_by_set_pos != 0) - goto cleanup; - - simple = TRUE; - break; - - default: - goto cleanup; - } - - cleanup: - cal_component_free_recur_list (rrule_list); - - return simple; -} - -/** - * cal_component_get_sequence: - * @comp: A calendar component object. - * @sequence: Return value for the sequence number. This should be freed using - * cal_component_free_sequence(). - * - * Queries the sequence number of a calendar component object. - **/ -void -cal_component_get_sequence (CalComponent *comp, int **sequence) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (sequence != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!priv->sequence) { - *sequence = NULL; - return; - } - - *sequence = g_new (int, 1); - **sequence = icalproperty_get_sequence (priv->sequence); -} - -/** - * cal_component_set_sequence: - * @comp: A calendar component object. - * @sequence: Sequence number value. - * - * Sets the sequence number of a calendar component object. Normally this - * function should not be called, since the sequence number is incremented - * automatically at the proper times. - **/ -void -cal_component_set_sequence (CalComponent *comp, int *sequence) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - priv->need_sequence_inc = FALSE; - - if (!sequence) { - if (priv->sequence) { - icalcomponent_remove_property (priv->icalcomp, priv->sequence); - icalproperty_free (priv->sequence); - priv->sequence = NULL; - } - - return; - } - - if (priv->sequence) - icalproperty_set_sequence (priv->sequence, *sequence); - else { - priv->sequence = icalproperty_new_sequence (*sequence); - icalcomponent_add_property (priv->icalcomp, priv->sequence); - } -} - -/** - * cal_component_get_status: - * @comp: A calendar component object. - * @status: Return value for the status value. It is set to #ICAL_STATUS_NONE - * if the component has no status property. - * - * Queries the status property of a calendar component object. - **/ -void -cal_component_get_status (CalComponent *comp, icalproperty_status *status) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (status != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!priv->status) { - *status = ICAL_STATUS_NONE; - return; - } - - *status = icalproperty_get_status (priv->status); -} - -/** - * cal_component_set_status: - * @comp: A calendar component object. - * @status: Status value. You should use #ICAL_STATUS_NONE if you want to unset - * this property. - * - * Sets the status property of a calendar component object. - **/ -void -cal_component_set_status (CalComponent *comp, icalproperty_status status) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - priv->need_sequence_inc = TRUE; - - if (status == ICAL_STATUS_NONE) { - if (priv->status) { - icalcomponent_remove_property (priv->icalcomp, priv->status); - icalproperty_free (priv->status); - priv->status = NULL; - } - - return; - } - - if (priv->status) { - icalproperty_set_status (priv->status, status); - } else { - priv->status = icalproperty_new_status (status); - icalcomponent_add_property (priv->icalcomp, priv->status); - } -} - -/** - * cal_component_get_summary: - * @comp: A calendar component object. - * @summary: Return value for the summary property and its parameters. - * - * Queries the summary of a calendar component object. - **/ -void -cal_component_get_summary (CalComponent *comp, CalComponentText *summary) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (summary != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (priv->summary.prop) - summary->value = icalproperty_get_summary (priv->summary.prop); - else - summary->value = NULL; - - if (priv->summary.altrep_param) - summary->altrep = icalparameter_get_altrep (priv->summary.altrep_param); - else - summary->altrep = NULL; -} - -/** - * cal_component_set_summary: - * @comp: A calendar component object. - * @summary: Summary property and its parameters. - * - * Sets the summary of a calendar component object. - **/ -void -cal_component_set_summary (CalComponent *comp, CalComponentText *summary) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!summary) { - if (priv->summary.prop) { - icalcomponent_remove_property (priv->icalcomp, priv->summary.prop); - icalproperty_free (priv->summary.prop); - - priv->summary.prop = NULL; - priv->summary.altrep_param = NULL; - } - - return; - } - - g_return_if_fail (summary->value != NULL); - - if (priv->summary.prop) - icalproperty_set_summary (priv->summary.prop, (char *) summary->value); - else { - priv->summary.prop = icalproperty_new_summary ((char *) summary->value); - icalcomponent_add_property (priv->icalcomp, priv->summary.prop); - } - - if (summary->altrep) { - g_assert (priv->summary.prop != NULL); - - if (priv->summary.altrep_param) - icalparameter_set_altrep (priv->summary.altrep_param, - (char *) summary->altrep); - else { - priv->summary.altrep_param = icalparameter_new_altrep ( - (char *) summary->altrep); - icalproperty_add_parameter (priv->summary.prop, - priv->summary.altrep_param); - } - } else if (priv->summary.altrep_param) { - icalproperty_remove_parameter (priv->summary.prop, ICAL_ALTREP_PARAMETER); - icalparameter_free (priv->summary.altrep_param); - priv->summary.altrep_param = NULL; - } -} - -/** - * cal_component_get_transparency: - * @comp: A calendar component object. - * @transp: Return value for the time transparency. - * - * Queries the time transparency of a calendar component object. - **/ -void -cal_component_get_transparency (CalComponent *comp, CalComponentTransparency *transp) -{ - CalComponentPrivate *priv; - const char *val; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (transp != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!priv->transparency) { - *transp = CAL_COMPONENT_TRANSP_NONE; - return; - } - - val = icalproperty_get_transp (priv->transparency); - - if (strcasecmp (val, "TRANSPARENT") == 0) - *transp = CAL_COMPONENT_TRANSP_TRANSPARENT; - else if (strcasecmp (val, "OPAQUE") == 0) - *transp = CAL_COMPONENT_TRANSP_OPAQUE; - else - *transp = CAL_COMPONENT_TRANSP_UNKNOWN; -} - -/** - * cal_component_set_transparency: - * @comp: A calendar component object. - * @transp: Time transparency value. - * - * Sets the time transparency of a calendar component object. - **/ -void -cal_component_set_transparency (CalComponent *comp, CalComponentTransparency transp) -{ - CalComponentPrivate *priv; - char *str; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (transp != CAL_COMPONENT_TRANSP_UNKNOWN); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - - if (transp == CAL_COMPONENT_TRANSP_NONE) { - if (priv->transparency) { - icalcomponent_remove_property (priv->icalcomp, priv->transparency); - icalproperty_free (priv->transparency); - priv->transparency = NULL; - } - - return; - } - - switch (transp) { - case CAL_COMPONENT_TRANSP_TRANSPARENT: - str = "TRANSPARENT"; - break; - - case CAL_COMPONENT_TRANSP_OPAQUE: - str = "OPAQUE"; - break; - - default: - g_assert_not_reached (); - str = NULL; - } - - if (priv->transparency) - icalproperty_set_transp (priv->transparency, str); - else { - priv->transparency = icalproperty_new_transp (str); - icalcomponent_add_property (priv->icalcomp, priv->transparency); - } -} - -/** - * cal_component_get_url: - * @comp: A calendar component object. - * @url: Return value for the URL. - * - * Queries the uniform resource locator property of a calendar component object. - **/ -void -cal_component_get_url (CalComponent *comp, const char **url) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (url != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (priv->url) - *url = icalproperty_get_url (priv->url); - else - *url = NULL; -} - -/** - * cal_component_set_url: - * @comp: A calendar component object. - * @url: URL value. - * - * Sets the uniform resource locator property of a calendar component object. - **/ -void -cal_component_set_url (CalComponent *comp, const char *url) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!url || !(*url)) { - if (priv->url) { - icalcomponent_remove_property (priv->icalcomp, priv->url); - icalproperty_free (priv->url); - priv->url = NULL; - } - - return; - } - - if (priv->url) - icalproperty_set_url (priv->url, (char *) url); - else { - priv->url = icalproperty_new_url ((char *) url); - icalcomponent_add_property (priv->icalcomp, priv->url); - } -} - -/* Gets a text list value */ -static void -get_attendee_list (GSList *attendee_list, GSList **al) -{ - GSList *l; - - *al = NULL; - - if (!attendee_list) - return; - - for (l = attendee_list; l; l = l->next) { - struct attendee *attendee; - CalComponentAttendee *a; - - attendee = l->data; - g_assert (attendee->prop != NULL); - - a = g_new0 (CalComponentAttendee, 1); - a->value = icalproperty_get_attendee (attendee->prop); - - if (attendee->member_param) - a->member = icalparameter_get_member (attendee->member_param); - if (attendee->cutype_param) - a->cutype = icalparameter_get_cutype (attendee->cutype_param); - if (attendee->role_param) - a->role = icalparameter_get_role (attendee->role_param); - if (attendee->partstat_param) - a->status = icalparameter_get_role (attendee->partstat_param); - if (attendee->rsvp_param && icalparameter_get_rsvp (attendee->rsvp_param) == ICAL_RSVP_TRUE) - a->rsvp = TRUE; - else - a->rsvp = FALSE; - if (attendee->delfrom_param) - a->delfrom = icalparameter_get_sentby (attendee->delfrom_param); - if (attendee->delto_param) - a->delto = icalparameter_get_sentby (attendee->delto_param); - if (attendee->sentby_param) - a->sentby = icalparameter_get_sentby (attendee->sentby_param); - if (attendee->cn_param) - a->cn = icalparameter_get_sentby (attendee->cn_param); - if (attendee->language_param) - a->language = icalparameter_get_sentby (attendee->language_param); - - *al = g_slist_prepend (*al, a); - } - - *al = g_slist_reverse (*al); -} - - -/* Sets a text list value */ -static void -set_attendee_list (CalComponent *comp, - GSList **attendee_list, - GSList *al) -{ - CalComponentPrivate *priv; - GSList *l; - - priv = comp->priv; - - /* Remove old attendees */ - - for (l = *attendee_list; l; l = l->next) { - struct attendee *attendee; - - attendee = l->data; - g_assert (attendee->prop != NULL); - - icalcomponent_remove_property (priv->icalcomp, attendee->prop); - icalproperty_free (attendee->prop); - g_free (attendee); - } - - g_slist_free (*attendee_list); - *attendee_list = NULL; - - /* Add in new attendees */ - - for (l = al; l; l = l->next) { - CalComponentAttendee *a; - struct attendee *attendee; - - a = l->data; - g_return_if_fail (a->value != NULL); - - attendee = g_new0 (struct attendee, 1); - - attendee->prop = icalproperty_new_attendee (a->value); - icalcomponent_add_property (priv->icalcomp, attendee->prop); - - if (a->member) { - attendee->member_param = icalparameter_new_member (a->member); - icalproperty_add_parameter (attendee->prop, attendee->member_param); - } - - attendee->cutype_param = icalparameter_new_cutype (a->cutype); - icalproperty_add_parameter (attendee->prop, attendee->cutype_param); - - attendee->role_param = icalparameter_new_role (a->role); - icalproperty_add_parameter (attendee->prop, attendee->role_param); - - attendee->partstat_param = icalparameter_new_partstat (a->status); - icalproperty_add_parameter (attendee->prop, attendee->partstat_param); - - if (a->rsvp) - attendee->rsvp_param = icalparameter_new_rsvp (ICAL_RSVP_TRUE); - else - attendee->rsvp_param = icalparameter_new_rsvp (ICAL_RSVP_FALSE); - icalproperty_add_parameter (attendee->prop, attendee->rsvp_param); - - if (a->delfrom) { - attendee->delfrom_param = icalparameter_new_delegatedfrom (a->delfrom); - icalproperty_add_parameter (attendee->prop, attendee->delfrom_param); - } - if (a->delto) { - attendee->delto_param = icalparameter_new_delegatedto (a->delto); - icalproperty_add_parameter (attendee->prop, attendee->delto_param); - } - if (a->sentby) { - attendee->sentby_param = icalparameter_new_sentby (a->sentby); - icalproperty_add_parameter (attendee->prop, attendee->sentby_param); - } - if (a->cn) { - attendee->cn_param = icalparameter_new_cn (a->cn); - icalproperty_add_parameter (attendee->prop, attendee->cn_param); - } - if (a->language) { - attendee->language_param = icalparameter_new_language (a->language); - icalproperty_add_parameter (attendee->prop, attendee->language_param); - } - - *attendee_list = g_slist_prepend (*attendee_list, attendee); - } - - *attendee_list = g_slist_reverse (*attendee_list); -} - -/** - * cal_component_get_attendee_list: - * @comp: A calendar component object. - * @attendee_list: Return value for the attendee property. - * This should be freed using the cal_component_free_attendee_list () - * function. - * - * Queries the attendee properties of the calendar component object - **/ -void -cal_component_get_attendee_list (CalComponent *comp, GSList **attendee_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (attendee_list != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - get_attendee_list (priv->attendee_list, attendee_list); -} - -/** - * cal_component_set_attendee_list: - * @comp: A calendar component object. - * @attendee_list: Values for attendee properties - * - * Sets the attendees of a calendar component object - **/ -void -cal_component_set_attendee_list (CalComponent *comp, GSList *attendee_list) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - set_attendee_list (comp, &priv->attendee_list, attendee_list); -} - -gboolean -cal_component_has_attendees (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_val_if_fail (comp != NULL, FALSE); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); - - priv = comp->priv; - - if (g_slist_length (priv->attendee_list) > 0) - return TRUE; - - return FALSE; -} - -/** - * cal_component_get_location: - * @comp: A calendar component object. - * @url: Return value for the location. - * - * Queries the location property of a calendar component object. - **/ -void -cal_component_get_location (CalComponent *comp, const char **location) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (location != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (priv->location) - *location = icalproperty_get_location (priv->location); - else - *location = NULL; -} - -/** - * cal_component_set_location: - * @comp: A calendar component object. - * @url: Location value. - * - * Sets the location property of a calendar component object. - **/ -void -cal_component_set_location (CalComponent *comp, const char *location) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - if (!location || !(*location)) { - if (priv->location) { - icalcomponent_remove_property (priv->icalcomp, priv->location); - icalproperty_free (priv->location); - priv->location = NULL; - } - - return; - } - - if (priv->location) - icalproperty_set_location (priv->location, (char *) location); - else { - priv->location = icalproperty_new_location ((char *) location); - icalcomponent_add_property (priv->icalcomp, priv->location); - } -} - - - -/** - * cal_component_free_categories_list: - * @categ_list: List of category strings. - * - * Frees a list of category strings. - **/ -void -cal_component_free_categories_list (GSList *categ_list) -{ - GSList *l; - - for (l = categ_list; l; l = l->next) - g_free (l->data); - - g_slist_free (categ_list); -} - -/** - * cal_component_free_datetime: - * @dt: A date/time structure. - * - * Frees a date/time structure. - **/ -void -cal_component_free_datetime (CalComponentDateTime *dt) -{ - g_return_if_fail (dt != NULL); - - g_free (dt->value); - g_free ((char*)dt->tzid); -} - -/** - * cal_component_free_exdate_list: - * @exdate_list: List of #CalComponentDateTime structures. - * - * Frees a list of #CalComponentDateTime structures as returned by the - * cal_component_get_exdate_list() function. - **/ -void -cal_component_free_exdate_list (GSList *exdate_list) -{ - GSList *l; - - for (l = exdate_list; l; l = l->next) { - CalComponentDateTime *cdt; - - g_assert (l->data != NULL); - cdt = l->data; - - g_assert (cdt->value != NULL); - g_free (cdt->value); - g_free ((char*)cdt->tzid); - - g_free (cdt); - } - - g_slist_free (exdate_list); -} - -/** - * cal_component_free_geo: - * @geo: An #icalgeotype structure. - * - * Frees a struct #icalgeotype structure as returned by the calendar component - * functions. - **/ -void -cal_component_free_geo (struct icalgeotype *geo) -{ - g_return_if_fail (geo != NULL); - - g_free (geo); -} - -/** - * cal_component_free_icaltimetype: - * @t: An #icaltimetype structure. - * - * Frees a struct #icaltimetype value as returned by the calendar component - * functions. - **/ -void -cal_component_free_icaltimetype (struct icaltimetype *t) -{ - g_return_if_fail (t != NULL); - - g_free (t); -} - -/** - * cal_component_free_percent: - * @percent: Percent value. - * - * Frees a percent value as returned by the cal_component_get_percent() - * function. - **/ -void -cal_component_free_percent (int *percent) -{ - g_return_if_fail (percent != NULL); - - g_free (percent); -} - -/** - * cal_component_free_priority: - * @priority: Priority value. - * - * Frees a priority value as returned by the cal_component_get_priority() - * function. - **/ -void -cal_component_free_priority (int *priority) -{ - g_return_if_fail (priority != NULL); - - g_free (priority); -} - -/** - * cal_component_free_period_list: - * @period_list: List of #CalComponentPeriod structures. - * - * Frees a list of #CalComponentPeriod structures. - **/ -void -cal_component_free_period_list (GSList *period_list) -{ - GSList *l; - - for (l = period_list; l; l = l->next) { - CalComponentPeriod *period; - - g_assert (l->data != NULL); - - period = l->data; - g_free (period); - } - - g_slist_free (period_list); -} - -/** - * cal_component_free_recur_list: - * @recur_list: List of struct #icalrecurrencetype structures. - * - * Frees a list of struct #icalrecurrencetype structures. - **/ -void -cal_component_free_recur_list (GSList *recur_list) -{ - GSList *l; - - for (l = recur_list; l; l = l->next) { - struct icalrecurrencetype *r; - - g_assert (l->data != NULL); - r = l->data; - - g_free (r); - } - - g_slist_free (recur_list); -} - -/** - * cal_component_free_sequence: - * @sequence: Sequence number value. - * - * Frees a sequence number value. - **/ -void -cal_component_free_sequence (int *sequence) -{ - g_return_if_fail (sequence != NULL); - - g_free (sequence); -} - -/** - * cal_component_free_text_list: - * @text_list: List of #CalComponentText structures. - * - * Frees a list of #CalComponentText structures. This function should only be - * used to free lists of text values as returned by the other getter functions - * of #CalComponent. - **/ -void -cal_component_free_text_list (GSList *text_list) -{ - GSList *l; - - for (l = text_list; l; l = l->next) { - CalComponentText *text; - - g_assert (l->data != NULL); - - text = l->data; - g_return_if_fail (text != NULL); - g_free (text); - } - - g_slist_free (text_list); -} - -/** - * cal_component_free_attendee_list: - * @attendee_list: - * - * - **/ -void -cal_component_free_attendee_list (GSList *attendee_list) -{ - GSList *l; - - for (l = attendee_list; l; l = l->next) { - CalComponentAttendee *attendee; - - g_assert (l->data != NULL); - - attendee = l->data; - g_return_if_fail (attendee != NULL); - g_free (attendee); - } - - g_slist_free (attendee_list); -} - - - -/** - * cal_component_has_alarms: - * @comp: A calendar component object. - * - * Checks whether the component has any alarms. - * - * Return value: TRUE if the component has any alarms. - **/ -gboolean -cal_component_has_alarms (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_val_if_fail (comp != NULL, FALSE); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE); - - priv = comp->priv; - g_return_val_if_fail (priv->icalcomp != NULL, FALSE); - - return g_hash_table_size (priv->alarm_uid_hash) != 0; -} - -/** - * cal_component_add_alarm: - * @comp: A calendar component. - * @alarm: An alarm. - * - * Adds an alarm subcomponent to a calendar component. You should have created - * the @alarm by using cal_component_alarm_new(); it is invalid to use a - * #CalComponentAlarm structure that came from cal_component_get_alarm(). After - * adding the alarm, the @alarm structure is no longer valid because the - * internal structures may change and you should get rid of it by using - * cal_component_alarm_free(). - **/ -void -cal_component_add_alarm (CalComponent *comp, CalComponentAlarm *alarm) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (alarm != NULL); - - priv = comp->priv; - - add_alarm (comp, alarm->icalcomp, icalproperty_get_x (alarm->uid)); - icalcomponent_add_component (priv->icalcomp, alarm->icalcomp); -} - -/** - * cal_component_remove_alarm: - * @comp: A calendar component. - * @auid: UID of the alarm to remove. - * - * Removes an alarm subcomponent from a calendar component. If the alarm that - * corresponds to the specified @auid had been fetched with - * cal_component_get_alarm(), then those alarm structures will be invalid; you - * should get rid of them with cal_component_alarm_free() before using this - * function. - **/ -void -cal_component_remove_alarm (CalComponent *comp, const char *auid) -{ - CalComponentPrivate *priv; - icalcomponent *alarm; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - g_return_if_fail (auid != NULL); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - alarm = g_hash_table_lookup (priv->alarm_uid_hash, auid); - if (!alarm) - return; - - g_hash_table_remove (priv->alarm_uid_hash, auid); - icalcomponent_remove_component (priv->icalcomp, alarm); - icalcomponent_free (alarm); -} - -static gboolean -for_each_remove_all_alarms (gpointer key, gpointer value, gpointer data) -{ - CalComponent *comp = CAL_COMPONENT (data); - CalComponentPrivate *priv; - icalcomponent *alarm = value; - - priv = comp->priv; - - icalcomponent_remove_component (priv->icalcomp, alarm); - icalcomponent_free (alarm); - - return TRUE; -} - -/** - * cal_component_remove_all_alarms: - * @comp: A calendar component - * - * Remove all alarms from the calendar component - **/ -void -cal_component_remove_all_alarms (CalComponent *comp) -{ - CalComponentPrivate *priv; - - g_return_if_fail (comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - priv = comp->priv; - g_return_if_fail (priv->icalcomp != NULL); - - g_hash_table_foreach_remove (priv->alarm_uid_hash, for_each_remove_all_alarms, comp); -} - - -/* Scans an icalproperty from a calendar component and adds its mapping to our - * own alarm structure. - */ -static void -scan_alarm_property (CalComponentAlarm *alarm, icalproperty *prop) -{ - icalproperty_kind kind; - const char *xname; - - kind = icalproperty_isa (prop); - - switch (kind) { - case ICAL_ACTION_PROPERTY: - alarm->action = prop; - break; - - case ICAL_ATTACH_PROPERTY: - /* FIXME: mail alarms may have any number of these, not just one */ - alarm->attach = prop; - break; - - case ICAL_DESCRIPTION_PROPERTY: - alarm->description.prop = prop; - alarm->description.altrep_param = icalproperty_get_first_parameter ( - prop, ICAL_ALTREP_PARAMETER); - break; - - case ICAL_DURATION_PROPERTY: - alarm->duration = prop; - break; - - case ICAL_REPEAT_PROPERTY: - alarm->repeat = prop; - break; - - case ICAL_TRIGGER_PROPERTY: - alarm->trigger = prop; - break; - - case ICAL_X_PROPERTY: - xname = icalproperty_get_x_name (prop); - g_assert (xname != NULL); - - if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0) - alarm->uid = prop; - - break; - - default: - break; - } -} - -/* Creates a CalComponentAlarm from a libical alarm subcomponent */ -static CalComponentAlarm * -make_alarm (icalcomponent *subcomp) -{ - CalComponentAlarm *alarm; - icalproperty *prop; - - alarm = g_new (CalComponentAlarm, 1); - - alarm->icalcomp = subcomp; - alarm->uid = NULL; - - alarm->action = NULL; - alarm->attach = NULL; - alarm->description.prop = NULL; - alarm->description.altrep_param = NULL; - alarm->duration = NULL; - alarm->repeat = NULL; - alarm->trigger = NULL; - - for (prop = icalcomponent_get_first_property (subcomp, ICAL_ANY_PROPERTY); - prop; - prop = icalcomponent_get_next_property (subcomp, ICAL_ANY_PROPERTY)) - scan_alarm_property (alarm, prop); - - g_assert (alarm->uid != NULL); - - return alarm; -} - -/** - * cal_component_get_alarm_uids: - * @comp: A calendar component. - * - * Builds a list of the unique identifiers of the alarm subcomponents inside a - * calendar component. - * - * Return value: List of unique identifiers for alarms. This should be freed - * using cal_obj_uid_list_free(). - **/ -GList * -cal_component_get_alarm_uids (CalComponent *comp) -{ - CalComponentPrivate *priv; - icalcompiter iter; - GList *l; - - g_return_val_if_fail (comp != NULL, NULL); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL); - - priv = comp->priv; - g_return_val_if_fail (priv->icalcomp != NULL, NULL); - - l = NULL; - for (iter = icalcomponent_begin_component (priv->icalcomp, ICAL_VALARM_COMPONENT); - icalcompiter_deref (&iter) != NULL; - icalcompiter_next (&iter)) { - icalcomponent *subcomp; - icalproperty *prop; - - subcomp = icalcompiter_deref (&iter); - for (prop = icalcomponent_get_first_property (subcomp, ICAL_X_PROPERTY); - prop; - prop = icalcomponent_get_next_property (subcomp, ICAL_X_PROPERTY)) { - const char *xname; - - xname = icalproperty_get_x_name (prop); - g_assert (xname != NULL); - - if (strcmp (xname, EVOLUTION_ALARM_UID_PROPERTY) == 0) { - const char *auid; - - auid = alarm_uid_from_prop (prop); - l = g_list_append (l, g_strdup (auid)); - } - } - } - - return l; -} - -/** - * cal_component_get_alarm: - * @comp: A calendar component. - * @auid: Unique identifier for the sought alarm subcomponent. - * - * Queries a particular alarm subcomponent of a calendar component. - * - * Return value: The alarm subcomponent that corresponds to the specified @auid, - * or #NULL if no alarm exists with that UID. This should be freed using - * cal_component_alarm_free(). - **/ -CalComponentAlarm * -cal_component_get_alarm (CalComponent *comp, const char *auid) -{ - CalComponentPrivate *priv; - icalcomponent *alarm; - - g_return_val_if_fail (comp != NULL, NULL); - g_return_val_if_fail (IS_CAL_COMPONENT (comp), NULL); - - priv = comp->priv; - g_return_val_if_fail (priv->icalcomp != NULL, NULL); - - g_return_val_if_fail (auid != NULL, NULL); - - alarm = g_hash_table_lookup (priv->alarm_uid_hash, auid); - - if (alarm) - return make_alarm (alarm); - else - return NULL; -} - -/** - * cal_component_alarms_free: - * @alarms: Component alarms structure. - * - * Frees a #CalComponentAlarms structure. - **/ -void -cal_component_alarms_free (CalComponentAlarms *alarms) -{ - GSList *l; - - g_return_if_fail (alarms != NULL); - - g_assert (alarms->comp != NULL); - g_object_unref (G_OBJECT (alarms->comp)); - - for (l = alarms->alarms; l; l = l->next) { - CalAlarmInstance *instance; - - instance = l->data; - g_assert (instance != NULL); - g_free (instance); - } - - g_slist_free (alarms->alarms); - g_free (alarms); -} - -/** - * cal_component_alarm_new: - * - * - * - * Return value: a new alarm component - **/ -CalComponentAlarm * -cal_component_alarm_new (void) -{ - CalComponentAlarm *alarm; - char *new_auid ; - - alarm = g_new (CalComponentAlarm, 1); - - alarm->icalcomp = icalcomponent_new (ICAL_VALARM_COMPONENT); - - new_auid = cal_component_gen_uid (); - alarm->uid = icalproperty_new_x (new_auid); - icalproperty_set_x_name (alarm->uid, EVOLUTION_ALARM_UID_PROPERTY); - icalcomponent_add_property (alarm->icalcomp, alarm->uid); - g_free (new_auid); - - alarm->action = NULL; - alarm->attach = NULL; - alarm->description.prop = NULL; - alarm->description.altrep_param = NULL; - alarm->duration = NULL; - alarm->repeat = NULL; - alarm->trigger = NULL; - - return alarm; -} - -/** - * cal_component_alarm_clone: - * @alarm: An alarm subcomponent. - * - * Creates a new alarm subcomponent by copying the information from another one. - * - * Return value: A newly-created alarm subcomponent with the same values as the - * original one. Should be freed with cal_component_alarm_free(). - **/ -CalComponentAlarm * -cal_component_alarm_clone (CalComponentAlarm *alarm) -{ - icalcomponent *icalcomp; - - g_return_val_if_fail (alarm != NULL, NULL); - - icalcomp = icalcomponent_new_clone (alarm->icalcomp); - return make_alarm (icalcomp); -} - -/** - * cal_component_alarm_free: - * @alarm: A calendar alarm. - * - * Frees an alarm structure. - **/ -void -cal_component_alarm_free (CalComponentAlarm *alarm) -{ - g_return_if_fail (alarm != NULL); - - g_assert (alarm->icalcomp != NULL); - - if (icalcomponent_get_parent (alarm->icalcomp) == NULL) - icalcomponent_free (alarm->icalcomp); - - alarm->icalcomp = NULL; - alarm->uid = NULL; - alarm->action = NULL; - alarm->attach = NULL; - alarm->description.prop = NULL; - alarm->description.altrep_param = NULL; - alarm->duration = NULL; - alarm->repeat = NULL; - alarm->trigger = NULL; - - g_free (alarm); -} - -/** - * cal_component_alarm_get_uid: - * @alarm: An alarm subcomponent. - * - * Queries the unique identifier of an alarm subcomponent. - * - * Return value: UID of the alarm. - **/ -const char * -cal_component_alarm_get_uid (CalComponentAlarm *alarm) -{ - g_return_val_if_fail (alarm != NULL, NULL); - - return alarm_uid_from_prop (alarm->uid); -} - -/** - * cal_component_alarm_get_action: - * @alarm: An alarm. - * @action: Return value for the alarm's action type. - * - * Queries the action type of an alarm. - **/ -void -cal_component_alarm_get_action (CalComponentAlarm *alarm, CalAlarmAction *action) -{ - enum icalproperty_action ipa; - - g_return_if_fail (alarm != NULL); - g_return_if_fail (action != NULL); - - g_assert (alarm->icalcomp != NULL); - - if (!alarm->action) { - *action = CAL_ALARM_NONE; - return; - } - - ipa = icalproperty_get_action (alarm->action); - - switch (ipa) { - case ICAL_ACTION_AUDIO: - *action = CAL_ALARM_AUDIO; - break; - - case ICAL_ACTION_DISPLAY: - *action = CAL_ALARM_DISPLAY; - break; - - case ICAL_ACTION_EMAIL: - *action = CAL_ALARM_EMAIL; - break; - - case ICAL_ACTION_PROCEDURE: - *action = CAL_ALARM_PROCEDURE; - break; - - case ICAL_ACTION_NONE: - *action = CAL_ALARM_NONE; - break; - - default: - *action = CAL_ALARM_UNKNOWN; - } -} - -/** - * cal_component_alarm_set_action: - * @alarm: An alarm. - * @action: Action type. - * - * Sets the action type for an alarm. - **/ -void -cal_component_alarm_set_action (CalComponentAlarm *alarm, CalAlarmAction action) -{ - enum icalproperty_action ipa; - - g_return_if_fail (alarm != NULL); - g_return_if_fail (action != CAL_ALARM_NONE); - g_return_if_fail (action != CAL_ALARM_UNKNOWN); - - g_assert (alarm->icalcomp != NULL); - - switch (action) { - case CAL_ALARM_AUDIO: - ipa = ICAL_ACTION_AUDIO; - break; - - case CAL_ALARM_DISPLAY: - ipa = ICAL_ACTION_DISPLAY; - break; - - case CAL_ALARM_EMAIL: - ipa = ICAL_ACTION_EMAIL; - break; - - case CAL_ALARM_PROCEDURE: - ipa = ICAL_ACTION_PROCEDURE; - break; - - default: - g_assert_not_reached (); - ipa = ICAL_ACTION_NONE; - } - - if (alarm->action) - icalproperty_set_action (alarm->action, ipa); - else { - alarm->action = icalproperty_new_action (ipa); - icalcomponent_add_property (alarm->icalcomp, alarm->action); - } -} - -/** - * cal_component_alarm_get_attach: - * @alarm: An alarm. - * @attach: Return value for the attachment; should be freed using icalattach_unref(). - * - * Queries the attachment property of an alarm. - **/ -void -cal_component_alarm_get_attach (CalComponentAlarm *alarm, icalattach **attach) -{ - g_return_if_fail (alarm != NULL); - g_return_if_fail (attach != NULL); - - g_assert (alarm->icalcomp != NULL); - - if (alarm->attach) { - *attach = icalproperty_get_attach (alarm->attach); - icalattach_ref (*attach); - } else - *attach = NULL; -} - -/** - * cal_component_alarm_set_attach: - * @alarm: An alarm. - * @attach: Attachment property or NULL to remove an existing property. - * - * Sets the attachment property of an alarm. - **/ -void -cal_component_alarm_set_attach (CalComponentAlarm *alarm, icalattach *attach) -{ - g_return_if_fail (alarm != NULL); - - g_assert (alarm->icalcomp != NULL); - - if (alarm->attach) { - icalcomponent_remove_property (alarm->icalcomp, alarm->attach); - icalproperty_free (alarm->attach); - alarm->attach = NULL; - } - - if (attach) { - alarm->attach = icalproperty_new_attach (attach); - icalcomponent_add_property (alarm->icalcomp, alarm->attach); - } -} - -/** - * cal_component_alarm_get_description: - * @alarm: An alarm. - * @description: Return value for the description property and its parameters. - * - * Queries the description property of an alarm. - **/ -void -cal_component_alarm_get_description (CalComponentAlarm *alarm, CalComponentText *description) -{ - g_return_if_fail (alarm != NULL); - g_return_if_fail (description != NULL); - - g_assert (alarm->icalcomp != NULL); - - if (alarm->description.prop) - description->value = icalproperty_get_description (alarm->description.prop); - else - description->value = NULL; - - if (alarm->description.altrep_param) - description->altrep = icalparameter_get_altrep (alarm->description.altrep_param); - else - description->altrep = NULL; -} - -/** - * cal_component_alarm_set_description: - * @alarm: An alarm. - * @description: Description property and its parameters, or NULL for no description. - * - * Sets the description property of an alarm. - **/ -void -cal_component_alarm_set_description (CalComponentAlarm *alarm, CalComponentText *description) -{ - g_return_if_fail (alarm != NULL); - - g_assert (alarm->icalcomp != NULL); - - if (alarm->description.prop) { - icalcomponent_remove_property (alarm->icalcomp, alarm->description.prop); - icalproperty_free (alarm->description.prop); - - alarm->description.prop = NULL; - alarm->description.altrep_param = NULL; - } - - if (!description) - return; - - g_return_if_fail (description->value != NULL); - - alarm->description.prop = icalproperty_new_description (description->value); - icalcomponent_add_property (alarm->icalcomp, alarm->description.prop); - - if (description->altrep) { - alarm->description.altrep_param = icalparameter_new_altrep ( - (char *) description->altrep); - icalproperty_add_parameter (alarm->description.prop, - alarm->description.altrep_param); - } -} - -/** - * cal_component_alarm_get_repeat: - * @alarm: An alarm. - * @repeat: Return value for the repeat/duration properties. - * - * Queries the repeat/duration properties of an alarm. - **/ -void -cal_component_alarm_get_repeat (CalComponentAlarm *alarm, CalAlarmRepeat *repeat) -{ - g_return_if_fail (alarm != NULL); - g_return_if_fail (repeat != NULL); - - g_assert (alarm->icalcomp != NULL); - - if (!(alarm->repeat && alarm->duration)) { - repeat->repetitions = 0; - memset (&repeat->duration, 0, sizeof (repeat->duration)); - return; - } - - repeat->repetitions = icalproperty_get_repeat (alarm->repeat); - repeat->duration = icalproperty_get_duration (alarm->duration); -} - -/** - * cal_component_alarm_set_repeat: - * @alarm: An alarm. - * @repeat: Repeat/duration values. To remove any repetitions from the alarm, - * set the @repeat.repetitions to 0. - * - * Sets the repeat/duration values for an alarm. - **/ -void -cal_component_alarm_set_repeat (CalComponentAlarm *alarm, CalAlarmRepeat repeat) -{ - g_return_if_fail (alarm != NULL); - g_return_if_fail (repeat.repetitions >= 0); - - g_assert (alarm->icalcomp != NULL); - - /* Delete old properties */ - - if (alarm->repeat) { - icalcomponent_remove_property (alarm->icalcomp, alarm->repeat); - icalproperty_free (alarm->repeat); - alarm->repeat = NULL; - } - - if (alarm->duration) { - icalcomponent_remove_property (alarm->icalcomp, alarm->duration); - icalproperty_free (alarm->duration); - alarm->duration = NULL; - } - - /* Set the new properties */ - - if (repeat.repetitions == 0) - return; /* For zero extra repetitions the properties should not exist */ - - alarm->repeat = icalproperty_new_repeat (repeat.repetitions); - icalcomponent_add_property (alarm->icalcomp, alarm->repeat); - - alarm->duration = icalproperty_new_duration (repeat.duration); - icalcomponent_add_property (alarm->icalcomp, alarm->duration); -} - -/** - * cal_component_alarm_get_trigger: - * @alarm: An alarm. - * @trigger: Return value for the trigger time. - * - * Queries the trigger time for an alarm. - **/ -void -cal_component_alarm_get_trigger (CalComponentAlarm *alarm, CalAlarmTrigger *trigger) -{ - icalparameter *param; - struct icaltriggertype t; - gboolean relative; - - g_return_if_fail (alarm != NULL); - g_return_if_fail (trigger != NULL); - - g_assert (alarm->icalcomp != NULL); - - if (!alarm->trigger) { - trigger->type = CAL_ALARM_TRIGGER_NONE; - return; - } - - /* Get trigger type */ - - param = icalproperty_get_first_parameter (alarm->trigger, ICAL_VALUE_PARAMETER); - if (param) { - icalparameter_value value; - - value = icalparameter_get_value (param); - - switch (value) { - case ICAL_VALUE_DURATION: - relative = TRUE; - break; - - case ICAL_VALUE_DATETIME: - relative = FALSE; - break; - - default: - g_message ("cal_component_alarm_get_trigger(): Unknown value for trigger " - "value %d; using RELATIVE", value); - - relative = TRUE; - break; - } - } else - relative = TRUE; - - /* Get trigger value and the RELATED parameter */ - - t = icalproperty_get_trigger (alarm->trigger); - - if (relative) { - trigger->u.rel_duration = t.duration; - - param = icalproperty_get_first_parameter (alarm->trigger, ICAL_RELATED_PARAMETER); - if (param) { - icalparameter_related rel; - - rel = icalparameter_get_related (param); - - switch (rel) { - case ICAL_RELATED_START: - trigger->type = CAL_ALARM_TRIGGER_RELATIVE_START; - break; - - case ICAL_RELATED_END: - trigger->type = CAL_ALARM_TRIGGER_RELATIVE_END; - break; - - default: - g_assert_not_reached (); - } - } else - trigger->type = CAL_ALARM_TRIGGER_RELATIVE_START; - } else { - trigger->u.abs_time = t.time; - trigger->type = CAL_ALARM_TRIGGER_ABSOLUTE; - } -} - -/** - * cal_component_alarm_set_trigger: - * @alarm: An alarm. - * @trigger: Trigger time structure. - * - * Sets the trigger time of an alarm. - **/ -void -cal_component_alarm_set_trigger (CalComponentAlarm *alarm, CalAlarmTrigger trigger) -{ - struct icaltriggertype t; - icalparameter *param; - icalparameter_value value_type; - icalparameter_related related; - - g_return_if_fail (alarm != NULL); - g_return_if_fail (trigger.type != CAL_ALARM_TRIGGER_NONE); - - g_assert (alarm->icalcomp != NULL); - - /* Delete old trigger */ - - if (alarm->trigger) { - icalcomponent_remove_property (alarm->icalcomp, alarm->trigger); - icalproperty_free (alarm->trigger); - alarm->trigger = NULL; - } - - /* Set the value */ - - related = ICAL_RELATED_START; /* Keep GCC happy */ - - t.time = icaltime_null_time (); - t.duration = icaldurationtype_null_duration (); - switch (trigger.type) { - case CAL_ALARM_TRIGGER_RELATIVE_START: - t.duration = trigger.u.rel_duration; - value_type = ICAL_VALUE_DURATION; - related = ICAL_RELATED_START; - break; - - case CAL_ALARM_TRIGGER_RELATIVE_END: - t.duration = trigger.u.rel_duration; - value_type = ICAL_VALUE_DURATION; - related = ICAL_RELATED_END; - break; - - case CAL_ALARM_TRIGGER_ABSOLUTE: - t.time = trigger.u.abs_time; - value_type = ICAL_VALUE_DATETIME; - break; - - default: - g_assert_not_reached (); - return; - } - - alarm->trigger = icalproperty_new_trigger (t); - icalcomponent_add_property (alarm->icalcomp, alarm->trigger); - - /* Value parameters */ - - param = icalproperty_get_first_parameter (alarm->trigger, ICAL_VALUE_PARAMETER); - if (param) - icalparameter_set_value (param, value_type); - else { - param = icalparameter_new_value (value_type); - icalproperty_add_parameter (alarm->trigger, param); - } - - /* Related parameter */ - - if (trigger.type != CAL_ALARM_TRIGGER_ABSOLUTE) { - param = icalproperty_get_first_parameter (alarm->trigger, ICAL_RELATED_PARAMETER); - - if (param) - icalparameter_set_related (param, related); - else { - param = icalparameter_new_related (related); - icalproperty_add_parameter (alarm->trigger, param); - } - } -} - -/** - * cal_component_alarm_get_icalcomponent - * @alarm: An alarm. - * - * Get the icalcomponent associated with the given #CalComponentAlarm. - * - * Returns: the icalcomponent. - */ -icalcomponent * -cal_component_alarm_get_icalcomponent (CalComponentAlarm *alarm) -{ - g_return_val_if_fail (alarm != NULL, NULL); - return alarm->icalcomp; -} - -/* Returns TRUE if both strings match, i.e. they are both NULL or the - strings are equal. */ -static gboolean -cal_component_strings_match (const gchar *string1, - const gchar *string2) -{ - if (string1 == NULL || string2 == NULL) - return (string1 == string2) ? TRUE : FALSE; - - if (!strcmp (string1, string2)) - return TRUE; - - return FALSE; -} - - -/** - * cal_component_event_dates_match: - * @comp1: A calendar component object. - * @comp2: A calendar component object. - * - * Checks if the DTSTART and DTEND properties of the 2 components match. - * Note that the events may have different recurrence properties which are not - * taken into account here. - * - * Returns: TRUE if the DTSTART and DTEND properties of the 2 components match. - **/ -gboolean -cal_component_event_dates_match (CalComponent *comp1, - CalComponent *comp2) -{ - CalComponentDateTime comp1_dtstart, comp1_dtend; - CalComponentDateTime comp2_dtstart, comp2_dtend; - gboolean retval = TRUE; - - cal_component_get_dtstart (comp1, &comp1_dtstart); - cal_component_get_dtend (comp1, &comp1_dtend); - cal_component_get_dtstart (comp2, &comp2_dtstart); - cal_component_get_dtend (comp2, &comp2_dtend); - - /* If either value is NULL they must both be NULL to match. */ - if (comp1_dtstart.value == NULL || comp2_dtstart.value == NULL) { - if (comp1_dtstart.value != comp2_dtstart.value) { - retval = FALSE; - goto out; - } - } else { - if (icaltime_compare (*comp1_dtstart.value, - *comp2_dtstart.value)) { - retval = FALSE; - goto out; - } - } - - if (comp1_dtend.value == NULL || comp2_dtend.value == NULL) { - if (comp1_dtend.value != comp2_dtend.value) { - retval = FALSE; - goto out; - } - } else { - if (icaltime_compare (*comp1_dtend.value, - *comp2_dtend.value)) { - retval = FALSE; - goto out; - } - } - - /* Now check the timezones. */ - if (!cal_component_strings_match (comp1_dtstart.tzid, - comp2_dtstart.tzid)) { - retval = FALSE; - goto out; - } - - if (!cal_component_strings_match (comp1_dtend.tzid, - comp2_dtend.tzid)) { - retval = FALSE; - } - - out: - - cal_component_free_datetime (&comp1_dtstart); - cal_component_free_datetime (&comp1_dtend); - cal_component_free_datetime (&comp2_dtstart); - cal_component_free_datetime (&comp2_dtend); - - return retval; -} - - diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h deleted file mode 100644 index dba2e5a179..0000000000 --- a/calendar/cal-util/cal-component.h +++ /dev/null @@ -1,443 +0,0 @@ -/* Evolution calendar - iCalendar component object - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_COMPONENT_H -#define CAL_COMPONENT_H - -#include <glib/gmacros.h> -#include <time.h> -#include <glib-object.h> -#include <ical.h> - -G_BEGIN_DECLS - - - -#define CAL_COMPONENT_TYPE (cal_component_get_type ()) -#define CAL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_COMPONENT_TYPE, CalComponent)) -#define CAL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_COMPONENT_TYPE, \ - CalComponentClass)) -#define IS_CAL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_COMPONENT_TYPE)) -#define IS_CAL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_COMPONENT_TYPE)) - -/* Types of calendar components to be stored by a CalComponent, as per RFC 2445. - * We don't put the alarm component type here since we store alarms as separate - * structures inside the other "real" components. - */ -typedef enum { - CAL_COMPONENT_NO_TYPE, - CAL_COMPONENT_EVENT, - CAL_COMPONENT_TODO, - CAL_COMPONENT_JOURNAL, - CAL_COMPONENT_FREEBUSY, - CAL_COMPONENT_TIMEZONE -} CalComponentVType; - -/* Field identifiers for a calendar component; these are used by the data model - * for ETable. - * - * NOTE: These are also used in the ETable specification, and the column - * numbers are saved in the user settings file. So don't reorder them! - */ -typedef enum { - CAL_COMPONENT_FIELD_CATEGORIES, /* concatenation of the categories list */ - CAL_COMPONENT_FIELD_CLASSIFICATION, - CAL_COMPONENT_FIELD_COMPLETED, - CAL_COMPONENT_FIELD_DTEND, - CAL_COMPONENT_FIELD_DTSTART, - CAL_COMPONENT_FIELD_DUE, - CAL_COMPONENT_FIELD_GEO, - CAL_COMPONENT_FIELD_PERCENT, - CAL_COMPONENT_FIELD_PRIORITY, - CAL_COMPONENT_FIELD_SUMMARY, - CAL_COMPONENT_FIELD_TRANSPARENCY, - CAL_COMPONENT_FIELD_URL, - CAL_COMPONENT_FIELD_HAS_ALARMS, /* not a real field */ - CAL_COMPONENT_FIELD_ICON, /* not a real field */ - CAL_COMPONENT_FIELD_COMPLETE, /* not a real field */ - CAL_COMPONENT_FIELD_RECURRING, /* not a real field */ - CAL_COMPONENT_FIELD_OVERDUE, /* not a real field */ - CAL_COMPONENT_FIELD_COLOR, /* not a real field */ - CAL_COMPONENT_FIELD_STATUS, - CAL_COMPONENT_FIELD_COMPONENT, /* not a real field */ -#if 0 - CAL_COMPONENT_FIELD_LOCATION, -#endif - CAL_COMPONENT_FIELD_NUM_FIELDS -} CalComponentField; - -/* Structures and enumerations to return properties and their parameters */ - -/* CLASSIFICATION property */ -typedef enum { - CAL_COMPONENT_CLASS_NONE, - CAL_COMPONENT_CLASS_PUBLIC, - CAL_COMPONENT_CLASS_PRIVATE, - CAL_COMPONENT_CLASS_CONFIDENTIAL, - CAL_COMPONENT_CLASS_UNKNOWN -} CalComponentClassification; - -/* Properties that have time and timezone information */ -typedef struct { - /* Actual date/time value */ - struct icaltimetype *value; - - /* Timezone ID */ - const char *tzid; -} CalComponentDateTime; - -/* Way in which a period of time is specified */ -typedef enum { - CAL_COMPONENT_PERIOD_DATETIME, - CAL_COMPONENT_PERIOD_DURATION -} CalComponentPeriodType; - -/* Period of time, can have explicit start/end times or start/duration instead */ -typedef struct { - CalComponentPeriodType type; - - struct icaltimetype start; - - union { - struct icaltimetype end; - struct icaldurationtype duration; - } u; -} CalComponentPeriod; - -/* The type of range */ -typedef enum { - CAL_COMPONENT_RANGE_SINGLE, - CAL_COMPONENT_RANGE_THISPRIOR, - CAL_COMPONENT_RANGE_THISFUTURE, -} CalComponentRangeType; - -typedef struct { - CalComponentRangeType type; - - CalComponentDateTime datetime; -} CalComponentRange; - -/* Text properties */ -typedef struct { - /* Description string */ - const char *value; - - /* Alternate representation URI */ - const char *altrep; -} CalComponentText; - -/* Time transparency */ -typedef enum { - CAL_COMPONENT_TRANSP_NONE, - CAL_COMPONENT_TRANSP_TRANSPARENT, - CAL_COMPONENT_TRANSP_OPAQUE, - CAL_COMPONENT_TRANSP_UNKNOWN -} CalComponentTransparency; - -/* Organizer & Attendee */ -typedef struct { - const char *value; - - const char *member; - icalparameter_cutype cutype; - icalparameter_role role; - icalparameter_partstat status; - gboolean rsvp; - - const char *delto; - const char *delfrom; - const char *sentby; - const char *cn; - const char *language; -} CalComponentAttendee; - -typedef struct { - const char *value; - const char *sentby; - const char *cn; - const char *language; -} CalComponentOrganizer; - -/* Main calendar component object */ - -typedef struct _CalComponent CalComponent; -typedef struct _CalComponentClass CalComponentClass; - -typedef struct _CalComponentPrivate CalComponentPrivate; - -struct _CalComponent { - GObject object; - - /* Private data */ - CalComponentPrivate *priv; -}; - -struct _CalComponentClass { - GObjectClass parent_class; -}; - -/* Calendar component */ - -GType cal_component_get_type (void); - -char *cal_component_gen_uid (void); - -CalComponent *cal_component_new (void); - -CalComponent *cal_component_clone (CalComponent *comp); - -void cal_component_set_new_vtype (CalComponent *comp, CalComponentVType type); - -gboolean cal_component_set_icalcomponent (CalComponent *comp, icalcomponent *icalcomp); -icalcomponent *cal_component_get_icalcomponent (CalComponent *comp); -void cal_component_rescan (CalComponent *comp); -void cal_component_strip_errors (CalComponent *comp); - -CalComponentVType cal_component_get_vtype (CalComponent *comp); - -char *cal_component_get_as_string (CalComponent *comp); - -void cal_component_commit_sequence (CalComponent *comp); -void cal_component_abort_sequence (CalComponent *comp); - -void cal_component_get_uid (CalComponent *comp, const char **uid); -void cal_component_set_uid (CalComponent *comp, const char *uid); - -void cal_component_get_categories (CalComponent *comp, const char **categories); -void cal_component_set_categories (CalComponent *comp, const char *categories); -void cal_component_get_categories_list (CalComponent *comp, GSList **categ_list); -void cal_component_set_categories_list (CalComponent *comp, GSList *categ_list); - -void cal_component_get_classification (CalComponent *comp, CalComponentClassification *classif); -void cal_component_set_classification (CalComponent *comp, CalComponentClassification classif); - -void cal_component_get_comment_list (CalComponent *comp, GSList **text_list); -void cal_component_set_comment_list (CalComponent *comp, GSList *text_list); - -void cal_component_get_completed (CalComponent *comp, struct icaltimetype **t); -void cal_component_set_completed (CalComponent *comp, struct icaltimetype *t); - -void cal_component_get_contact_list (CalComponent *comp, GSList **text_list); -void cal_component_set_contact_list (CalComponent *comp, GSList *text_list); - -void cal_component_get_created (CalComponent *comp, struct icaltimetype **t); -void cal_component_set_created (CalComponent *comp, struct icaltimetype *t); - -void cal_component_get_description_list (CalComponent *comp, GSList **text_list); -void cal_component_set_description_list (CalComponent *comp, GSList *text_list); - -void cal_component_get_dtend (CalComponent *comp, CalComponentDateTime *dt); -void cal_component_set_dtend (CalComponent *comp, CalComponentDateTime *dt); - -void cal_component_get_dtstamp (CalComponent *comp, struct icaltimetype *t); -void cal_component_set_dtstamp (CalComponent *comp, struct icaltimetype *t); - -void cal_component_get_dtstart (CalComponent *comp, CalComponentDateTime *dt); -void cal_component_set_dtstart (CalComponent *comp, CalComponentDateTime *dt); - -void cal_component_get_due (CalComponent *comp, CalComponentDateTime *dt); -void cal_component_set_due (CalComponent *comp, CalComponentDateTime *dt); - -void cal_component_get_exdate_list (CalComponent *comp, GSList **exdate_list); -void cal_component_set_exdate_list (CalComponent *comp, GSList *exdate_list); -gboolean cal_component_has_exdates (CalComponent *comp); - -void cal_component_get_exrule_list (CalComponent *comp, GSList **recur_list); -void cal_component_get_exrule_property_list (CalComponent *comp, GSList **recur_list); -void cal_component_set_exrule_list (CalComponent *comp, GSList *recur_list); -gboolean cal_component_has_exrules (CalComponent *comp); - -gboolean cal_component_has_exceptions (CalComponent *comp); - -void cal_component_get_geo (CalComponent *comp, struct icalgeotype **geo); -void cal_component_set_geo (CalComponent *comp, struct icalgeotype *geo); - -void cal_component_get_last_modified (CalComponent *comp, struct icaltimetype **t); -void cal_component_set_last_modified (CalComponent *comp, struct icaltimetype *t); - -void cal_component_get_organizer (CalComponent *comp, CalComponentOrganizer *organizer); -void cal_component_set_organizer (CalComponent *comp, CalComponentOrganizer *organizer); -gboolean cal_component_has_organizer (CalComponent *comp); - -void cal_component_get_percent (CalComponent *comp, int **percent); -void cal_component_set_percent (CalComponent *comp, int *percent); - -void cal_component_get_priority (CalComponent *comp, int **priority); -void cal_component_set_priority (CalComponent *comp, int *priority); - -void cal_component_get_recurid (CalComponent *comp, CalComponentRange *recur_id); -void cal_component_set_recurid (CalComponent *comp, CalComponentRange *recur_id); - -void cal_component_get_rdate_list (CalComponent *comp, GSList **period_list); -void cal_component_set_rdate_list (CalComponent *comp, GSList *period_list); -gboolean cal_component_has_rdates (CalComponent *comp); - -void cal_component_get_rrule_list (CalComponent *comp, GSList **recur_list); -void cal_component_get_rrule_property_list (CalComponent *comp, GSList **recur_list); -void cal_component_set_rrule_list (CalComponent *comp, GSList *recur_list); -gboolean cal_component_has_rrules (CalComponent *comp); - -gboolean cal_component_has_recurrences (CalComponent *comp); -gboolean cal_component_has_simple_recurrence (CalComponent *comp); - -void cal_component_get_sequence (CalComponent *comp, int **sequence); -void cal_component_set_sequence (CalComponent *comp, int *sequence); - -void cal_component_get_status (CalComponent *comp, icalproperty_status *status); -void cal_component_set_status (CalComponent *comp, icalproperty_status status); - -void cal_component_get_summary (CalComponent *comp, CalComponentText *summary); -void cal_component_set_summary (CalComponent *comp, CalComponentText *summary); - -void cal_component_get_transparency (CalComponent *comp, CalComponentTransparency *transp); -void cal_component_set_transparency (CalComponent *comp, CalComponentTransparency transp); - -void cal_component_get_url (CalComponent *comp, const char **url); -void cal_component_set_url (CalComponent *comp, const char *url); - -void cal_component_get_attendee_list (CalComponent *comp, GSList **attendee_list); -void cal_component_set_attendee_list (CalComponent *comp, GSList *attendee_list); -gboolean cal_component_has_attendees (CalComponent *comp); - -void cal_component_get_location (CalComponent *comp, const char **location); -void cal_component_set_location (CalComponent *comp, const char *location); - -gboolean cal_component_event_dates_match (CalComponent *comp1, CalComponent *comp2); - - -/* Functions to free returned values */ - -void cal_component_free_categories_list (GSList *categ_list); -void cal_component_free_datetime (CalComponentDateTime *dt); -void cal_component_free_exdate_list (GSList *exdate_list); -void cal_component_free_geo (struct icalgeotype *geo); -void cal_component_free_icaltimetype (struct icaltimetype *t); -void cal_component_free_percent (int *percent); -void cal_component_free_priority (int *priority); -void cal_component_free_period_list (GSList *period_list); -void cal_component_free_recur_list (GSList *recur_list); -void cal_component_free_sequence (int *sequence); -void cal_component_free_text_list (GSList *text_list); -void cal_component_free_attendee_list (GSList *attendee_list); - -/* Alarms */ - -/* Opaque structure used to represent alarm subcomponents */ -typedef struct _CalComponentAlarm CalComponentAlarm; - -/* An alarm occurrence, i.e. a trigger instance */ -typedef struct { - /* UID of the alarm that triggered */ - const char *auid; - - /* Trigger time, i.e. "5 minutes before the appointment" */ - time_t trigger; - - /* Actual event occurrence to which this trigger corresponds */ - time_t occur_start; - time_t occur_end; -} CalAlarmInstance; - -/* Alarm trigger instances for a particular component */ -typedef struct { - /* The actual component */ - CalComponent *comp; - - /* List of CalAlarmInstance structures */ - GSList *alarms; -} CalComponentAlarms; - -/* Alarm types */ -typedef enum { - CAL_ALARM_NONE, - CAL_ALARM_AUDIO, - CAL_ALARM_DISPLAY, - CAL_ALARM_EMAIL, - CAL_ALARM_PROCEDURE, - CAL_ALARM_UNKNOWN -} CalAlarmAction; - -/* Whether a trigger is relative to the start or end of an event occurrence, or - * whether it is specified to occur at an absolute time. - */ -typedef enum { - CAL_ALARM_TRIGGER_NONE, - CAL_ALARM_TRIGGER_RELATIVE_START, - CAL_ALARM_TRIGGER_RELATIVE_END, - CAL_ALARM_TRIGGER_ABSOLUTE -} CalAlarmTriggerType; - -typedef struct { - CalAlarmTriggerType type; - - union { - struct icaldurationtype rel_duration; - struct icaltimetype abs_time; - } u; -} CalAlarmTrigger; - -typedef struct { - /* Number of extra repetitions, zero for none */ - int repetitions; - - /* Interval between repetitions */ - struct icaldurationtype duration; -} CalAlarmRepeat; - -gboolean cal_component_has_alarms (CalComponent *comp); -void cal_component_add_alarm (CalComponent *comp, CalComponentAlarm *alarm); -void cal_component_remove_alarm (CalComponent *comp, const char *auid); -void cal_component_remove_all_alarms (CalComponent *comp); - -GList *cal_component_get_alarm_uids (CalComponent *comp); -CalComponentAlarm *cal_component_get_alarm (CalComponent *comp, const char *auid); - -void cal_component_alarms_free (CalComponentAlarms *alarms); - -/* CalComponentAlarms */ -CalComponentAlarm *cal_component_alarm_new (void); -CalComponentAlarm *cal_component_alarm_clone (CalComponentAlarm *alarm); -void cal_component_alarm_free (CalComponentAlarm *alarm); - -const char *cal_component_alarm_get_uid (CalComponentAlarm *alarm); - -void cal_component_alarm_get_action (CalComponentAlarm *alarm, CalAlarmAction *action); -void cal_component_alarm_set_action (CalComponentAlarm *alarm, CalAlarmAction action); - -void cal_component_alarm_get_attach (CalComponentAlarm *alarm, icalattach **attach); -void cal_component_alarm_set_attach (CalComponentAlarm *alarm, icalattach *attach); - -void cal_component_alarm_get_description (CalComponentAlarm *alarm, CalComponentText *description); -void cal_component_alarm_set_description (CalComponentAlarm *alarm, CalComponentText *description); - -void cal_component_alarm_get_repeat (CalComponentAlarm *alarm, CalAlarmRepeat *repeat); -void cal_component_alarm_set_repeat (CalComponentAlarm *alarm, CalAlarmRepeat repeat); - -void cal_component_alarm_get_trigger (CalComponentAlarm *alarm, CalAlarmTrigger *trigger); -void cal_component_alarm_set_trigger (CalComponentAlarm *alarm, CalAlarmTrigger trigger); - -icalcomponent *cal_component_alarm_get_icalcomponent (CalComponentAlarm *alarm); - - - -G_END_DECLS - -#endif diff --git a/calendar/cal-util/cal-recur.c b/calendar/cal-util/cal-recur.c deleted file mode 100644 index e050004031..0000000000 --- a/calendar/cal-util/cal-recur.c +++ /dev/null @@ -1,3980 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Evolution calendar recurrence rule functions - * - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Damon Chaplin <damon@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <stdlib.h> -#include <string.h> -#include <cal-util/cal-recur.h> -#include <cal-util/timeutil.h> - - -/* - * Introduction to The Recurrence Generation Functions: - * - * Note: This is pretty complicated. See the iCalendar spec (RFC 2445) for - * the specification of the recurrence rules and lots of examples - * (sections 4.3.10 & 4.8.5). We also want to support the older - * vCalendar spec, though this should be easy since it is basically a - * subset of iCalendar. - * - * o An iCalendar event can have any number of recurrence rules specifying - * occurrences of the event, as well as dates & times of specific - * occurrences. It can also have any number of recurrence rules and - * specific dates & times specifying exceptions to the occurrences. - * So we first merge all the occurrences generated, eliminating any - * duplicates, then we generate all the exceptions and remove these to - * form the final set of occurrences. - * - * o There are 7 frequencies of occurrences: YEARLY, MONTHLY, WEEKLY, DAILY, - * HOURLY, MINUTELY & SECONDLY. The 'interval' property specifies the - * multiples of the frequency which we step by. We generate a 'set' of - * occurrences for each period defined by the frequency & interval. - * So for a YEARLY frequency with an interval of 3, we generate a set of - * occurrences for every 3rd year. We use complete years here - any - * generated occurrences that occur before the event's start (or after its - * end) are just discarded. - * - * o There are 8 frequency modifiers: BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, - * BYDAY, BYHOUR, BYMINUTE & BYSECOND. These can either add extra occurrences - * or filter out occurrences. For example 'FREQ=YEARLY;BYMONTH=1,2' produces - * 2 occurrences for each year rather than the default 1. And - * 'FREQ=DAILY;BYMONTH=1' filters out all occurrences except those in Jan. - * If the modifier works on periods which are less than the recurrence - * frequency, then extra occurrences are added, otherwise occurrences are - * filtered. So we have 2 functions for each modifier - one to expand events - * and the other to filter. We use a table of functions for each frequency - * which points to the appropriate function to use for each modifier. - * - * o Any number of frequency modifiers can be used in a recurrence rule. - * (Though the iCalendar spec says that BYWEEKNO can only be used in a YEARLY - * rule, and some modifiers aren't appropriate for some frequencies - e.g. - * BYMONTHDAY is not really useful in a WEEKLY frequency, and BYYEARDAY is - * not useful in a MONTHLY or WEEKLY frequency). - * The frequency modifiers are applied in the order given above. The first 5 - * modifier rules (BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY & BYDAY) all - * produce the days on which the occurrences take place, and so we have to - * compute some of these in parallel rather than sequentially, or we may end - * up with too many days. - * - * o Note that some expansion functions may produce days which are invalid, - * e.g. 31st September, 30th Feb. These invalid days are removed before the - * BYHOUR, BYMINUTE & BYSECOND modifier functions are applied. - * - * o After the set of occurrences for the frequency interval are generated, - * the BYSETPOS property is used to select which of the occurrences are - * finally output. If BYSETPOS is not specified then all the occurrences are - * output. - * - * - * FIXME: I think there are a few errors in this code: - * - * 1) I'm not sure it should be generating events in parallel like it says - * above. That needs to be checked. - * - * 2) I didn't think about timezone changes when implementing this. I just - * assumed all the occurrences of the event would be in local time. - * But when clocks go back or forwards due to daylight-saving time, some - * special handling may be needed, especially for the shorter frequencies. - * e.g. for a MINUTELY frequency it should probably iterate over all the - * minutes before and after clocks go back (i.e. some may be the same local - * time but have different UTC offsets). For longer frequencies, if an - * occurrence lands on the overlapping or non-existant time when clocks - * go back/forward, then it may need to choose which of the times to use - * or move the time forward or something. I'm not sure this is clear in the - * spec. - */ - -/* This is the maximum year we will go up to (inclusive). Since we use time_t - values we can't go past 2037 anyway, and some of our VTIMEZONEs may stop - at 2037 as well. */ -#define MAX_YEAR 2037 - -/* Define this for some debugging output. */ -#if 0 -#define CAL_OBJ_DEBUG 1 -#endif - -/* We will use icalrecurrencetype instead of this eventually. */ -typedef struct { - icalrecurrencetype_frequency freq; - - int interval; - - /* Specifies the end of the recurrence, inclusive. No occurrences are - generated after this date. If it is 0, the event recurs forever. */ - time_t enddate; - - /* WKST property - the week start day: 0 = Monday to 6 = Sunday. */ - gint week_start_day; - - - /* NOTE: I've used GList's here, but it doesn't matter if we use - other data structures like arrays. The code should be easy to - change. So long as it is easy to see if the modifier is set. */ - - /* For BYMONTH modifier. A list of GINT_TO_POINTERs, 0-11. */ - GList *bymonth; - - /* For BYWEEKNO modifier. A list of GINT_TO_POINTERs, [+-]1-53. */ - GList *byweekno; - - /* For BYYEARDAY modifier. A list of GINT_TO_POINTERs, [+-]1-366. */ - GList *byyearday; - - /* For BYMONTHDAY modifier. A list of GINT_TO_POINTERs, [+-]1-31. */ - GList *bymonthday; - - /* For BYDAY modifier. A list of GINT_TO_POINTERs, in pairs. - The first of each pair is the weekday, 0 = Monday to 6 = Sunday. - The second of each pair is the week number [+-]0-53. */ - GList *byday; - - /* For BYHOUR modifier. A list of GINT_TO_POINTERs, 0-23. */ - GList *byhour; - - /* For BYMINUTE modifier. A list of GINT_TO_POINTERs, 0-59. */ - GList *byminute; - - /* For BYSECOND modifier. A list of GINT_TO_POINTERs, 0-60. */ - GList *bysecond; - - /* For BYSETPOS modifier. A list of GINT_TO_POINTERs, +ve or -ve. */ - GList *bysetpos; -} CalRecurrence; - -/* This is what we use to pass to all the filter functions. */ -typedef struct _RecurData RecurData; -struct _RecurData { - CalRecurrence *recur; - - /* This is used for the WEEKLY frequency. It is the offset from the - week_start_day. */ - gint weekday_offset; - - /* This is used for fast lookup in BYMONTH filtering. */ - guint8 months[12]; - - /* This is used for fast lookup in BYYEARDAY filtering. */ - guint8 yeardays[367], neg_yeardays[367]; /* Days are 1 - 366. */ - - /* This is used for fast lookup in BYMONTHDAY filtering. */ - guint8 monthdays[32], neg_monthdays[32]; /* Days are 1 to 31. */ - - /* This is used for fast lookup in BYDAY filtering. */ - guint8 weekdays[7]; - - /* This is used for fast lookup in BYHOUR filtering. */ - guint8 hours[24]; - - /* This is used for fast lookup in BYMINUTE filtering. */ - guint8 minutes[60]; - - /* This is used for fast lookup in BYSECOND filtering. */ - guint8 seconds[62]; -}; - -/* This is what we use to represent a date & time. */ -typedef struct _CalObjTime CalObjTime; -struct _CalObjTime { - guint16 year; - guint8 month; /* 0 - 11 */ - guint8 day; /* 1 - 31 */ - guint8 hour; /* 0 - 23 */ - guint8 minute; /* 0 - 59 */ - guint8 second; /* 0 - 59 (maybe up to 61 for leap seconds) */ - guint8 flags; /* The meaning of this depends on where the - CalObjTime is used. In most cases this is - set to TRUE to indicate that this is an - RDATE with an end or a duration set. - In the exceptions code, this is set to TRUE - to indicate that this is an EXDATE with a - DATE value. */ -}; - -/* This is what we use to represent specific recurrence dates. - Note that we assume it starts with a CalObjTime when sorting. */ -typedef struct _CalObjRecurrenceDate CalObjRecurrenceDate; -struct _CalObjRecurrenceDate { - CalObjTime start; - CalComponentPeriod *period; -}; - -/* The paramter we use to store the enddate in RRULE and EXRULE properties. */ -#define EVOLUTION_END_DATE_PARAMETER "X-EVOLUTION-ENDDATE" - -typedef gboolean (*CalObjFindStartFn) (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime); -typedef gboolean (*CalObjFindNextFn) (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end); -typedef GArray* (*CalObjFilterFn) (RecurData *recur_data, - GArray *occs); - -typedef struct _CalRecurVTable CalRecurVTable; -struct _CalRecurVTable { - CalObjFindStartFn find_start_position; - CalObjFindNextFn find_next_position; - - CalObjFilterFn bymonth_filter; - CalObjFilterFn byweekno_filter; - CalObjFilterFn byyearday_filter; - CalObjFilterFn bymonthday_filter; - CalObjFilterFn byday_filter; - CalObjFilterFn byhour_filter; - CalObjFilterFn byminute_filter; - CalObjFilterFn bysecond_filter; -}; - - -/* This is used to specify which parts of the CalObjTime to compare in - cal_obj_time_compare(). */ -typedef enum { - CALOBJ_YEAR, - CALOBJ_MONTH, - CALOBJ_DAY, - CALOBJ_HOUR, - CALOBJ_MINUTE, - CALOBJ_SECOND -} CalObjTimeComparison; - -static void cal_recur_generate_instances_of_rule (CalComponent *comp, - icalproperty *prop, - time_t start, - time_t end, - CalRecurInstanceFn cb, - gpointer cb_data, - CalRecurResolveTimezoneFn tz_cb, - gpointer tz_cb_data, - icaltimezone *default_timezone); - -static CalRecurrence * cal_recur_from_icalproperty (icalproperty *prop, - gboolean exception, - icaltimezone *zone, - gboolean convert_end_date); -static gint cal_recur_ical_weekday_to_weekday (enum icalrecurrencetype_weekday day); -static void cal_recur_free (CalRecurrence *r); - - -static gboolean cal_object_get_rdate_end (CalObjTime *occ, - GArray *rdate_periods); -static void cal_object_compute_duration (CalObjTime *start, - CalObjTime *end, - gint *days, - gint *seconds); - -static gboolean generate_instances_for_chunk (CalComponent *comp, - time_t comp_dtstart, - icaltimezone *zone, - GSList *rrules, - GSList *rdates, - GSList *exrules, - GSList *exdates, - gboolean single_rule, - CalObjTime *event_start, - time_t interval_start, - CalObjTime *chunk_start, - CalObjTime *chunk_end, - gint duration_days, - gint duration_seconds, - gboolean convert_end_date, - CalRecurInstanceFn cb, - gpointer cb_data); - -static GArray* cal_obj_expand_recurrence (CalObjTime *event_start, - icaltimezone *zone, - CalRecurrence *recur, - CalObjTime *interval_start, - CalObjTime *interval_end, - gboolean *finished); - -static GArray* cal_obj_generate_set_yearly (RecurData *recur_data, - CalRecurVTable *vtable, - CalObjTime *occ); -static GArray* cal_obj_generate_set_monthly (RecurData *recur_data, - CalRecurVTable *vtable, - CalObjTime *occ); -static GArray* cal_obj_generate_set_default (RecurData *recur_data, - CalRecurVTable *vtable, - CalObjTime *occ); - - -static CalRecurVTable* cal_obj_get_vtable (icalrecurrencetype_frequency recur_type); -static void cal_obj_initialize_recur_data (RecurData *recur_data, - CalRecurrence *recur, - CalObjTime *event_start); -static void cal_obj_sort_occurrences (GArray *occs); -static gint cal_obj_time_compare_func (const void *arg1, - const void *arg2); -static void cal_obj_remove_duplicates_and_invalid_dates (GArray *occs); -static void cal_obj_remove_exceptions (GArray *occs, - GArray *ex_occs); -static GArray* cal_obj_bysetpos_filter (CalRecurrence *recur, - GArray *occs); - - -static gboolean cal_obj_yearly_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime); -static gboolean cal_obj_yearly_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end); - -static gboolean cal_obj_monthly_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime); -static gboolean cal_obj_monthly_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end); - -static gboolean cal_obj_weekly_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime); -static gboolean cal_obj_weekly_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end); - -static gboolean cal_obj_daily_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime); -static gboolean cal_obj_daily_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end); - -static gboolean cal_obj_hourly_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime); -static gboolean cal_obj_hourly_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end); - -static gboolean cal_obj_minutely_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime); -static gboolean cal_obj_minutely_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end); - -static gboolean cal_obj_secondly_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime); -static gboolean cal_obj_secondly_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end); - -static GArray* cal_obj_bymonth_expand (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_bymonth_filter (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_byweekno_expand (RecurData *recur_data, - GArray *occs); -#if 0 -/* This isn't used at present. */ -static GArray* cal_obj_byweekno_filter (RecurData *recur_data, - GArray *occs); -#endif -static GArray* cal_obj_byyearday_expand (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_byyearday_filter (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_bymonthday_expand (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_bymonthday_filter (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_byday_expand_yearly (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_byday_expand_monthly (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_byday_expand_weekly (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_byday_filter (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_byhour_expand (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_byhour_filter (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_byminute_expand (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_byminute_filter (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_bysecond_expand (RecurData *recur_data, - GArray *occs); -static GArray* cal_obj_bysecond_filter (RecurData *recur_data, - GArray *occs); - -static void cal_obj_time_add_months (CalObjTime *cotime, - gint months); -static void cal_obj_time_add_days (CalObjTime *cotime, - gint days); -static void cal_obj_time_add_hours (CalObjTime *cotime, - gint hours); -static void cal_obj_time_add_minutes (CalObjTime *cotime, - gint minutes); -static void cal_obj_time_add_seconds (CalObjTime *cotime, - gint seconds); -static gint cal_obj_time_compare (CalObjTime *cotime1, - CalObjTime *cotime2, - CalObjTimeComparison type); -static gint cal_obj_time_weekday (CalObjTime *cotime); -static gint cal_obj_time_weekday_offset (CalObjTime *cotime, - CalRecurrence *recur); -static gint cal_obj_time_day_of_year (CalObjTime *cotime); -static void cal_obj_time_find_first_week (CalObjTime *cotime, - RecurData *recur_data); -static void cal_object_time_from_time (CalObjTime *cotime, - time_t t, - icaltimezone *zone); -static gint cal_obj_date_only_compare_func (const void *arg1, - const void *arg2); - - - -static gboolean cal_recur_ensure_end_dates (CalComponent *comp, - gboolean refresh, - CalRecurResolveTimezoneFn tz_cb, - gpointer tz_cb_data); -static gboolean cal_recur_ensure_rule_end_date (CalComponent *comp, - icalproperty *prop, - gboolean exception, - gboolean refresh, - CalRecurResolveTimezoneFn tz_cb, - gpointer tz_cb_data); -static gboolean cal_recur_ensure_rule_end_date_cb (CalComponent *comp, - time_t instance_start, - time_t instance_end, - gpointer data); -static time_t cal_recur_get_rule_end_date (icalproperty *prop, - icaltimezone *default_timezone); -static void cal_recur_set_rule_end_date (icalproperty *prop, - time_t end_date); - - -#ifdef CAL_OBJ_DEBUG -static char* cal_obj_time_to_string (CalObjTime *cotime); -#endif - - -CalRecurVTable cal_obj_yearly_vtable = { - cal_obj_yearly_find_start_position, - cal_obj_yearly_find_next_position, - - cal_obj_bymonth_expand, - cal_obj_byweekno_expand, - cal_obj_byyearday_expand, - cal_obj_bymonthday_expand, - cal_obj_byday_expand_yearly, - cal_obj_byhour_expand, - cal_obj_byminute_expand, - cal_obj_bysecond_expand -}; - -CalRecurVTable cal_obj_monthly_vtable = { - cal_obj_monthly_find_start_position, - cal_obj_monthly_find_next_position, - - cal_obj_bymonth_filter, - NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */ - NULL, /* BYYEARDAY is not useful in a MONTHLY frequency. */ - cal_obj_bymonthday_expand, - cal_obj_byday_expand_monthly, - cal_obj_byhour_expand, - cal_obj_byminute_expand, - cal_obj_bysecond_expand -}; - -CalRecurVTable cal_obj_weekly_vtable = { - cal_obj_weekly_find_start_position, - cal_obj_weekly_find_next_position, - - cal_obj_bymonth_filter, - NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */ - NULL, /* BYYEARDAY is not useful in a WEEKLY frequency. */ - NULL, /* BYMONTHDAY is not useful in a WEEKLY frequency. */ - cal_obj_byday_expand_weekly, - cal_obj_byhour_expand, - cal_obj_byminute_expand, - cal_obj_bysecond_expand -}; - -CalRecurVTable cal_obj_daily_vtable = { - cal_obj_daily_find_start_position, - cal_obj_daily_find_next_position, - - cal_obj_bymonth_filter, - NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */ - cal_obj_byyearday_filter, - cal_obj_bymonthday_filter, - cal_obj_byday_filter, - cal_obj_byhour_expand, - cal_obj_byminute_expand, - cal_obj_bysecond_expand -}; - -CalRecurVTable cal_obj_hourly_vtable = { - cal_obj_hourly_find_start_position, - cal_obj_hourly_find_next_position, - - cal_obj_bymonth_filter, - NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */ - cal_obj_byyearday_filter, - cal_obj_bymonthday_filter, - cal_obj_byday_filter, - cal_obj_byhour_filter, - cal_obj_byminute_expand, - cal_obj_bysecond_expand -}; - -CalRecurVTable cal_obj_minutely_vtable = { - cal_obj_minutely_find_start_position, - cal_obj_minutely_find_next_position, - - cal_obj_bymonth_filter, - NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */ - cal_obj_byyearday_filter, - cal_obj_bymonthday_filter, - cal_obj_byday_filter, - cal_obj_byhour_filter, - cal_obj_byminute_filter, - cal_obj_bysecond_expand -}; - -CalRecurVTable cal_obj_secondly_vtable = { - cal_obj_secondly_find_start_position, - cal_obj_secondly_find_next_position, - - cal_obj_bymonth_filter, - NULL, /* BYWEEKNO is only applicable to YEARLY frequency. */ - cal_obj_byyearday_filter, - cal_obj_bymonthday_filter, - cal_obj_byday_filter, - cal_obj_byhour_filter, - cal_obj_byminute_filter, - cal_obj_bysecond_filter -}; - -/* - * Calls the given callback function for each occurrence of the event that - * intersects the range between the given start and end times (the end time is - * not included). Note that the occurrences may start before the given start - * time. - * - * If the callback routine returns FALSE the occurrence generation stops. - * - * Both start and end can be -1, in which case we start at the events first - * instance and continue until it ends, or forever if it has no enddate. - */ -void -cal_recur_generate_instances (CalComponent *comp, - time_t start, - time_t end, - CalRecurInstanceFn cb, - gpointer cb_data, - CalRecurResolveTimezoneFn tz_cb, - gpointer tz_cb_data, - icaltimezone *default_timezone) -{ -#if 0 - g_print ("In cal_recur_generate_instances comp: %p\n", comp); - g_print (" start: %li - %s", start, ctime (&start)); - g_print (" end : %li - %s", end, ctime (&end)); -#endif - cal_recur_generate_instances_of_rule (comp, NULL, start, end, - cb, cb_data, tz_cb, tz_cb_data, - default_timezone); -} - - -/* - * Calls the given callback function for each occurrence of the given - * recurrence rule between the given start and end times. If the rule is NULL - * it uses all the rules from the component. - * - * If the callback routine returns FALSE the occurrence generation stops. - * - * The use of the specific rule is for determining the end of a rule when - * COUNT is set. The callback will count instances and store the enddate - * when COUNT is reached. - * - * Both start and end can be -1, in which case we start at the events first - * instance and continue until it ends, or forever if it has no enddate. - */ -static void -cal_recur_generate_instances_of_rule (CalComponent *comp, - icalproperty *prop, - time_t start, - time_t end, - CalRecurInstanceFn cb, - gpointer cb_data, - CalRecurResolveTimezoneFn tz_cb, - gpointer tz_cb_data, - icaltimezone *default_timezone) -{ - CalComponentDateTime dtstart, dtend; - time_t dtstart_time, dtend_time; - GSList *rrules = NULL, *rdates = NULL, elem; - GSList *exrules = NULL, *exdates = NULL; - CalObjTime interval_start, interval_end, event_start, event_end; - CalObjTime chunk_start, chunk_end; - gint days, seconds, year; - gboolean single_rule, convert_end_date = FALSE; - icaltimezone *start_zone = NULL, *end_zone = NULL; - - g_return_if_fail (comp != NULL); - g_return_if_fail (cb != NULL); - g_return_if_fail (tz_cb != NULL); - g_return_if_fail (start >= -1); - g_return_if_fail (end >= -1); - - /* Get dtstart, dtend, recurrences, and exceptions. Note that - cal_component_get_dtend() will convert a DURATION property to a - DTEND so we don't need to worry about that. */ - - cal_component_get_dtstart (comp, &dtstart); - cal_component_get_dtend (comp, &dtend); - - if (!dtstart.value) { - g_message ("cal_recur_generate_instances_of_rule(): bogus " - "component, does not have DTSTART. Skipping..."); - goto out; - } - - /* For DATE-TIME values with a TZID, we use the supplied callback to - resolve the TZID. For DATE values and DATE-TIME values without a - TZID (i.e. floating times) we use the default timezone. */ - if (dtstart.tzid && !dtstart.value->is_date) { - start_zone = (*tz_cb) (dtstart.tzid, tz_cb_data); - } else { - start_zone = default_timezone; - - /* Flag that we need to convert the saved ENDDATE property - to the default timezone. */ - convert_end_date = TRUE; - } - - dtstart_time = icaltime_as_timet_with_zone (*dtstart.value, - start_zone); - if (start == -1) - start = dtstart_time; - - if (dtend.value) { - /* If both DTSTART and DTEND are DATE values, and they are the - same day, we add 1 day to DTEND. This means that most - events created with the old Evolution behavior will still - work OK. I'm not sure what Outlook does in this case. */ - if (dtstart.value->is_date && dtend.value->is_date) { - if (icaltime_compare_date_only (*dtstart.value, - *dtend.value) == 0) { - icaltime_adjust (dtend.value, 1, 0, 0, 0); - } - } - } else { - /* If there is no DTEND, then if DTSTART is a DATE-TIME value - we use the same time (so we have a single point in time). - If DTSTART is a DATE value we add 1 day. */ - dtend.value = g_new (struct icaltimetype, 1); - *dtend.value = *dtstart.value; - - if (dtstart.value->is_date) { - icaltime_adjust (dtend.value, 1, 0, 0, 0); - } - } - - if (dtend.tzid && !dtend.value->is_date) { - end_zone = (*tz_cb) (dtend.tzid, tz_cb_data); - } else { - end_zone = default_timezone; - } - - /* We don't do this any more, since Outlook assumes that the DTEND - date is not included. */ -#if 0 - /* If DTEND is a DATE value, we add 1 day to it so that it includes - the entire day. */ - if (dtend.value->is_date) { - dtend.value->hour = 0; - dtend.value->minute = 0; - dtend.value->second = 0; - icaltime_adjust (dtend.value, 1, 0, 0, 0); - } -#endif - dtend_time = icaltime_as_timet_with_zone (*dtend.value, end_zone); - - /* If there is no recurrence, just call the callback if the event - intersects the given interval. */ - if (!(cal_component_has_recurrences (comp) - || cal_component_has_exceptions (comp))) { - if ((end == -1 || dtstart_time < end) && dtend_time > start) { - (* cb) (comp, dtstart_time, dtend_time, cb_data); - } - - goto out; - } - - /* If a specific recurrence rule is being used, set up a simple list, - else get the recurrence rules from the component. */ - if (prop) { - single_rule = TRUE; - - elem.data = prop; - elem.next = NULL; - rrules = &elem; - } else { - single_rule = FALSE; - - /* Make sure all the enddates for the rules are set. */ - cal_recur_ensure_end_dates (comp, FALSE, tz_cb, tz_cb_data); - - cal_component_get_rrule_property_list (comp, &rrules); - cal_component_get_rdate_list (comp, &rdates); - cal_component_get_exrule_property_list (comp, &exrules); - cal_component_get_exdate_list (comp, &exdates); - } - - /* Convert the interval start & end to CalObjTime. Note that if end - is -1 interval_end won't be set, so don't use it! - Also note that we use end - 1 since we want the interval to be - inclusive as it makes the code simpler. We do all calculation - in the timezone of the DTSTART. */ - cal_object_time_from_time (&interval_start, start, start_zone); - if (end != -1) - cal_object_time_from_time (&interval_end, end - 1, start_zone); - - cal_object_time_from_time (&event_start, dtstart_time, start_zone); - cal_object_time_from_time (&event_end, dtend_time, start_zone); - - /* Calculate the duration of the event, which we use for all - occurrences. We can't just subtract start from end since that may - be affected by daylight-saving time. So we want a value of days - + seconds. */ - cal_object_compute_duration (&event_start, &event_end, - &days, &seconds); - - /* Take off the duration from interval_start, so we get occurrences - that start just before the start time but overlap it. But only do - that if the interval is after the event's start time. */ - if (start > dtstart_time) { - cal_obj_time_add_days (&interval_start, -days); - cal_obj_time_add_seconds (&interval_start, -seconds); - } - - /* Expand the recurrence for each year between start & end, or until - the callback returns 0 if end is 0. We do a year at a time to - give the callback function a chance to break out of the loop, and - so we don't get into problems with infinite recurrences. Since we - have to work on complete sets of occurrences, if there is a yearly - frequency it wouldn't make sense to break it into smaller chunks, - since we would then be calculating the same sets several times. - Though this does mean that we sometimes do a lot more work than - is necessary, e.g. if COUNT is set to something quite low. */ - for (year = interval_start.year; - (end == -1 || year <= interval_end.year) && year <= MAX_YEAR; - year++) { - chunk_start = interval_start; - chunk_start.year = year; - if (end != -1) - chunk_end = interval_end; - chunk_end.year = year; - - if (year != interval_start.year) { - chunk_start.month = 0; - chunk_start.day = 1; - chunk_start.hour = 0; - chunk_start.minute = 0; - chunk_start.second = 0; - } - if (end == -1 || year != interval_end.year) { - chunk_end.month = 11; - chunk_end.day = 31; - chunk_end.hour = 23; - chunk_end.minute = 59; - chunk_end.second = 61; - chunk_end.flags = FALSE; - } - - if (!generate_instances_for_chunk (comp, dtstart_time, - start_zone, - rrules, rdates, - exrules, exdates, - single_rule, - &event_start, - start, - &chunk_start, &chunk_end, - days, seconds, - convert_end_date, - cb, cb_data)) - break; - } - - if (!prop) { - cal_component_free_period_list (rdates); - cal_component_free_exdate_list (exdates); - } - - out: - cal_component_free_datetime (&dtstart); - cal_component_free_datetime (&dtend); -} - -/* Builds a list of GINT_TO_POINTER() elements out of a short array from a - * struct icalrecurrencetype. - */ -static GList * -array_to_list (short *array, int max_elements) -{ - GList *l; - int i; - - l = NULL; - - for (i = 0; i < max_elements && array[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) - l = g_list_prepend (l, GINT_TO_POINTER ((int) (array[i]))); - return g_list_reverse (l); -} - -/** - * cal_recur_from_icalproperty: - * @prop: An RRULE or EXRULE #icalproperty. - * @exception: TRUE if this is an EXRULE rather than an RRULE. - * @zone: The DTSTART timezone, used for converting the UNTIL property if it - * is given as a DATE value. - * @convert_end_date: TRUE if the saved end date needs to be converted to the - * given @zone timezone. This is needed if the DTSTART is a DATE or floating - * time. - * - * Converts an #icalproperty to a #CalRecurrence. This should be - * freed using the cal_recur_free() function. - * - * Return value: #CalRecurrence structure. - **/ -static CalRecurrence * -cal_recur_from_icalproperty (icalproperty *prop, gboolean exception, - icaltimezone *zone, gboolean convert_end_date) -{ - struct icalrecurrencetype ir; - CalRecurrence *r; - gint max_elements, i; - GList *elem; - - g_return_val_if_fail (prop != NULL, NULL); - - r = g_new (CalRecurrence, 1); - - if (exception) - ir = icalproperty_get_exrule (prop); - else - ir = icalproperty_get_rrule (prop); - - r->freq = ir.freq; - r->interval = ir.interval; - - if (ir.count != 0) { - /* If COUNT is set, we use the pre-calculated enddate. - Note that this can be 0 if the RULE doesn't actually - generate COUNT instances. */ - r->enddate = cal_recur_get_rule_end_date (prop, convert_end_date ? zone : NULL); - } else { - if (icaltime_is_null_time (ir.until)) { - /* If neither COUNT or UNTIL is set, the event - recurs forever. */ - r->enddate = 0; - } else if (ir.until.is_date) { - /* If UNTIL is a DATE, we stop at the end of - the day, in local time (with the DTSTART timezone). - Note that UNTIL is inclusive so we stop before - midnight. */ - ir.until.hour = 23; - ir.until.minute = 59; - ir.until.second = 59; - ir.until.is_date = FALSE; - - r->enddate = icaltime_as_timet_with_zone (ir.until, - zone); -#if 0 - g_print (" until: %li - %s", r->enddate, ctime (&r->enddate)); -#endif - - } else { - /* If UNTIL is a DATE-TIME, it must be in UTC. */ - icaltimezone *utc_zone; - utc_zone = icaltimezone_get_utc_timezone (); - r->enddate = icaltime_as_timet_with_zone (ir.until, - utc_zone); - } - } - - r->week_start_day = cal_recur_ical_weekday_to_weekday (ir.week_start); - - r->bymonth = array_to_list (ir.by_month, - sizeof (ir.by_month) / sizeof (ir.by_month[0])); - for (elem = r->bymonth; elem; elem = elem->next) { - /* We need to convert from 1-12 to 0-11, i.e. subtract 1. */ - int month = GPOINTER_TO_INT (elem->data) - 1; - elem->data = GINT_TO_POINTER (month); - } - - r->byweekno = array_to_list (ir.by_week_no, - sizeof (ir.by_week_no) / sizeof (ir.by_week_no[0])); - - r->byyearday = array_to_list (ir.by_year_day, - sizeof (ir.by_year_day) / sizeof (ir.by_year_day[0])); - - r->bymonthday = array_to_list (ir.by_month_day, - sizeof (ir.by_month_day) / sizeof (ir.by_month_day[0])); - - /* FIXME: libical only supports 8 values, out of possible 107 * 7. */ - r->byday = NULL; - max_elements = sizeof (ir.by_day) / sizeof (ir.by_day[0]); - for (i = 0; i < max_elements && ir.by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) { - enum icalrecurrencetype_weekday day; - gint weeknum, weekday; - - day = icalrecurrencetype_day_day_of_week (ir.by_day[i]); - weeknum = icalrecurrencetype_day_position (ir.by_day[i]); - - weekday = cal_recur_ical_weekday_to_weekday (day); - - r->byday = g_list_prepend (r->byday, - GINT_TO_POINTER (weeknum)); - r->byday = g_list_prepend (r->byday, - GINT_TO_POINTER (weekday)); - } - - r->byhour = array_to_list (ir.by_hour, - sizeof (ir.by_hour) / sizeof (ir.by_hour[0])); - - r->byminute = array_to_list (ir.by_minute, - sizeof (ir.by_minute) / sizeof (ir.by_minute[0])); - - r->bysecond = array_to_list (ir.by_second, - sizeof (ir.by_second) / sizeof (ir.by_second[0])); - - r->bysetpos = array_to_list (ir.by_set_pos, - sizeof (ir.by_set_pos) / sizeof (ir.by_set_pos[0])); - - return r; -} - - -static gint -cal_recur_ical_weekday_to_weekday (enum icalrecurrencetype_weekday day) -{ - gint weekday; - - switch (day) { - case ICAL_NO_WEEKDAY: /* Monday is the default in RFC2445. */ - case ICAL_MONDAY_WEEKDAY: - weekday = 0; - break; - case ICAL_TUESDAY_WEEKDAY: - weekday = 1; - break; - case ICAL_WEDNESDAY_WEEKDAY: - weekday = 2; - break; - case ICAL_THURSDAY_WEEKDAY: - weekday = 3; - break; - case ICAL_FRIDAY_WEEKDAY: - weekday = 4; - break; - case ICAL_SATURDAY_WEEKDAY: - weekday = 5; - break; - case ICAL_SUNDAY_WEEKDAY: - weekday = 6; - break; - default: - g_warning ("cal_recur_ical_weekday_to_weekday(): Unknown week day %d", - day); - weekday = 0; - } - - return weekday; -} - - -/** - * cal_recur_free: - * @r: A #CalRecurrence structure. - * - * Frees a #CalRecurrence structure. - **/ -static void -cal_recur_free (CalRecurrence *r) -{ - g_return_if_fail (r != NULL); - - g_list_free (r->bymonth); - g_list_free (r->byweekno); - g_list_free (r->byyearday); - g_list_free (r->bymonthday); - g_list_free (r->byday); - g_list_free (r->byhour); - g_list_free (r->byminute); - g_list_free (r->bysecond); - g_list_free (r->bysetpos); - - g_free (r); -} - -/* Generates one year's worth of recurrence instances. Returns TRUE if all the - * callback invocations returned TRUE, or FALSE when any one of them returns - * FALSE, i.e. meaning that the instance generation should be stopped. - * - * This should only output instances whose start time is between chunk_start - * and chunk_end (inclusive), or we may generate duplicates when we do the next - * chunk. (This applies mainly to weekly recurrences, since weeks can span 2 - * years.) - * - * It should also only output instances that are on or after the event's - * DTSTART property and that intersect the required interval, between - * interval_start and interval_end. - */ -static gboolean -generate_instances_for_chunk (CalComponent *comp, - time_t comp_dtstart, - icaltimezone *zone, - GSList *rrules, - GSList *rdates, - GSList *exrules, - GSList *exdates, - gboolean single_rule, - CalObjTime *event_start, - time_t interval_start, - CalObjTime *chunk_start, - CalObjTime *chunk_end, - gint duration_days, - gint duration_seconds, - gboolean convert_end_date, - CalRecurInstanceFn cb, - gpointer cb_data) -{ - GArray *occs, *ex_occs, *tmp_occs, *rdate_periods; - CalObjTime cotime, *occ; - GSList *elem; - gint i; - time_t start_time, end_time; - struct icaltimetype start_tt, end_tt; - gboolean cb_status = TRUE, rule_finished, finished = TRUE; - -#if 0 - g_print ("In generate_instances_for_chunk rrules: %p\n" - " %i/%i/%i %02i:%02i:%02i - %i/%i/%i %02i:%02i:%02i\n", - rrules, - chunk_start->day, chunk_start->month + 1, - chunk_start->year, chunk_start->hour, - chunk_start->minute, chunk_start->second, - chunk_end->day, chunk_end->month + 1, - chunk_end->year, chunk_end->hour, - chunk_end->minute, chunk_end->second); -#endif - - occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - ex_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - rdate_periods = g_array_new (FALSE, FALSE, - sizeof (CalObjRecurrenceDate)); - - /* The original DTSTART property is included in the occurrence set, - but not if we are just generating occurrences for a single rule. */ - if (!single_rule) { - /* We add it if it is in this chunk. If it is after this chunk - we set finished to FALSE, since we know we aren't finished - yet. */ - if (cal_obj_time_compare_func (event_start, chunk_end) >= 0) - finished = FALSE; - else if (cal_obj_time_compare_func (event_start, chunk_start) >= 0) - g_array_append_vals (occs, event_start, 1); - } - - /* Expand each of the recurrence rules. */ - for (elem = rrules; elem; elem = elem->next) { - icalproperty *prop; - CalRecurrence *r; - - prop = elem->data; - r = cal_recur_from_icalproperty (prop, FALSE, zone, - convert_end_date); - - tmp_occs = cal_obj_expand_recurrence (event_start, zone, r, - chunk_start, - chunk_end, - &rule_finished); - cal_recur_free (r); - - /* If any of the rules return FALSE for finished, we know we - have to carry on so we set finished to FALSE. */ - if (!rule_finished) - finished = FALSE; - - g_array_append_vals (occs, tmp_occs->data, tmp_occs->len); - g_array_free (tmp_occs, TRUE); - } - - /* Add on specific RDATE occurrence dates. If they have an end time - or duration set, flag them as RDATEs, and store a pointer to the - period in the rdate_periods array. Otherwise we can just treat them - as normal occurrences. */ - for (elem = rdates; elem; elem = elem->next) { - CalComponentPeriod *p; - CalObjRecurrenceDate rdate; - - p = elem->data; - - /* FIXME: We currently assume RDATEs are in the same timezone - as DTSTART. We should get the RDATE timezone and convert - to the DTSTART timezone first. */ - cotime.year = p->start.year; - cotime.month = p->start.month - 1; - cotime.day = p->start.day; - cotime.hour = p->start.hour; - cotime.minute = p->start.minute; - cotime.second = p->start.second; - cotime.flags = FALSE; - - /* If the rdate is after the current chunk we set finished - to FALSE, and we skip it. */ - if (cal_obj_time_compare_func (&cotime, chunk_end) >= 0) { - finished = FALSE; - continue; - } - - /* Check if the end date or duration is set. If it is we need - to store it so we can get it later. (libical seems to set - second to -1 to denote an unset time. See icalvalue.c) - FIXME. */ - if (p->type != CAL_COMPONENT_PERIOD_DATETIME - || p->u.end.second != -1) { - cotime.flags = TRUE; - - rdate.start = cotime; - rdate.period = p; - g_array_append_val (rdate_periods, rdate); - } - - g_array_append_val (occs, cotime); - } - - /* Expand each of the exception rules. */ - for (elem = exrules; elem; elem = elem->next) { - icalproperty *prop; - CalRecurrence *r; - - prop = elem->data; - r = cal_recur_from_icalproperty (prop, FALSE, zone, - convert_end_date); - - tmp_occs = cal_obj_expand_recurrence (event_start, zone, r, - chunk_start, - chunk_end, - &rule_finished); - cal_recur_free (r); - - g_array_append_vals (ex_occs, tmp_occs->data, tmp_occs->len); - g_array_free (tmp_occs, TRUE); - } - - /* Add on specific exception dates. */ - for (elem = exdates; elem; elem = elem->next) { - CalComponentDateTime *cdt; - - cdt = elem->data; - - /* FIXME: We currently assume EXDATEs are in the same timezone - as DTSTART. We should get the EXDATE timezone and convert - to the DTSTART timezone first. */ - cotime.year = cdt->value->year; - cotime.month = cdt->value->month - 1; - cotime.day = cdt->value->day; - - /* If the EXDATE has a DATE value, set the time to the start - of the day and set flags to TRUE so we know to skip all - occurrences on that date. */ - if (cdt->value->is_date) { - cotime.hour = 0; - cotime.minute = 0; - cotime.second = 0; - cotime.flags = TRUE; - } else { - cotime.hour = cdt->value->hour; - cotime.minute = cdt->value->minute; - cotime.second = cdt->value->second; - cotime.flags = FALSE; - } - - g_array_append_val (ex_occs, cotime); - } - - - /* Sort all the arrays. */ - cal_obj_sort_occurrences (occs); - cal_obj_sort_occurrences (ex_occs); - - qsort (rdate_periods->data, rdate_periods->len, - sizeof (CalObjRecurrenceDate), cal_obj_time_compare_func); - - /* Create the final array, by removing the exceptions from the - occurrences, and removing any duplicates. */ - cal_obj_remove_exceptions (occs, ex_occs); - - /* Call the callback for each occurrence. If it returns 0 we break - out of the loop. */ - for (i = 0; i < occs->len; i++) { - /* Convert each CalObjTime into a start & end time_t, and - check it is within the bounds of the event & interval. */ - occ = &g_array_index (occs, CalObjTime, i); -#if 0 - g_print ("Checking occurrence: %s\n", - cal_obj_time_to_string (occ)); -#endif - start_tt = icaltime_null_time (); - start_tt.year = occ->year; - start_tt.month = occ->month + 1; - start_tt.day = occ->day; - start_tt.hour = occ->hour; - start_tt.minute = occ->minute; - start_tt.second = occ->second; - start_time = icaltime_as_timet_with_zone (start_tt, zone); - - if (start_time == -1) { - g_warning ("time_t out of range"); - finished = TRUE; - break; - } - - /* Check to ensure that the start time is at or after the - event's DTSTART time, and that it is inside the chunk that - we are currently working on. (Note that the chunk_end time - is never after the interval end time, so this also tests - that we don't go past the end of the required interval). */ - if (start_time < comp_dtstart - || cal_obj_time_compare_func (occ, chunk_start) < 0 - || cal_obj_time_compare_func (occ, chunk_end) > 0) { -#if 0 - g_print (" start time invalid\n"); -#endif - continue; - } - - if (occ->flags) { - /* If it is an RDATE, we see if the end date or - duration was set. If not, we use the same duration - as the original occurrence. */ - if (!cal_object_get_rdate_end (occ, rdate_periods)) { - cal_obj_time_add_days (occ, duration_days); - cal_obj_time_add_seconds (occ, - duration_seconds); - } - } else { - cal_obj_time_add_days (occ, duration_days); - cal_obj_time_add_seconds (occ, duration_seconds); - } - - end_tt = icaltime_null_time (); - end_tt.year = occ->year; - end_tt.month = occ->month + 1; - end_tt.day = occ->day; - end_tt.hour = occ->hour; - end_tt.minute = occ->minute; - end_tt.second = occ->second; - end_time = icaltime_as_timet_with_zone (end_tt, zone); - - if (end_time == -1) { - g_warning ("time_t out of range"); - finished = TRUE; - break; - } - - /* Check that the end time is after the interval start, so we - know that it intersects the required interval. */ - if (end_time <= interval_start) { -#if 0 - g_print (" end time invalid\n"); -#endif - continue; - } - - cb_status = (*cb) (comp, start_time, end_time, cb_data); - if (!cb_status) - break; - } - - g_array_free (occs, TRUE); - g_array_free (ex_occs, TRUE); - g_array_free (rdate_periods, TRUE); - - /* We return TRUE (i.e. carry on) only if the callback has always - returned TRUE and we know that we have more occurrences to generate - (i.e. finished is FALSE). */ - return cb_status && !finished; -} - - -/* This looks up the occurrence time in the sorted rdate_periods array, and - tries to compute the end time of the occurrence. If no end time or duration - is set it returns FALSE and the default duration will be used. */ -static gboolean -cal_object_get_rdate_end (CalObjTime *occ, - GArray *rdate_periods) -{ - CalObjRecurrenceDate *rdate = NULL; - CalComponentPeriod *p; - gint lower, upper, middle, cmp = 0; - - lower = 0; - upper = rdate_periods->len; - - while (lower < upper) { - middle = (lower + upper) >> 1; - - rdate = &g_array_index (rdate_periods, CalObjRecurrenceDate, - middle); - - cmp = cal_obj_time_compare_func (occ, &rdate->start); - - if (cmp == 0) - break; - else if (cmp < 0) - upper = middle; - else - lower = middle + 1; - } - - /* This should never happen. */ - if (cmp == 0) { - g_warning ("Recurrence date not found"); - return FALSE; - } - - p = rdate->period; - if (p->type == CAL_COMPONENT_PERIOD_DATETIME) { - /* FIXME: We currently assume RDATEs are in the same timezone - as DTSTART. We should get the RDATE timezone and convert - to the DTSTART timezone first. */ - occ->year = p->u.end.year; - occ->month = p->u.end.month - 1; - occ->day = p->u.end.day; - occ->hour = p->u.end.hour; - occ->minute = p->u.end.minute; - occ->second = p->u.end.second; - occ->flags = FALSE; - } else { - cal_obj_time_add_days (occ, p->u.duration.weeks * 7 - + p->u.duration.days); - cal_obj_time_add_hours (occ, p->u.duration.hours); - cal_obj_time_add_minutes (occ, p->u.duration.minutes); - cal_obj_time_add_seconds (occ, p->u.duration.seconds); - } - - return TRUE; -} - - -static void -cal_object_compute_duration (CalObjTime *start, - CalObjTime *end, - gint *days, - gint *seconds) -{ - GDate start_date, end_date; - gint start_seconds, end_seconds; - - g_date_clear (&start_date, 1); - g_date_clear (&end_date, 1); - g_date_set_dmy (&start_date, start->day, start->month + 1, - start->year); - g_date_set_dmy (&end_date, end->day, end->month + 1, - end->year); - - *days = g_date_julian (&end_date) - g_date_julian (&start_date); - start_seconds = start->hour * 3600 + start->minute * 60 - + start->second; - end_seconds = end->hour * 3600 + end->minute * 60 + end->second; - - *seconds = end_seconds - start_seconds; - if (*seconds < 0) { - *days = *days - 1; - *seconds += 24 * 60 * 60; - } -} - - -/* Returns an unsorted GArray of CalObjTime's resulting from expanding the - given recurrence rule within the given interval. Note that it doesn't - clip the generated occurrences to the interval, i.e. if the interval - starts part way through the year this function still returns all the - occurrences for the year. Clipping is done later. - The finished flag is set to FALSE if there are more occurrences to generate - after the given interval.*/ -static GArray* -cal_obj_expand_recurrence (CalObjTime *event_start, - icaltimezone *zone, - CalRecurrence *recur, - CalObjTime *interval_start, - CalObjTime *interval_end, - gboolean *finished) -{ - CalRecurVTable *vtable; - CalObjTime *event_end = NULL, event_end_cotime; - RecurData recur_data; - CalObjTime occ, *cotime; - GArray *all_occs, *occs; - gint len; - - /* This is the resulting array of CalObjTime elements. */ - all_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - *finished = TRUE; - - vtable = cal_obj_get_vtable (recur->freq); - if (!vtable) - return all_occs; - - /* Calculate some useful data such as some fast lookup tables. */ - cal_obj_initialize_recur_data (&recur_data, recur, event_start); - - /* Compute the event_end, if the recur's enddate is set. */ - if (recur->enddate > 0) { - cal_object_time_from_time (&event_end_cotime, - recur->enddate, zone); - event_end = &event_end_cotime; - - /* If the enddate is before the requested interval return. */ - if (cal_obj_time_compare_func (event_end, interval_start) < 0) - return all_occs; - } - - /* Set finished to FALSE if we know there will be more occurrences to - do after this interval. */ - if (!interval_end || !event_end - || cal_obj_time_compare_func (event_end, interval_end) > 0) - *finished = FALSE; - - /* Get the first period based on the frequency and the interval that - intersects the interval between start and end. */ - if ((*vtable->find_start_position) (event_start, event_end, - &recur_data, - interval_start, interval_end, - &occ)) - return all_occs; - - /* Loop until the event ends or we go past the end of the required - interval. */ - for (;;) { - /* Generate the set of occurrences for this period. */ - switch (recur->freq) { - case ICAL_YEARLY_RECURRENCE: - occs = cal_obj_generate_set_yearly (&recur_data, - vtable, &occ); - break; - case ICAL_MONTHLY_RECURRENCE: - occs = cal_obj_generate_set_monthly (&recur_data, - vtable, &occ); - break; - default: - occs = cal_obj_generate_set_default (&recur_data, - vtable, &occ); - break; - } - - /* Sort the occurrences and remove duplicates. */ - cal_obj_sort_occurrences (occs); - cal_obj_remove_duplicates_and_invalid_dates (occs); - - /* Apply the BYSETPOS property. */ - occs = cal_obj_bysetpos_filter (recur, occs); - - /* Remove any occs after event_end. */ - len = occs->len - 1; - if (event_end) { - while (len >= 0) { - cotime = &g_array_index (occs, CalObjTime, - len); - if (cal_obj_time_compare_func (cotime, - event_end) <= 0) - break; - len--; - } - } - - /* Add the occurrences onto the main array. */ - if (len >= 0) - g_array_append_vals (all_occs, occs->data, len + 1); - - g_array_free (occs, TRUE); - - /* Skip to the next period, or exit the loop if finished. */ - if ((*vtable->find_next_position) (&occ, event_end, - &recur_data, interval_end)) - break; - } - - return all_occs; -} - - -static GArray* -cal_obj_generate_set_yearly (RecurData *recur_data, - CalRecurVTable *vtable, - CalObjTime *occ) -{ - CalRecurrence *recur = recur_data->recur; - GArray *occs_arrays[4], *occs, *occs2; - gint num_occs_arrays = 0, i; - - /* This is a bit complicated, since the iCalendar spec says that - several BYxxx modifiers can be used simultaneously. So we have to - be quite careful when determining the days of the occurrences. - The BYHOUR, BYMINUTE & BYSECOND modifiers are no problem at all. - - The modifiers we have to worry about are: BYMONTH, BYWEEKNO, - BYYEARDAY, BYMONTHDAY & BYDAY. We can't do these sequentially - since each filter will mess up the results of the previous one. - But they aren't all completely independant, e.g. BYMONTHDAY and - BYDAY are related to BYMONTH, and BYDAY is related to BYWEEKNO. - - BYDAY & BYMONTHDAY can also be applied independently, which makes - it worse. So we assume that if BYMONTH or BYWEEKNO is used, then - the BYDAY modifier applies to those, else it is applied - independantly. - - We expand the occurrences in parallel into the occs_arrays[] array, - and then merge them all into one GArray before expanding BYHOUR, - BYMINUTE & BYSECOND. */ - - if (recur->bymonth) { - occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - g_array_append_vals (occs, occ, 1); - - occs = (*vtable->bymonth_filter) (recur_data, occs); - - /* If BYMONTHDAY & BYDAY are both set we need to expand them - in parallel and add the results. */ - if (recur->bymonthday && recur->byday) { - /* Copy the occs array. */ - occs2 = g_array_new (FALSE, FALSE, - sizeof (CalObjTime)); - g_array_append_vals (occs2, occs->data, occs->len); - - occs = (*vtable->bymonthday_filter) (recur_data, occs); - /* Note that we explicitly call the monthly version - of the BYDAY expansion filter. */ - occs2 = cal_obj_byday_expand_monthly (recur_data, - occs2); - - /* Add the 2 resulting arrays together. */ - g_array_append_vals (occs, occs2->data, occs2->len); - g_array_free (occs2, TRUE); - } else { - occs = (*vtable->bymonthday_filter) (recur_data, occs); - /* Note that we explicitly call the monthly version - of the BYDAY expansion filter. */ - occs = cal_obj_byday_expand_monthly (recur_data, occs); - } - - occs_arrays[num_occs_arrays++] = occs; - } - - if (recur->byweekno) { - occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - g_array_append_vals (occs, occ, 1); - - occs = (*vtable->byweekno_filter) (recur_data, occs); - /* Note that we explicitly call the weekly version of the - BYDAY expansion filter. */ - occs = cal_obj_byday_expand_weekly (recur_data, occs); - - occs_arrays[num_occs_arrays++] = occs; - } - - if (recur->byyearday) { - occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - g_array_append_vals (occs, occ, 1); - - occs = (*vtable->byyearday_filter) (recur_data, occs); - - occs_arrays[num_occs_arrays++] = occs; - } - - /* If BYMONTHDAY is set, and BYMONTH is not set, we need to - expand BYMONTHDAY independantly. */ - if (recur->bymonthday && !recur->bymonth) { - occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - g_array_append_vals (occs, occ, 1); - - occs = (*vtable->bymonthday_filter) (recur_data, occs); - - occs_arrays[num_occs_arrays++] = occs; - } - - /* If BYDAY is set, and BYMONTH and BYWEEKNO are not set, we need to - expand BYDAY independantly. */ - if (recur->byday && !recur->bymonth && !recur->byweekno) { - occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - g_array_append_vals (occs, occ, 1); - - occs = (*vtable->byday_filter) (recur_data, occs); - - occs_arrays[num_occs_arrays++] = occs; - } - - /* Add all the arrays together. If no filters were used we just - create an array with one element. */ - if (num_occs_arrays > 0) { - occs = occs_arrays[0]; - for (i = 1; i < num_occs_arrays; i++) { - occs2 = occs_arrays[i]; - g_array_append_vals (occs, occs2->data, occs2->len); - g_array_free (occs2, TRUE); - } - } else { - occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - g_array_append_vals (occs, occ, 1); - } - - /* Now expand BYHOUR, BYMINUTE & BYSECOND. */ - occs = (*vtable->byhour_filter) (recur_data, occs); - occs = (*vtable->byminute_filter) (recur_data, occs); - occs = (*vtable->bysecond_filter) (recur_data, occs); - - return occs; -} - - -static GArray* -cal_obj_generate_set_monthly (RecurData *recur_data, - CalRecurVTable *vtable, - CalObjTime *occ) -{ - GArray *occs, *occs2; - - /* We start with just the one time in each set. */ - occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - g_array_append_vals (occs, occ, 1); - - occs = (*vtable->bymonth_filter) (recur_data, occs); - - /* We need to combine the output of BYMONTHDAY & BYDAY, by doing them - in parallel rather than sequentially. If we did them sequentially - then we would lose the occurrences generated by BYMONTHDAY, and - instead have repetitions of the occurrences from BYDAY. */ - if (recur_data->recur->bymonthday && recur_data->recur->byday) { - occs2 = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - g_array_append_vals (occs2, occs->data, occs->len); - - occs = (*vtable->bymonthday_filter) (recur_data, occs); - occs2 = (*vtable->byday_filter) (recur_data, occs2); - - g_array_append_vals (occs, occs2->data, occs2->len); - g_array_free (occs2, TRUE); - } else { - occs = (*vtable->bymonthday_filter) (recur_data, occs); - occs = (*vtable->byday_filter) (recur_data, occs); - } - - occs = (*vtable->byhour_filter) (recur_data, occs); - occs = (*vtable->byminute_filter) (recur_data, occs); - occs = (*vtable->bysecond_filter) (recur_data, occs); - - return occs; -} - - -static GArray* -cal_obj_generate_set_default (RecurData *recur_data, - CalRecurVTable *vtable, - CalObjTime *occ) -{ - GArray *occs; - -#if 0 - g_print ("Generating set for %i/%i/%i %02i:%02i:%02i\n", - occ->day, occ->month + 1, occ->year, occ->hour, occ->minute, - occ->second); -#endif - - /* We start with just the one time in the set. */ - occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - g_array_append_vals (occs, occ, 1); - - occs = (*vtable->bymonth_filter) (recur_data, occs); - if (vtable->byweekno_filter) - occs = (*vtable->byweekno_filter) (recur_data, occs); - if (vtable->byyearday_filter) - occs = (*vtable->byyearday_filter) (recur_data, occs); - if (vtable->bymonthday_filter) - occs = (*vtable->bymonthday_filter) (recur_data, occs); - occs = (*vtable->byday_filter) (recur_data, occs); - - occs = (*vtable->byhour_filter) (recur_data, occs); - occs = (*vtable->byminute_filter) (recur_data, occs); - occs = (*vtable->bysecond_filter) (recur_data, occs); - - return occs; -} - - - -/* Returns the function table corresponding to the recurrence frequency. */ -static CalRecurVTable* cal_obj_get_vtable (icalrecurrencetype_frequency recur_type) -{ - CalRecurVTable* vtable; - - switch (recur_type) { - case ICAL_YEARLY_RECURRENCE: - vtable = &cal_obj_yearly_vtable; - break; - case ICAL_MONTHLY_RECURRENCE: - vtable = &cal_obj_monthly_vtable; - break; - case ICAL_WEEKLY_RECURRENCE: - vtable = &cal_obj_weekly_vtable; - break; - case ICAL_DAILY_RECURRENCE: - vtable = &cal_obj_daily_vtable; - break; - case ICAL_HOURLY_RECURRENCE: - vtable = &cal_obj_hourly_vtable; - break; - case ICAL_MINUTELY_RECURRENCE: - vtable = &cal_obj_minutely_vtable; - break; - case ICAL_SECONDLY_RECURRENCE: - vtable = &cal_obj_secondly_vtable; - break; - default: - g_warning ("Unknown recurrence frequency"); - vtable = NULL; - } - - return vtable; -} - - -/* This creates a number of fast lookup tables used when filtering with the - modifier properties BYMONTH, BYYEARDAY etc. */ -static void -cal_obj_initialize_recur_data (RecurData *recur_data, - CalRecurrence *recur, - CalObjTime *event_start) -{ - GList *elem; - gint month, yearday, monthday, weekday, week_num, hour, minute, second; - - /* Clear the entire RecurData. */ - memset (recur_data, 0, sizeof (RecurData)); - - recur_data->recur = recur; - - /* Set the weekday, used for the WEEKLY frequency and the BYWEEKNO - modifier. */ - recur_data->weekday_offset = cal_obj_time_weekday_offset (event_start, - recur); - - /* Create an array of months from bymonths for fast lookup. */ - elem = recur->bymonth; - while (elem) { - month = GPOINTER_TO_INT (elem->data); - recur_data->months[month] = 1; - elem = elem->next; - } - - /* Create an array of yeardays from byyearday for fast lookup. - We create a second array to handle the negative values. The first - element there corresponds to the last day of the year. */ - elem = recur->byyearday; - while (elem) { - yearday = GPOINTER_TO_INT (elem->data); - if (yearday >= 0) - recur_data->yeardays[yearday] = 1; - else - recur_data->neg_yeardays[-yearday] = 1; - elem = elem->next; - } - - /* Create an array of monthdays from bymonthday for fast lookup. - We create a second array to handle the negative values. The first - element there corresponds to the last day of the month. */ - elem = recur->bymonthday; - while (elem) { - monthday = GPOINTER_TO_INT (elem->data); - if (monthday >= 0) - recur_data->monthdays[monthday] = 1; - else - recur_data->neg_monthdays[-monthday] = 1; - elem = elem->next; - } - - /* Create an array of weekdays from byday for fast lookup. */ - elem = recur->byday; - while (elem) { - weekday = GPOINTER_TO_INT (elem->data); - elem = elem->next; - /* The week number is not used when filtering. */ - week_num = GPOINTER_TO_INT (elem->data); - elem = elem->next; - - recur_data->weekdays[weekday] = 1; - } - - /* Create an array of hours from byhour for fast lookup. */ - elem = recur->byhour; - while (elem) { - hour = GPOINTER_TO_INT (elem->data); - recur_data->hours[hour] = 1; - elem = elem->next; - } - - /* Create an array of minutes from byminutes for fast lookup. */ - elem = recur->byminute; - while (elem) { - minute = GPOINTER_TO_INT (elem->data); - recur_data->minutes[minute] = 1; - elem = elem->next; - } - - /* Create an array of seconds from byseconds for fast lookup. */ - elem = recur->bysecond; - while (elem) { - second = GPOINTER_TO_INT (elem->data); - recur_data->seconds[second] = 1; - elem = elem->next; - } -} - - -static void -cal_obj_sort_occurrences (GArray *occs) -{ - qsort (occs->data, occs->len, sizeof (CalObjTime), - cal_obj_time_compare_func); -} - - -static void -cal_obj_remove_duplicates_and_invalid_dates (GArray *occs) -{ - static const int days_in_month[12] = { - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 - }; - - CalObjTime *occ, *prev_occ = NULL; - gint len, i, j = 0, year, month, days; - gboolean keep_occ; - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - keep_occ = TRUE; - - if (prev_occ && cal_obj_time_compare_func (occ, - prev_occ) == 0) - keep_occ = FALSE; - - year = occ->year; - month = occ->month; - days = days_in_month[occ->month]; - /* If it is february and a leap year, add a day. */ - if (month == 1 && (year % 4 == 0 - && (year % 100 != 0 - || year % 400 == 0))) - days++; - if (occ->day > days) - keep_occ = FALSE; - - if (keep_occ) { - if (i != j) - g_array_index (occs, CalObjTime, j) - = g_array_index (occs, CalObjTime, i); - j++; - } - - prev_occ = occ; - } - - g_array_set_size (occs, j); -} - - -/* Removes the exceptions from the ex_occs array from the occurrences in the - occs array, and removes any duplicates. Both arrays are sorted. */ -static void -cal_obj_remove_exceptions (GArray *occs, - GArray *ex_occs) -{ - CalObjTime *occ, *prev_occ = NULL, *ex_occ = NULL, *last_occ_kept; - gint i, j = 0, cmp, ex_index, occs_len, ex_occs_len; - gboolean keep_occ, current_time_is_exception = FALSE; - - if (occs->len == 0) - return; - - ex_index = 0; - occs_len = occs->len; - ex_occs_len = ex_occs->len; - - if (ex_occs_len > 0) - ex_occ = &g_array_index (ex_occs, CalObjTime, ex_index); - - for (i = 0; i < occs_len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - keep_occ = TRUE; - - /* If the occurrence is a duplicate of the previous one, skip - it. */ - if (prev_occ - && cal_obj_time_compare_func (occ, prev_occ) == 0) { - keep_occ = FALSE; - - /* If this occurrence is an RDATE with an end or - duration set, and the previous occurrence in the - array was kept, set the RDATE flag of the last one, - so we still use the end date or duration. */ - if (occ->flags && !current_time_is_exception) { - last_occ_kept = &g_array_index (occs, - CalObjTime, - j - 1); - last_occ_kept->flags = TRUE; - } - } else { - /* We've found a new occurrence time. Reset the flag - to indicate that it hasn't been found in the - exceptions array (yet). */ - current_time_is_exception = FALSE; - - if (ex_occ) { - /* Step through the exceptions until we come - to one that matches or follows this - occurrence. */ - while (ex_occ) { - /* If the exception is an EXDATE with - a DATE value, we only have to - compare the date. */ - if (ex_occ->flags) - cmp = cal_obj_date_only_compare_func (ex_occ, occ); - else - cmp = cal_obj_time_compare_func (ex_occ, occ); - - if (cmp > 0) - break; - - /* Move to the next exception, or set - ex_occ to NULL when we reach the - end of array. */ - ex_index++; - if (ex_index < ex_occs_len) - ex_occ = &g_array_index (ex_occs, CalObjTime, ex_index); - else - ex_occ = NULL; - - /* If the exception did match this - occurrence we remove it, and set the - flag to indicate that the current - time is an exception. */ - if (cmp == 0) { - current_time_is_exception = TRUE; - keep_occ = FALSE; - break; - } - } - } - } - - if (keep_occ) { - /* We are keeping this occurrence, so we move it to - the next free space, unless its position hasn't - changed (i.e. all previous occurrences were also - kept). */ - if (i != j) - g_array_index (occs, CalObjTime, j) - = g_array_index (occs, CalObjTime, i); - j++; - } - - prev_occ = occ; - } - - g_array_set_size (occs, j); -} - - - -static GArray* -cal_obj_bysetpos_filter (CalRecurrence *recur, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - GList *elem; - gint len, pos; - - /* If BYSETPOS has not been specified, or the array is empty, just - return the array. */ - elem = recur->bysetpos; - if (!elem || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - /* Iterate over the indices given in bysetpos, adding the corresponding - element from occs to new_occs. */ - len = occs->len; - while (elem) { - pos = GPOINTER_TO_INT (elem->data); - - /* Negative values count back from the end of the array. */ - if (pos < 0) - pos += len; - /* Positive values need to be decremented since the array is - 0-based. */ - else - pos--; - - if (pos >= 0 && pos < len) { - occ = &g_array_index (occs, CalObjTime, pos); - g_array_append_vals (new_occs, occ, 1); - } - elem = elem->next; - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - - - -/* Finds the first year from the event_start, counting in multiples of the - recurrence interval, that intersects the given interval. It returns TRUE - if there is no intersection. */ -static gboolean -cal_obj_yearly_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime) -{ - *cotime = *event_start; - - /* Move on to the next interval, if the event starts before the - given interval. */ - if (cotime->year < interval_start->year) { - gint years = interval_start->year - cotime->year - + recur_data->recur->interval - 1; - years -= years % recur_data->recur->interval; - /* NOTE: The day may now be invalid, e.g. 29th Feb. */ - cotime->year += years; - } - - if ((event_end && cotime->year > event_end->year) - || (interval_end && cotime->year > interval_end->year)) - return TRUE; - - return FALSE; -} - - -static gboolean -cal_obj_yearly_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end) -{ - /* NOTE: The day may now be invalid, e.g. 29th Feb. */ - cotime->year += recur_data->recur->interval; - - if ((event_end && cotime->year > event_end->year) - || (interval_end && cotime->year > interval_end->year)) - return TRUE; - - return FALSE; -} - - - -static gboolean -cal_obj_monthly_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime) -{ - *cotime = *event_start; - - /* Move on to the next interval, if the event starts before the - given interval. */ - if (cal_obj_time_compare (cotime, interval_start, CALOBJ_MONTH) < 0) { - gint months = (interval_start->year - cotime->year) * 12 - + interval_start->month - cotime->month - + recur_data->recur->interval - 1; - months -= months % recur_data->recur->interval; - /* NOTE: The day may now be invalid, e.g. 31st Sep. */ - cal_obj_time_add_months (cotime, months); - } - - if (event_end && cal_obj_time_compare (cotime, event_end, - CALOBJ_MONTH) > 0) - return TRUE; - if (interval_end && cal_obj_time_compare (cotime, interval_end, - CALOBJ_MONTH) > 0) - return TRUE; - - return FALSE; -} - - -static gboolean -cal_obj_monthly_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end) -{ - /* NOTE: The day may now be invalid, e.g. 31st Sep. */ - cal_obj_time_add_months (cotime, recur_data->recur->interval); - - if (event_end && cal_obj_time_compare (cotime, event_end, - CALOBJ_MONTH) > 0) - return TRUE; - if (interval_end && cal_obj_time_compare (cotime, interval_end, - CALOBJ_MONTH) > 0) - return TRUE; - - return FALSE; -} - - - -static gboolean -cal_obj_weekly_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime) -{ - GDate event_start_date, interval_start_date; - guint32 event_start_julian, interval_start_julian; - gint interval_start_weekday_offset; - CalObjTime week_start; - - if (event_end && cal_obj_time_compare (event_end, interval_start, - CALOBJ_DAY) < 0) - return TRUE; - if (interval_end && cal_obj_time_compare (event_start, interval_end, - CALOBJ_DAY) > 0) - return TRUE; - - *cotime = *event_start; - - /* Convert the event start and interval start to GDates, so we can - easily find the number of days between them. */ - g_date_clear (&event_start_date, 1); - g_date_set_dmy (&event_start_date, event_start->day, - event_start->month + 1, event_start->year); - g_date_clear (&interval_start_date, 1); - g_date_set_dmy (&interval_start_date, interval_start->day, - interval_start->month + 1, interval_start->year); - - /* Calculate the start of the weeks corresponding to the event start - and interval start. */ - event_start_julian = g_date_julian (&event_start_date); - event_start_julian -= recur_data->weekday_offset; - - interval_start_julian = g_date_julian (&interval_start_date); - interval_start_weekday_offset = cal_obj_time_weekday_offset (interval_start, recur_data->recur); - interval_start_julian -= interval_start_weekday_offset; - - /* We want to find the first full week using the recurrence interval - that intersects the given interval dates. */ - if (event_start_julian < interval_start_julian) { - gint weeks = (interval_start_julian - event_start_julian) / 7; - weeks += recur_data->recur->interval - 1; - weeks -= weeks % recur_data->recur->interval; - cal_obj_time_add_days (cotime, weeks * 7); - } - - week_start = *cotime; - cal_obj_time_add_days (&week_start, -recur_data->weekday_offset); - - if (event_end && cal_obj_time_compare (&week_start, event_end, - CALOBJ_DAY) > 0) - return TRUE; - if (interval_end && cal_obj_time_compare (&week_start, interval_end, - CALOBJ_DAY) > 0) - return TRUE; - - return FALSE; -} - - -static gboolean -cal_obj_weekly_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end) -{ - CalObjTime week_start; - - cal_obj_time_add_days (cotime, recur_data->recur->interval * 7); - - /* Return TRUE if the start of this week is after the event finishes - or is after the end of the required interval. */ - week_start = *cotime; - cal_obj_time_add_days (&week_start, -recur_data->weekday_offset); - -#ifdef CAL_OBJ_DEBUG - g_print ("Next day: %s\n", cal_obj_time_to_string (cotime)); - g_print ("Week Start: %s\n", cal_obj_time_to_string (&week_start)); -#endif - - if (event_end && cal_obj_time_compare (&week_start, event_end, - CALOBJ_DAY) > 0) - return TRUE; - if (interval_end && cal_obj_time_compare (&week_start, interval_end, - CALOBJ_DAY) > 0) { -#ifdef CAL_OBJ_DEBUG - g_print ("Interval end reached: %s\n", - cal_obj_time_to_string (interval_end)); -#endif - return TRUE; - } - - return FALSE; -} - - -static gboolean -cal_obj_daily_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime) -{ - GDate event_start_date, interval_start_date; - guint32 event_start_julian, interval_start_julian, days; - - if (interval_end && cal_obj_time_compare (event_start, interval_end, - CALOBJ_DAY) > 0) - return TRUE; - if (event_end && cal_obj_time_compare (event_end, interval_start, - CALOBJ_DAY) < 0) - return TRUE; - - *cotime = *event_start; - - /* Convert the event start and interval start to GDates, so we can - easily find the number of days between them. */ - g_date_clear (&event_start_date, 1); - g_date_set_dmy (&event_start_date, event_start->day, - event_start->month + 1, event_start->year); - g_date_clear (&interval_start_date, 1); - g_date_set_dmy (&interval_start_date, interval_start->day, - interval_start->month + 1, interval_start->year); - - event_start_julian = g_date_julian (&event_start_date); - interval_start_julian = g_date_julian (&interval_start_date); - - if (event_start_julian < interval_start_julian) { - days = interval_start_julian - event_start_julian - + recur_data->recur->interval - 1; - days -= days % recur_data->recur->interval; - cal_obj_time_add_days (cotime, days); - } - - if (event_end && cal_obj_time_compare (cotime, event_end, - CALOBJ_DAY) > 0) - return TRUE; - if (interval_end && cal_obj_time_compare (cotime, interval_end, - CALOBJ_DAY) > 0) - return TRUE; - - return FALSE; -} - - -static gboolean -cal_obj_daily_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end) -{ - cal_obj_time_add_days (cotime, recur_data->recur->interval); - - if (event_end && cal_obj_time_compare (cotime, event_end, - CALOBJ_DAY) > 0) - return TRUE; - if (interval_end && cal_obj_time_compare (cotime, interval_end, - CALOBJ_DAY) > 0) - return TRUE; - - return FALSE; -} - - -static gboolean -cal_obj_hourly_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime) -{ - GDate event_start_date, interval_start_date; - guint32 event_start_julian, interval_start_julian, hours; - - if (interval_end && cal_obj_time_compare (event_start, interval_end, - CALOBJ_HOUR) > 0) - return TRUE; - if (event_end && cal_obj_time_compare (event_end, interval_start, - CALOBJ_HOUR) < 0) - return TRUE; - - *cotime = *event_start; - - if (cal_obj_time_compare (event_start, interval_start, - CALOBJ_HOUR) < 0) { - /* Convert the event start and interval start to GDates, so we - can easily find the number of days between them. */ - g_date_clear (&event_start_date, 1); - g_date_set_dmy (&event_start_date, event_start->day, - event_start->month + 1, event_start->year); - g_date_clear (&interval_start_date, 1); - g_date_set_dmy (&interval_start_date, interval_start->day, - interval_start->month + 1, - interval_start->year); - - event_start_julian = g_date_julian (&event_start_date); - interval_start_julian = g_date_julian (&interval_start_date); - - hours = (interval_start_julian - event_start_julian) * 24; - hours += interval_start->hour - event_start->hour; - hours += recur_data->recur->interval - 1; - hours -= hours % recur_data->recur->interval; - cal_obj_time_add_hours (cotime, hours); - } - - if (event_end && cal_obj_time_compare (cotime, event_end, - CALOBJ_HOUR) > 0) - return TRUE; - if (interval_end && cal_obj_time_compare (cotime, interval_end, - CALOBJ_HOUR) > 0) - return TRUE; - - return FALSE; -} - - -static gboolean -cal_obj_hourly_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end) -{ - cal_obj_time_add_hours (cotime, recur_data->recur->interval); - - if (event_end && cal_obj_time_compare (cotime, event_end, - CALOBJ_HOUR) > 0) - return TRUE; - if (interval_end && cal_obj_time_compare (cotime, interval_end, - CALOBJ_HOUR) > 0) - return TRUE; - - return FALSE; -} - - -static gboolean -cal_obj_minutely_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime) -{ - GDate event_start_date, interval_start_date; - guint32 event_start_julian, interval_start_julian, minutes; - - if (interval_end && cal_obj_time_compare (event_start, interval_end, - CALOBJ_MINUTE) > 0) - return TRUE; - if (event_end && cal_obj_time_compare (event_end, interval_start, - CALOBJ_MINUTE) < 0) - return TRUE; - - *cotime = *event_start; - - if (cal_obj_time_compare (event_start, interval_start, - CALOBJ_MINUTE) < 0) { - /* Convert the event start and interval start to GDates, so we - can easily find the number of days between them. */ - g_date_clear (&event_start_date, 1); - g_date_set_dmy (&event_start_date, event_start->day, - event_start->month + 1, event_start->year); - g_date_clear (&interval_start_date, 1); - g_date_set_dmy (&interval_start_date, interval_start->day, - interval_start->month + 1, - interval_start->year); - - event_start_julian = g_date_julian (&event_start_date); - interval_start_julian = g_date_julian (&interval_start_date); - - minutes = (interval_start_julian - event_start_julian) - * 24 * 60; - minutes += (interval_start->hour - event_start->hour) * 24; - minutes += interval_start->minute - event_start->minute; - minutes += recur_data->recur->interval - 1; - minutes -= minutes % recur_data->recur->interval; - cal_obj_time_add_minutes (cotime, minutes); - } - - if (event_end && cal_obj_time_compare (cotime, event_end, - CALOBJ_MINUTE) > 0) - return TRUE; - if (interval_end && cal_obj_time_compare (cotime, interval_end, - CALOBJ_MINUTE) > 0) - return TRUE; - - return FALSE; -} - - -static gboolean -cal_obj_minutely_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end) -{ - cal_obj_time_add_minutes (cotime, recur_data->recur->interval); - - if (event_end && cal_obj_time_compare (cotime, event_end, - CALOBJ_MINUTE) > 0) - return TRUE; - if (interval_end && cal_obj_time_compare (cotime, interval_end, - CALOBJ_MINUTE) > 0) - return TRUE; - - return FALSE; -} - - -static gboolean -cal_obj_secondly_find_start_position (CalObjTime *event_start, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_start, - CalObjTime *interval_end, - CalObjTime *cotime) -{ - GDate event_start_date, interval_start_date; - guint32 event_start_julian, interval_start_julian, seconds; - - if (interval_end && cal_obj_time_compare (event_start, interval_end, - CALOBJ_SECOND) > 0) - return TRUE; - if (event_end && cal_obj_time_compare (event_end, interval_start, - CALOBJ_SECOND) < 0) - return TRUE; - - *cotime = *event_start; - - if (cal_obj_time_compare (event_start, interval_start, - CALOBJ_SECOND) < 0) { - /* Convert the event start and interval start to GDates, so we - can easily find the number of days between them. */ - g_date_clear (&event_start_date, 1); - g_date_set_dmy (&event_start_date, event_start->day, - event_start->month + 1, event_start->year); - g_date_clear (&interval_start_date, 1); - g_date_set_dmy (&interval_start_date, interval_start->day, - interval_start->month + 1, - interval_start->year); - - event_start_julian = g_date_julian (&event_start_date); - interval_start_julian = g_date_julian (&interval_start_date); - - seconds = (interval_start_julian - event_start_julian) - * 24 * 60 * 60; - seconds += (interval_start->hour - event_start->hour) - * 24 * 60; - seconds += (interval_start->minute - event_start->minute) * 60; - seconds += interval_start->second - event_start->second; - seconds += recur_data->recur->interval - 1; - seconds -= seconds % recur_data->recur->interval; - cal_obj_time_add_seconds (cotime, seconds); - } - - if (event_end && cal_obj_time_compare (cotime, event_end, - CALOBJ_SECOND) >= 0) - return TRUE; - if (interval_end && cal_obj_time_compare (cotime, interval_end, - CALOBJ_SECOND) >= 0) - return TRUE; - - return FALSE; -} - - -static gboolean -cal_obj_secondly_find_next_position (CalObjTime *cotime, - CalObjTime *event_end, - RecurData *recur_data, - CalObjTime *interval_end) -{ - cal_obj_time_add_seconds (cotime, recur_data->recur->interval); - - if (event_end && cal_obj_time_compare (cotime, event_end, - CALOBJ_SECOND) >= 0) - return TRUE; - if (interval_end && cal_obj_time_compare (cotime, interval_end, - CALOBJ_SECOND) >= 0) - return TRUE; - - return FALSE; -} - - - - - -/* If the BYMONTH rule is specified it expands each occurrence in occs, by - using each of the months in the bymonth list. */ -static GArray* -cal_obj_bymonth_expand (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - GList *elem; - gint len, i; - - /* If BYMONTH has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->bymonth || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - - elem = recur_data->recur->bymonth; - while (elem) { - /* NOTE: The day may now be invalid, e.g. 31st Feb. */ - occ->month = GPOINTER_TO_INT (elem->data); - g_array_append_vals (new_occs, occ, 1); - elem = elem->next; - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - -/* If the BYMONTH rule is specified it filters out all occurrences in occs - which do not match one of the months in the bymonth list. */ -static GArray* -cal_obj_bymonth_filter (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - gint len, i; - - /* If BYMONTH has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->bymonth || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - if (recur_data->months[occ->month]) - g_array_append_vals (new_occs, occ, 1); - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - - -static GArray* -cal_obj_byweekno_expand (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ, year_start_cotime, year_end_cotime, cotime; - GList *elem; - gint len, i, weekno; - - /* If BYWEEKNO has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->byweekno || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - - /* Find the day that would correspond to week 1 (note that - week 1 is the first week starting from the specified week - start day that has 4 days in the new year). */ - year_start_cotime = *occ; - cal_obj_time_find_first_week (&year_start_cotime, - recur_data); - - /* Find the day that would correspond to week 1 of the next - year, which we use for -ve week numbers. */ - year_end_cotime = *occ; - year_end_cotime.year++; - cal_obj_time_find_first_week (&year_end_cotime, - recur_data); - - /* Now iterate over the week numbers in byweekno, generating a - new occurrence for each one. */ - elem = recur_data->recur->byweekno; - while (elem) { - weekno = GPOINTER_TO_INT (elem->data); - if (weekno > 0) { - cotime = year_start_cotime; - cal_obj_time_add_days (&cotime, - (weekno - 1) * 7); - } else { - cotime = year_end_cotime; - cal_obj_time_add_days (&cotime, weekno * 7); - } - - /* Skip occurrences if they fall outside the year. */ - if (cotime.year == occ->year) - g_array_append_val (new_occs, cotime); - elem = elem->next; - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - -#if 0 -/* This isn't used at present. */ -static GArray* -cal_obj_byweekno_filter (RecurData *recur_data, - GArray *occs) -{ - - return occs; -} -#endif - - -static GArray* -cal_obj_byyearday_expand (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ, year_start_cotime, year_end_cotime, cotime; - GList *elem; - gint len, i, dayno; - - /* If BYYEARDAY has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->byyearday || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - - /* Find the day that would correspond to day 1. */ - year_start_cotime = *occ; - year_start_cotime.month = 0; - year_start_cotime.day = 1; - - /* Find the day that would correspond to day 1 of the next - year, which we use for -ve day numbers. */ - year_end_cotime = *occ; - year_end_cotime.year++; - year_end_cotime.month = 0; - year_end_cotime.day = 1; - - /* Now iterate over the day numbers in byyearday, generating a - new occurrence for each one. */ - elem = recur_data->recur->byyearday; - while (elem) { - dayno = GPOINTER_TO_INT (elem->data); - if (dayno > 0) { - cotime = year_start_cotime; - cal_obj_time_add_days (&cotime, dayno - 1); - } else { - cotime = year_end_cotime; - cal_obj_time_add_days (&cotime, dayno); - } - - /* Skip occurrences if they fall outside the year. */ - if (cotime.year == occ->year) - g_array_append_val (new_occs, cotime); - elem = elem->next; - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - -/* Note: occs must not contain invalid dates, e.g. 31st September. */ -static GArray* -cal_obj_byyearday_filter (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - gint yearday, len, i, days_in_year; - - /* If BYYEARDAY has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->byyearday || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - yearday = cal_obj_time_day_of_year (occ); - if (recur_data->yeardays[yearday]) { - g_array_append_vals (new_occs, occ, 1); - } else { - days_in_year = g_date_is_leap_year (occ->year) - ? 366 : 365; - if (recur_data->neg_yeardays[days_in_year + 1 - - yearday]) - g_array_append_vals (new_occs, occ, 1); - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - - -static GArray* -cal_obj_bymonthday_expand (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ, month_start_cotime, month_end_cotime, cotime; - GList *elem; - gint len, i, dayno; - - /* If BYMONTHDAY has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->bymonthday || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - - /* Find the day that would correspond to day 1. */ - month_start_cotime = *occ; - month_start_cotime.day = 1; - - /* Find the day that would correspond to day 1 of the next - month, which we use for -ve day numbers. */ - month_end_cotime = *occ; - month_end_cotime.month++; - month_end_cotime.day = 1; - - /* Now iterate over the day numbers in bymonthday, generating a - new occurrence for each one. */ - elem = recur_data->recur->bymonthday; - while (elem) { - dayno = GPOINTER_TO_INT (elem->data); - if (dayno > 0) { - cotime = month_start_cotime; - cal_obj_time_add_days (&cotime, dayno - 1); - } else { - cotime = month_end_cotime; - cal_obj_time_add_days (&cotime, dayno); - } - - /* Skip occurrences if they fall outside the month. */ - if (cotime.month == occ->month) - g_array_append_val (new_occs, cotime); - elem = elem->next; - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - -static GArray* -cal_obj_bymonthday_filter (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - gint len, i, days_in_month; - - /* If BYMONTHDAY has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->bymonthday || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - if (recur_data->monthdays[occ->day]) { - g_array_append_vals (new_occs, occ, 1); - } else { - days_in_month = time_days_in_month (occ->year, - occ->month); - if (recur_data->neg_monthdays[days_in_month + 1 - - occ->day]) - g_array_append_vals (new_occs, occ, 1); - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - - -static GArray* -cal_obj_byday_expand_yearly (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - GList *elem; - gint len, i, weekday, week_num; - gint first_weekday, last_weekday, offset; - guint16 year; - - /* If BYDAY has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->byday || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - - elem = recur_data->recur->byday; - while (elem) { - weekday = GPOINTER_TO_INT (elem->data); - elem = elem->next; - week_num = GPOINTER_TO_INT (elem->data); - elem = elem->next; - - year = occ->year; - if (week_num == 0) { - /* Expand to every Mon/Tue/etc. in the year. */ - occ->month = 0; - occ->day = 1; - first_weekday = cal_obj_time_weekday (occ); - offset = (weekday + 7 - first_weekday) % 7; - cal_obj_time_add_days (occ, offset); - - while (occ->year == year) { - g_array_append_vals (new_occs, occ, 1); - cal_obj_time_add_days (occ, 7); - } - - } else if (week_num > 0) { - /* Add the nth Mon/Tue/etc. in the year. */ - occ->month = 0; - occ->day = 1; - first_weekday = cal_obj_time_weekday (occ); - offset = (weekday + 7 - first_weekday) % 7; - offset += (week_num - 1) * 7; - cal_obj_time_add_days (occ, offset); - if (occ->year == year) - g_array_append_vals (new_occs, occ, 1); - - } else { - /* Add the -nth Mon/Tue/etc. in the year. */ - occ->month = 11; - occ->day = 31; - last_weekday = cal_obj_time_weekday (occ); - offset = (last_weekday + 7 - weekday) % 7; - offset += (week_num - 1) * 7; - cal_obj_time_add_days (occ, -offset); - if (occ->year == year) - g_array_append_vals (new_occs, occ, 1); - } - - /* Reset the year, as we may have gone past the end. */ - occ->year = year; - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - -static GArray* -cal_obj_byday_expand_monthly (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - GList *elem; - gint len, i, weekday, week_num; - gint first_weekday, last_weekday, offset; - guint16 year; - guint8 month; - - /* If BYDAY has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->byday || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - - elem = recur_data->recur->byday; - while (elem) { - weekday = GPOINTER_TO_INT (elem->data); - elem = elem->next; - week_num = GPOINTER_TO_INT (elem->data); - elem = elem->next; - - year = occ->year; - month = occ->month; - if (week_num == 0) { - /* Expand to every Mon/Tue/etc. in the month.*/ - occ->day = 1; - first_weekday = cal_obj_time_weekday (occ); - offset = (weekday + 7 - first_weekday) % 7; - cal_obj_time_add_days (occ, offset); - - while (occ->year == year - && occ->month == month) { - g_array_append_vals (new_occs, occ, 1); - cal_obj_time_add_days (occ, 7); - } - - } else if (week_num > 0) { - /* Add the nth Mon/Tue/etc. in the month. */ - occ->day = 1; - first_weekday = cal_obj_time_weekday (occ); - offset = (weekday + 7 - first_weekday) % 7; - offset += (week_num - 1) * 7; - cal_obj_time_add_days (occ, offset); - if (occ->year == year && occ->month == month) - g_array_append_vals (new_occs, occ, 1); - - } else { - /* Add the -nth Mon/Tue/etc. in the month. */ - occ->day = time_days_in_month (occ->year, - occ->month); - last_weekday = cal_obj_time_weekday (occ); - - /* This calculates the number of days to step - backwards from the last day of the month - to the weekday we want. */ - offset = (last_weekday + 7 - weekday) % 7; - - /* This adds on the weeks. */ - offset += (-week_num - 1) * 7; - - cal_obj_time_add_days (occ, -offset); - if (occ->year == year && occ->month == month) - g_array_append_vals (new_occs, occ, 1); - } - - /* Reset the year & month, as we may have gone past - the end. */ - occ->year = year; - occ->month = month; - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - -/* Note: occs must not contain invalid dates, e.g. 31st September. */ -static GArray* -cal_obj_byday_expand_weekly (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - GList *elem; - gint len, i, weekday, week_num; - gint weekday_offset, new_weekday_offset; - - /* If BYDAY has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->byday || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - - elem = recur_data->recur->byday; - while (elem) { - weekday = GPOINTER_TO_INT (elem->data); - elem = elem->next; - - /* FIXME: Currently we just ignore this, but maybe we - should skip all elements where week_num != 0. - The spec isn't clear about this. */ - week_num = GPOINTER_TO_INT (elem->data); - elem = elem->next; - - weekday_offset = cal_obj_time_weekday_offset (occ, recur_data->recur); - new_weekday_offset = (weekday + 7 - recur_data->recur->week_start_day) % 7; - cal_obj_time_add_days (occ, new_weekday_offset - weekday_offset); - g_array_append_vals (new_occs, occ, 1); - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - -/* Note: occs must not contain invalid dates, e.g. 31st September. */ -static GArray* -cal_obj_byday_filter (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - gint len, i, weekday; - - /* If BYDAY has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->byday || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - weekday = cal_obj_time_weekday (occ); - - /* See if the weekday on its own is set. */ - if (recur_data->weekdays[weekday]) - g_array_append_vals (new_occs, occ, 1); - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - - -/* If the BYHOUR rule is specified it expands each occurrence in occs, by - using each of the hours in the byhour list. */ -static GArray* -cal_obj_byhour_expand (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - GList *elem; - gint len, i; - - /* If BYHOUR has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->byhour || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - - elem = recur_data->recur->byhour; - while (elem) { - occ->hour = GPOINTER_TO_INT (elem->data); - g_array_append_vals (new_occs, occ, 1); - elem = elem->next; - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - -/* If the BYHOUR rule is specified it filters out all occurrences in occs - which do not match one of the hours in the byhour list. */ -static GArray* -cal_obj_byhour_filter (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - gint len, i; - - /* If BYHOUR has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->byhour || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - if (recur_data->hours[occ->hour]) - g_array_append_vals (new_occs, occ, 1); - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - - -/* If the BYMINUTE rule is specified it expands each occurrence in occs, by - using each of the minutes in the byminute list. */ -static GArray* -cal_obj_byminute_expand (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - GList *elem; - gint len, i; - - /* If BYMINUTE has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->byminute || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - - elem = recur_data->recur->byminute; - while (elem) { - occ->minute = GPOINTER_TO_INT (elem->data); - g_array_append_vals (new_occs, occ, 1); - elem = elem->next; - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - -/* If the BYMINUTE rule is specified it filters out all occurrences in occs - which do not match one of the minutes in the byminute list. */ -static GArray* -cal_obj_byminute_filter (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - gint len, i; - - /* If BYMINUTE has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->byminute || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - if (recur_data->minutes[occ->minute]) - g_array_append_vals (new_occs, occ, 1); - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - - -/* If the BYSECOND rule is specified it expands each occurrence in occs, by - using each of the seconds in the bysecond list. */ -static GArray* -cal_obj_bysecond_expand (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - GList *elem; - gint len, i; - - /* If BYSECOND has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->bysecond || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - - elem = recur_data->recur->bysecond; - while (elem) { - occ->second = GPOINTER_TO_INT (elem->data); - g_array_append_vals (new_occs, occ, 1); - elem = elem->next; - } - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - -/* If the BYSECOND rule is specified it filters out all occurrences in occs - which do not match one of the seconds in the bysecond list. */ -static GArray* -cal_obj_bysecond_filter (RecurData *recur_data, - GArray *occs) -{ - GArray *new_occs; - CalObjTime *occ; - gint len, i; - - /* If BYSECOND has not been specified, or the array is empty, just - return the array. */ - if (!recur_data->recur->bysecond || occs->len == 0) - return occs; - - new_occs = g_array_new (FALSE, FALSE, sizeof (CalObjTime)); - - len = occs->len; - for (i = 0; i < len; i++) { - occ = &g_array_index (occs, CalObjTime, i); - if (recur_data->seconds[occ->second]) - g_array_append_vals (new_occs, occ, 1); - } - - g_array_free (occs, TRUE); - - return new_occs; -} - - - - - -/* Adds a positive or negative number of months to the given CalObjTime, - updating the year appropriately so we end up with a valid month. - Note that the day may be invalid, e.g. 30th Feb. */ -static void -cal_obj_time_add_months (CalObjTime *cotime, - gint months) -{ - guint month, years; - - /* We use a guint to avoid overflow on the guint8. */ - month = cotime->month + months; - cotime->month = month % 12; - if (month > 0) { - cotime->year += month / 12; - } else { - years = month / 12; - if (cotime->month != 0) { - cotime->month += 12; - years -= 1; - } - cotime->year += years; - } -} - - -/* Adds a positive or negative number of days to the given CalObjTime, - updating the month and year appropriately so we end up with a valid day. */ -static void -cal_obj_time_add_days (CalObjTime *cotime, - gint days) -{ - gint day, days_in_month; - - /* We use a guint to avoid overflow on the guint8. */ - day = cotime->day; - day += days; - - if (days >= 0) { - for (;;) { - days_in_month = time_days_in_month (cotime->year, - cotime->month); - if (day <= days_in_month) - break; - - cotime->month++; - if (cotime->month >= 12) { - cotime->year++; - cotime->month = 0; - } - - day -= days_in_month; - } - - cotime->day = (guint8) day; - } else { - while (day <= 0) { - if (cotime->month == 0) { - cotime->year--; - cotime->month = 11; - } else { - cotime->month--; - } - - days_in_month = time_days_in_month (cotime->year, - cotime->month); - day += days_in_month; - } - - cotime->day = (guint8) day; - } -} - - -/* Adds a positive or negative number of hours to the given CalObjTime, - updating the day, month & year appropriately so we end up with a valid - time. */ -static void -cal_obj_time_add_hours (CalObjTime *cotime, - gint hours) -{ - gint hour, days; - - /* We use a gint to avoid overflow on the guint8. */ - hour = cotime->hour + hours; - cotime->hour = hour % 24; - if (hour >= 0) { - if (hour >= 24) - cal_obj_time_add_days (cotime, hour / 24); - } else { - days = hour / 24; - if (cotime->hour != 0) { - cotime->hour += 24; - days -= 1; - } - cal_obj_time_add_days (cotime, days); - } -} - - -/* Adds a positive or negative number of minutes to the given CalObjTime, - updating the rest of the CalObjTime appropriately. */ -static void -cal_obj_time_add_minutes (CalObjTime *cotime, - gint minutes) -{ - gint minute, hours; - - /* We use a gint to avoid overflow on the guint8. */ - minute = cotime->minute + minutes; - cotime->minute = minute % 60; - if (minute >= 0) { - if (minute >= 60) - cal_obj_time_add_hours (cotime, minute / 60); - } else { - hours = minute / 60; - if (cotime->minute != 0) { - cotime->minute += 60; - hours -= 1; - } - cal_obj_time_add_hours (cotime, hours); - } -} - - -/* Adds a positive or negative number of seconds to the given CalObjTime, - updating the rest of the CalObjTime appropriately. */ -static void -cal_obj_time_add_seconds (CalObjTime *cotime, - gint seconds) -{ - gint second, minutes; - - /* We use a gint to avoid overflow on the guint8. */ - second = cotime->second + seconds; - cotime->second = second % 60; - if (second >= 0) { - if (second >= 60) - cal_obj_time_add_minutes (cotime, second / 60); - } else { - minutes = second / 60; - if (cotime->second != 0) { - cotime->second += 60; - minutes -= 1; - } - cal_obj_time_add_minutes (cotime, minutes); - } -} - - -/* Compares 2 CalObjTimes. Returns -1 if the cotime1 is before cotime2, 0 if - they are the same, or 1 if cotime1 is after cotime2. The comparison type - specifies which parts of the times we are interested in, e.g. if CALOBJ_DAY - is used we only want to know if the days are different. */ -static gint -cal_obj_time_compare (CalObjTime *cotime1, - CalObjTime *cotime2, - CalObjTimeComparison type) -{ - if (cotime1->year < cotime2->year) - return -1; - if (cotime1->year > cotime2->year) - return 1; - - if (type == CALOBJ_YEAR) - return 0; - - if (cotime1->month < cotime2->month) - return -1; - if (cotime1->month > cotime2->month) - return 1; - - if (type == CALOBJ_MONTH) - return 0; - - if (cotime1->day < cotime2->day) - return -1; - if (cotime1->day > cotime2->day) - return 1; - - if (type == CALOBJ_DAY) - return 0; - - if (cotime1->hour < cotime2->hour) - return -1; - if (cotime1->hour > cotime2->hour) - return 1; - - if (type == CALOBJ_HOUR) - return 0; - - if (cotime1->minute < cotime2->minute) - return -1; - if (cotime1->minute > cotime2->minute) - return 1; - - if (type == CALOBJ_MINUTE) - return 0; - - if (cotime1->second < cotime2->second) - return -1; - if (cotime1->second > cotime2->second) - return 1; - - return 0; -} - - -/* This is the same as the above function, but without the comparison type. - It is used for qsort(). */ -static gint -cal_obj_time_compare_func (const void *arg1, - const void *arg2) -{ - CalObjTime *cotime1, *cotime2; - gint retval; - - cotime1 = (CalObjTime*) arg1; - cotime2 = (CalObjTime*) arg2; - - if (cotime1->year < cotime2->year) - retval = -1; - else if (cotime1->year > cotime2->year) - retval = 1; - - else if (cotime1->month < cotime2->month) - retval = -1; - else if (cotime1->month > cotime2->month) - retval = 1; - - else if (cotime1->day < cotime2->day) - retval = -1; - else if (cotime1->day > cotime2->day) - retval = 1; - - else if (cotime1->hour < cotime2->hour) - retval = -1; - else if (cotime1->hour > cotime2->hour) - retval = 1; - - else if (cotime1->minute < cotime2->minute) - retval = -1; - else if (cotime1->minute > cotime2->minute) - retval = 1; - - else if (cotime1->second < cotime2->second) - retval = -1; - else if (cotime1->second > cotime2->second) - retval = 1; - - else - retval = 0; - -#if 0 - g_print ("%s - ", cal_obj_time_to_string (cotime1)); - g_print ("%s : %i\n", cal_obj_time_to_string (cotime2), retval); -#endif - - return retval; -} - - -static gint -cal_obj_date_only_compare_func (const void *arg1, - const void *arg2) -{ - CalObjTime *cotime1, *cotime2; - - cotime1 = (CalObjTime*) arg1; - cotime2 = (CalObjTime*) arg2; - - if (cotime1->year < cotime2->year) - return -1; - if (cotime1->year > cotime2->year) - return 1; - - if (cotime1->month < cotime2->month) - return -1; - if (cotime1->month > cotime2->month) - return 1; - - if (cotime1->day < cotime2->day) - return -1; - if (cotime1->day > cotime2->day) - return 1; - - return 0; -} - - -/* Returns the weekday of the given CalObjTime, from 0 (Mon) - 6 (Sun). */ -static gint -cal_obj_time_weekday (CalObjTime *cotime) -{ - GDate date; - gint weekday; - - g_date_clear (&date, 1); - g_date_set_dmy (&date, cotime->day, cotime->month + 1, cotime->year); - - /* This results in a value of 0 (Monday) - 6 (Sunday). */ - weekday = g_date_weekday (&date) - 1; - - return weekday; -} - - -/* Returns the weekday of the given CalObjTime, from 0 - 6. The week start - day is Monday by default, but can be set in the recurrence rule. */ -static gint -cal_obj_time_weekday_offset (CalObjTime *cotime, - CalRecurrence *recur) -{ - GDate date; - gint weekday, offset; - - g_date_clear (&date, 1); - g_date_set_dmy (&date, cotime->day, cotime->month + 1, cotime->year); - - /* This results in a value of 0 (Monday) - 6 (Sunday). */ - weekday = g_date_weekday (&date) - 1; - - /* This calculates the offset of our day from the start of the week. - We just add on a week (to avoid any possible negative values) and - then subtract the specified week start day, then convert it into a - value from 0-6. */ - offset = (weekday + 7 - recur->week_start_day) % 7; - - return offset; -} - - -/* Returns the day of the year of the given CalObjTime, from 1 - 366. */ -static gint -cal_obj_time_day_of_year (CalObjTime *cotime) -{ - GDate date; - - g_date_clear (&date, 1); - g_date_set_dmy (&date, cotime->day, cotime->month + 1, cotime->year); - - return g_date_day_of_year (&date); -} - - -/* Finds the first week in the given CalObjTime's year, using the same weekday - as the event start day (i.e. from the RecurData). - The first week of the year is the first week starting from the specified - week start day that has 4 days in the new year. It may be in the previous - year. */ -static void -cal_obj_time_find_first_week (CalObjTime *cotime, - RecurData *recur_data) -{ - GDate date; - gint weekday, week_start_day, first_full_week_start_offset, offset; - - /* Find out the weekday of the 1st of the year, 0 (Mon) - 6 (Sun). */ - g_date_clear (&date, 1); - g_date_set_dmy (&date, 1, 1, cotime->year); - weekday = g_date_weekday (&date) - 1; - - /* Calculate the first day of the year that starts a new week, i.e. the - first week_start_day after weekday, using 0 = 1st Jan. - e.g. if the 1st Jan is a Tuesday (1) and week_start_day is a - Monday (0), the result will be (0 + 7 - 1) % 7 = 6 (7th Jan). */ - week_start_day = recur_data->recur->week_start_day; - first_full_week_start_offset = (week_start_day + 7 - weekday) % 7; - - /* Now see if we have to move backwards 1 week, i.e. if the week - starts on or after Jan 5th (since the previous week has 4 days in - this year and so will be the first week of the year). */ - if (first_full_week_start_offset >= 4) - first_full_week_start_offset -= 7; - - /* Now add the days to get to the event's weekday. */ - offset = first_full_week_start_offset + recur_data->weekday_offset; - - /* Now move the cotime to the appropriate day. */ - cotime->month = 0; - cotime->day = 1; - cal_obj_time_add_days (cotime, offset); -} - - -static void -cal_object_time_from_time (CalObjTime *cotime, - time_t t, - icaltimezone *zone) -{ - struct icaltimetype tt; - - tt = icaltime_from_timet_with_zone (t, FALSE, zone); - - cotime->year = tt.year; - cotime->month = tt.month - 1; - cotime->day = tt.day; - cotime->hour = tt.hour; - cotime->minute = tt.minute; - cotime->second = tt.second; - cotime->flags = FALSE; -} - - -/* Debugging function to convert a CalObjTime to a string. It uses a static - buffer so beware. */ -#ifdef CAL_OBJ_DEBUG -static char* -cal_obj_time_to_string (CalObjTime *cotime) -{ - static char buffer[20]; - char *weekdays[] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun", - " " }; - gint weekday; - - weekday = cal_obj_time_weekday (cotime); - - sprintf (buffer, "%s %02i/%02i/%04i %02i:%02i:%02i", - weekdays[weekday], - cotime->day, cotime->month + 1, cotime->year, - cotime->hour, cotime->minute, cotime->second); - return buffer; -} -#endif - - -/* This recalculates the end dates for recurrence & exception rules which use - the COUNT property. If refresh is TRUE it will recalculate all enddates - for rules which use COUNT. If refresh is FALSE, it will only calculate - the enddate if it hasn't already been set. It returns TRUE if the component - was changed, i.e. if the component should be saved at some point. - We store the enddate in the "X-EVOLUTION-ENDDATE" parameter of the RRULE - or EXRULE. */ -static gboolean -cal_recur_ensure_end_dates (CalComponent *comp, - gboolean refresh, - CalRecurResolveTimezoneFn tz_cb, - gpointer tz_cb_data) -{ - GSList *rrules, *exrules, *elem; - gboolean changed = FALSE; - - /* Do the RRULEs. */ - cal_component_get_rrule_property_list (comp, &rrules); - for (elem = rrules; elem; elem = elem->next) { - changed |= cal_recur_ensure_rule_end_date (comp, elem->data, - FALSE, refresh, - tz_cb, tz_cb_data); - } - - /* Do the EXRULEs. */ - cal_component_get_exrule_property_list (comp, &exrules); - for (elem = exrules; elem; elem = elem->next) { - changed |= cal_recur_ensure_rule_end_date (comp, elem->data, - TRUE, refresh, - tz_cb, tz_cb_data); - } - - return changed; -} - - -typedef struct _CalRecurEnsureEndDateData CalRecurEnsureEndDateData; -struct _CalRecurEnsureEndDateData { - gint count; - gint instances; - time_t end_date; -}; - - -static gboolean -cal_recur_ensure_rule_end_date (CalComponent *comp, - icalproperty *prop, - gboolean exception, - gboolean refresh, - CalRecurResolveTimezoneFn tz_cb, - gpointer tz_cb_data) -{ - struct icalrecurrencetype rule; - CalRecurEnsureEndDateData cb_data; - - if (exception) - rule = icalproperty_get_exrule (prop); - else - rule = icalproperty_get_rrule (prop); - - /* If the rule doesn't use COUNT just return. */ - if (rule.count == 0) - return FALSE; - - /* If refresh is FALSE, we check if the enddate is already set, and - if it is we just return. */ - if (!refresh) { - if (cal_recur_get_rule_end_date (prop, NULL) != -1) - return FALSE; - } - - /* Calculate the end date. Note that we initialize end_date to 0, so - if the RULE doesn't generate COUNT instances we save a time_t of 0. - Also note that we use the UTC timezone as the default timezone. - In get_end_date() if the DTSTART is a DATE or floating time, we will - convert the ENDDATE to the current timezone. */ - cb_data.count = rule.count; - cb_data.instances = 0; - cb_data.end_date = 0; - cal_recur_generate_instances_of_rule (comp, prop, -1, -1, - cal_recur_ensure_rule_end_date_cb, - &cb_data, tz_cb, tz_cb_data, - icaltimezone_get_utc_timezone ()); - - /* Store the end date in the "X-EVOLUTION-ENDDATE" parameter of the - rule. */ - cal_recur_set_rule_end_date (prop, cb_data.end_date); - - return TRUE; -} - - -static gboolean -cal_recur_ensure_rule_end_date_cb (CalComponent *comp, - time_t instance_start, - time_t instance_end, - gpointer data) -{ - CalRecurEnsureEndDateData *cb_data; - - cb_data = (CalRecurEnsureEndDateData*) data; - - cb_data->instances++; - - if (cb_data->instances == cb_data->count) { - cb_data->end_date = instance_start; - return FALSE; - } - - return TRUE; -} - - -/* If default_timezone is set, the saved ENDDATE parameter is assumed to be - in that timezone. This is used when the DTSTART is a DATE or floating - value, since the RRULE end date will change depending on the timezone that - it is evaluated in. */ -static time_t -cal_recur_get_rule_end_date (icalproperty *prop, - icaltimezone *default_timezone) -{ - icalparameter *param; - const char *xname, *xvalue; - icalvalue *value; - struct icaltimetype icaltime; - icaltimezone *zone; - - param = icalproperty_get_first_parameter (prop, ICAL_X_PARAMETER); - while (param) { - xname = icalparameter_get_xname (param); - if (xname && !strcmp (xname, EVOLUTION_END_DATE_PARAMETER)) { - xvalue = icalparameter_get_x (param); - value = icalvalue_new_from_string (ICAL_DATETIME_VALUE, - xvalue); - if (value) { - icaltime = icalvalue_get_datetime (value); - icalvalue_free (value); - - zone = default_timezone ? default_timezone : - icaltimezone_get_utc_timezone (); - return icaltime_as_timet_with_zone (icaltime, - zone); - } - } - - param = icalproperty_get_next_parameter (prop, - ICAL_X_PARAMETER); - } - - return -1; -} - - -static void -cal_recur_set_rule_end_date (icalproperty *prop, - time_t end_date) -{ - icalparameter *param; - icalvalue *value; - icaltimezone *utc_zone; - struct icaltimetype icaltime; - const char *end_date_string, *xname; - - /* We save the value as a UTC DATE-TIME. */ - utc_zone = icaltimezone_get_utc_timezone (); - icaltime = icaltime_from_timet_with_zone (end_date, FALSE, utc_zone); - value = icalvalue_new_datetime (icaltime); - end_date_string = icalvalue_as_ical_string (value); - icalvalue_free (value); - - /* If we already have an X-EVOLUTION-ENDDATE parameter, set the value - to the new date-time. */ - param = icalproperty_get_first_parameter (prop, ICAL_X_PARAMETER); - while (param) { - xname = icalparameter_get_xname (param); - if (xname && !strcmp (xname, EVOLUTION_END_DATE_PARAMETER)) { - icalparameter_set_x (param, end_date_string); - return; - } - param = icalproperty_get_next_parameter (prop, ICAL_X_PARAMETER); - } - - /* Create a new X-EVOLUTION-ENDDATE and add it to the property. */ - param = icalparameter_new_x (end_date_string); - icalparameter_set_xname (param, EVOLUTION_END_DATE_PARAMETER); - icalproperty_add_parameter (prop, param); -} - diff --git a/calendar/cal-util/cal-recur.h b/calendar/cal-util/cal-recur.h deleted file mode 100644 index 5e1e21f1f4..0000000000 --- a/calendar/cal-util/cal-recur.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Evolution calendar recurrence rule functions - * - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Damon Chaplin <damon@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_RECUR_H -#define CAL_RECUR_H - -#include <glib.h> -#include <cal-util/cal-component.h> - -G_BEGIN_DECLS - -typedef gboolean (* CalRecurInstanceFn) (CalComponent *comp, - time_t instance_start, - time_t instance_end, - gpointer data); - -typedef icaltimezone* (* CalRecurResolveTimezoneFn) (const char *tzid, - gpointer data); - -/* - * Calls the given callback function for each occurrence of the event that - * intersects the range between the given start and end times (the end time is - * not included). Note that the occurrences may start before the given start - * time. - * - * If the callback routine returns FALSE the occurrence generation stops. - * - * Both start and end can be -1, in which case we start at the events first - * instance and continue until it ends, or forever if it has no enddate. - * - * The tz_cb is used to resolve references to timezones. It is passed a TZID - * and should return the icaltimezone* corresponding to that TZID. We need to - * do this as we access timezones in different ways on the client & server. - * - * The default_timezone argument is used for DTSTART or DTEND properties that - * are DATE values or do not have a TZID (i.e. floating times). - */ -void cal_recur_generate_instances (CalComponent *comp, - time_t start, - time_t end, - CalRecurInstanceFn cb, - gpointer cb_data, - CalRecurResolveTimezoneFn tz_cb, - gpointer tz_cb_data, - icaltimezone *default_timezone); - -G_END_DECLS - -#endif diff --git a/calendar/cal-util/cal-util-marshal.list b/calendar/cal-util/cal-util-marshal.list deleted file mode 100644 index 7c58793852..0000000000 --- a/calendar/cal-util/cal-util-marshal.list +++ /dev/null @@ -1,8 +0,0 @@ -NONE:INT,INT -NONE:ENUM,ENUM -NONE:ENUM,STRING -NONE:STRING,BOOL,INT,INT -NONE:STRING,STRING -NONE:POINTER,ENUM -NONE:POINTER,STRING -NONE:POINTER,POINTER diff --git a/calendar/cal-util/cal-util.c b/calendar/cal-util/cal-util.c deleted file mode 100644 index 9730bfdbc2..0000000000 --- a/calendar/cal-util/cal-util.c +++ /dev/null @@ -1,614 +0,0 @@ -/* Evolution calendar utilities and types - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-util.h> -#include "cal-util.h" - - - -/** - * cal_obj_instance_list_free: - * @list: List of #CalObjInstance structures. - * - * Frees a list of #CalObjInstance structures. - **/ -void -cal_obj_instance_list_free (GList *list) -{ - CalObjInstance *i; - GList *l; - - for (l = list; l; l = l->next) { - i = l->data; - - g_assert (i != NULL); - g_assert (i->uid != NULL); - - g_free (i->uid); - g_free (i); - } - - g_list_free (list); -} - -/** - * cal_obj_uid_list_free: - * @list: List of strings with unique identifiers. - * - * Frees a list of unique identifiers for calendar objects. - **/ -void -cal_obj_uid_list_free (GList *list) -{ - GList *l; - - for (l = list; l; l = l->next) { - char *uid; - - uid = l->data; - - g_assert (uid != NULL); - g_free (uid); - } - - g_list_free (list); -} - -icalcomponent * -cal_util_new_top_level (void) -{ - icalcomponent *icalcomp; - icalproperty *prop; - - icalcomp = icalcomponent_new (ICAL_VCALENDAR_COMPONENT); - - /* RFC 2445, section 4.7.1 */ - prop = icalproperty_new_calscale ("GREGORIAN"); - icalcomponent_add_property (icalcomp, prop); - - /* RFC 2445, section 4.7.3 */ - prop = icalproperty_new_prodid ("-//Ximian//NONSGML Evolution Calendar//EN"); - icalcomponent_add_property (icalcomp, prop); - - /* RFC 2445, section 4.7.4. This is the iCalendar spec version, *NOT* - * the product version! Do not change this! - */ - prop = icalproperty_new_version ("2.0"); - icalcomponent_add_property (icalcomp, prop); - - return icalcomp; -} - -/* Computes the range of time in which recurrences should be generated for a - * component in order to compute alarm trigger times. - */ -static void -compute_alarm_range (CalComponent *comp, GList *alarm_uids, time_t start, time_t end, - time_t *alarm_start, time_t *alarm_end) -{ - GList *l; - time_t repeat_time; - - *alarm_start = start; - *alarm_end = end; - - repeat_time = 0; - - for (l = alarm_uids; l; l = l->next) { - const char *auid; - CalComponentAlarm *alarm; - CalAlarmTrigger trigger; - struct icaldurationtype *dur; - time_t dur_time; - CalAlarmRepeat repeat; - - auid = l->data; - alarm = cal_component_get_alarm (comp, auid); - g_assert (alarm != NULL); - - cal_component_alarm_get_trigger (alarm, &trigger); - cal_component_alarm_get_repeat (alarm, &repeat); - cal_component_alarm_free (alarm); - - switch (trigger.type) { - case CAL_ALARM_TRIGGER_NONE: - case CAL_ALARM_TRIGGER_ABSOLUTE: - break; - - case CAL_ALARM_TRIGGER_RELATIVE_START: - case CAL_ALARM_TRIGGER_RELATIVE_END: - dur = &trigger.u.rel_duration; - dur_time = icaldurationtype_as_int (*dur); - - if (repeat.repetitions != 0) { - int rdur; - - rdur = repeat.repetitions * icaldurationtype_as_int (repeat.duration); - repeat_time = MAX (repeat_time, rdur); - } - - if (dur->is_neg) - /* If the duration is negative then dur_time - * will be negative as well; that is why we - * subtract to expand the range. - */ - *alarm_end = MAX (*alarm_end, end - dur_time); - else - *alarm_start = MIN (*alarm_start, start - dur_time); - - break; - - default: - g_assert_not_reached (); - } - } - - *alarm_start -= repeat_time; - - g_assert (*alarm_start <= *alarm_end); -} - -/* Closure data to generate alarm occurrences */ -struct alarm_occurrence_data { - /* These are the info we have */ - GList *alarm_uids; - time_t start; - time_t end; - - /* This is what we compute */ - GSList *triggers; - int n_triggers; -}; - -static void -add_trigger (struct alarm_occurrence_data *aod, const char *auid, time_t trigger, - time_t occur_start, time_t occur_end) -{ - CalAlarmInstance *instance; - - instance = g_new (CalAlarmInstance, 1); - instance->auid = auid; - instance->trigger = trigger; - instance->occur_start = occur_start; - instance->occur_end = occur_end; - - aod->triggers = g_slist_prepend (aod->triggers, instance); - aod->n_triggers++; -} - -/* Callback used from cal_recur_generate_instances(); generates triggers for all - * of a component's RELATIVE alarms. - */ -static gboolean -add_alarm_occurrences_cb (CalComponent *comp, time_t start, time_t end, gpointer data) -{ - struct alarm_occurrence_data *aod; - GList *l; - - aod = data; - - for (l = aod->alarm_uids; l; l = l->next) { - const char *auid; - CalComponentAlarm *alarm; - CalAlarmTrigger trigger; - CalAlarmRepeat repeat; - struct icaldurationtype *dur; - time_t dur_time; - time_t occur_time, trigger_time; - - auid = l->data; - alarm = cal_component_get_alarm (comp, auid); - g_assert (alarm != NULL); - - cal_component_alarm_get_trigger (alarm, &trigger); - cal_component_alarm_get_repeat (alarm, &repeat); - cal_component_alarm_free (alarm); - - if (trigger.type != CAL_ALARM_TRIGGER_RELATIVE_START - && trigger.type != CAL_ALARM_TRIGGER_RELATIVE_END) - continue; - - dur = &trigger.u.rel_duration; - dur_time = icaldurationtype_as_int (*dur); - - if (trigger.type == CAL_ALARM_TRIGGER_RELATIVE_START) - occur_time = start; - else - occur_time = end; - - /* If dur->is_neg is true then dur_time will already be - * negative. So we do not need to test for dur->is_neg here; we - * can simply add the dur_time value to the occur_time and get - * the correct result. - */ - - trigger_time = occur_time + dur_time; - - /* Add repeating alarms */ - - if (repeat.repetitions != 0) { - int i; - time_t repeat_time; - - repeat_time = icaldurationtype_as_int (repeat.duration); - - for (i = 0; i < repeat.repetitions; i++) { - time_t t; - - t = trigger_time + (i + 1) * repeat_time; - - if (t >= aod->start && t < aod->end) - add_trigger (aod, auid, t, start, end); - } - } - - /* Add the trigger itself */ - - if (trigger_time >= aod->start && trigger_time < aod->end) - add_trigger (aod, auid, trigger_time, start, end); - } - - return TRUE; -} - -/* Generates the absolute triggers for a component */ -static void -generate_absolute_triggers (CalComponent *comp, struct alarm_occurrence_data *aod, - CalRecurResolveTimezoneFn resolve_tzid, - gpointer user_data, - icaltimezone *default_timezone) -{ - GList *l; - CalComponentDateTime dt_start, dt_end; - - cal_component_get_dtstart (comp, &dt_start); - cal_component_get_dtend (comp, &dt_end); - - for (l = aod->alarm_uids; l; l = l->next) { - const char *auid; - CalComponentAlarm *alarm; - CalAlarmRepeat repeat; - CalAlarmTrigger trigger; - time_t abs_time; - time_t occur_start, occur_end; - icaltimezone *zone; - - auid = l->data; - alarm = cal_component_get_alarm (comp, auid); - g_assert (alarm != NULL); - - cal_component_alarm_get_trigger (alarm, &trigger); - cal_component_alarm_get_repeat (alarm, &repeat); - cal_component_alarm_free (alarm); - - if (trigger.type != CAL_ALARM_TRIGGER_ABSOLUTE) - continue; - - /* Absolute triggers are always in UTC; see RFC 2445 section 4.8.6.3 */ - zone = icaltimezone_get_utc_timezone (); - - abs_time = icaltime_as_timet_with_zone (trigger.u.abs_time, zone); - - /* No particular occurrence, so just use the times from the component */ - - if (dt_start.value) { - if (dt_start.tzid && !dt_start.value->is_date) - zone = (* resolve_tzid) (dt_start.tzid, user_data); - else - zone = default_timezone; - - occur_start = icaltime_as_timet_with_zone (*dt_start.value, zone); - } else - occur_start = -1; - - if (dt_end.value) { - if (dt_end.tzid && !dt_end.value->is_date) - zone = (* resolve_tzid) (dt_end.tzid, user_data); - else - zone = default_timezone; - - occur_end = icaltime_as_timet_with_zone (*dt_end.value, zone); - } else - occur_end = -1; - - /* Add repeating alarms */ - - if (repeat.repetitions != 0) { - int i; - time_t repeat_time; - - repeat_time = icaldurationtype_as_int (repeat.duration); - - for (i = 0; i < repeat.repetitions; i++) { - time_t t; - - t = abs_time + (i + 1) * repeat_time; - - if (t >= aod->start && t < aod->end) - add_trigger (aod, auid, t, occur_start, occur_end); - } - } - - /* Add the trigger itself */ - - if (abs_time >= aod->start && abs_time < aod->end) - add_trigger (aod, auid, abs_time, occur_start, occur_end); - } - - cal_component_free_datetime (&dt_start); - cal_component_free_datetime (&dt_end); -} - -/* Compares two alarm instances; called from g_slist_sort() */ -static gint -compare_alarm_instance (gconstpointer a, gconstpointer b) -{ - const CalAlarmInstance *aia, *aib; - - aia = a; - aib = b; - - if (aia->trigger < aib->trigger) - return -1; - else if (aia->trigger > aib->trigger) - return 1; - else - return 0; -} - -/** - * cal_util_generate_alarms_for_comp - * @comp: the CalComponent to generate alarms from - * @start: start time - * @end: end time - * @resolve_tzid: callback for resolving timezones - * @user_data: data to be passed to the resolve_tzid callback - * @default_timezone: the timezone used to resolve DATE and floating DATE-TIME - * values. - * - * Generates alarm instances for a calendar component. Returns the instances - * structure, or NULL if no alarm instances occurred in the specified time - * range. - */ -CalComponentAlarms * -cal_util_generate_alarms_for_comp (CalComponent *comp, - time_t start, - time_t end, - CalRecurResolveTimezoneFn resolve_tzid, - gpointer user_data, - icaltimezone *default_timezone) -{ - GList *alarm_uids; - time_t alarm_start, alarm_end; - struct alarm_occurrence_data aod; - CalComponentAlarms *alarms; - - if (!cal_component_has_alarms (comp)) - return NULL; - - alarm_uids = cal_component_get_alarm_uids (comp); - compute_alarm_range (comp, alarm_uids, start, end, &alarm_start, &alarm_end); - - aod.alarm_uids = alarm_uids; - aod.start = start; - aod.end = end; - aod.triggers = NULL; - aod.n_triggers = 0; - - cal_recur_generate_instances (comp, alarm_start, alarm_end, - add_alarm_occurrences_cb, &aod, - resolve_tzid, user_data, - default_timezone); - - /* We add the ABSOLUTE triggers separately */ - generate_absolute_triggers (comp, &aod, resolve_tzid, user_data, default_timezone); - - if (aod.n_triggers == 0) - return NULL; - - /* Create the component alarm instances structure */ - - alarms = g_new (CalComponentAlarms, 1); - alarms->comp = comp; - g_object_ref (G_OBJECT (alarms->comp)); - alarms->alarms = g_slist_sort (aod.triggers, compare_alarm_instance); - - return alarms; -} - -/** - * cal_util_generate_alarms_for_list - * @comps: list of CalComponent's - * @start: start time - * @end: end time - * @comp_alarms: list to be returned - * @resolve_tzid: callback for resolving timezones - * @user_data: data to be passed to the resolve_tzid callback - * @default_timezone: the timezone used to resolve DATE and floating DATE-TIME - * values. - * - * Iterates through all the components in the comps list and generates alarm - * instances for them; putting them in the comp_alarms list. - * - * Returns: the number of elements it added to that list. - */ -int -cal_util_generate_alarms_for_list (GList *comps, - time_t start, - time_t end, - GSList **comp_alarms, - CalRecurResolveTimezoneFn resolve_tzid, - gpointer user_data, - icaltimezone *default_timezone) -{ - GList *l; - int n; - - n = 0; - - for (l = comps; l; l = l->next) { - CalComponent *comp; - CalComponentAlarms *alarms; - - comp = CAL_COMPONENT (l->data); - alarms = cal_util_generate_alarms_for_comp (comp, start, end, resolve_tzid, user_data, default_timezone); - - if (alarms) { - *comp_alarms = g_slist_prepend (*comp_alarms, alarms); - n++; - } - } - - return n; -} - - -/* Converts an iCalendar PRIORITY value to a translated string. Any unknown - priority value (i.e. not 0-9) will be returned as "" (undefined). */ -char * -cal_util_priority_to_string (int priority) -{ - char *retval; - - if (priority <= 0) - retval = ""; - else if (priority <= 4) - retval = _("High"); - else if (priority == 5) - retval = _("Normal"); - else if (priority <= 9) - retval = _("Low"); - else - retval = ""; - - return retval; -} - - -/* Converts a translated priority string to an iCalendar priority value. - Returns -1 if the priority string is not valid. */ -int -cal_util_priority_from_string (const char *string) -{ - int priority; - - /* An empty string is the same as 'None'. */ - if (!string || !string[0] || !g_strcasecmp (string, _("Undefined"))) - priority = 0; - else if (!g_strcasecmp (string, _("High"))) - priority = 3; - else if (!g_strcasecmp (string, _("Normal"))) - priority = 5; - else if (!g_strcasecmp (string, _("Low"))) - priority = 7; - else - priority = -1; - - return priority; -} - -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; -} - -/* callback for icalcomponent_foreach_tzid */ -typedef struct { - icalcomponent *vcal_comp; - CalComponent *comp; -} ForeachTzidData; - -static void -add_timezone_cb (icalparameter *param, void *data) -{ - icaltimezone *tz; - const char *tzid; - icalcomponent *vtz_comp; - ForeachTzidData *f_data = (ForeachTzidData *) data; - - tzid = icalparameter_get_tzid (param); - if (!tzid) - return; - - tz = icalcomponent_get_timezone (f_data->vcal_comp, tzid); - if (tz) - return; - - tz = icalcomponent_get_timezone (cal_component_get_icalcomponent (f_data->comp), - tzid); - if (!tz) { - tz = icaltimezone_get_builtin_timezone_from_tzid (tzid); - if (!tz) - return; - } - - vtz_comp = icaltimezone_get_component (tz); - if (!vtz_comp) - return; - - icalcomponent_add_component (f_data->vcal_comp, - icalcomponent_new_clone (vtz_comp)); -} - -/* Adds VTIMEZONE components to a VCALENDAR for all tzid's - * in the given CalComponent. */ -void -cal_util_add_timezones_from_component (icalcomponent *vcal_comp, - CalComponent *comp) -{ - ForeachTzidData f_data; - - g_return_if_fail (vcal_comp != NULL); - g_return_if_fail (IS_CAL_COMPONENT (comp)); - - f_data.vcal_comp = vcal_comp; - f_data.comp = comp; - icalcomponent_foreach_tzid (cal_component_get_icalcomponent (comp), - add_timezone_cb, &f_data); -} diff --git a/calendar/cal-util/cal-util.h b/calendar/cal-util/cal-util.h deleted file mode 100644 index a4d95a3e8c..0000000000 --- a/calendar/cal-util/cal-util.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Evolution calendar utilities and types - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_UTIL_H -#define CAL_UTIL_H - -#include <ical.h> -#include <time.h> -#include <glib.h> -#include <cal-util/cal-component.h> -#include <cal-util/cal-recur.h> - -G_BEGIN_DECLS - - - -/* Instance of a calendar object. This can be an actual occurrence, a - * recurrence, or an alarm trigger of a `real' calendar object. - */ -typedef struct { - char *uid; /* UID of the object */ - time_t start; /* Start time of instance */ - time_t end; /* End time of instance */ -} CalObjInstance; - -void cal_obj_instance_list_free (GList *list); - -/* Used for multiple UID queries */ -typedef enum { - CALOBJ_TYPE_EVENT = 1 << 0, - CALOBJ_TYPE_TODO = 1 << 1, - CALOBJ_TYPE_JOURNAL = 1 << 2, - CALOBJ_TYPE_ANY = 0x07 -} CalObjType; - -/* Used for mode stuff */ -typedef enum { - CAL_MODE_INVALID = -1, - CAL_MODE_LOCAL = 1 << 0, - CAL_MODE_REMOTE = 1 << 1, - CAL_MODE_ANY = 0x07 -} CalMode; - -void cal_obj_uid_list_free (GList *list); - -icalcomponent *cal_util_new_top_level (void); - -CalComponentAlarms *cal_util_generate_alarms_for_comp (CalComponent *comp, - time_t start, - time_t end, - CalRecurResolveTimezoneFn resolve_tzid, - gpointer user_data, - icaltimezone *default_timezone); -int cal_util_generate_alarms_for_list (GList *comps, - time_t start, - time_t end, - GSList **comp_alarms, - CalRecurResolveTimezoneFn resolve_tzid, - gpointer user_data, - icaltimezone *default_timezone); - -icaltimezone *cal_util_resolve_tzid (const char *tzid, gpointer data); - -char *cal_util_priority_to_string (int priority); -int cal_util_priority_from_string (const char *string); - -char *cal_util_expand_uri (char *uri, gboolean tasks); - -void cal_util_add_timezones_from_component (icalcomponent *vcal_comp, - CalComponent *comp); - -G_END_DECLS - -#endif - diff --git a/calendar/cal-util/test-recur.c b/calendar/cal-util/test-recur.c deleted file mode 100644 index 5078a1db94..0000000000 --- a/calendar/cal-util/test-recur.c +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Damon Chaplin <damon@ximian.com> - * - * Copyright 2000, Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * This tests the recurrence rule expansion functions. - * - * NOTE: currently it starts from the event start date and continues - * until all recurrence rules/dates end or we reach MAX_OCCURRENCES - * occurrences. So it does not test generating occurrences for a specific - * interval. A nice addition might be to do this automatically and compare - * the results from the complete set to ensure they match. - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtkmain.h> -#include <cal-util/cal-recur.h> - - -/* Since events can recur infinitely, we set a limit to the number of - occurrences we output. */ -#define MAX_OCCURRENCES 1000 - -static void usage (void); -static icalcomponent* scan_ics_file (char *filename); -static char* get_line (char *s, - size_t size, - void *data); -static void generate_occurrences (icalcomponent *comp); -static gboolean occurrence_cb (CalComponent *comp, - time_t instance_start, - time_t instance_end, - gpointer data); - - -int -main (int argc, - char *argv[]) -{ - gchar *filename; - icalcomponent *icalcomp; - - gtk_init (&argc, &argv); - - if (argc != 2) - usage (); - - filename = argv[1]; - - icalcomp = scan_ics_file (filename); - if (icalcomp) - generate_occurrences (icalcomp); - - return 0; -} - - -static void -usage (void) -{ - g_print ("Usage: test-recur <filename>\n"); - exit (1); -} - - -static icalcomponent* -scan_ics_file (char *filename) -{ - FILE *fp; - icalcomponent *icalcomp; - icalparser *parser; - - g_print ("Opening file: %s\n", filename); - fp = fopen (filename, "r"); - - if (!fp) { - g_print ("Can't open file: %s\n", filename); - return NULL; - } - - parser = icalparser_new (); - icalparser_set_gen_data (parser, fp); - - icalcomp = icalparser_parse (parser, get_line); - icalparser_free (parser); - - return icalcomp; -} - - -/* Callback used from icalparser_parse() */ -static char * -get_line (char *s, - size_t size, - void *data) -{ - return fgets (s, size, (FILE*) data); -} - - -/* This resolves any TZIDs in the components. The VTIMEZONEs must be in the - file we are reading. */ -static icaltimezone* -resolve_tzid_cb (const char *tzid, - gpointer user_data) -{ - icalcomponent *vcalendar_comp = user_data; - - if (!tzid || !tzid[0]) - return NULL; - else if (!strcmp (tzid, "UTC")) - return icaltimezone_get_utc_timezone (); - - return icalcomponent_get_timezone (vcalendar_comp, tzid); -} - - -static void -generate_occurrences (icalcomponent *icalcomp) -{ - icalcompiter iter; - icaltimezone *default_timezone; - - /* This is the timezone we will use for DATE and floating values. */ - default_timezone = icaltimezone_get_utc_timezone (); - - for (iter = icalcomponent_begin_component (icalcomp, ICAL_ANY_COMPONENT); - icalcompiter_deref (&iter) != NULL; - icalcompiter_next (&iter)) { - icalcomponent *tmp_icalcomp; - CalComponent *comp; - icalcomponent_kind kind; - gint occurrences; - - tmp_icalcomp = icalcompiter_deref (&iter); - kind = icalcomponent_isa (tmp_icalcomp); - - if (!(kind == ICAL_VEVENT_COMPONENT - || kind == ICAL_VTODO_COMPONENT - || kind == ICAL_VJOURNAL_COMPONENT)) - continue; - - comp = cal_component_new (); - - if (!cal_component_set_icalcomponent (comp, tmp_icalcomp)) - continue; - - g_print ("#############################################################################\n"); - g_print ("%s\n\n", icalcomponent_as_ical_string (tmp_icalcomp)); - g_print ("Instances:\n"); - - occurrences = 0; - /* I use specific times when I am trying to pin down a bug seen - in one of the calendar views. */ -#if 0 - cal_recur_generate_instances (comp, 982022400, 982108800, - occurrence_cb, &occurrences, - resolve_tzid_cb, icalcomp, - default_timezone); -#else - cal_recur_generate_instances (comp, -1, -1, - occurrence_cb, &occurrences, - resolve_tzid_cb, icalcomp, - default_timezone); -#endif - - /* Print the component again so we can see the - X-EVOLUTION-ENDDATE parameter (only set if COUNT is used). - */ - g_print ("#############################################################################\n"); -#if 0 - g_print ("%s\n\n", icalcomponent_as_ical_string (tmp_icalcomp)); -#endif - } -} - - -static gboolean -occurrence_cb (CalComponent *comp, - time_t instance_start, - time_t instance_end, - gpointer data) -{ - char start[32], finish[32]; - gint *occurrences; - - occurrences = (gint*) data; - - strcpy (start, ctime (&instance_start)); - start[24] = '\0'; - strcpy (finish, ctime (&instance_end)); - finish[24] = '\0'; - - g_print ("%s - %s\n", start, finish); - - (*occurrences)++; - return (*occurrences == MAX_OCCURRENCES) ? FALSE : TRUE; -} diff --git a/calendar/cal-util/timeutil.c b/calendar/cal-util/timeutil.c deleted file mode 100644 index 75e04611a3..0000000000 --- a/calendar/cal-util/timeutil.c +++ /dev/null @@ -1,577 +0,0 @@ -/* Miscellaneous time-related utilities - * - * Copyright (C) 2000, 2001 Ximian, Inc. - * - * Authors: Federico Mena <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Damon Chaplin <damon@ximian.com> - */ - -#include <string.h> -#include <ctype.h> -#include <glib.h> -#include <ical.h> -#include "timeutil.h" - - - -#define REFORMATION_DAY 639787 /* First day of the reformation, counted from 1 Jan 1 */ -#define MISSING_DAYS 11 /* They corrected out 11 days */ -#define THURSDAY 4 /* First day of reformation */ -#define SATURDAY 6 /* Offset value; 1 Jan 1 was a Saturday */ - - -/* Number of days in a month, using 0 (Jan) to 11 (Dec). For leap years, - add 1 to February (month 1). */ -static const int days_in_month[12] = { - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 -}; - - - -/************************************************************************** - * time_t manipulation functions. - * - * NOTE: these use the Unix timezone functions like mktime() and localtime() - * and so should not be used in Evolution. New Evolution code should use - * icaltimetype values rather than time_t values wherever possible. - **************************************************************************/ - -/* Adds a day onto the time, using local time. - Note that if clocks go forward due to daylight savings time, there are - some non-existent local times, so the hour may be changed to make it a - valid time. This also means that it may not be wise to keep calling - time_add_day() to step through a certain period - if the hour gets changed - to make it valid time, any further calls to time_add_day() will also return - this hour, which may not be what you want. */ -time_t -time_add_day (time_t time, int days) -{ - struct tm *tm; - - tm = localtime (&time); - tm->tm_mday += days; - tm->tm_isdst = -1; - - return mktime (tm); -} - -time_t -time_add_week (time_t time, int weeks) -{ - return time_add_day (time, weeks * 7); -} - -/* Returns the start of the day, according to the local time. */ -time_t -time_day_begin (time_t t) -{ - struct tm tm; - - tm = *localtime (&t); - tm.tm_hour = tm.tm_min = tm.tm_sec = 0; - tm.tm_isdst = -1; - - return mktime (&tm); -} - -/* Returns the end of the day, according to the local time. */ -time_t -time_day_end (time_t t) -{ - struct tm tm; - - tm = *localtime (&t); - tm.tm_hour = tm.tm_min = tm.tm_sec = 0; - tm.tm_mday++; - tm.tm_isdst = -1; - - return mktime (&tm); -} - - -/************************************************************************** - * time_t manipulation functions, using timezones in libical. - * - * NOTE: these are only here to make the transition to the timezone - * functions easier. New code should use icaltimetype values rather than - * time_t values wherever possible. - **************************************************************************/ - - -/* Adds or subtracts a number of days to/from the given time_t value, using - the given timezone. - NOTE: this function is only here to make the transition to the timezone - functions easier. New code should use icaltimetype values and - icaltime_adjust() to add or subtract days, hours, minutes & seconds. */ -time_t -time_add_day_with_zone (time_t time, int days, icaltimezone *zone) -{ - struct icaltimetype tt; - - /* Convert to an icaltimetype. */ - tt = icaltime_from_timet_with_zone (time, FALSE, zone); - - /* Add/subtract the number of days. */ - icaltime_adjust (&tt, days, 0, 0, 0); - - /* Convert back to a time_t. */ - return icaltime_as_timet_with_zone (tt, zone); -} - - -/* Adds or subtracts a number of weeks to/from the given time_t value, using - the given timezone. - NOTE: this function is only here to make the transition to the timezone - functions easier. New code should use icaltimetype values and - icaltime_adjust() to add or subtract days, hours, minutes & seconds. */ -time_t -time_add_week_with_zone (time_t time, int weeks, icaltimezone *zone) -{ - return time_add_day_with_zone (time, weeks * 7, zone); -} - - -/* Adds or subtracts a number of months to/from the given time_t value, using - the given timezone. - - If the day would be off the end of the month (e.g. adding 1 month to - 30th January, would lead to an invalid day, 30th February), it moves it - down to the last day in the month, e.g. 28th Feb (or 29th in a leap year.) - - NOTE: this function is only here to make the transition to the timezone - functions easier. New code should use icaltimetype values and - icaltime_adjust() to add or subtract days, hours, minutes & seconds. */ -time_t -time_add_month_with_zone (time_t time, int months, icaltimezone *zone) -{ - struct icaltimetype tt; - int day, days_in_month; - - /* Convert to an icaltimetype. */ - tt = icaltime_from_timet_with_zone (time, FALSE, zone); - - /* Add on the number of months. */ - tt.month += months; - - /* Save the day, and set it to 1, so we don't overflow into the next - month. */ - day = tt.day; - tt.day = 1; - - /* Normalize it, fixing any month overflow. */ - tt = icaltime_normalize (tt); - - /* If we go past the end of a month, set it to the last day. */ - days_in_month = time_days_in_month (tt.year, tt.month - 1); - if (day > days_in_month) - day = days_in_month; - - tt.day = day; - - /* Convert back to a time_t. */ - return icaltime_as_timet_with_zone (tt, zone); -} - - -/* Returns the start of the year containing the given time_t, using the given - timezone. - NOTE: this function is only here to make the transition to the timezone - functions easier. New code should use icaltimetype values and - icaltime_adjust() to add or subtract days, hours, minutes & seconds. */ -time_t -time_year_begin_with_zone (time_t time, icaltimezone *zone) -{ - struct icaltimetype tt; - - /* Convert to an icaltimetype. */ - tt = icaltime_from_timet_with_zone (time, FALSE, zone); - - /* Set it to the start of the year. */ - tt.month = 1; - tt.day = 1; - tt.hour = 0; - tt.minute = 0; - tt.second = 0; - - /* Convert back to a time_t. */ - return icaltime_as_timet_with_zone (tt, zone); -} - - -/* Returns the start of the month containing the given time_t, using the given - timezone. - NOTE: this function is only here to make the transition to the timezone - functions easier. New code should use icaltimetype values and - icaltime_adjust() to add or subtract days, hours, minutes & seconds. */ -time_t -time_month_begin_with_zone (time_t time, icaltimezone *zone) -{ - struct icaltimetype tt; - - /* Convert to an icaltimetype. */ - tt = icaltime_from_timet_with_zone (time, FALSE, zone); - - /* Set it to the start of the month. */ - tt.day = 1; - tt.hour = 0; - tt.minute = 0; - tt.second = 0; - - /* Convert back to a time_t. */ - return icaltime_as_timet_with_zone (tt, zone); -} - - -/* Returns the start of the week containing the given time_t, using the given - timezone. week_start_day should use the same values as mktime(), - i.e. 0 (Sun) to 6 (Sat). - NOTE: this function is only here to make the transition to the timezone - functions easier. New code should use icaltimetype values and - icaltime_adjust() to add or subtract days, hours, minutes & seconds. */ -time_t -time_week_begin_with_zone (time_t time, int week_start_day, icaltimezone *zone) -{ - struct icaltimetype tt; - int weekday, offset; - - /* Convert to an icaltimetype. */ - tt = icaltime_from_timet_with_zone (time, FALSE, zone); - - /* Get the weekday. */ - weekday = time_day_of_week (tt.day, tt.month - 1, tt.year); - - /* Calculate the current offset from the week start day. */ - offset = (weekday + 7 - week_start_day) % 7; - - /* Set it to the start of the month. */ - tt.day -= offset; - tt.hour = 0; - tt.minute = 0; - tt.second = 0; - - /* Normalize it, to fix any overflow. */ - tt = icaltime_normalize (tt); - - /* Convert back to a time_t. */ - return icaltime_as_timet_with_zone (tt, zone); -} - - -/* Returns the start of the day containing the given time_t, using the given - timezone. - NOTE: this function is only here to make the transition to the timezone - functions easier. New code should use icaltimetype values and - icaltime_adjust() to add or subtract days, hours, minutes & seconds. */ -time_t -time_day_begin_with_zone (time_t time, icaltimezone *zone) -{ - struct icaltimetype tt; - - /* Convert to an icaltimetype. */ - tt = icaltime_from_timet_with_zone (time, FALSE, zone); - - /* Set it to the start of the day. */ - tt.hour = 0; - tt.minute = 0; - tt.second = 0; - - /* Convert back to a time_t. */ - return icaltime_as_timet_with_zone (tt, zone); -} - - -/* Returns the end of the day containing the given time_t, using the given - timezone. (The end of the day is the start of the next day.) - NOTE: this function is only here to make the transition to the timezone - functions easier. New code should use icaltimetype values and - icaltime_adjust() to add or subtract days, hours, minutes & seconds. */ -time_t -time_day_end_with_zone (time_t time, icaltimezone *zone) -{ - struct icaltimetype tt; - - /* Convert to an icaltimetype. */ - tt = icaltime_from_timet_with_zone (time, FALSE, zone); - - /* Set it to the start of the next day. */ - tt.day++; - tt.hour = 0; - tt.minute = 0; - tt.second = 0; - - /* Normalize it, to fix any overflow. */ - tt = icaltime_normalize (tt); - - /* Convert back to a time_t. */ - return icaltime_as_timet_with_zone (tt, zone); -} - -/** - * time_to_gdate_with_zone: - * @date: Destination #GDate value. - * @time: A time value. - * @zone: Desired timezone for destination @date, or NULL if the UTC timezone - * is desired. - * - * Converts a time_t value to a #GDate structure using the specified timezone. - * This is analogous to g_date_set_time() but takes the timezone into account. - **/ -void -time_to_gdate_with_zone (GDate *date, time_t time, icaltimezone *zone) -{ - struct icaltimetype tt; - - g_return_if_fail (date != NULL); - g_return_if_fail (time != -1); - - tt = icaltime_from_timet_with_zone (time, FALSE, - zone ? zone : icaltimezone_get_utc_timezone ()); - - g_date_set_dmy (date, tt.day, tt.month, tt.year); -} - - -/************************************************************************** - * General time functions. - **************************************************************************/ - - -/* Returns the number of days in the month. Year is the normal year, e.g. 2001. - Month is 0 (Jan) to 11 (Dec). */ -int -time_days_in_month (int year, int month) -{ - int days; - - g_return_val_if_fail (year >= 1900, 0); - g_return_val_if_fail ((month >= 0) && (month < 12), 0); - - days = days_in_month[month]; - if (month == 1 && time_is_leap_year (year)) - days++; - - return days; -} - - -/* Returns the 1-based day number within the year of the specified date. - Year is the normal year, e.g. 2001. Month is 0 to 11. */ -int -time_day_of_year (int day, int month, int year) -{ - int i; - - for (i = 0; i < month; i++) { - day += days_in_month[i]; - - if (i == 1 && time_is_leap_year (year)) - day++; - } - - return day; -} - - -/* Returns the day of the week for the specified date, 0 (Sun) to 6 (Sat). - For the days that were removed on the Gregorian reformation, it returns - Thursday. Year is the normal year, e.g. 2001. Month is 0 to 11. */ -int -time_day_of_week (int day, int month, int year) -{ - int n; - - n = (year - 1) * 365 + time_leap_years_up_to (year - 1) - + time_day_of_year (day, month, year); - - if (n < REFORMATION_DAY) - return (n - 1 + SATURDAY) % 7; - - if (n >= (REFORMATION_DAY + MISSING_DAYS)) - return (n - 1 + SATURDAY - MISSING_DAYS) % 7; - - return THURSDAY; -} - - -/* Returns whether the specified year is a leap year. Year is the normal year, - e.g. 2001. */ -gboolean -time_is_leap_year (int year) -{ - if (year <= 1752) - return !(year % 4); - else - return (!(year % 4) && (year % 100)) || !(year % 400); -} - - -/* Returns the number of leap years since year 1 up to (but not including) the - specified year. Year is the normal year, e.g. 2001. */ -int -time_leap_years_up_to (int year) -{ - /* There is normally a leap year every 4 years, except at the turn of - centuries since 1700. But there is a leap year on centuries since 1700 - which are divisible by 400. */ - return (year / 4 - - ((year > 1700) ? (year / 100 - 17) : 0) - + ((year > 1600) ? ((year - 1600) / 400) : 0)); -} - - -/** - * isodate_from_time_t: - * @t: A time value. - * - * Creates an ISO 8601 UTC representation from a time value. - * - * Return value: String with the ISO 8601 representation of the UTC time. - **/ -char * -isodate_from_time_t (time_t t) -{ - gchar *ret; - - ret = g_malloc (17); /* 4+2+2+1+2+2+2+1 + 1 */ - strftime (ret, 17, "%Y%m%dT%H%M%SZ", gmtime (&t)); - - return ret; -} - -/** - * time_from_isodate: - * @str: Date/time value in ISO 8601 format. - * - * Converts an ISO 8601 UTC time string into a time_t value. - * - * Return value: Time_t corresponding to the specified ISO string. - * Note that we only allow UTC times at present. - **/ -time_t -time_from_isodate (const char *str) -{ - struct icaltimetype tt = icaltime_null_time (); - icaltimezone *utc_zone; - int len, i; - - g_return_val_if_fail (str != NULL, -1); - - /* yyyymmdd[Thhmmss[Z]] */ - - len = strlen (str); - - if (!(len == 8 || len == 15 || len == 16)) - return -1; - - for (i = 0; i < len; i++) - if (!((i != 8 && i != 15 && isdigit (str[i])) - || (i == 8 && str[i] == 'T') - || (i == 15 && str[i] == 'Z'))) - return -1; - -#define digit_at(x,y) (x[y] - '0') - - tt.year = digit_at (str, 0) * 1000 - + digit_at (str, 1) * 100 - + digit_at (str, 2) * 10 - + digit_at (str, 3); - - tt.month = digit_at (str, 4) * 10 - + digit_at (str, 5); - - tt.day = digit_at (str, 6) * 10 - + digit_at (str, 7); - - if (len > 8) { - tt.hour = digit_at (str, 9) * 10 - + digit_at (str, 10); - tt.minute = digit_at (str, 11) * 10 - + digit_at (str, 12); - tt.second = digit_at (str, 13) * 10 - + digit_at (str, 14); - } - - utc_zone = icaltimezone_get_utc_timezone (); - - return icaltime_as_timet_with_zone (tt, utc_zone); -} - -struct tm -icaltimetype_to_tm (struct icaltimetype *itt) -{ - struct tm tm; - - memset (&tm, 0, sizeof (struct tm)); - - if (!itt->is_date) { - tm.tm_sec = itt->second; - tm.tm_min = itt->minute; - tm.tm_hour = itt->hour; - } - - tm.tm_mday = itt->day; - tm.tm_mon = itt->month - 1; - tm.tm_year = itt->year - 1900; - tm.tm_wday = time_day_of_week (itt->day, itt->month - 1, itt->year); - tm.tm_isdst = -1; - - return tm; -} - -/** - * icaltimetype_to_tm_with_zone: - * @itt: A time value. - * @from_zone: Source timezone. - * @to_zone: Destination timezone. - * - * Converts a time value from one timezone to another, and returns a struct tm - * representation of the time. - * - * Return value: The converted time as a struct tm. All fields will be - * set properly except for tm.tm_yday. - **/ -struct tm -icaltimetype_to_tm_with_zone (struct icaltimetype *itt, - icaltimezone *from_zone, - icaltimezone *to_zone) -{ - struct tm tm; - struct icaltimetype itt_copy; - - memset (&tm, 0, sizeof (tm)); - tm.tm_isdst = -1; - - g_return_val_if_fail (itt != NULL, tm); - - itt_copy = *itt; - - icaltimezone_convert_time (&itt_copy, from_zone, to_zone); - tm = icaltimetype_to_tm (&itt_copy); - - return tm; -} - -struct icaltimetype -tm_to_icaltimetype (struct tm *tm, gboolean is_date) -{ - struct icaltimetype itt; - - memset (&itt, 0, sizeof (struct icaltimetype)); - - if (!is_date) { - itt.second = tm->tm_sec; - itt.minute = tm->tm_min; - itt.hour = tm->tm_hour; - } - - itt.day = tm->tm_mday; - itt.month = tm->tm_mon + 1; - itt.year = tm->tm_year+ 1900; - - itt.is_utc = 0; - itt.is_date = is_date; - - return itt; -} - diff --git a/calendar/cal-util/timeutil.h b/calendar/cal-util/timeutil.h deleted file mode 100644 index 77a8f180e1..0000000000 --- a/calendar/cal-util/timeutil.h +++ /dev/null @@ -1,122 +0,0 @@ -/* Miscellaneous time-related utilities - * - * Copyright (C) 1998 The Free Software Foundation - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Federico Mena <federico@ximian.com> - * Miguel de Icaza <miguel@ximian.com> - * Damon Chaplin <damon@ximian.com> - */ - -#ifndef TIMEUTIL_H -#define TIMEUTIL_H - - -#include <time.h> -#include <ical.h> -#include <glib.h> - - -/************************************************************************** - * General time functions. - **************************************************************************/ - -/* Returns the number of days in the month. Year is the normal year, e.g. 2001. - Month is 0 (Jan) to 11 (Dec). */ -int time_days_in_month (int year, int month); - -/* Returns the 1-based day number within the year of the specified date. - Year is the normal year, e.g. 2001. Month is 0 to 11. */ -int time_day_of_year (int day, int month, int year); - -/* Returns the day of the week for the specified date, 0 (Sun) to 6 (Sat). - For the days that were removed on the Gregorian reformation, it returns - Thursday. Year is the normal year, e.g. 2001. Month is 0 to 11. */ -int time_day_of_week (int day, int month, int year); - -/* Returns whether the specified year is a leap year. Year is the normal year, - e.g. 2001. */ -gboolean time_is_leap_year (int year); - -/* Returns the number of leap years since year 1 up to (but not including) the - specified year. Year is the normal year, e.g. 2001. */ -int time_leap_years_up_to (int year); - -/* Convert to or from an ISO 8601 representation of a time, in UTC, - e.g. "20010708T183000Z". */ -char *isodate_from_time_t (time_t t); -time_t time_from_isodate (const char *str); - - -/************************************************************************** - * time_t manipulation functions. - * - * NOTE: these use the Unix timezone functions like mktime() and localtime() - * and so should not be used in Evolution. New Evolution code should use - * icaltimetype values rather than time_t values wherever possible. - **************************************************************************/ - -/* Add or subtract a number of days, weeks or months. */ -time_t time_add_day (time_t time, int days); -time_t time_add_week (time_t time, int weeks); - -/* Returns the beginning or end of the day. */ -time_t time_day_begin (time_t t); -time_t time_day_end (time_t t); - - -/************************************************************************** - * time_t manipulation functions, using timezones in libical. - * - * NOTE: these are only here to make the transition to the timezone - * functions easier. New code should use icaltimetype values rather than - * time_t values wherever possible. - **************************************************************************/ - -/* Adds or subtracts a number of days to/from the given time_t value, using - the given timezone. */ -time_t time_add_day_with_zone (time_t time, int days, icaltimezone *zone); - -/* Adds or subtracts a number of weeks to/from the given time_t value, using - the given timezone. */ -time_t time_add_week_with_zone (time_t time, int weeks, icaltimezone *zone); - -/* Adds or subtracts a number of months to/from the given time_t value, using - the given timezone. */ -time_t time_add_month_with_zone (time_t time, int months, icaltimezone *zone); - -/* Returns the start of the year containing the given time_t, using the given - timezone. */ -time_t time_year_begin_with_zone (time_t time, icaltimezone *zone); - -/* Returns the start of the month containing the given time_t, using the given - timezone. */ -time_t time_month_begin_with_zone (time_t time, icaltimezone *zone); - -/* Returns the start of the week containing the given time_t, using the given - timezone. week_start_day should use the same values as mktime(), - i.e. 0 (Sun) to 6 (Sat). */ -time_t time_week_begin_with_zone (time_t time, int week_start_day, - icaltimezone *zone); - -/* Returns the start of the day containing the given time_t, using the given - timezone. */ -time_t time_day_begin_with_zone (time_t time, icaltimezone *zone); - -/* Returns the end of the day containing the given time_t, using the given - timezone. (The end of the day is the start of the next day.) */ -time_t time_day_end_with_zone (time_t time, icaltimezone *zone); - -void time_to_gdate_with_zone (GDate *date, time_t time, icaltimezone *zone); - -/************************************************************************** - * struct tm manipulation - **************************************************************************/ - -struct tm icaltimetype_to_tm (struct icaltimetype *itt); -struct tm icaltimetype_to_tm_with_zone (struct icaltimetype *itt, - icaltimezone *from_zone, - icaltimezone *to_zone); -struct icaltimetype tm_to_icaltimetype (struct tm *tm, gboolean is_date); - -#endif diff --git a/calendar/conduits/.cvsignore b/calendar/conduits/.cvsignore deleted file mode 100644 index b840c21800..0000000000 --- a/calendar/conduits/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile.in -Makefile
\ No newline at end of file diff --git a/calendar/conduits/Makefile.am b/calendar/conduits/Makefile.am deleted file mode 100644 index 906ea61971..0000000000 --- a/calendar/conduits/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = calendar todo diff --git a/calendar/conduits/calendar/.cvsignore b/calendar/conduits/calendar/.cvsignore deleted file mode 100644 index e8ba6ad844..0000000000 --- a/calendar/conduits/calendar/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -Makefile.in -Makefile -.deps -e-calendar.conduit -*.lo -.libs -libecalendar_conduit.la -e-calendar-conduit-control-applet -e-calendar-conduit-control-applet.desktop diff --git a/calendar/conduits/calendar/Makefile.am b/calendar/conduits/calendar/Makefile.am deleted file mode 100644 index 3ddaf94ee7..0000000000 --- a/calendar/conduits/calendar/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/calendar \ - -I$(top_builddir)/calendar/cal-client \ - -I$(top_srcdir)/libical/src/libical \ - -I$(top_builddir)/libical/src/libical \ - -I$(top_srcdir)/e-util \ - -I$(top_builddir)/e-util \ - $(EVOLUTION_CALENDAR_CONDUIT_CFLAGS) - -# Calendar Conduit -e_calendar_conduitsdir=$(libdir)/gnome-pilot/conduits -e_calendar_conduits_LTLIBRARIES = libecalendar_conduit.la - -libecalendar_conduit_la_SOURCES = \ - calendar-conduit.c - -libecalendar_conduit_la_LDFLAGS = -module -avoid-version -libecalendar_conduit_la_LIBADD = \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/calendar/cal-client/libcal-client-static.la \ - $(top_builddir)/calendar/cal-util/libcal-util-static.la \ - $(top_builddir)/libversit/libversit.a \ - $(top_builddir)/libical/src/libical/libical-static.la \ - $(top_builddir)/libwombat/libwombat-static.la \ - $(top_builddir)/e-util/libeconduit-static.la \ - $(EVOLUTION_CALENDAR_CONDUIT_LIBS) - -e-calendar.conduit: e-calendar.conduit.in Makefile - sed -e 's^\@prefix\@^$(prefix)^g' \ - -e 's^\@datadir\@^$(datadir)^g' \ - < $(srcdir)/e-calendar.conduit.in > e-calendar.conduit.tmp \ - && mv e-calendar.conduit.tmp e-calendar.conduit - -Conduitdir = $(datadir)/gnome-pilot/conduits/ -Conduit_DATA = e-calendar.conduit - -EXTRA_DIST = \ - e-calendar.conduit.in - -install-data-local: - $(mkinstalldirs) $(Conduitdir) diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c deleted file mode 100644 index 6ebaca44d4..0000000000 --- a/calendar/conduits/calendar/calendar-conduit.c +++ /dev/null @@ -1,1858 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Evolution calendar - Calendar Conduit - * - * Copyright (C) 1998 Free Software Foundation - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Eskil Heyn Olsen <deity@eskil.dk> - * JP Rosevear <jpr@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> - -#include <bonobo.h> -#include <bonobo-conf/bonobo-config-database.h> -#include <cal-client/cal-client-types.h> -#include <cal-client/cal-client.h> -#include <cal-util/timeutil.h> -#include <pi-source.h> -#include <pi-socket.h> -#include <pi-dlp.h> -#include <pi-datebook.h> -#include <gpilotd/gnome-pilot-conduit.h> -#include <gpilotd/gnome-pilot-conduit-sync-abs.h> -#include <libgpilotdCM/gnome-pilot-conduit-management.h> -#include <libgpilotdCM/gnome-pilot-conduit-config.h> -#include <e-pilot-map.h> -#include <e-pilot-settings.h> -#include <e-pilot-util.h> - -GnomePilotConduit * conduit_get_gpilot_conduit (guint32); -void conduit_destroy_gpilot_conduit (GnomePilotConduit*); - -#define CONDUIT_VERSION "0.1.6" -#ifdef G_LOG_DOMAIN -#undef G_LOG_DOMAIN -#endif -#define G_LOG_DOMAIN "ecalconduit" - -#define DEBUG_CALCONDUIT 1 -/* #undef DEBUG_CALCONDUIT */ - -#ifdef DEBUG_CALCONDUIT -#define LOG(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e) -#else -#define LOG(e...) -#endif - -#define WARN(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, e) -#define INFO(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e) - -#define PILOT_MAX_ADVANCE 99 - -typedef struct _ECalLocalRecord ECalLocalRecord; -typedef struct _ECalConduitCfg ECalConduitCfg; -typedef struct _ECalConduitGui ECalConduitGui; -typedef struct _ECalConduitContext ECalConduitContext; - -/* Local Record */ -struct _ECalLocalRecord { - /* The stuff from gnome-pilot-conduit-standard-abs.h - Must be first in the structure, or instances of this - structure cannot be used by gnome-pilot-conduit-standard-abs. - */ - GnomePilotDesktopRecord local; - - /* The corresponding Comp object */ - CalComponent *comp; - - /* pilot-link appointment structure */ - struct Appointment *appt; -}; - -static void -calconduit_destroy_record (ECalLocalRecord *local) -{ - gtk_object_unref (GTK_OBJECT (local->comp)); - free_Appointment (local->appt); - g_free (local->appt); - g_free (local); -} - -/* Configuration */ -struct _ECalConduitCfg { - guint32 pilot_id; - GnomePilotConduitSyncType sync_type; - - gboolean secret; - gboolean multi_day_split; - - gchar *last_uri; -}; - -static ECalConduitCfg * -calconduit_load_configuration (guint32 pilot_id) -{ - ECalConduitCfg *c; - GnomePilotConduitManagement *management; - GnomePilotConduitConfig *config; - gchar prefix[256]; - - c = g_new0 (ECalConduitCfg, 1); - g_assert (c != NULL); - - /* Pilot ID */ - c->pilot_id = pilot_id; - - /* Sync Type */ - management = gnome_pilot_conduit_management_new ("e_calendar_conduit", GNOME_PILOT_CONDUIT_MGMT_ID); - config = gnome_pilot_conduit_config_new (management, pilot_id); - if (!gnome_pilot_conduit_config_is_enabled (config, &c->sync_type)) - c->sync_type = GnomePilotConduitSyncTypeNotSet; - gtk_object_unref (GTK_OBJECT (config)); - gtk_object_unref (GTK_OBJECT (management)); - - /* Custom settings */ - g_snprintf (prefix, 255, "/gnome-pilot.d/e-calendar-conduit/Pilot_%u/", pilot_id); - gnome_config_push_prefix (prefix); - - c->secret = gnome_config_get_bool ("secret=FALSE"); - c->multi_day_split = gnome_config_get_bool ("multi_day_split=TRUE"); - c->last_uri = gnome_config_get_string ("last_uri"); - - gnome_config_pop_prefix (); - - return c; -} - -static void -calconduit_save_configuration (ECalConduitCfg *c) -{ - gchar prefix[256]; - - g_snprintf (prefix, 255, "/gnome-pilot.d/e-calendar-conduit/Pilot_%u/", c->pilot_id); - gnome_config_push_prefix (prefix); - - gnome_config_set_bool ("secret", c->secret); - gnome_config_set_bool ("multi_day_split", c->multi_day_split); - gnome_config_set_string ("last_uri", c->last_uri); - - gnome_config_pop_prefix (); - - gnome_config_sync (); - gnome_config_drop_all (); -} - -static ECalConduitCfg* -calconduit_dupe_configuration (ECalConduitCfg *c) -{ - ECalConduitCfg *retval; - - g_return_val_if_fail (c != NULL, NULL); - - retval = g_new0 (ECalConduitCfg, 1); - retval->pilot_id = c->pilot_id; - retval->sync_type = c->sync_type; - retval->secret = c->secret; - retval->multi_day_split = c->multi_day_split; - retval->last_uri = g_strdup (c->last_uri); - - return retval; -} - -static void -calconduit_destroy_configuration (ECalConduitCfg *c) -{ - g_return_if_fail (c != NULL); - - g_free (c->last_uri); - g_free (c); -} - -/* Gui */ -struct _ECalConduitGui { - GtkWidget *multi_day_split; -}; - -static ECalConduitGui * -e_cal_gui_new (EPilotSettings *ps) -{ - ECalConduitGui *gui; - GtkWidget *lbl; - gint rows; - - g_return_val_if_fail (ps != NULL, NULL); - g_return_val_if_fail (E_IS_PILOT_SETTINGS (ps), NULL); - - gtk_table_resize (GTK_TABLE (ps), E_PILOT_SETTINGS_TABLE_ROWS + 1, E_PILOT_SETTINGS_TABLE_COLS); - - gui = g_new0 (ECalConduitGui, 1); - - rows = E_PILOT_SETTINGS_TABLE_ROWS; - lbl = gtk_label_new (_("Split Multi-Day Events:")); - gui->multi_day_split = gtk_check_button_new (); - gtk_table_attach_defaults (GTK_TABLE (ps), lbl, 0, 1, rows, rows + 1); - gtk_table_attach_defaults (GTK_TABLE (ps), gui->multi_day_split, 1, 2, rows, rows + 1); - gtk_widget_show (lbl); - gtk_widget_show (gui->multi_day_split); - - return gui; -} - -static void -e_cal_gui_fill_widgets (ECalConduitGui *gui, ECalConduitCfg *cfg) -{ - g_return_if_fail (gui != NULL); - g_return_if_fail (cfg != NULL); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gui->multi_day_split), - cfg->multi_day_split); -} - -static void -e_cal_gui_fill_config (ECalConduitGui *gui, ECalConduitCfg *cfg) -{ - g_return_if_fail (gui != NULL); - g_return_if_fail (cfg != NULL); - - cfg->multi_day_split = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gui->multi_day_split)); -} - -static void -e_cal_gui_destroy (ECalConduitGui *gui) -{ - g_free (gui); -} - -/* Context */ -struct _ECalConduitContext { - GnomePilotDBInfo *dbi; - - ECalConduitCfg *cfg; - ECalConduitCfg *new_cfg; - ECalConduitGui *gui; - GtkWidget *ps; - - struct AppointmentAppInfo ai; - - CalClient *client; - - icaltimezone *timezone; - GList *uids; - GList *changed; - GHashTable *changed_hash; - GList *locals; - - EPilotMap *map; -}; - -static ECalConduitContext * -e_calendar_context_new (guint32 pilot_id) -{ - ECalConduitContext *ctxt; - - ctxt = g_new0 (ECalConduitContext, 1); - g_assert (ctxt != NULL); - - ctxt->cfg = calconduit_load_configuration (pilot_id); - ctxt->new_cfg = calconduit_dupe_configuration (ctxt->cfg); - ctxt->ps = NULL; - ctxt->dbi = NULL; - ctxt->client = NULL; - ctxt->timezone = NULL; - ctxt->uids = NULL; - ctxt->changed = NULL; - ctxt->changed_hash = NULL; - ctxt->locals = NULL; - ctxt->map = NULL; - - return ctxt; -} - -static gboolean -e_calendar_context_foreach_change (gpointer key, gpointer value, gpointer data) -{ - g_free (key); - - return TRUE; -} - -static void -e_calendar_context_destroy (ECalConduitContext *ctxt) -{ - GList *l; - - g_return_if_fail (ctxt != NULL); - - if (ctxt->cfg != NULL) - calconduit_destroy_configuration (ctxt->cfg); - if (ctxt->new_cfg != NULL) - calconduit_destroy_configuration (ctxt->new_cfg); - if (ctxt->gui != NULL) - e_cal_gui_destroy (ctxt->gui); - - if (ctxt->client != NULL) - gtk_object_unref (GTK_OBJECT (ctxt->client)); - - if (ctxt->uids != NULL) - cal_obj_uid_list_free (ctxt->uids); - - if (ctxt->changed != NULL) - cal_client_change_list_free (ctxt->changed); - - if (ctxt->changed_hash != NULL) { - g_hash_table_foreach_remove (ctxt->changed_hash, e_calendar_context_foreach_change, NULL); - g_hash_table_destroy (ctxt->changed_hash); - } - - if (ctxt->locals != NULL) { - for (l = ctxt->locals; l != NULL; l = l->next) - calconduit_destroy_record (l->data); - g_list_free (ctxt->locals); - } - - if (ctxt->map != NULL) - e_pilot_map_destroy (ctxt->map); -} - -/* Debug routines */ -static char * -print_local (ECalLocalRecord *local) -{ - static char buff[ 4096 ]; - - if (local == NULL) { - sprintf (buff, "[NULL]"); - return buff; - } - - if (local->appt && local->appt->description) { - g_snprintf (buff, 4096, "[%ld %ld '%s' '%s']", - mktime (&local->appt->begin), - mktime (&local->appt->end), - local->appt->description ? - local->appt->description : "", - local->appt->note ? - local->appt->note : ""); - return buff; - } - - return ""; -} - -static char *print_remote (GnomePilotRecord *remote) -{ - static char buff[ 4096 ]; - struct Appointment appt; - - if (remote == NULL) { - sprintf (buff, "[NULL]"); - return buff; - } - - memset (&appt, 0, sizeof (struct Appointment)); - unpack_Appointment (&appt, remote->record, remote->length); - - g_snprintf (buff, 4096, "[%ld %ld '%s' '%s']", - mktime (&appt.begin), - mktime (&appt.end), - appt.description ? - appt.description : "", - appt.note ? - appt.note : ""); - - free_Appointment (&appt); - - return buff; -} - -/* Calendar Server routines */ -static void -start_calendar_server_cb (CalClient *cal_client, - CalClientOpenStatus status, - gpointer data) -{ - gboolean *success = data; - - if (status == CAL_CLIENT_OPEN_SUCCESS) { - *success = TRUE; - } else { - *success = FALSE; - WARN ("Failed to open calendar!\n"); - } - - gtk_main_quit (); /* end the sub event loop */ -} - -static int -start_calendar_server (ECalConduitContext *ctxt) -{ - gboolean success = FALSE; - - g_return_val_if_fail (ctxt != NULL, -2); - - ctxt->client = cal_client_new (); - - gtk_signal_connect (GTK_OBJECT (ctxt->client), "cal_opened", - start_calendar_server_cb, &success); - - if (!cal_client_open_default_calendar (ctxt->client, FALSE)) - return -1; - - /* run a sub event loop to turn cal-client's async load - notification into a synchronous call */ - gtk_main (); - - if (success) - return 0; - - return -1; -} - -/* Utility routines */ -static icaltimezone * -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); - - return timezone; -} - -static icaltimezone * -get_default_timezone (void) -{ - Bonobo_ConfigDatabase db; - icaltimezone *timezone = NULL; - char *location; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - location = bonobo_config_get_string_with_default (db, - "/Calendar/Display/Timezone", "UTC", NULL); - if (!location || !location[0]) { - g_free (location); - location = g_strdup ("UTC"); - } - - timezone = icaltimezone_get_builtin_timezone (location); - g_free (location); - - bonobo_object_release_unref (db, NULL); - - return timezone; -} - - -static char * -map_name (ECalConduitContext *ctxt) -{ - char *filename; - - filename = g_strdup_printf ("%s/evolution/local/Calendar/pilot-map-calendar-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id); - - return filename; -} - -static icalrecurrencetype_weekday -get_ical_day (int day) -{ - switch (day) { - case 0: - return ICAL_SUNDAY_WEEKDAY; - case 1: - return ICAL_MONDAY_WEEKDAY; - case 2: - return ICAL_TUESDAY_WEEKDAY; - case 3: - return ICAL_WEDNESDAY_WEEKDAY; - case 4: - return ICAL_THURSDAY_WEEKDAY; - case 5: - return ICAL_FRIDAY_WEEKDAY; - case 6: - return ICAL_SATURDAY_WEEKDAY; - } - - return ICAL_NO_WEEKDAY; -} - -static int -get_pilot_day (icalrecurrencetype_weekday wd) -{ - switch (wd) { - case ICAL_SUNDAY_WEEKDAY: - return 0; - case ICAL_MONDAY_WEEKDAY: - return 1; - case ICAL_TUESDAY_WEEKDAY: - return 2; - case ICAL_WEDNESDAY_WEEKDAY: - return 3; - case ICAL_THURSDAY_WEEKDAY: - return 4; - case ICAL_FRIDAY_WEEKDAY: - return 5; - case ICAL_SATURDAY_WEEKDAY: - return 6; - default: - return -1; - } -} - -static gboolean -is_empty_time (struct tm time) -{ - if (time.tm_sec || time.tm_min || time.tm_hour - || time.tm_mday || time.tm_mon || time.tm_year) - return FALSE; - - return TRUE; -} - -static gboolean -is_all_day (CalClient *client, CalComponentDateTime *dt_start, CalComponentDateTime *dt_end) -{ - time_t dt_start_time, dt_end_time; - icaltimezone *timezone; - - if (dt_start->value->is_date && dt_end->value->is_date) - return TRUE; - - timezone = get_timezone (client, dt_start->tzid); - dt_start_time = icaltime_as_timet_with_zone (*dt_start->value, timezone); - dt_end_time = icaltime_as_timet_with_zone (*dt_end->value, get_timezone (client, dt_end->tzid)); - - if (dt_end_time == time_add_day_with_zone (dt_start_time, 1, timezone)) - return TRUE; - - return FALSE; -} - -static gboolean -process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi_uid, GList **multi_ccc) -{ - CalComponentDateTime dt_start, dt_end; - icaltimezone *tz_start, *tz_end; - time_t event_start, event_end, day_end; - struct icaltimetype *old_start_value, *old_end_value; - const char *uid; - gboolean is_date = FALSE; - gboolean last = FALSE; - gboolean ret = TRUE; - - *multi_ccc = NULL; - *multi_uid = NULL; - - if (ccc->type == CAL_CLIENT_CHANGE_DELETED) - return FALSE; - - /* Start time */ - cal_component_get_dtstart (ccc->comp, &dt_start); - if (dt_start.value->is_date) - tz_start = ctxt->timezone; - else - tz_start = get_timezone (ctxt->client, dt_start.tzid); - event_start = icaltime_as_timet_with_zone (*dt_start.value, tz_start); - - cal_component_get_dtend (ccc->comp, &dt_end); - if (dt_end.value->is_date) - tz_end = ctxt->timezone; - else - tz_end = get_timezone (ctxt->client, dt_end.tzid); - event_end = icaltime_as_timet_with_zone (*dt_end.value, tz_end); - - day_end = time_day_end_with_zone (event_start, ctxt->timezone); - if (day_end >= event_end) { - ret = FALSE; - goto cleanup; - } else if (cal_component_has_recurrences (ccc->comp) || !ctxt->cfg->multi_day_split) { - ret = TRUE; - goto cleanup; - } - - if (dt_start.value->is_date && dt_end.value->is_date) - is_date = TRUE; - - old_start_value = dt_start.value; - old_end_value = dt_end.value; - while (!last) { - CalComponent *clone = cal_component_clone (ccc->comp); - char *new_uid = cal_component_gen_uid (); - struct icaltimetype start_value, end_value; - CalClientChange *c = g_new0 (CalClientChange, 1); - - if (day_end >= event_end) { - day_end = event_end; - last = TRUE; - } - - cal_component_set_uid (clone, new_uid); - - start_value = icaltime_from_timet_with_zone (event_start, is_date, tz_start); - dt_start.value = &start_value; - cal_component_set_dtstart (clone, &dt_start); - - end_value = icaltime_from_timet_with_zone (day_end, is_date, tz_end); - dt_end.value = &end_value; - cal_component_set_dtend (clone, &dt_end); - - cal_client_update_object (ctxt->client, clone); - - 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); - - event_start = day_end; - day_end = time_day_end_with_zone (event_start, ctxt->timezone); - } - dt_start.value = old_start_value; - dt_end.value = old_end_value; - - cal_component_get_uid (ccc->comp, &uid); - cal_client_remove_object (ctxt->client, uid); - ccc->type = CAL_CLIENT_CHANGE_DELETED; - - cleanup: - cal_component_free_datetime (&dt_start); - cal_component_free_datetime (&dt_end); - - return ret; -} - -static short -nth_weekday (int pos, icalrecurrencetype_weekday weekday) -{ - g_assert ((pos > 0 && pos <= 5) || (pos == -1)); - - return ((abs (pos) * 8) + weekday) * (pos < 0 ? -1 : 1); -} - -static GList * -next_changed_item (ECalConduitContext *ctxt, GList *changes) -{ - CalClientChange *ccc; - GList *l; - - for (l = changes; l != NULL; l = l->next) { - const char *uid; - - ccc = l->data; - - cal_component_get_uid (ccc->comp, &uid); - if (g_hash_table_lookup (ctxt->changed_hash, uid)) - return l; - } - - return NULL; -} - -static void -compute_status (ECalConduitContext *ctxt, ECalLocalRecord *local, const char *uid) -{ - CalClientChange *ccc; - - local->local.archived = FALSE; - local->local.secret = FALSE; - - ccc = g_hash_table_lookup (ctxt->changed_hash, uid); - - if (ccc == NULL) { - local->local.attr = GnomePilotRecordNothing; - return; - } - - switch (ccc->type) { - case CAL_CLIENT_CHANGE_ADDED: - local->local.attr = GnomePilotRecordNew; - break; - - case CAL_CLIENT_CHANGE_MODIFIED: - local->local.attr = GnomePilotRecordModified; - break; - - case CAL_CLIENT_CHANGE_DELETED: - local->local.attr = GnomePilotRecordDeleted; - break; - } -} - -static GnomePilotRecord -local_record_to_pilot_record (ECalLocalRecord *local, - ECalConduitContext *ctxt) -{ - GnomePilotRecord p; - static char record[0xffff]; - - g_assert (local->comp != NULL); - g_assert (local->appt != NULL ); - - p.ID = local->local.ID; - p.category = local->local.category; - p.attr = local->local.attr; - p.archived = local->local.archived; - p.secret = local->local.secret; - - /* Generate pilot record structure */ - p.record = record; - p.length = pack_Appointment (local->appt, p.record, 0xffff); - - return p; -} - -/* - * converts a CalComponent object to a ECalLocalRecord - */ -static void -local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitContext *ctxt) -{ - const char *uid; - CalComponentText summary; - GSList *d_list = NULL, *edl = NULL, *l; - CalComponentText *description; - CalComponentDateTime dt_start, dt_end; - CalComponentClassification classif; - icaltimezone *default_tz = ctxt->timezone; - int i; - - g_return_if_fail (local != NULL); - g_return_if_fail (comp != NULL); - - local->comp = comp; - gtk_object_ref (GTK_OBJECT (comp)); - - cal_component_get_uid (local->comp, &uid); - local->local.ID = e_pilot_map_lookup_pid (ctxt->map, uid, TRUE); - compute_status (ctxt, local, uid); - - local->appt = g_new0 (struct Appointment, 1); - - /* Handle the fields and category we don't sync by making sure - * we don't overwrite them - */ - if (local->local.ID != 0) { - struct Appointment appt; - char record[0xffff]; - int cat = 0; - - if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, - ctxt->dbi->db_handle, - local->local.ID, &record, - NULL, NULL, NULL, &cat) > 0) { - local->local.category = cat; - memset (&appt, 0, sizeof (struct Appointment)); - unpack_Appointment (&appt, record, 0xffff); - local->appt->alarm = appt.alarm; - local->appt->advance = appt.advance; - local->appt->advanceUnits = appt.advanceUnits; - free_Appointment (&appt); - } - } - - /* STOP: don't replace these with g_strdup, since free_Appointment - uses free to deallocate */ - cal_component_get_summary (comp, &summary); - if (summary.value) - local->appt->description = e_pilot_utf8_to_pchar (summary.value); - - cal_component_get_description_list (comp, &d_list); - if (d_list) { - description = (CalComponentText *) d_list->data; - if (description && description->value) - local->appt->note = e_pilot_utf8_to_pchar (description->value); - else - local->appt->note = NULL; - } else { - local->appt->note = NULL; - } - - /* Start/End */ - cal_component_get_dtstart (comp, &dt_start); - cal_component_get_dtend (comp, &dt_end); - if (dt_start.value) { - icaltimezone_convert_time (dt_start.value, - get_timezone (ctxt->client, dt_start.tzid), - default_tz); - local->appt->begin = icaltimetype_to_tm (dt_start.value); - } - - if (dt_start.value && dt_end.value) { - if (is_all_day (ctxt->client, &dt_start, &dt_end)) { - local->appt->event = 1; - } else { - icaltimezone_convert_time (dt_end.value, - get_timezone (ctxt->client, dt_end.tzid), - default_tz); - local->appt->end = icaltimetype_to_tm (dt_end.value); - local->appt->event = 0; - } - } else { - local->appt->event = 1; - } - cal_component_free_datetime (&dt_start); - cal_component_free_datetime (&dt_end); - - /* Recurrence Rules */ - local->appt->repeatType = repeatNone; - - if (cal_component_has_rrules (comp)) { - GSList *list; - struct icalrecurrencetype *recur; - - cal_component_get_rrule_list (comp, &list); - recur = list->data; - - switch (recur->freq) { - case ICAL_DAILY_RECURRENCE: - local->appt->repeatType = repeatDaily; - break; - case ICAL_WEEKLY_RECURRENCE: - local->appt->repeatType = repeatWeekly; - for (i = 0; i <= 7 && recur->by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) { - icalrecurrencetype_weekday wd; - - wd = icalrecurrencetype_day_day_of_week (recur->by_day[i]); - local->appt->repeatDays[get_pilot_day (wd)] = 1; - } - - break; - case ICAL_MONTHLY_RECURRENCE: - if (recur->by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) { - local->appt->repeatType = repeatMonthlyByDate; - break; - } - - /* FIX ME Not going to work with -ve by_day */ - local->appt->repeatType = repeatMonthlyByDay; - switch (icalrecurrencetype_day_position (recur->by_day[0])) { - case 1: - local->appt->repeatDay = dom1stSun; - break; - case 2: - local->appt->repeatDay = dom2ndSun; - break; - case 3: - local->appt->repeatDay = dom3rdSun; - break; - case 4: - local->appt->repeatDay = dom4thSun; - break; - case 5: - local->appt->repeatDay = domLastSun; - break; - } - local->appt->repeatDay += get_pilot_day (icalrecurrencetype_day_day_of_week (recur->by_day[0])); - break; - case ICAL_YEARLY_RECURRENCE: - local->appt->repeatType = repeatYearly; - break; - default: - break; - } - - if (local->appt->repeatType != repeatNone) { - local->appt->repeatFrequency = recur->interval; - } - - if (icaltime_is_null_time (recur->until)) { - local->appt->repeatForever = 1; - } else { - local->appt->repeatForever = 0; - icaltimezone_convert_time (&recur->until, - icaltimezone_get_utc_timezone (), - default_tz); - local->appt->repeatEnd = icaltimetype_to_tm (&recur->until); - } - - cal_component_free_recur_list (list); - } - - /* Exceptions */ - cal_component_get_exdate_list (comp, &edl); - local->appt->exceptions = g_slist_length (edl); - local->appt->exception = g_new0 (struct tm, local->appt->exceptions); - for (l = edl, i = 0; l != NULL; l = l->next, i++) { - CalComponentDateTime *dt = l->data; - - icaltimezone_convert_time (dt->value, - icaltimezone_get_utc_timezone (), - default_tz); - *local->appt->exception = icaltimetype_to_tm (dt->value); - } - cal_component_free_exdate_list (edl); - - /* Alarm */ - local->appt->alarm = 0; - if (cal_component_has_alarms (comp)) { - GList *uids, *l; - CalComponentAlarm *alarm; - CalAlarmTrigger trigger; - - uids = cal_component_get_alarm_uids (comp); - for (l = uids; l != NULL; l = l->next) { - alarm = cal_component_get_alarm (comp, l->data); - cal_component_alarm_get_trigger (alarm, &trigger); - - if ((trigger.type == CAL_ALARM_TRIGGER_RELATIVE_START - && trigger.u.rel_duration.is_neg)) { - local->appt->advanceUnits = advMinutes; - local->appt->advance = - trigger.u.rel_duration.minutes - + trigger.u.rel_duration.hours * 60 - + trigger.u.rel_duration.days * 60 * 24 - + trigger.u.rel_duration.weeks * 7 * 60 * 24; - - if (local->appt->advance > PILOT_MAX_ADVANCE) { - local->appt->advanceUnits = advHours; - local->appt->advance = - trigger.u.rel_duration.minutes / 60 - + trigger.u.rel_duration.hours - + trigger.u.rel_duration.days * 24 - + trigger.u.rel_duration.weeks * 7 * 24; - } - if (local->appt->advance > PILOT_MAX_ADVANCE) { - local->appt->advanceUnits = advDays; - local->appt->advance = - trigger.u.rel_duration.minutes / (60 * 24) - + trigger.u.rel_duration.hours / 24 - + trigger.u.rel_duration.days - + trigger.u.rel_duration.weeks * 7; - } - if (local->appt->advance > PILOT_MAX_ADVANCE) - local->appt->advance = PILOT_MAX_ADVANCE; - - local->appt->alarm = 1; - break; - } - cal_component_alarm_free (alarm); - } - cal_obj_uid_list_free (uids); - } - - cal_component_get_classification (comp, &classif); - - if (classif == CAL_COMPONENT_CLASS_PRIVATE) - local->local.secret = 1; - else - local->local.secret = 0; - - local->local.archived = 0; -} - -static void -local_record_from_uid (ECalLocalRecord *local, - const char *uid, - ECalConduitContext *ctxt) -{ - CalComponent *comp; - CalClientGetStatus status; - - g_assert(local!=NULL); - - status = cal_client_get_object (ctxt->client, uid, &comp); - - if (status == CAL_CLIENT_GET_SUCCESS) { - local_record_from_comp (local, comp, ctxt); - gtk_object_unref (GTK_OBJECT (comp)); - } else if (status == CAL_CLIENT_GET_NOT_FOUND) { - comp = cal_component_new (); - cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT); - cal_component_set_uid (comp, uid); - local_record_from_comp (local, comp, ctxt); - gtk_object_unref (GTK_OBJECT (comp)); - } else { - INFO ("Object did not exist"); - } -} - -static CalComponent * -comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, - GnomePilotRecord *remote, - CalComponent *in_comp, - icaltimezone *timezone) -{ - CalComponent *comp; - struct Appointment appt; - struct icaltimetype now = icaltime_from_timet_with_zone (time (NULL), FALSE, timezone), it; - struct icalrecurrencetype recur; - CalComponentText summary = {NULL, NULL}; - CalComponentDateTime dt = {NULL, NULL}; - GSList *edl = NULL; - char *txt; - int pos, i; - - g_return_val_if_fail (remote != NULL, NULL); - - memset (&appt, 0, sizeof (struct Appointment)); - unpack_Appointment (&appt, remote->record, remote->length); - - if (in_comp == NULL) { - comp = cal_component_new (); - cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT); - cal_component_set_created (comp, &now); - } else { - comp = cal_component_clone (in_comp); - } - - cal_component_set_last_modified (comp, &now); - - summary.value = txt = e_pilot_utf8_from_pchar (appt.description); - cal_component_set_summary (comp, &summary); - free (txt); - - /* The iCal description field */ - if (!appt.note) { - cal_component_set_description_list (comp, NULL); - } else { - GSList l; - CalComponentText text; - - text.value = txt = e_pilot_utf8_from_pchar (appt.note); - text.altrep = NULL; - l.data = &text; - l.next = NULL; - - cal_component_set_description_list (comp, &l); - free (txt); - } - - if (appt.event && !is_empty_time (appt.begin)) { - it = tm_to_icaltimetype (&appt.begin, TRUE); - dt.value = ⁢ - dt.tzid = NULL; - cal_component_set_dtstart (comp, &dt); - cal_component_set_dtend (comp, &dt); - } else { - dt.tzid = icaltimezone_get_tzid (timezone); - - if (!is_empty_time (appt.begin)) { - it = tm_to_icaltimetype (&appt.begin, FALSE); - dt.value = ⁢ - cal_component_set_dtstart (comp, &dt); - } - - if (!is_empty_time (appt.end)) { - it = tm_to_icaltimetype (&appt.end, FALSE); - dt.value = ⁢ - cal_component_set_dtend (comp, &dt); - } - } - - /* Recurrence information */ - icalrecurrencetype_clear (&recur); - - switch (appt.repeatType) { - case repeatNone: - recur.freq = ICAL_NO_RECURRENCE; - break; - - case repeatDaily: - recur.freq = ICAL_DAILY_RECURRENCE; - recur.interval = appt.repeatFrequency; - break; - - case repeatWeekly: - recur.freq = ICAL_WEEKLY_RECURRENCE; - recur.interval = appt.repeatFrequency; - - pos = 0; - for (i = 0; i < 7; i++) { - if (appt.repeatDays[i]) - recur.by_day[pos++] = get_ical_day (i); - } - - break; - - case repeatMonthlyByDay: - recur.freq = ICAL_MONTHLY_RECURRENCE; - recur.interval = appt.repeatFrequency; - if (appt.repeatDay < domLastSun) - recur.by_day[0] = nth_weekday ((appt.repeatDay / 7) + 1, - get_ical_day (appt.repeatDay % 7)); - else - recur.by_day[0] = nth_weekday (-1, get_ical_day (appt.repeatDay % 7)); - break; - - case repeatMonthlyByDate: - recur.freq = ICAL_MONTHLY_RECURRENCE; - recur.interval = appt.repeatFrequency; - recur.by_month_day[0] = appt.begin.tm_mday; - break; - - case repeatYearly: - recur.freq = ICAL_YEARLY_RECURRENCE; - recur.interval = appt.repeatFrequency; - break; - - default: - g_assert_not_reached (); - } - - if (recur.freq != ICAL_NO_RECURRENCE) { - GSList *list = NULL; - - /* recurrence start of week */ - recur.week_start = get_ical_day (appt.repeatWeekstart); - - if (!appt.repeatForever) { - recur.until = tm_to_icaltimetype (&appt.repeatEnd, TRUE); - } - - list = g_slist_append (list, &recur); - cal_component_set_rrule_list (comp, list); - g_slist_free (list); - } else { - cal_component_set_rrule_list (comp, NULL); - } - - /* Exceptions */ - for (i = 0; i < appt.exceptions; i++) { - struct tm ex; - CalComponentDateTime *dt = g_new0 (CalComponentDateTime, 1); - - dt->value = g_new0 (struct icaltimetype, 1); - dt->tzid = NULL; - - ex = appt.exception[i]; - *dt->value = tm_to_icaltimetype (&ex, TRUE); - - edl = g_slist_prepend (edl, dt); - } - cal_component_set_exdate_list (comp, edl); - cal_component_free_exdate_list (edl); - - /* Alarm */ - if (appt.alarm) { - CalComponentAlarm *alarm = NULL; - CalAlarmTrigger trigger; - gboolean found = FALSE; - - if (cal_component_has_alarms (comp)) { - GList *uids, *l; - - uids = cal_component_get_alarm_uids (comp); - for (l = uids; l != NULL; l = l->next) { - alarm = cal_component_get_alarm (comp, l->data); - cal_component_alarm_get_trigger (alarm, &trigger); - if ((trigger.type == CAL_ALARM_TRIGGER_RELATIVE_START - && trigger.u.rel_duration.is_neg)) { - found = TRUE; - break; - } - cal_component_alarm_free (alarm); - } - cal_obj_uid_list_free (uids); - } - if (!found) - alarm = cal_component_alarm_new (); - - memset (&trigger, 0, sizeof (CalAlarmTrigger)); - trigger.type = CAL_ALARM_TRIGGER_RELATIVE_START; - trigger.u.rel_duration.is_neg = 1; - switch (appt.advanceUnits) { - case advMinutes: - trigger.u.rel_duration.minutes = appt.advance; - break; - case advHours: - trigger.u.rel_duration.hours = appt.advance; - break; - case advDays: - trigger.u.rel_duration.days = appt.advance; - break; - } - cal_component_alarm_set_trigger (alarm, trigger); - cal_component_alarm_set_action (alarm, CAL_ALARM_DISPLAY); - - if (!found) - cal_component_add_alarm (comp, alarm); - cal_component_alarm_free (alarm); - } - - cal_component_set_transparency (comp, CAL_COMPONENT_TRANSP_NONE); - - if (remote->attr & dlpRecAttrSecret) - cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PRIVATE); - else - cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PUBLIC); - - cal_component_commit_sequence (comp); - - free_Appointment (&appt); - - return comp; -} - -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); - int map_count; - const char *uri; - - /* If there are objects but no log */ - map_count = g_hash_table_size (ctxt->map->pid_map); - if (map_count == 0) - gnome_pilot_conduit_standard_set_slow (conduit, TRUE); - - /* Or if the URI's don't match */ - uri = cal_client_get_uri (ctxt->client); - LOG(" Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>"); - if (ctxt->cfg->last_uri != NULL && strcmp (ctxt->cfg->last_uri, uri)) { - gnome_pilot_conduit_standard_set_slow (conduit, TRUE); - e_pilot_map_clear (ctxt->map); - } - - if (gnome_pilot_conduit_standard_get_slow (conduit)) { - ctxt->map->write_touched_only = TRUE; - LOG (" doing slow sync\n"); - } else { - LOG (" doing fast sync\n"); - } -} - -/* Pilot syncing callbacks */ -static gint -pre_sync (GnomePilotConduit *conduit, - GnomePilotDBInfo *dbi, - ECalConduitContext *ctxt) -{ - GnomePilotConduitSyncAbs *abs_conduit; - GList *removed = NULL, *added = NULL, *l; - int len; - unsigned char *buf; - char *filename, *change_id; - gint num_records, add_records = 0, mod_records = 0, del_records = 0; - - abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit); - - LOG ("---------------------------------------------------------\n"); - LOG ("pre_sync: Calendar Conduit v.%s", CONDUIT_VERSION); - - ctxt->dbi = dbi; - ctxt->client = NULL; - - if (start_calendar_server (ctxt) != 0) { - WARN(_("Could not start wombat server")); - gnome_pilot_conduit_error (conduit, _("Could not start wombat")); - return -1; - } - - /* Get the timezone */ - ctxt->timezone = get_default_timezone (); - if (ctxt->timezone == NULL) - return -1; - LOG (" 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); - - /* Load the uid <--> pilot id mapping */ - filename = map_name (ctxt); - e_pilot_map_read (filename, &ctxt->map); - g_free (filename); - - /* Get the local database */ - ctxt->uids = cal_client_get_uids (ctxt->client, CALOBJ_TYPE_EVENT); - - /* 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); - 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; - - if (process_multi_day (ctxt, ccc, &multi_uid, &multi_ccc)) { - ctxt->uids = g_list_concat (ctxt->uids, multi_uid); - - added = g_list_concat (added, multi_ccc); - removed = g_list_prepend (removed, ccc); - } - } - - /* Remove the events that were split up */ - g_list_concat (ctxt->changed, added); - for (l = removed; l != NULL; l = l->next) { - CalClientChange *ccc = l->data; - const char *uid; - - cal_component_get_uid (ccc->comp, &uid); - if (e_pilot_map_lookup_pid (ctxt->map, uid, FALSE) == 0) { - ctxt->changed = g_list_remove (ctxt->changed, ccc); - gtk_object_unref (GTK_OBJECT (ccc->comp)); - g_free (ccc); - } - } - g_list_free (removed); - - for (l = ctxt->changed; l != NULL; l = l->next) { - CalClientChange *ccc = l->data; - const char *uid; - - cal_component_get_uid (ccc->comp, &uid); - if (!e_pilot_map_uid_is_archived (ctxt->map, uid)) { - - g_hash_table_insert (ctxt->changed_hash, g_strdup (uid), ccc); - - switch (ccc->type) { - case CAL_CLIENT_CHANGE_ADDED: - add_records++; - break; - case CAL_CLIENT_CHANGE_MODIFIED: - mod_records++; - break; - case CAL_CLIENT_CHANGE_DELETED: - del_records++; - break; - } - } else if (ccc->type == CAL_CLIENT_CHANGE_DELETED) { - e_pilot_map_remove_by_uid (ctxt->map, uid); - } - } - - /* Set the count information */ - num_records = cal_client_get_n_objects (ctxt->client, CALOBJ_TYPE_EVENT); - 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); - gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, del_records); - - buf = (unsigned char*)g_malloc (0xffff); - len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0, - (unsigned char *)buf, 0xffff); - - if (len < 0) { - WARN (_("Could not read pilot's Calendar application block")); - WARN ("dlp_ReadAppBlock(...) = %d", len); - gnome_pilot_conduit_error (conduit, - _("Could not read pilot's Calendar application block")); - return -1; - } - unpack_AppointmentAppInfo (&(ctxt->ai), buf, len); - g_free (buf); - - check_for_slow_setting (conduit, ctxt); - if (ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyToPilot - || ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyFromPilot) - ctxt->map->write_touched_only = TRUE; - - return 0; -} - -static gint -post_sync (GnomePilotConduit *conduit, - GnomePilotDBInfo *dbi, - ECalConduitContext *ctxt) -{ - GList *changed; - gchar *filename, *change_id; - - LOG ("post_sync: Calendar Conduit v.%s", CONDUIT_VERSION); - - g_free (ctxt->cfg->last_uri); - ctxt->cfg->last_uri = g_strdup (cal_client_get_uri (ctxt->client)); - calconduit_save_configuration (ctxt->cfg); - - filename = map_name (ctxt); - e_pilot_map_write (filename, ctxt->map); - g_free (filename); - - /* FIX ME ugly hack - our changes musn't count, this does introduce - * 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); - g_free (change_id); - - LOG ("---------------------------------------------------------\n"); - - return 0; -} - -static gint -set_pilot_id (GnomePilotConduitSyncAbs *conduit, - ECalLocalRecord *local, - guint32 ID, - ECalConduitContext *ctxt) -{ - const char *uid; - - LOG ("set_pilot_id: setting to %d\n", ID); - - cal_component_get_uid (local->comp, &uid); - e_pilot_map_insert (ctxt->map, ID, uid, FALSE); - - return 0; -} - -static gint -set_status_cleared (GnomePilotConduitSyncAbs *conduit, - ECalLocalRecord *local, - ECalConduitContext *ctxt) -{ - const char *uid; - - LOG ("set_status_cleared: clearing status\n"); - - cal_component_get_uid (local->comp, &uid); - g_hash_table_remove (ctxt->changed_hash, uid); - - return 0; -} - -static gint -for_each (GnomePilotConduitSyncAbs *conduit, - ECalLocalRecord **local, - ECalConduitContext *ctxt) -{ - static GList *uids, *iterator; - static int count; - - g_return_val_if_fail (local != NULL, -1); - - if (*local == NULL) { - LOG ("beginning for_each"); - - uids = ctxt->uids; - count = 0; - - if (uids != NULL) { - LOG ("iterating over %d records", g_list_length (uids)); - - *local = g_new0 (ECalLocalRecord, 1); - local_record_from_uid (*local, uids->data, ctxt); - g_list_prepend (ctxt->locals, *local); - - iterator = uids; - } else { - LOG ("no events"); - (*local) = NULL; - return 0; - } - } else { - count++; - if (g_list_next (iterator)) { - iterator = g_list_next (iterator); - - *local = g_new0 (ECalLocalRecord, 1); - local_record_from_uid (*local, iterator->data, ctxt); - g_list_prepend (ctxt->locals, *local); - } else { - LOG ("for_each ending"); - - /* Tell the pilot the iteration is over */ - *local = NULL; - - return 0; - } - } - - return 0; -} - -static gint -for_each_modified (GnomePilotConduitSyncAbs *conduit, - ECalLocalRecord **local, - ECalConduitContext *ctxt) -{ - static GList *iterator; - static int count; - - g_return_val_if_fail (local != NULL, -1); - - if (*local == NULL) { - LOG ("for_each_modified beginning\n"); - - iterator = ctxt->changed; - - count = 0; - - LOG ("iterating over %d records", g_hash_table_size (ctxt->changed_hash)); - - iterator = next_changed_item (ctxt, iterator); - if (iterator != NULL) { - CalClientChange *ccc = iterator->data; - - *local = g_new0 (ECalLocalRecord, 1); - local_record_from_comp (*local, ccc->comp, ctxt); - g_list_prepend (ctxt->locals, *local); - } else { - LOG ("no events"); - - *local = NULL; - } - } else { - count++; - iterator = g_list_next (iterator); - if (iterator && (iterator = next_changed_item (ctxt, iterator))) { - CalClientChange *ccc = iterator->data; - - *local = g_new0 (ECalLocalRecord, 1); - local_record_from_comp (*local, ccc->comp, ctxt); - g_list_prepend (ctxt->locals, *local); - } else { - LOG ("for_each_modified ending"); - - /* Signal the iteration is over */ - *local = NULL; - } - } - - return 0; -} - -static gint -compare (GnomePilotConduitSyncAbs *conduit, - ECalLocalRecord *local, - GnomePilotRecord *remote, - ECalConduitContext *ctxt) -{ - /* used by the quick compare */ - GnomePilotRecord local_pilot; - int retval = 0; - - LOG ("compare: local=%s remote=%s...\n", - print_local (local), print_remote (remote)); - - g_return_val_if_fail (local!=NULL,-1); - g_return_val_if_fail (remote!=NULL,-1); - - local_pilot = local_record_to_pilot_record (local, ctxt); - - if (remote->length != local_pilot.length - || memcmp (local_pilot.record, remote->record, remote->length)) - retval = 1; - - if (retval == 0) - LOG (" equal"); - else - LOG (" not equal"); - - return retval; -} - -static gint -add_record (GnomePilotConduitSyncAbs *conduit, - GnomePilotRecord *remote, - ECalConduitContext *ctxt) -{ - CalComponent *comp; - const char *uid; - int retval = 0; - - g_return_val_if_fail (remote != NULL, -1); - - LOG ("add_record: adding %s to desktop\n", print_remote (remote)); - - comp = comp_from_remote_record (conduit, remote, NULL, ctxt->timezone); - update_comp (conduit, comp, ctxt); - - cal_component_get_uid (comp, &uid); - e_pilot_map_insert (ctxt->map, remote->ID, uid, FALSE); - - gtk_object_unref (GTK_OBJECT (comp)); - - return retval; -} - -static gint -replace_record (GnomePilotConduitSyncAbs *conduit, - ECalLocalRecord *local, - GnomePilotRecord *remote, - ECalConduitContext *ctxt) -{ - CalComponent *new_comp; - int retval = 0; - - g_return_val_if_fail (remote != NULL, -1); - - LOG ("replace_record: replace %s with %s\n", - print_local (local), print_remote (remote)); - - new_comp = comp_from_remote_record (conduit, remote, local->comp, ctxt->timezone); - gtk_object_unref (GTK_OBJECT (local->comp)); - local->comp = new_comp; - update_comp (conduit, local->comp, ctxt); - - return retval; -} - -static gint -delete_record (GnomePilotConduitSyncAbs *conduit, - ECalLocalRecord *local, - ECalConduitContext *ctxt) -{ - const char *uid; - - g_return_val_if_fail (local != NULL, -1); - g_assert (local->comp != NULL); - - cal_component_get_uid (local->comp, &uid); - - LOG ("delete_record: deleting %s\n", uid); - - e_pilot_map_remove_by_uid (ctxt->map, uid); - cal_client_remove_object (ctxt->client, uid); - - return 0; -} - -static gint -archive_record (GnomePilotConduitSyncAbs *conduit, - ECalLocalRecord *local, - gboolean archive, - ECalConduitContext *ctxt) -{ - const char *uid; - int retval = 0; - - g_return_val_if_fail (local != NULL, -1); - - LOG ("archive_record: %s\n", archive ? "yes" : "no"); - - cal_component_get_uid (local->comp, &uid); - e_pilot_map_insert (ctxt->map, local->local.ID, uid, archive); - - return retval; -} - -static gint -match (GnomePilotConduitSyncAbs *conduit, - GnomePilotRecord *remote, - ECalLocalRecord **local, - ECalConduitContext *ctxt) -{ - const char *uid; - - LOG ("match: looking for local copy of %s\n", - print_remote (remote)); - - g_return_val_if_fail (local != NULL, -1); - g_return_val_if_fail (remote != NULL, -1); - - *local = NULL; - uid = e_pilot_map_lookup_uid (ctxt->map, remote->ID, TRUE); - - if (!uid) - return 0; - - LOG (" matched\n"); - - *local = g_new0 (ECalLocalRecord, 1); - local_record_from_uid (*local, uid, ctxt); - - return 0; -} - -static gint -free_match (GnomePilotConduitSyncAbs *conduit, - ECalLocalRecord *local, - ECalConduitContext *ctxt) -{ - LOG ("free_match: freeing\n"); - - g_return_val_if_fail (local != NULL, -1); - - calconduit_destroy_record (local); - - return 0; -} - -static gint -prepare (GnomePilotConduitSyncAbs *conduit, - ECalLocalRecord *local, - GnomePilotRecord *remote, - ECalConduitContext *ctxt) -{ - LOG ("prepare: encoding local %s\n", print_local (local)); - - *remote = local_record_to_pilot_record (local, ctxt); - - return 0; -} - -/* Pilot Settings Callbacks */ -static void -fill_widgets (ECalConduitContext *ctxt) -{ - e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps), - ctxt->cfg->secret); - - e_cal_gui_fill_widgets (ctxt->gui, ctxt->cfg); -} - -static gint -create_settings_window (GnomePilotConduit *conduit, - GtkWidget *parent, - ECalConduitContext *ctxt) -{ - LOG ("create_settings_window"); - - ctxt->ps = e_pilot_settings_new (); - ctxt->gui = e_cal_gui_new (E_PILOT_SETTINGS (ctxt->ps)); - - gtk_container_add (GTK_CONTAINER (parent), ctxt->ps); - gtk_widget_show (ctxt->ps); - - fill_widgets (ctxt); - - return 0; -} -static void -display_settings (GnomePilotConduit *conduit, ECalConduitContext *ctxt) -{ - LOG ("display_settings"); - - fill_widgets (ctxt); -} - -static void -save_settings (GnomePilotConduit *conduit, ECalConduitContext *ctxt) -{ - LOG ("save_settings"); - - ctxt->new_cfg->secret = - e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps)); - e_cal_gui_fill_config (ctxt->gui, ctxt->new_cfg); - - calconduit_save_configuration (ctxt->new_cfg); -} - -static void -revert_settings (GnomePilotConduit *conduit, ECalConduitContext *ctxt) -{ - LOG ("revert_settings"); - - calconduit_save_configuration (ctxt->cfg); - calconduit_destroy_configuration (ctxt->new_cfg); - ctxt->new_cfg = calconduit_dupe_configuration (ctxt->cfg); -} - -static ORBit_MessageValidationResult -accept_all_cookies (CORBA_unsigned_long request_id, - CORBA_Principal *principal, - CORBA_char *operation) -{ - /* allow ALL cookies */ - return ORBIT_MESSAGE_ALLOW_ALL; -} - - -GnomePilotConduit * -conduit_get_gpilot_conduit (guint32 pilot_id) -{ - GtkObject *retval; - ECalConduitContext *ctxt; - - LOG ("in calendar's conduit_get_gpilot_conduit\n"); - - /* we need to find wombat with oaf, so make sure oaf - is initialized here. once the desktop is converted - to oaf and gpilotd is built with oaf, this can go away */ - if (!oaf_is_initialized ()) { - char *argv[ 1 ] = {"hi"}; - oaf_init (1, argv); - - if (bonobo_init (CORBA_OBJECT_NIL, - CORBA_OBJECT_NIL, - CORBA_OBJECT_NIL) == FALSE) - g_error (_("Could not initialize Bonobo")); - - ORBit_set_request_validation_handler (accept_all_cookies); - } - - retval = gnome_pilot_conduit_sync_abs_new ("DatebookDB", 0x64617465); - g_assert (retval != NULL); - - ctxt = e_calendar_context_new (pilot_id); - gtk_object_set_data (GTK_OBJECT (retval), "calconduit_context", ctxt); - - /* Sync signals */ - gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, ctxt); - gtk_signal_connect (retval, "post_sync", (GtkSignalFunc) post_sync, ctxt); - - gtk_signal_connect (retval, "set_pilot_id", (GtkSignalFunc) set_pilot_id, ctxt); - gtk_signal_connect (retval, "set_status_cleared", (GtkSignalFunc) set_status_cleared, ctxt); - - gtk_signal_connect (retval, "for_each", (GtkSignalFunc) for_each, ctxt); - gtk_signal_connect (retval, "for_each_modified", (GtkSignalFunc) for_each_modified, ctxt); - gtk_signal_connect (retval, "compare", (GtkSignalFunc) compare, ctxt); - - gtk_signal_connect (retval, "add_record", (GtkSignalFunc) add_record, ctxt); - gtk_signal_connect (retval, "replace_record", (GtkSignalFunc) replace_record, ctxt); - gtk_signal_connect (retval, "delete_record", (GtkSignalFunc) delete_record, ctxt); - gtk_signal_connect (retval, "archive_record", (GtkSignalFunc) archive_record, ctxt); - - gtk_signal_connect (retval, "match", (GtkSignalFunc) match, ctxt); - gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt); - - gtk_signal_connect (retval, "prepare", (GtkSignalFunc) prepare, ctxt); - - /* Gui Settings */ - gtk_signal_connect (retval, "create_settings_window", (GtkSignalFunc) create_settings_window, ctxt); - gtk_signal_connect (retval, "display_settings", (GtkSignalFunc) display_settings, ctxt); - gtk_signal_connect (retval, "save_settings", (GtkSignalFunc) save_settings, ctxt); - gtk_signal_connect (retval, "revert_settings", (GtkSignalFunc) revert_settings, ctxt); - - return GNOME_PILOT_CONDUIT (retval); -} - -void -conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit) -{ - GtkObject *obj = GTK_OBJECT (conduit); - ECalConduitContext *ctxt; - - ctxt = gtk_object_get_data (obj, "calconduit_context"); - e_calendar_context_destroy (ctxt); - - gtk_object_destroy (obj); -} diff --git a/calendar/conduits/calendar/e-calendar.conduit.in b/calendar/conduits/calendar/e-calendar.conduit.in deleted file mode 100644 index e75d889234..0000000000 --- a/calendar/conduits/calendar/e-calendar.conduit.in +++ /dev/null @@ -1,9 +0,0 @@ -<gnome-pilot-conduit version="1.0"> - <conduit id="e_calendar_conduit" type="shlib" location="@prefix@/lib/gnome-pilot/conduits/libecalendar_conduit.so"/> - <name value="ECalendar"/> - <conduit-attribute name="description" value="Synchronizes Calendar with Evolution"/> - <conduit-attribute name="default-synctype" value="synchronize"/> - <conduit-attribute name="valid-synctypes" value="synchronize copy_from_pilot copy_to_pilot"/> - <conduit-attribute name="settings" value="TRUE"/> - <conduit-attribute name="icon" value="@datadir@/images/evolution/conduits/48_evo-calendar-conduit.png"/> -</gnome-pilot-conduit> diff --git a/calendar/conduits/todo/.cvsignore b/calendar/conduits/todo/.cvsignore deleted file mode 100644 index 3ee063c770..0000000000 --- a/calendar/conduits/todo/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -Makefile.in -Makefile -.deps -.libs -*.lo -*.la -e-todo-conduit-control-applet -e-todo-conduit-control-applet.desktop -e-todo.conduit diff --git a/calendar/conduits/todo/Makefile.am b/calendar/conduits/todo/Makefile.am deleted file mode 100644 index 7c0822debc..0000000000 --- a/calendar/conduits/todo/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/calendar \ - -I$(top_builddir)/calendar/cal-client \ - -I$(top_srcdir)/libical/src/libical \ - -I$(top_builddir)/libical/src/libical \ - -I$(top_srcdir)/e-util \ - -I$(top_builddir)/e-util \ - $(EVOLUTION_CALENDAR_CONDUIT_CFLAGS) - -# ToDo Conduit -e_todo_conduitsdir=$(libdir)/gnome-pilot/conduits -e_todo_conduits_LTLIBRARIES = libetodo_conduit.la - -libetodo_conduit_la_SOURCES = \ - todo-conduit.c - -libetodo_conduit_la_LDFLAGS = -module -avoid-version -libetodo_conduit_la_LIBADD = \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/calendar/cal-client/libcal-client-static.la \ - $(top_builddir)/calendar/cal-util/libcal-util-static.la \ - $(top_builddir)/libversit/libversit.a \ - $(top_builddir)/libical/src/libical/libical-static.la \ - $(top_builddir)/libwombat/libwombat-static.la \ - $(top_builddir)/e-util/libeconduit-static.la \ - $(EVOLUTION_CALENDAR_CONDUIT_LIBS) - -e-todo.conduit: e-todo.conduit.in Makefile - sed -e 's^\@prefix\@^$(prefix)^g' \ - -e 's^\@datadir\@^$(datadir)^g' \ - < $(srcdir)/e-todo.conduit.in > e-todo.conduit.tmp \ - && mv e-todo.conduit.tmp e-todo.conduit - -Conduitdir = $(datadir)/gnome-pilot/conduits/ -Conduit_DATA = e-todo.conduit - -EXTRA_DIST = \ - e-todo.conduit.in - -install-data-local: - $(mkinstalldirs) $(Conduitdir) diff --git a/calendar/conduits/todo/e-todo.conduit.in b/calendar/conduits/todo/e-todo.conduit.in deleted file mode 100644 index a7bea27a8f..0000000000 --- a/calendar/conduits/todo/e-todo.conduit.in +++ /dev/null @@ -1,9 +0,0 @@ -<gnome-pilot-conduit version="1.0"> - <conduit id="e_todo_conduit" type="shlib" location="@prefix@/lib/gnome-pilot/conduits/libetodo_conduit.so"/> - <name value="EToDo"/> - <conduit-attribute name="description" value="Synchronizes ToDo List with Evolution"/> - <conduit-attribute name="default-synctype" value="synchronize"/> - <conduit-attribute name="valid-synctypes" value="synchronize copy_from_pilot copy_to_pilot"/> - <conduit-attribute name="settings" value="TRUE"/> - <conduit-attribute name="icon" value="@datadir@/images/evolution/conduits/48_evo-todo-conduit.png"/> -</gnome-pilot-conduit> diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c deleted file mode 100644 index 42c8b3c865..0000000000 --- a/calendar/conduits/todo/todo-conduit.c +++ /dev/null @@ -1,1435 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Evolution calendar - ToDo Conduit - * - * Copyright (C) 1998 Free Software Foundation - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Eskil Heyn Olsen <deity@eskil.dk> - * JP Rosevear <jpr@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> - -#include <liboaf/liboaf.h> -#include <bonobo.h> -#include <bonobo-conf/bonobo-config-database.h> -#include <cal-client/cal-client-types.h> -#include <cal-client/cal-client.h> -#include <cal-util/timeutil.h> -#include <pi-source.h> -#include <pi-socket.h> -#include <pi-dlp.h> -#include <pi-todo.h> -#include <libical/src/libical/icaltypes.h> -#include <gpilotd/gnome-pilot-conduit.h> -#include <gpilotd/gnome-pilot-conduit-sync-abs.h> -#include <libgpilotdCM/gnome-pilot-conduit-management.h> -#include <libgpilotdCM/gnome-pilot-conduit-config.h> -#include <e-pilot-map.h> -#include <e-pilot-settings.h> -#include <e-pilot-util.h> - -GnomePilotConduit * conduit_get_gpilot_conduit (guint32); -void conduit_destroy_gpilot_conduit (GnomePilotConduit*); - -#define CONDUIT_VERSION "0.1.4" -#ifdef G_LOG_DOMAIN -#undef G_LOG_DOMAIN -#endif -#define G_LOG_DOMAIN "etodoconduit" - -#define DEBUG_TODOCONDUIT 1 -/* #undef DEBUG_TODOCONDUIT */ - -#ifdef DEBUG_TODOCONDUIT -#define LOG(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e) -#else -#define LOG(e...) -#endif - -#define WARN(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, e) -#define INFO(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e) - -typedef struct _EToDoLocalRecord EToDoLocalRecord; -typedef struct _EToDoConduitCfg EToDoConduitCfg; -typedef struct _EToDoConduitGui EToDoConduitGui; -typedef struct _EToDoConduitContext EToDoConduitContext; - -/* Local Record */ -struct _EToDoLocalRecord { - /* The stuff from gnome-pilot-conduit-standard-abs.h - Must be first in the structure, or instances of this - structure cannot be used by gnome-pilot-conduit-standard-abs. - */ - GnomePilotDesktopRecord local; - - /* The corresponding Comp object */ - CalComponent *comp; - - /* pilot-link todo structure */ - struct ToDo *todo; -}; - -static void -todoconduit_destroy_record (EToDoLocalRecord *local) -{ - gtk_object_unref (GTK_OBJECT (local->comp)); - free_ToDo (local->todo); - g_free (local->todo); - g_free (local); -} - -/* Configuration */ -struct _EToDoConduitCfg { - guint32 pilot_id; - GnomePilotConduitSyncType sync_type; - - gboolean secret; - gint priority; - - gchar *last_uri; -}; - -static EToDoConduitCfg * -todoconduit_load_configuration (guint32 pilot_id) -{ - EToDoConduitCfg *c; - GnomePilotConduitManagement *management; - GnomePilotConduitConfig *config; - gchar prefix[256]; - g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/", - pilot_id); - - c = g_new0 (EToDoConduitCfg,1); - g_assert (c != NULL); - - c->pilot_id = pilot_id; - - management = gnome_pilot_conduit_management_new ("e_todo_conduit", GNOME_PILOT_CONDUIT_MGMT_ID); - config = gnome_pilot_conduit_config_new (management, pilot_id); - if (!gnome_pilot_conduit_config_is_enabled (config, &c->sync_type)) - c->sync_type = GnomePilotConduitSyncTypeNotSet; - gtk_object_unref (GTK_OBJECT (config)); - gtk_object_unref (GTK_OBJECT (management)); - - /* Custom settings */ - gnome_config_push_prefix (prefix); - - c->secret = gnome_config_get_bool ("secret=FALSE"); - c->priority = gnome_config_get_int ("priority=3"); - c->last_uri = gnome_config_get_string ("last_uri"); - - gnome_config_pop_prefix (); - - return c; -} - -static void -todoconduit_save_configuration (EToDoConduitCfg *c) -{ - gchar prefix[256]; - - g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/", - c->pilot_id); - - gnome_config_push_prefix (prefix); - gnome_config_set_bool ("secret", c->secret); - gnome_config_set_int ("priority", c->priority); - gnome_config_set_string ("last_uri", c->last_uri); - gnome_config_pop_prefix (); - - gnome_config_sync (); - gnome_config_drop_all (); -} - -static EToDoConduitCfg* -todoconduit_dupe_configuration (EToDoConduitCfg *c) -{ - EToDoConduitCfg *retval; - - g_return_val_if_fail (c != NULL, NULL); - - retval = g_new0 (EToDoConduitCfg, 1); - retval->sync_type = c->sync_type; - retval->pilot_id = c->pilot_id; - - retval->secret = c->secret; - retval->priority = c->priority; - retval->last_uri = g_strdup (c->last_uri); - - return retval; -} - -static void -todoconduit_destroy_configuration (EToDoConduitCfg *c) -{ - g_return_if_fail (c != NULL); - - g_free (c->last_uri); - g_free (c); -} - -/* Gui */ -struct _EToDoConduitGui { - GtkWidget *priority; -}; - -static EToDoConduitGui * -e_todo_gui_new (EPilotSettings *ps) -{ - EToDoConduitGui *gui; - GtkWidget *lbl; - GtkObject *adj; - gint rows; - - g_return_val_if_fail (ps != NULL, NULL); - g_return_val_if_fail (E_IS_PILOT_SETTINGS (ps), NULL); - - gtk_table_resize (GTK_TABLE (ps), E_PILOT_SETTINGS_TABLE_ROWS + 1, E_PILOT_SETTINGS_TABLE_COLS); - - gui = g_new0 (EToDoConduitGui, 1); - - rows = E_PILOT_SETTINGS_TABLE_ROWS; - lbl = gtk_label_new (_("Default Priority:")); - gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5); - adj = gtk_adjustment_new (1, 1, 5, 1, 5, 5); - gui->priority = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1.0, 0); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (gui->priority), TRUE); - gtk_table_attach_defaults (GTK_TABLE (ps), lbl, 0, 1, rows, rows + 1); - gtk_table_attach_defaults (GTK_TABLE (ps), gui->priority, 1, 2, rows, rows + 1); - gtk_widget_show (lbl); - gtk_widget_show (gui->priority); - - return gui; -} - -static void -e_todo_gui_fill_widgets (EToDoConduitGui *gui, EToDoConduitCfg *cfg) -{ - g_return_if_fail (gui != NULL); - g_return_if_fail (cfg != NULL); - - gtk_spin_button_set_value (GTK_SPIN_BUTTON (gui->priority), cfg->priority); -} - -static void -e_todo_gui_fill_config (EToDoConduitGui *gui, EToDoConduitCfg *cfg) -{ - g_return_if_fail (gui != NULL); - g_return_if_fail (cfg != NULL); - - cfg->priority = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (gui->priority)); -} - -static void -e_todo_gui_destroy (EToDoConduitGui *gui) -{ - g_free (gui); -} - -/* Context */ -struct _EToDoConduitContext { - GnomePilotDBInfo *dbi; - - EToDoConduitCfg *cfg; - EToDoConduitCfg *new_cfg; - EToDoConduitGui *gui; - GtkWidget *ps; - - struct ToDoAppInfo ai; - - CalClient *client; - - icaltimezone *timezone; - GList *uids; - GList *changed; - GHashTable *changed_hash; - GList *locals; - - EPilotMap *map; -}; - -static EToDoConduitContext * -e_todo_context_new (guint32 pilot_id) -{ - EToDoConduitContext *ctxt = g_new0 (EToDoConduitContext, 1); - - ctxt->cfg = todoconduit_load_configuration (pilot_id); - ctxt->new_cfg = todoconduit_dupe_configuration (ctxt->cfg); - ctxt->gui = NULL; - ctxt->ps = NULL; - ctxt->client = NULL; - ctxt->uids = NULL; - ctxt->changed_hash = NULL; - ctxt->changed = NULL; - ctxt->locals = NULL; - ctxt->map = NULL; - - return ctxt; -} - -static gboolean -e_todo_context_foreach_change (gpointer key, gpointer value, gpointer data) -{ - g_free (key); - - return TRUE; -} - -static void -e_todo_context_destroy (EToDoConduitContext *ctxt) -{ - GList *l; - - g_return_if_fail (ctxt != NULL); - - if (ctxt->cfg != NULL) - todoconduit_destroy_configuration (ctxt->cfg); - if (ctxt->new_cfg != NULL) - todoconduit_destroy_configuration (ctxt->new_cfg); - if (ctxt->gui != NULL) - e_todo_gui_destroy (ctxt->gui); - - if (ctxt->client != NULL) - gtk_object_unref (GTK_OBJECT (ctxt->client)); - - if (ctxt->uids != NULL) - cal_obj_uid_list_free (ctxt->uids); - - if (ctxt->changed_hash != NULL) { - g_hash_table_foreach_remove (ctxt->changed_hash, e_todo_context_foreach_change, NULL); - g_hash_table_destroy (ctxt->changed_hash); - } - - if (ctxt->locals != NULL) { - for (l = ctxt->locals; l != NULL; l = l->next) - todoconduit_destroy_record (l->data); - g_list_free (ctxt->locals); - } - - if (ctxt->changed != NULL) - cal_client_change_list_free (ctxt->changed); - - if (ctxt->map != NULL) - e_pilot_map_destroy (ctxt->map); - - g_free (ctxt); -} - -/* Debug routines */ -static char * -print_local (EToDoLocalRecord *local) -{ - static char buff[ 4096 ]; - - if (local == NULL) { - sprintf (buff, "[NULL]"); - return buff; - } - - if (local->todo && local->todo->description) { - g_snprintf (buff, 4096, "[%d %ld %d %d '%s' '%s']", - local->todo->indefinite, - mktime (& local->todo->due), - local->todo->priority, - local->todo->complete, - local->todo->description ? - local->todo->description : "", - local->todo->note ? - local->todo->note : ""); - return buff; - } - - return ""; -} - -static char *print_remote (GnomePilotRecord *remote) -{ - static char buff[ 4096 ]; - struct ToDo todo; - - if (remote == NULL) { - sprintf (buff, "[NULL]"); - return buff; - } - - memset (&todo, 0, sizeof (struct ToDo)); - unpack_ToDo (&todo, remote->record, remote->length); - - g_snprintf (buff, 4096, "[%d %ld %d %d '%s' '%s']", - todo.indefinite, - mktime (&todo.due), - todo.priority, - todo.complete, - todo.description ? - todo.description : "", - todo.note ? - todo.note : ""); - - free_ToDo (&todo); - - return buff; -} - - -/* Calendar Server routines */ -static void -start_calendar_server_cb (CalClient *cal_client, - CalClientOpenStatus status, - gpointer data) -{ - gboolean *success = data; - - if (status == CAL_CLIENT_OPEN_SUCCESS) { - *success = TRUE; - } else { - *success = FALSE; - WARN ("Failed to open calendar!\n"); - } - - gtk_main_quit (); /* end the sub event loop */ -} - -static int -start_calendar_server (EToDoConduitContext *ctxt) -{ - gboolean success = FALSE; - - g_return_val_if_fail (ctxt != NULL, -2); - - ctxt->client = cal_client_new (); - - gtk_signal_connect (GTK_OBJECT (ctxt->client), "cal_opened", - start_calendar_server_cb, &success); - - if (!cal_client_open_default_tasks (ctxt->client, FALSE)) - return -1; - - /* run a sub event loop to turn cal-client's async load - notification into a synchronous call */ - gtk_main (); - - if (success) - return 0; - - return -1; -} - -/* Utility routines */ -static icaltimezone * -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); - - return timezone; -} - -static icaltimezone * -get_default_timezone (void) -{ - Bonobo_ConfigDatabase db; - icaltimezone *timezone = NULL; - char *location; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev); - - if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) { - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - location = bonobo_config_get_string_with_default (db, - "/Calendar/Display/Timezone", "UTC", NULL); - if (!location || !location[0]) { - g_free (location); - location = g_strdup ("UTC"); - } - - timezone = icaltimezone_get_builtin_timezone (location); - g_free (location); - - bonobo_object_release_unref (db, NULL); - - return timezone; -} - -static char * -map_name (EToDoConduitContext *ctxt) -{ - char *filename; - - filename = g_strdup_printf ("%s/evolution/local/Tasks/pilot-map-todo-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id); - - return filename; -} - -static gboolean -is_empty_time (struct tm time) -{ - if (time.tm_sec || time.tm_min || time.tm_hour - || time.tm_mday || time.tm_mon || time.tm_year) - return FALSE; - - return TRUE; -} - -static GList * -next_changed_item (EToDoConduitContext *ctxt, GList *changes) -{ - CalClientChange *ccc; - GList *l; - - for (l = changes; l != NULL; l = l->next) { - const char *uid; - - ccc = l->data; - - cal_component_get_uid (ccc->comp, &uid); - if (g_hash_table_lookup (ctxt->changed_hash, uid)) - return l; - } - - return NULL; -} - -static void -compute_status (EToDoConduitContext *ctxt, EToDoLocalRecord *local, const char *uid) -{ - CalClientChange *ccc; - - local->local.archived = FALSE; - local->local.secret = FALSE; - - ccc = g_hash_table_lookup (ctxt->changed_hash, uid); - - if (ccc == NULL) { - local->local.attr = GnomePilotRecordNothing; - return; - } - - switch (ccc->type) { - case CAL_CLIENT_CHANGE_ADDED: - local->local.attr = GnomePilotRecordNew; - break; - case CAL_CLIENT_CHANGE_MODIFIED: - local->local.attr = GnomePilotRecordModified; - break; - case CAL_CLIENT_CHANGE_DELETED: - local->local.attr = GnomePilotRecordDeleted; - break; - } -} - -static GnomePilotRecord -local_record_to_pilot_record (EToDoLocalRecord *local, - EToDoConduitContext *ctxt) -{ - GnomePilotRecord p; - static char record[0xffff]; - - g_assert (local->comp != NULL); - g_assert (local->todo != NULL ); - - LOG ("local_record_to_pilot_record\n"); - - p.ID = local->local.ID; - p.category = local->local.category; - p.attr = local->local.attr; - p.archived = local->local.archived; - p.secret = local->local.secret; - - /* Generate pilot record structure */ - p.record = record; - p.length = pack_ToDo (local->todo, p.record, 0xffff); - - return p; -} - -/* - * converts a CalComponent object to a EToDoLocalRecord - */ -static void -local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoConduitContext *ctxt) -{ - const char *uid; - int *priority; - icalproperty_status status; - CalComponentText summary; - GSList *d_list = NULL; - CalComponentText *description; - CalComponentDateTime due; - CalComponentClassification classif; - icaltimezone *default_tz = get_default_timezone (); - - LOG ("local_record_from_comp\n"); - - g_return_if_fail (local != NULL); - g_return_if_fail (comp != NULL); - - local->comp = comp; - gtk_object_ref (GTK_OBJECT (comp)); - - cal_component_get_uid (local->comp, &uid); - local->local.ID = e_pilot_map_lookup_pid (ctxt->map, uid, TRUE); - - compute_status (ctxt, local, uid); - - local->todo = g_new0 (struct ToDo,1); - - /* Don't overwrite the category */ - if (local->local.ID != 0) { - char record[0xffff]; - int cat = 0; - - if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, - ctxt->dbi->db_handle, - local->local.ID, &record, - NULL, NULL, NULL, &cat) > 0) { - local->local.category = cat; - } - } - - /* STOP: don't replace these with g_strdup, since free_ToDo - uses free to deallocate */ - cal_component_get_summary (comp, &summary); - if (summary.value) - local->todo->description = e_pilot_utf8_to_pchar (summary.value); - - cal_component_get_description_list (comp, &d_list); - if (d_list) { - description = (CalComponentText *) d_list->data; - if (description && description->value) - local->todo->note = e_pilot_utf8_to_pchar (description->value); - else - local->todo->note = NULL; - } else { - local->todo->note = NULL; - } - - cal_component_get_due (comp, &due); - if (due.value) { - icaltimezone_convert_time (due.value, - get_timezone (ctxt->client, due.tzid), - default_tz); - local->todo->due = icaltimetype_to_tm (due.value); - local->todo->indefinite = 0; - } else { - local->todo->indefinite = 1; - } - cal_component_free_datetime (&due); - - cal_component_get_status (comp, &status); - if (status == ICAL_STATUS_COMPLETED) - local->todo->complete = 1; - else - local->todo->complete = 0; - - cal_component_get_priority (comp, &priority); - if (priority && *priority != 0) { - if (*priority <= 3) - local->todo->priority = 1; - else if (*priority == 4) - local->todo->priority = 2; - else if (*priority == 5) - local->todo->priority = 3; - else if (*priority <= 7) - local->todo->priority = 4; - else - local->todo->priority = 5; - - cal_component_free_priority (priority); - } else { - local->todo->priority = ctxt->cfg->priority; - } - - cal_component_get_classification (comp, &classif); - - if (classif == CAL_COMPONENT_CLASS_PRIVATE) - local->local.secret = 1; - else - local->local.secret = 0; - - local->local.archived = 0; -} - -static void -local_record_from_uid (EToDoLocalRecord *local, - const char *uid, - EToDoConduitContext *ctxt) -{ - CalComponent *comp; - CalClientGetStatus status; - - g_assert(local!=NULL); - - status = cal_client_get_object (ctxt->client, uid, &comp); - - if (status == CAL_CLIENT_GET_SUCCESS) { - local_record_from_comp (local, comp, ctxt); - gtk_object_unref (GTK_OBJECT (comp)); - } else if (status == CAL_CLIENT_GET_NOT_FOUND) { - comp = cal_component_new (); - cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO); - cal_component_set_uid (comp, uid); - local_record_from_comp (local, comp, ctxt); - gtk_object_unref (GTK_OBJECT (comp)); - } else { - INFO ("Object did not exist"); - } - - -} - - -static CalComponent * -comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, - GnomePilotRecord *remote, - CalComponent *in_comp, - icaltimezone *timezone) -{ - CalComponent *comp; - struct ToDo todo; - CalComponentText summary = {NULL, NULL}; - CalComponentDateTime dt = {NULL, icaltimezone_get_tzid (timezone)}; - struct icaltimetype due, now; - icaltimezone *utc_zone; - int priority; - char *txt; - - g_return_val_if_fail (remote != NULL, NULL); - - memset (&todo, 0, sizeof (struct ToDo)); - unpack_ToDo (&todo, remote->record, remote->length); - - utc_zone = icaltimezone_get_utc_timezone (); - now = icaltime_from_timet_with_zone (time (NULL), FALSE, - utc_zone); - - if (in_comp == NULL) { - comp = cal_component_new (); - cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO); - cal_component_set_created (comp, &now); - } else { - comp = cal_component_clone (in_comp); - } - - cal_component_set_last_modified (comp, &now); - - summary.value = txt = e_pilot_utf8_from_pchar (todo.description); - cal_component_set_summary (comp, &summary); - free (txt); - - /* The iCal description field */ - if (!todo.note) { - cal_component_set_comment_list (comp, NULL); - } else { - GSList l; - CalComponentText text; - - text.value = txt = e_pilot_utf8_from_pchar (todo.note); - text.altrep = NULL; - l.data = &text; - l.next = NULL; - - cal_component_set_description_list (comp, &l); - free (txt); - } - - if (todo.complete) { - int percent = 100; - - cal_component_set_completed (comp, &now); - cal_component_set_percent (comp, &percent); - cal_component_set_status (comp, ICAL_STATUS_COMPLETED); - } else { - int *percent = NULL; - icalproperty_status status; - - cal_component_set_completed (comp, NULL); - - cal_component_get_percent (comp, &percent); - if (percent == NULL || *percent == 100) { - int p = 0; - cal_component_set_percent (comp, &p); - } - if (percent != NULL) - cal_component_free_percent (percent); - - cal_component_get_status (comp, &status); - if (status == ICAL_STATUS_COMPLETED) - cal_component_set_status (comp, ICAL_STATUS_NEEDSACTION); - } - - if (!is_empty_time (todo.due)) { - due = tm_to_icaltimetype (&todo.due, FALSE); - dt.value = &due; - cal_component_set_due (comp, &dt); - } - - switch (todo.priority) { - case 1: - priority = 3; - break; - case 2: - priority = 4; - break; - case 3: - priority = 5; - break; - case 4: - priority = 7; - break; - default: - priority = 9; - } - - cal_component_set_priority (comp, &priority); - cal_component_set_transparency (comp, CAL_COMPONENT_TRANSP_NONE); - - if (remote->attr & dlpRecAttrSecret) - cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PRIVATE); - else - cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PUBLIC); - - cal_component_commit_sequence (comp); - - free_ToDo(&todo); - - return comp; -} - -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); - int map_count; - const char *uri; - - /* If there are no objects or objects but no log */ - map_count = g_hash_table_size (ctxt->map->pid_map); - if (map_count == 0) - gnome_pilot_conduit_standard_set_slow (conduit, TRUE); - - /* Or if the URI's don't match */ - uri = cal_client_get_uri (ctxt->client); - LOG(" Current URI %s (%s)\n", uri, ctxt->cfg->last_uri ? ctxt->cfg->last_uri : "<NONE>"); - if (ctxt->cfg->last_uri != NULL && strcmp (ctxt->cfg->last_uri, uri)) { - gnome_pilot_conduit_standard_set_slow (conduit, TRUE); - e_pilot_map_clear (ctxt->map); - } - - if (gnome_pilot_conduit_standard_get_slow (conduit)) { - ctxt->map->write_touched_only = TRUE; - LOG (" doing slow sync\n"); - } else { - LOG (" doing fast sync\n"); - } -} - -/* Pilot syncing callbacks */ -static gint -pre_sync (GnomePilotConduit *conduit, - GnomePilotDBInfo *dbi, - EToDoConduitContext *ctxt) -{ - GnomePilotConduitSyncAbs *abs_conduit; - GList *l; - int len; - unsigned char *buf; - char *filename, *change_id; - gint num_records, add_records = 0, mod_records = 0, del_records = 0; - - abs_conduit = GNOME_PILOT_CONDUIT_SYNC_ABS (conduit); - - LOG ("---------------------------------------------------------\n"); - LOG ("pre_sync: ToDo Conduit v.%s", CONDUIT_VERSION); - g_message ("ToDo Conduit v.%s", CONDUIT_VERSION); - - ctxt->dbi = dbi; - ctxt->client = NULL; - - if (start_calendar_server (ctxt) != 0) { - WARN(_("Could not start wombat server")); - gnome_pilot_conduit_error (conduit, _("Could not start wombat")); - return -1; - } - - /* Get the timezone */ - ctxt->timezone = get_default_timezone (); - if (ctxt->timezone == NULL) - return -1; - LOG (" Using timezone: %s", icaltimezone_get_tzid (ctxt->timezone)); - - /* Load the uid <--> pilot id map */ - filename = map_name (ctxt); - e_pilot_map_read (filename, &ctxt->map); - g_free (filename); - - /* Get the local database */ - ctxt->uids = cal_client_get_uids (ctxt->client, CALOBJ_TYPE_TODO); - - /* 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); - ctxt->changed_hash = g_hash_table_new (g_str_hash, g_str_equal); - g_free (change_id); - - for (l = ctxt->changed; l != NULL; l = l->next) { - CalClientChange *ccc = l->data; - const char *uid; - - cal_component_get_uid (ccc->comp, &uid); - if (!e_pilot_map_uid_is_archived (ctxt->map, uid)) { - - g_hash_table_insert (ctxt->changed_hash, g_strdup (uid), ccc); - - switch (ccc->type) { - case CAL_CLIENT_CHANGE_ADDED: - add_records++; - break; - case CAL_CLIENT_CHANGE_MODIFIED: - mod_records++; - break; - case CAL_CLIENT_CHANGE_DELETED: - del_records++; - break; - } - } else if (ccc->type == CAL_CLIENT_CHANGE_DELETED) { - e_pilot_map_remove_by_uid (ctxt->map, uid); - } - } - - /* Set the count information */ - num_records = cal_client_get_n_objects (ctxt->client, CALOBJ_TYPE_TODO); - 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); - gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, del_records); - - buf = (unsigned char*)g_malloc (0xffff); - len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0, - (unsigned char *)buf, 0xffff); - - if (len < 0) { - WARN (_("Could not read pilot's ToDo application block")); - WARN ("dlp_ReadAppBlock(...) = %d", len); - gnome_pilot_conduit_error (conduit, - _("Could not read pilot's ToDo application block")); - return -1; - } - unpack_ToDoAppInfo (&(ctxt->ai), buf, len); - g_free (buf); - - check_for_slow_setting (conduit, ctxt); - if (ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyToPilot - || ctxt->cfg->sync_type == GnomePilotConduitSyncTypeCopyFromPilot) - ctxt->map->write_touched_only = TRUE; - - return 0; -} - -static gint -post_sync (GnomePilotConduit *conduit, - GnomePilotDBInfo *dbi, - EToDoConduitContext *ctxt) -{ - GList *changed; - gchar *filename, *change_id; - - LOG ("post_sync: ToDo Conduit v.%s", CONDUIT_VERSION); - - g_free (ctxt->cfg->last_uri); - ctxt->cfg->last_uri = g_strdup (cal_client_get_uri (ctxt->client)); - todoconduit_save_configuration (ctxt->cfg); - - filename = map_name (ctxt); - e_pilot_map_write (filename, ctxt->map); - g_free (filename); - - /* FIX ME ugly hack - our changes musn't count, this does introduce - * 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); - g_free (change_id); - - LOG ("---------------------------------------------------------\n"); - - return 0; -} - -static gint -set_pilot_id (GnomePilotConduitSyncAbs *conduit, - EToDoLocalRecord *local, - guint32 ID, - EToDoConduitContext *ctxt) -{ - const char *uid; - - LOG ("set_pilot_id: setting to %d\n", ID); - - cal_component_get_uid (local->comp, &uid); - e_pilot_map_insert (ctxt->map, ID, uid, FALSE); - - return 0; -} - -static gint -set_status_cleared (GnomePilotConduitSyncAbs *conduit, - EToDoLocalRecord *local, - EToDoConduitContext *ctxt) -{ - const char *uid; - - LOG ("set_status_cleared: clearing status\n"); - - cal_component_get_uid (local->comp, &uid); - g_hash_table_remove (ctxt->changed_hash, uid); - - return 0; -} - -static gint -for_each (GnomePilotConduitSyncAbs *conduit, - EToDoLocalRecord **local, - EToDoConduitContext *ctxt) -{ - static GList *uids, *iterator; - static int count; - - g_return_val_if_fail (local != NULL, -1); - - if (*local == NULL) { - LOG ("beginning for_each"); - - uids = ctxt->uids; - count = 0; - - if (uids != NULL) { - LOG ("iterating over %d records", g_list_length (uids)); - - *local = g_new0 (EToDoLocalRecord, 1); - local_record_from_uid (*local, uids->data, ctxt); - g_list_prepend (ctxt->locals, *local); - - iterator = uids; - } else { - LOG ("no events"); - (*local) = NULL; - return 0; - } - } else { - count++; - if (g_list_next (iterator)) { - iterator = g_list_next (iterator); - - *local = g_new0 (EToDoLocalRecord, 1); - local_record_from_uid (*local, iterator->data, ctxt); - g_list_prepend (ctxt->locals, *local); - } else { - LOG ("for_each ending"); - - /* Tell the pilot the iteration is over */ - *local = NULL; - - return 0; - } - } - - return 0; -} - -static gint -for_each_modified (GnomePilotConduitSyncAbs *conduit, - EToDoLocalRecord **local, - EToDoConduitContext *ctxt) -{ - static GList *iterator; - static int count; - - g_return_val_if_fail (local != NULL, 0); - - if (*local == NULL) { - LOG ("for_each_modified beginning\n"); - - iterator = ctxt->changed; - - count = 0; - - LOG ("iterating over %d records", g_hash_table_size (ctxt->changed_hash)); - - iterator = next_changed_item (ctxt, iterator); - if (iterator != NULL) { - CalClientChange *ccc = iterator->data; - - *local = g_new0 (EToDoLocalRecord, 1); - local_record_from_comp (*local, ccc->comp, ctxt); - g_list_prepend (ctxt->locals, *local); - } else { - LOG ("no events"); - - *local = NULL; - } - } else { - count++; - iterator = g_list_next (iterator); - if (iterator && (iterator = next_changed_item (ctxt, iterator))) { - CalClientChange *ccc = iterator->data; - - *local = g_new0 (EToDoLocalRecord, 1); - local_record_from_comp (*local, ccc->comp, ctxt); - g_list_prepend (ctxt->locals, *local); - } else { - LOG ("for_each_modified ending"); - - /* Signal the iteration is over */ - *local = NULL; - } - } - - return 0; -} - -static gint -compare (GnomePilotConduitSyncAbs *conduit, - EToDoLocalRecord *local, - GnomePilotRecord *remote, - EToDoConduitContext *ctxt) -{ - /* used by the quick compare */ - GnomePilotRecord local_pilot; - int retval = 0; - - LOG ("compare: local=%s remote=%s...\n", - print_local (local), print_remote (remote)); - - g_return_val_if_fail (local!=NULL,-1); - g_return_val_if_fail (remote!=NULL,-1); - - local_pilot = local_record_to_pilot_record (local, ctxt); - - if (remote->length != local_pilot.length - || memcmp (local_pilot.record, remote->record, remote->length)) - retval = 1; - - if (retval == 0) - LOG (" equal"); - else - LOG (" not equal"); - - return retval; -} - -static gint -add_record (GnomePilotConduitSyncAbs *conduit, - GnomePilotRecord *remote, - EToDoConduitContext *ctxt) -{ - CalComponent *comp; - const char *uid; - int retval = 0; - - g_return_val_if_fail (remote != NULL, -1); - - LOG ("add_record: adding %s to desktop\n", print_remote (remote)); - - comp = comp_from_remote_record (conduit, remote, NULL, ctxt->timezone); - update_comp (conduit, comp, ctxt); - - cal_component_get_uid (comp, &uid); - e_pilot_map_insert (ctxt->map, remote->ID, uid, FALSE); - - gtk_object_unref (GTK_OBJECT (comp)); - - return retval; -} - -static gint -replace_record (GnomePilotConduitSyncAbs *conduit, - EToDoLocalRecord *local, - GnomePilotRecord *remote, - EToDoConduitContext *ctxt) -{ - CalComponent *new_comp; - int retval = 0; - - g_return_val_if_fail (remote != NULL, -1); - - LOG ("replace_record: replace %s with %s\n", - print_local (local), print_remote (remote)); - - new_comp = comp_from_remote_record (conduit, remote, local->comp, ctxt->timezone); - gtk_object_unref (GTK_OBJECT (local->comp)); - local->comp = new_comp; - update_comp (conduit, local->comp, ctxt); - - return retval; -} - -static gint -delete_record (GnomePilotConduitSyncAbs *conduit, - EToDoLocalRecord *local, - EToDoConduitContext *ctxt) -{ - const char *uid; - - g_return_val_if_fail (local != NULL, -1); - g_return_val_if_fail (local->comp != NULL, -1); - - cal_component_get_uid (local->comp, &uid); - - LOG ("delete_record: deleting %s\n", uid); - - e_pilot_map_remove_by_uid (ctxt->map, uid); - cal_client_remove_object (ctxt->client, uid); - - return 0; -} - -static gint -archive_record (GnomePilotConduitSyncAbs *conduit, - EToDoLocalRecord *local, - gboolean archive, - EToDoConduitContext *ctxt) -{ - const char *uid; - int retval = 0; - - g_return_val_if_fail (local != NULL, -1); - - LOG ("archive_record: %s\n", archive ? "yes" : "no"); - - cal_component_get_uid (local->comp, &uid); - e_pilot_map_insert (ctxt->map, local->local.ID, uid, archive); - - return retval; -} - -static gint -match (GnomePilotConduitSyncAbs *conduit, - GnomePilotRecord *remote, - EToDoLocalRecord **local, - EToDoConduitContext *ctxt) -{ - const char *uid; - - LOG ("match: looking for local copy of %s\n", - print_remote (remote)); - - g_return_val_if_fail (local != NULL, -1); - g_return_val_if_fail (remote != NULL, -1); - - *local = NULL; - uid = e_pilot_map_lookup_uid (ctxt->map, remote->ID, TRUE); - - if (!uid) - return 0; - - LOG (" matched\n"); - - *local = g_new0 (EToDoLocalRecord, 1); - local_record_from_uid (*local, uid, ctxt); - - return 0; -} - -static gint -free_match (GnomePilotConduitSyncAbs *conduit, - EToDoLocalRecord *local, - EToDoConduitContext *ctxt) -{ - LOG ("free_match: freeing\n"); - - g_return_val_if_fail (local != NULL, -1); - - todoconduit_destroy_record (local); - - return 0; -} - -static gint -prepare (GnomePilotConduitSyncAbs *conduit, - EToDoLocalRecord *local, - GnomePilotRecord *remote, - EToDoConduitContext *ctxt) -{ - LOG ("prepare: encoding local %s\n", print_local (local)); - - *remote = local_record_to_pilot_record (local, ctxt); - - return 0; -} - -/* Pilot Settings Callbacks */ -static void -fill_widgets (EToDoConduitContext *ctxt) -{ - e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps), - ctxt->cfg->secret); - - e_todo_gui_fill_widgets (ctxt->gui, ctxt->cfg); -} - -static gint -create_settings_window (GnomePilotConduit *conduit, - GtkWidget *parent, - EToDoConduitContext *ctxt) -{ - LOG ("create_settings_window"); - - ctxt->ps = e_pilot_settings_new (); - ctxt->gui = e_todo_gui_new (E_PILOT_SETTINGS (ctxt->ps)); - - gtk_container_add (GTK_CONTAINER (parent), ctxt->ps); - gtk_widget_show (ctxt->ps); - - fill_widgets (ctxt); - - return 0; -} -static void -display_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt) -{ - LOG ("display_settings"); - - fill_widgets (ctxt); -} - -static void -save_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt) -{ - LOG ("save_settings"); - - ctxt->new_cfg->secret = e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps)); - e_todo_gui_fill_config (ctxt->gui, ctxt->new_cfg); - - todoconduit_save_configuration (ctxt->new_cfg); -} - -static void -revert_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt) -{ - LOG ("revert_settings"); - - todoconduit_save_configuration (ctxt->cfg); - todoconduit_destroy_configuration (ctxt->new_cfg); - ctxt->new_cfg = todoconduit_dupe_configuration (ctxt->cfg); -} - -static ORBit_MessageValidationResult -accept_all_cookies (CORBA_unsigned_long request_id, - CORBA_Principal *principal, - CORBA_char *operation) -{ - /* allow ALL cookies */ - return ORBIT_MESSAGE_ALLOW_ALL; -} - - -GnomePilotConduit * -conduit_get_gpilot_conduit (guint32 pilot_id) -{ - GtkObject *retval; - EToDoConduitContext *ctxt; - - LOG ("in todo's conduit_get_gpilot_conduit\n"); - - /* we need to find wombat with oaf, so make sure oaf - is initialized here. once the desktop is converted - to oaf and gpilotd is built with oaf, this can go away */ - if (!oaf_is_initialized ()) { - char *argv[ 1 ] = {"hi"}; - oaf_init (1, argv); - - if (bonobo_init (CORBA_OBJECT_NIL, - CORBA_OBJECT_NIL, - CORBA_OBJECT_NIL) == FALSE) - g_error (_("Could not initialize Bonobo")); - - ORBit_set_request_validation_handler (accept_all_cookies); - } - - retval = gnome_pilot_conduit_sync_abs_new ("ToDoDB", 0x746F646F); - g_assert (retval != NULL); - - ctxt = e_todo_context_new (pilot_id); - gtk_object_set_data (GTK_OBJECT (retval), "todoconduit_context", ctxt); - - gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, ctxt); - gtk_signal_connect (retval, "post_sync", (GtkSignalFunc) post_sync, ctxt); - - gtk_signal_connect (retval, "set_pilot_id", (GtkSignalFunc) set_pilot_id, ctxt); - gtk_signal_connect (retval, "set_status_cleared", (GtkSignalFunc) set_status_cleared, ctxt); - - gtk_signal_connect (retval, "for_each", (GtkSignalFunc) for_each, ctxt); - gtk_signal_connect (retval, "for_each_modified", (GtkSignalFunc) for_each_modified, ctxt); - gtk_signal_connect (retval, "compare", (GtkSignalFunc) compare, ctxt); - - gtk_signal_connect (retval, "add_record", (GtkSignalFunc) add_record, ctxt); - gtk_signal_connect (retval, "replace_record", (GtkSignalFunc) replace_record, ctxt); - gtk_signal_connect (retval, "delete_record", (GtkSignalFunc) delete_record, ctxt); - gtk_signal_connect (retval, "archive_record", (GtkSignalFunc) archive_record, ctxt); - - gtk_signal_connect (retval, "match", (GtkSignalFunc) match, ctxt); - gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt); - - gtk_signal_connect (retval, "prepare", (GtkSignalFunc) prepare, ctxt); - - /* Gui Settings */ - gtk_signal_connect (retval, "create_settings_window", (GtkSignalFunc) create_settings_window, ctxt); - gtk_signal_connect (retval, "display_settings", (GtkSignalFunc) display_settings, ctxt); - gtk_signal_connect (retval, "save_settings", (GtkSignalFunc) save_settings, ctxt); - gtk_signal_connect (retval, "revert_settings", (GtkSignalFunc) revert_settings, ctxt); - - return GNOME_PILOT_CONDUIT (retval); -} - -void -conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit) -{ - GtkObject *obj = GTK_OBJECT (conduit); - EToDoConduitContext *ctxt; - - ctxt = gtk_object_get_data (obj, "todoconduit_context"); - e_todo_context_destroy (ctxt); - - gtk_object_destroy (obj); -} diff --git a/calendar/gui/.cvsignore b/calendar/gui/.cvsignore deleted file mode 100644 index cd98cc234e..0000000000 --- a/calendar/gui/.cvsignore +++ /dev/null @@ -1,24 +0,0 @@ -Makefile.in -Makefile -.deps -_libs -.libs -.pure -evolution-calendar -evolution-calendar.pure -evolution-calendar.h -evolution-calendar-common.c -evolution-calendar-skels.c -evolution-calendar-stubs.c -*.lo -Evolution-Addressbook-SelectNames-common.c -Evolution-Addressbook-SelectNames-skels.c -Evolution-Addressbook-SelectNames-stubs.c -Evolution-Addressbook-SelectNames.h -Evolution-Composer-common.c -Evolution-Composer-skels.c -Evolution-Composer-stubs.c -Evolution-Composer.h -GNOME_Evolution_Calendar_Control.oaf -GNOME_Evolution_Calendar.oaf -GNOME_Evolution_Calendar_gnomecal.oaf diff --git a/calendar/gui/GNOME_Evolution_Calendar.oaf.in b/calendar/gui/GNOME_Evolution_Calendar.oaf.in deleted file mode 100644 index 68fd2a07d0..0000000000 --- a/calendar/gui/GNOME_Evolution_Calendar.oaf.in +++ /dev/null @@ -1,179 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_iTip_ControlFactory" - type="exe" - location="evolution-calendar"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory for the calendar iTip view control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_iTip_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Calendar_iTip_ControlFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Bonobo/Control:1.0"/> - <item value="IDL:Bonobo/PersistStream:1.0"/> - </oaf_attribute> - - <oaf_attribute name="bonobo:supported_mime_types" type="stringv"> - <item value="text/calendar"/> - <item value="text/x-calendar"/> - </oaf_attribute> - - <oaf_attribute name="name" type="string" - _value="Evolution calendar iTip/iMip viewer"/> - <oaf_attribute name="description" type="string" - _value="Factory for the calendar iTip view control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ShellComponent" - type="exe" - location="evolution-calendar"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/ShellComponent:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Evolution component for handling the calendar."/> - - <oaf_attribute name="evolution:shell_component_icon" type="string" - value="evolution-calendar.png"/> - <oaf_attribute name="evolution:shell_component_launch_order" type="number" - value="3"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ControlFactory" - type="exe" - location="evolution-calendar"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory for the sample Calendar control"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Calendar_ControlFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/calendar-control:1.0"/> - <item value="IDL:Bonobo/Control:1.0"/> - <item value="IDL:Bonobo/PropertyBag:1.0"/> - </oaf_attribute> - - <oaf_attribute name="bonobo:supported_mime_types" type="stringv"> - <item value="text/calendar"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="A sample Bonobo control which displays an calendar."/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Tasks_ControlFactory" - type="exe" - location="evolution-calendar"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory for the Evolution Tasks control"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Tasks_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Tasks_ControlFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/tasks-control:1.0"/> - <item value="IDL:Bonobo/Control:1.0"/> - <item value="IDL:Bonobo/PropertyBag:1.0"/> - </oaf_attribute> - - <oaf_attribute name="bonobo:supported_mime_types" type="stringv"> - <item value="text/calendar"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="A Bonobo control which displays a task list."/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_CompEditorFactory_Factory" - type="exe" - location="evolution-calendar"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory to create a component editor factory"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_CompEditorFactory" - type="factory" - location="OAFIID:GNOME_Evolution_Calendar_CompEditorFactory_Factory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/Calendar/CompEditorFactory:1.0"/> - <item value="IDL:Bonobo/Unknown:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory to centralize calendar component editor dialogs"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ConfigControlFactory" - type="exe" - location="evolution-calendar"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ConfigControl" - type="factory" - location="OAFIID:GNOME_Evolution_Calendar_ConfigControlFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/ConfigControl:1.0"/> - </oaf_attribute> - - <oaf_attribute name="evolution:config_item:title" type="string" - _value="Calendar and Tasks"/> - - <oaf_attribute name="evolution:config_item:description" type="string" - _value="Configure your timezone, Calendar and Task List here "/> - - <oaf_attribute name="evolution:config_item:icon_name" type="string" - value="evolution-calendar.png"/> - - <oaf_attribute name="evolution:config_item:type" type="stringv"> - <item value="calendar"/> - <item value="tasks"/> - </oaf_attribute> - - <oaf_attribute name="evolution:config_item:priority" type="string" value="-7"/> - - <oaf_attribute name="description" type="string" - _value="Configuration control for the Evolution Calendar."/> - -</oaf_server> - -</oaf_info> - diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am deleted file mode 100644 index 6e6f640b81..0000000000 --- a/calendar/gui/Makefile.am +++ /dev/null @@ -1,215 +0,0 @@ -## CORBA stuff - -IDLS = \ - $(top_srcdir)/composer/Evolution-Composer.idl \ - $(top_srcdir)/calendar/idl/evolution-calendar.idl \ - $(top_srcdir)/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl - -IDL_GENERATED = \ - Evolution-Composer.h \ - Evolution-Composer-common.c \ - Evolution-Composer-skels.c \ - Evolution-Composer-stubs.c \ - Evolution-Addressbook-SelectNames.h \ - Evolution-Addressbook-SelectNames-common.c \ - Evolution-Addressbook-SelectNames-skels.c \ - Evolution-Addressbook-SelectNames-stubs.c \ - evolution-calendar.h \ - evolution-calendar-common.c \ - evolution-calendar-skels.c \ - evolution-calendar-stubs.c - -$(IDL_GENERATED): $(IDLS) - $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \ - $(srcdir)/../../composer/Evolution-Composer.idl - $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \ - $(top_srcdir)/calendar/idl/evolution-calendar.idl - $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \ - $(top_srcdir)/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl - -BUILT_SOURCES = $(IDL_GENERATED) - -SUBDIRS = alarm-notify dialogs - -help_base = $(datadir)/gnome/help/cal - -bin_PROGRAMS = evolution-calendar - -INCLUDES = \ - -DG_LOG_DOMAIN=\"calendar-gui\" \ - -I$(top_builddir)/shell \ - -I$(top_srcdir)/shell \ - -I$(top_srcdir) \ - -I$(top_srcdir)/calendar \ - -I$(top_srcdir)/calendar/cal-client \ - -I$(top_builddir)/calendar/cal-client \ - -I$(top_srcdir)/libical/src/libical \ - -I$(top_builddir)/libical/src/libical \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -I$(top_srcdir)/widgets \ - -I$(includedir) \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DEVOLUTION_IMAGESDIR=\""$(datadir)"/images/evolution\" \ - $(EVOLUTION_CALENDAR_CFLAGS) - -iconsdir = $(datadir)/images/evolution - -gladedir = $(datadir)/evolution/glade -glade_DATA = \ - e-itip-control.glade \ - goto-dialog.glade - -etspecdir = $(datadir)/evolution/etspec/ -etspec_DATA = e-calendar-table.etspec e-meeting-time-sel.etspec - -evolution_calendar_SOURCES = \ - $(IDL_GENERATED) \ - cal-search-bar.c \ - cal-search-bar.h \ - calendar-config.c \ - calendar-config.h \ - calendar-commands.c \ - calendar-commands.h \ - calendar-model.c \ - calendar-model.h \ - calendar-offline-handler.c \ - calendar-offline-handler.h \ - calendar-view.c \ - calendar-view.h \ - calendar-view-factory.c \ - calendar-view-factory.h \ - comp-editor-factory.c \ - comp-editor-factory.h \ - comp-util.c \ - comp-util.h \ - config-control-factory.c \ - config-control-factory.h \ - control-factory.c \ - control-factory.h \ - component-factory.c \ - component-factory.h \ - e-calendar-table.h \ - e-calendar-table.c \ - e-cell-date-edit-text.h \ - e-cell-date-edit-text.c \ - e-comp-editor-registry.c \ - e-comp-editor-registry.h \ - e-day-view-layout.c \ - e-day-view-layout.h \ - e-day-view-main-item.c \ - e-day-view-main-item.h \ - e-day-view-time-item.c \ - e-day-view-time-item.h \ - e-day-view-top-item.c \ - e-day-view-top-item.h \ - e-day-view.c \ - e-day-view.h \ - e-itip-control.h \ - e-itip-control.c \ - e-meeting-attendee.c \ - e-meeting-attendee.h \ - e-meeting-model.c \ - e-meeting-model.h \ - e-meeting-time-sel.c \ - e-meeting-time-sel.h \ - e-meeting-time-sel-item.c \ - e-meeting-time-sel-item.h \ - e-meeting-types.h \ - e-meeting-utils.c \ - e-meeting-utils.h \ - e-week-view-event-item.c \ - e-week-view-event-item.h \ - e-week-view-layout.c \ - e-week-view-layout.h \ - e-week-view-main-item.c \ - e-week-view-main-item.h \ - e-week-view-titles-item.c \ - e-week-view-titles-item.h \ - e-week-view.c \ - e-week-view.h \ - e-tasks.c \ - e-tasks.h \ - e-timezone-entry.c \ - e-timezone-entry.h \ - gnome-cal.c \ - gnome-cal.h \ - goto.c \ - goto.h \ - itip-control-factory.c \ - itip-control-factory.h \ - itip-utils.c \ - itip-utils.h \ - main.c \ - misc.c \ - misc.h \ - print.c \ - print.h \ - tag-calendar.c \ - tag-calendar.h \ - tasks-control-factory.c \ - tasks-control-factory.h \ - tasks-control.c \ - tasks-control.h \ - tasks-migrate.c \ - tasks-migrate.h \ - weekday-picker.c \ - weekday-picker.h - -evolution_calendar_LDADD = \ - alarm-notify/libalarm.a \ - $(DB3_LDADD) \ - $(top_builddir)/widgets/menus/libmenus.la \ - $(top_builddir)/shell/libeshell.la \ - $(top_builddir)/calendar/cal-client/libcal-client.la \ - $(top_builddir)/calendar/cal-util/libcal-util.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libical/src/libical/libical-evolution.la \ - $(top_builddir)/libwombat/libwombat.la \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/libversit/libversit.a \ - $(top_builddir)/e-util/ename/libename.la \ - dialogs/libcal-dialogs.a \ - $(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(EVOLUTION_CALENDAR_LIBS) - -evolution_calendar_LDFLAGS = -export-dynamic - -oafdir = $(datadir)/oaf -oaf_in_files = \ - GNOME_Evolution_Calendar.oaf.in - -oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) - -@INTLTOOL_OAF_RULE@ - -EXTRA_DIST = \ - $(glade_DATA) \ - $(etspec_DATA) \ - $(oaf_in_files) - -install-data-local: - $(mkinstalldirs) $(DESTDIR)$(help_base)/C - $(mkinstalldirs) $(Conduitsdir) - -if ENABLE_PURIFY -PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ - -all-local: evolution-calendar.pure - -evolution-calendar.pure: evolution-calendar - @rm -f evolution-calendar.pure - $(PLINK) $(evolution_calendar_LDFLAGS) $(evolution_calendar_OBJECTS) $(evolution_calendar_LDADD) $(LIBS) - -endif - -CLEANFILES = $(BUILT_SOURCES) - -dist-hook: - cd $(distdir); rm -f $(BUILT_SOURCES) diff --git a/calendar/gui/alarm-notify/.cvsignore b/calendar/gui/alarm-notify/.cvsignore deleted file mode 100644 index 479589e914..0000000000 --- a/calendar/gui/alarm-notify/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -evolution-calendar-stubs.c -evolution-calendar-skels.c -evolution-calendar-common.c -evolution-calendar.h -evolution-alarm-notify -GNOME_Evolution_Calendar_AlarmNotify.oaf diff --git a/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.oaf.in b/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.oaf.in deleted file mode 100644 index 86f5c71493..0000000000 --- a/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.oaf.in +++ /dev/null @@ -1,24 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory" - type="exe" - location="evolution-alarm-notify"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory for the alarm notification service"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_AlarmNotify" - type="factory" - location="OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory"> - - <oaf_attribute name="description" type="string" - _value="Alarm notification service"/> -</oaf_server> - -</oaf_info> diff --git a/calendar/gui/alarm-notify/Makefile.am b/calendar/gui/alarm-notify/Makefile.am deleted file mode 100644 index ca28d1c10b..0000000000 --- a/calendar/gui/alarm-notify/Makefile.am +++ /dev/null @@ -1,83 +0,0 @@ -CORBA_GENERATED = \ - evolution-calendar.h \ - evolution-calendar-common.c \ - evolution-calendar-skels.c \ - evolution-calendar-stubs.c - -idls = $(top_srcdir)/calendar/idl/evolution-calendar.idl - -idl_flags = $(IDL_INCLUDES) - -$(CORBA_GENERATED): $(idls) - $(ORBIT_IDL) $(idl_flags) $(top_srcdir)/calendar/idl/evolution-calendar.idl - -bin_PROGRAMS = evolution-alarm-notify - -noinst_LIBRARIES = libalarm.a - -libalarm_a_SOURCES = \ - alarm.c \ - alarm.h - -INCLUDES = \ - -DG_LOG_DOMAIN=\"evolution-alarm-notify\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/calendar \ - -I$(top_builddir)/calendar \ - -I$(top_srcdir)/libical/src/libical \ - -I$(top_builddir)/libical/src/libical \ - -I$(top_srcdir)/widgets \ - -I$(includedir) \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - $(EVOLUTION_CALENDAR_CFLAGS) - -iconsdir = $(datadir)/images/evolution - -gladedir = $(datadir)/evolution/glade - -glade_DATA = \ - alarm-notify.glade - -evolution_alarm_notify_SOURCES = \ - $(CORBA_GENERATED) \ - alarm-notify.c \ - alarm-notify.h \ - alarm-notify-dialog.c \ - alarm-notify-dialog.h \ - alarm-queue.c \ - alarm-queue.h \ - config-data.c \ - config-data.h \ - notify-main.c \ - save.c \ - save.h - -evolution_alarm_notify_LDADD = \ - libalarm.a \ - $(top_builddir)/calendar/cal-client/libcal-client.la \ - $(top_builddir)/calendar/cal-util/libcal-util.la \ - $(top_builddir)/libical/src/libical/libical-evolution.la \ - $(top_builddir)/libwombat/libwombat.la \ - $(top_builddir)/e-util/libeutil.la \ - $(EVOLUTION_CALENDAR_LIBS) - -evolution_alarm_notify_LDFLAGS = -export-dynamic - -oafdir = $(datadir)/oaf -oaf_in_files = \ - GNOME_Evolution_Calendar_AlarmNotify.oaf.in - -oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) - -@INTLTOOL_OAF_RULE@ - -EXTRA_DIST = \ - $(oaf_DATA) \ - $(oaf_in_files) \ - $(glade_DATA) - -BUILT_SOURCES = $(CORBA_GENERATED) -CLEANFILES = $(BUILT_SOURCES) diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c deleted file mode 100644 index 46d6eca39e..0000000000 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.c +++ /dev/null @@ -1,414 +0,0 @@ -/* Evolution calendar - alarm notification dialog - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <stdio.h> -#include <string.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkspinbutton.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkwindow.h> -#include <libgnome/gnome-i18n.h> -#if 0 -# include <libgnomeui/gnome-winhints.h> -#endif -#include <libgnomeui/gnome-window-icon.h> -#include <glade/glade.h> -#include <e-util/e-time-utils.h> -#include <gal/widgets/e-unicode.h> -#include <gal/widgets/e-scroll-frame.h> -#include <gtkhtml/gtkhtml.h> -#include <gtkhtml/gtkhtml-stream.h> -#include "cal-util/timeutil.h" -#include "alarm-notify-dialog.h" -#include "config-data.h" - - -GtkWidget *make_html_display (gchar *widget_name, char *s1, char *s2, int scroll, int shadow); - -/* The useful contents of the alarm notify dialog */ -typedef struct { - GladeXML *xml; - - GtkWidget *dialog; - GtkWidget *close; - GtkWidget *snooze; - GtkWidget *edit; - GtkWidget *heading; - GtkWidget *message; - GtkWidget *snooze_time; - GtkWidget *html; - - AlarmNotifyFunc func; - gpointer func_data; -} AlarmNotify; - - - -/* Callback used when the notify dialog is destroyed */ -static void -dialog_destroy_cb (GtkObject *object, gpointer data) -{ - AlarmNotify *an; - - an = data; - gtk_object_unref (GTK_OBJECT (an->xml)); - g_free (an); -} - -/* Delete_event handler for the alarm notify dialog */ -static gint -delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - AlarmNotify *an; - - an = data; - g_assert (an->func != NULL); - - (* an->func) (ALARM_NOTIFY_CLOSE, -1, an->func_data); - - gtk_widget_destroy (widget); - return TRUE; -} - -/* Callback for the close button */ -static void -close_clicked_cb (GtkWidget *widget, gpointer data) -{ - AlarmNotify *an; - - an = data; - g_assert (an->func != NULL); - - (* an->func) (ALARM_NOTIFY_CLOSE, -1, an->func_data); - - gtk_widget_destroy (an->dialog); -} - -/* Callback for the snooze button */ -static void -snooze_clicked_cb (GtkWidget *widget, gpointer data) -{ - AlarmNotify *an; - int snooze_time; - - an = data; - g_assert (an->func != NULL); - - snooze_time = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (an->snooze_time)); - (* an->func) (ALARM_NOTIFY_SNOOZE, snooze_time, an->func_data); - - gtk_widget_destroy (an->dialog); -} - -/* Callback for the edit button */ -static void -edit_clicked_cb (GtkWidget *widget, gpointer data) -{ - AlarmNotify *an; - - an = data; - g_assert (an->func != NULL); - - (* an->func) (ALARM_NOTIFY_EDIT, -1, an->func_data); - - gtk_widget_destroy (an->dialog); -} - -static void -url_requested_cb (GtkHTML *html, const char *url, GtkHTMLStream *stream, gpointer data) -{ - - if (!strncmp ("file:///", url, strlen ("file:///"))) { - FILE *fp; - const char *filename = url + strlen ("file://"); - char buf[4096]; - size_t len; - - fp = fopen (filename, "r"); - - if (fp == NULL) { - g_warning ("Error opening image: %s\n", url); - gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR); - return; - } - - while ((len = fread (buf, 1, sizeof(buf), fp)) > 0) - gtk_html_stream_write (stream, buf, len); - - if (feof (fp)) { - fclose (fp); - gtk_html_stream_close (stream, GTK_HTML_STREAM_OK); - return; - } - - fclose (fp); - } - - g_warning ("Error loading image"); - gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR); - return; -} - -GtkWidget * -make_html_display (gchar *widget_name, char *s1, char *s2, int scroll, int shadow) -{ - GtkWidget *html, *frame; - - gtk_widget_push_visual(gdk_rgb_get_visual()); - gtk_widget_push_colormap(gdk_rgb_get_cmap()); - - html = gtk_html_new(); - - gtk_html_set_default_content_type (GTK_HTML (html), - "charset=utf-8"); - gtk_html_load_empty (GTK_HTML (html)); - - gtk_signal_connect (GTK_OBJECT (html), "url_requested", - GTK_SIGNAL_FUNC (url_requested_cb), - NULL); - - gtk_widget_pop_colormap(); - gtk_widget_pop_visual(); - - frame = e_scroll_frame_new(NULL, NULL); - - e_scroll_frame_set_policy(E_SCROLL_FRAME(frame), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - - - e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (frame), - GTK_SHADOW_IN); - - gtk_widget_set_usize (frame, 300, 200); - - gtk_container_add(GTK_CONTAINER (frame), html); - - gtk_widget_show_all(frame); - - gtk_object_set_user_data(GTK_OBJECT (frame), html); - return frame; -} - -static void -write_times (GtkHTMLStream *stream, char *start, char *end) -{ - if (start) - gtk_html_stream_printf (stream, "<b>%s</b> %s<br>", _("Starting:"), start); - if (end) - gtk_html_stream_printf (stream, "<b>%s</b> %s<br>", _("Ending:"), end); - -} - -/* Converts a time_t to a string, relative to the specified timezone */ -static char * -timet_to_str_with_zone (time_t t, icaltimezone *zone) -{ - struct icaltimetype itt; - struct tm tm; - char buf[256]; - - if (t == -1) - return g_strdup (_("invalid time")); - - itt = icaltime_from_timet_with_zone (t, FALSE, zone); - tm = icaltimetype_to_tm (&itt); - - e_time_format_date_and_time (&tm, config_data_get_24_hour_format (), - FALSE, FALSE, buf, sizeof (buf)); - return g_strdup (buf); -} - -/* Creates a heading for the alarm notification dialog */ -static void -write_html_heading (GtkHTMLStream *stream, const char *message, - CalComponentVType vtype, time_t occur_start, time_t occur_end) -{ - char *buf; - char *start, *end; - char *bg_path = "file://" EVOLUTION_ICONSDIR "/bcg.png"; - char *image_path = "file://" EVOLUTION_ICONSDIR "/alarm.png"; - icaltimezone *current_zone; - - /* Stringize the times */ - - current_zone = config_data_get_timezone (); - - buf = timet_to_str_with_zone (occur_start, current_zone); - start = e_utf8_from_locale_string (buf); - g_free (buf); - - buf = timet_to_str_with_zone (occur_end, current_zone); - end = e_utf8_from_locale_string (buf); - g_free (buf); - - /* Write the header */ - - gtk_html_stream_printf (stream, - "<HTML><BODY background=\"%s\">" - "<TABLE WIDTH=\"100%%\">" - "<TR>" - "<TD><IMG SRC=\"%s\" ALIGN=\"top\" BORDER=\"0\"></TD>" - "<TD><H1>%s</H1></TD>" - "</TR>" - "</TABLE>", - bg_path, - image_path, - _("Evolution Alarm")); - - gtk_html_stream_printf (stream, "<br><br><font size=\"+2\">%s</font><br><br>", message); - - /* Write the times */ - - switch (vtype) { - case CAL_COMPONENT_EVENT: - write_times (stream, start, end); - break; - - case CAL_COMPONENT_TODO: - write_times (stream, start, end); - break; - - default: - /* Only VEVENTs and VTODOs can have alarms */ - g_assert_not_reached (); - break; - } - - g_free (start); - g_free (end); -} - -/** - * alarm_notify_dialog: - * @trigger: Trigger time for the alarm. - * @occur_start: Start of occurrence time for the event. - * @occur_end: End of occurrence time for the event. - * @vtype: Type of the component which corresponds to the alarm. - * @message; Message to display in the dialog; usually comes from the component. - * @func: Function to be called when a dialog action is invoked. - * @func_data: Closure data for @func. - * - * Runs the alarm notification dialog. The specified @func will be used to - * notify the client about result of the actions in the dialog. - * - * Return value: TRUE on success, FALSE if the dialog could not be created. - **/ -gboolean -alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end, - CalComponentVType vtype, const char *message, - AlarmNotifyFunc func, gpointer func_data) -{ - AlarmNotify *an; - GtkHTMLStream *stream; - icaltimezone *current_zone; - char *buf, *title; - - g_return_val_if_fail (trigger != -1, FALSE); - - /* Only VEVENTs or VTODOs can have alarms */ - g_return_val_if_fail (vtype == CAL_COMPONENT_EVENT || vtype == CAL_COMPONENT_TODO, FALSE); - g_return_val_if_fail (message != NULL, FALSE); - g_return_val_if_fail (func != NULL, FALSE); - - an = g_new0 (AlarmNotify, 1); - - an->func = func; - an->func_data = func_data; - - an->xml = glade_xml_new (EVOLUTION_GLADEDIR "/alarm-notify.glade", NULL, NULL); - if (!an->xml) { - g_message ("alarm_notify_dialog(): Could not load the Glade XML file!"); - g_free (an); - return FALSE; - } - - an->dialog = glade_xml_get_widget (an->xml, "alarm-notify"); - an->close = glade_xml_get_widget (an->xml, "close"); - an->snooze = glade_xml_get_widget (an->xml, "snooze"); - an->edit = glade_xml_get_widget (an->xml, "edit"); - an->heading = glade_xml_get_widget (an->xml, "heading"); - an->message = glade_xml_get_widget (an->xml, "message"); - an->snooze_time = glade_xml_get_widget (an->xml, "snooze-time"); - an->html = gtk_object_get_user_data (GTK_OBJECT (glade_xml_get_widget (an->xml, "frame"))); - - if (!(an->dialog && an->close && an->snooze && an->edit && an->heading && an->message - && an->snooze_time)) { - g_message ("alarm_notify_dialog(): Could not find all widgets in Glade file!"); - gtk_object_unref (GTK_OBJECT (an->xml)); - g_free (an); - return FALSE; - } - - gtk_object_set_data (GTK_OBJECT (an->dialog), "alarm-notify", an); - gtk_signal_connect (GTK_OBJECT (an->dialog), "destroy", - GTK_SIGNAL_FUNC (dialog_destroy_cb), an); - - /* Title */ - - current_zone = config_data_get_timezone (); - - buf = timet_to_str_with_zone (trigger, current_zone); - title = g_strdup_printf (_("Alarm on %s"), buf); - g_free (buf); - - gtk_window_set_title (GTK_WINDOW (an->dialog), title); - g_free (title); - - /* html heading */ - stream = gtk_html_begin (GTK_HTML (an->html)); - write_html_heading (stream, message, vtype, occur_start, occur_end); - gtk_html_stream_close (stream, GTK_HTML_STREAM_OK); - - /* Connect actions */ - - gtk_signal_connect (GTK_OBJECT (an->dialog), "delete_event", - GTK_SIGNAL_FUNC (delete_event_cb), - an); - - gtk_signal_connect (GTK_OBJECT (an->close), "clicked", - GTK_SIGNAL_FUNC (close_clicked_cb), - an); - - gtk_signal_connect (GTK_OBJECT (an->snooze), "clicked", - GTK_SIGNAL_FUNC (snooze_clicked_cb), - an); - - gtk_signal_connect (GTK_OBJECT (an->edit), "clicked", - GTK_SIGNAL_FUNC (edit_clicked_cb), - an); - - /* Run! */ - - if (!GTK_WIDGET_REALIZED (an->dialog)) - gtk_widget_realize (an->dialog); - -#if 0 - gnome_win_hints_set_state (an->dialog, WIN_STATE_STICKY); - gnome_win_hints_set_layer (an->dialog, WIN_LAYER_ONTOP); - gnome_window_icon_set_from_file (GTK_WINDOW (an->dialog), EVOLUTION_ICONSDIR "/alarm.png"); -#endif - - gtk_widget_show (an->dialog); - return TRUE; -} - diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.h b/calendar/gui/alarm-notify/alarm-notify-dialog.h deleted file mode 100644 index 812463de8d..0000000000 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Evolution calendar - alarm notification dialog - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef ALARM_NOTIFY_DIALOG_H -#define ALARM_NOTIFY_DIALOG_H - -#include <time.h> -#include <glib.h> -#include <cal-util/cal-component.h> - - - -typedef enum { - ALARM_NOTIFY_CLOSE, - ALARM_NOTIFY_SNOOZE, - ALARM_NOTIFY_EDIT -} AlarmNotifyResult; - -typedef void (* AlarmNotifyFunc) (AlarmNotifyResult result, int snooze_mins, gpointer data); - -gboolean alarm_notify_dialog (time_t trigger, time_t occur_start, time_t occur_end, - CalComponentVType vtype, const char *message, - AlarmNotifyFunc func, gpointer func_data); - - - -#endif diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c deleted file mode 100644 index 8cba059431..0000000000 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ /dev/null @@ -1,482 +0,0 @@ -/* Evolution calendar - Alarm notification service object - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <cal-client/cal-client.h> -#include "alarm-notify.h" -#include "alarm-queue.h" -#include "save.h" -#include "e-util/e-url.h" - - - -/* A loaded client */ -typedef struct { - /* The actual client */ - CalClient *client; - - /* The URI of the client in gnome-vfs's format. This *is* the key that - * is stored in the uri_client_hash hash table below. - */ - EUri *uri; - - /* Number of times clients have requested this URI to be added to the - * alarm notification system. - */ - int refcount; - - /* the ID of the retry timeout function - */ - int timeout_id; -} LoadedClient; - -/* Private part of the AlarmNotify structure */ -struct _AlarmNotifyPrivate { - /* Mapping from EUri's to LoadedClient structures */ - GHashTable *uri_client_hash; -}; - - - -static void alarm_notify_class_init (AlarmNotifyClass *klass); -static void alarm_notify_init (AlarmNotify *an, AlarmNotifyClass *klass); -static void alarm_notify_finalize (GObject *object); - -static void AlarmNotify_addCalendar (PortableServer_Servant servant, - const CORBA_char *str_uri, - CORBA_Environment *ev); -static void AlarmNotify_removeCalendar (PortableServer_Servant servant, - const CORBA_char *str_uri, - CORBA_Environment *ev); - - -static BonoboObjectClass *parent_class; - - - -BONOBO_TYPE_FUNC_FULL (AlarmNotify, - GNOME_Evolution_Calendar_AlarmNotify, - BONOBO_TYPE_OBJECT, - alarm_notify); - -/* Class initialization function for the alarm notify service */ -static void -alarm_notify_class_init (AlarmNotifyClass *klass) -{ - GObjectClass *object_class; - - object_class = (GObjectClass *) klass; - - parent_class = g_type_class_peek_parent (klass); - - klass->epv.addCalendar = AlarmNotify_addCalendar; - klass->epv.removeCalendar = AlarmNotify_removeCalendar; - - object_class->finalize = alarm_notify_finalize; -} - -/* Object initialization function for the alarm notify system */ -static void -alarm_notify_init (AlarmNotify *an, AlarmNotifyClass *klass) -{ - AlarmNotifyPrivate *priv; - - priv = g_new0 (AlarmNotifyPrivate, 1); - an->priv = priv; - - priv->uri_client_hash = g_hash_table_new (g_str_hash, g_str_equal); -} - -/* Callback used from g_hash-table_forach(), used to destroy a loade client */ -static void -destroy_loaded_client_cb (gpointer key, gpointer value, gpointer data) -{ - LoadedClient *lc; - char *str_uri; - - str_uri = key; - lc = value; - - g_free (str_uri); - g_object_unref (G_OBJECT (lc->client)); - e_uri_free (lc->uri); - g_free (lc); -} - -/* Finalize handler for the alarm notify system */ -static void -alarm_notify_finalize (GObject *object) -{ - AlarmNotify *an; - AlarmNotifyPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_ALARM_NOTIFY (object)); - - an = ALARM_NOTIFY (object); - priv = an->priv; - - g_hash_table_foreach (priv->uri_client_hash, destroy_loaded_client_cb, NULL); - - g_hash_table_destroy (priv->uri_client_hash); - priv->uri_client_hash = NULL; - - g_free (priv); - an->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); -} - - - -/* CORBA servant implementation */ - -/* Looks for a canonicalized URI inside an array of URIs; returns the index - * within the array or -1 if not found. - */ -static int -find_uri_index (GPtrArray *uris, const char *str_uri) -{ - int i; - - for (i = 0; i < uris->len; i++) { - char *uri; - - uri = uris->pdata[i]; - if (strcmp (uri, str_uri) == 0) - break; - } - - if (i == uris->len) - return -1; - else - return i; -} - -/* Frees an array of URIs and the URIs within it. */ -static void -free_uris (GPtrArray *uris) -{ - int i; - - for (i = 0; i < uris->len; i++) { - char *uri; - - uri = uris->pdata[i]; - g_free (uri); - } - - g_ptr_array_free (uris, TRUE); -} - -/* Adds an URI to the list of calendars to load on startup */ -static void -add_uri_to_load (EUri *uri) -{ - char *str_uri; - GPtrArray *loaded_uris; - int i; - - /* Canonicalize the URI */ - str_uri = e_uri_to_string (uri, FALSE); - g_assert (str_uri != NULL); - - loaded_uris = get_calendars_to_load (); - if (!loaded_uris) { - g_message ("add_uri_to_load(): Could not get the list of calendars to load; " - "will not add `%s'", str_uri); - g_free (str_uri); - return; - } - - /* Look for the URI in the list of calendars to load */ - - i = find_uri_index (loaded_uris, str_uri); - - /* We only need to add the URI if we didn't find it among the list of - * calendars. - */ - if (i != -1) { - g_free (str_uri); - free_uris (loaded_uris); - return; - } - - g_ptr_array_add (loaded_uris, str_uri); - save_calendars_to_load (loaded_uris); - - free_uris (loaded_uris); -} - -/* Removes an URI from the list of calendars to load on startup */ -static void -remove_uri_to_load (EUri *uri) -{ - char *str_uri; - GPtrArray *loaded_uris; - char *loaded_uri; - int i; - - /* Canonicalize the URI */ - str_uri = e_uri_to_string (uri, FALSE); - g_assert (str_uri != NULL); - - loaded_uris = get_calendars_to_load (); - if (!loaded_uris) { - g_message ("remove_uri_to_load(): Could not get the list of calendars to load; " - "will not add `%s'", str_uri); - g_free (str_uri); - return; - } - - /* Look for the URI in the list of calendars to load */ - - i = find_uri_index (loaded_uris, str_uri); - g_free (str_uri); - - /* If we didn't find it, there is no need to remove it */ - if (i == -1) { - free_uris (loaded_uris); - return; - } - - loaded_uri = loaded_uris->pdata[i]; - g_free (loaded_uri); - - g_ptr_array_remove_index (loaded_uris, i); - save_calendars_to_load (loaded_uris); - - free_uris (loaded_uris); -} - -/* AlarmNotify::addCalendar method */ -static void -AlarmNotify_addCalendar (PortableServer_Servant servant, - const CORBA_char *str_uri, - CORBA_Environment *ev) -{ - AlarmNotify *an; - - an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); - alarm_notify_add_calendar (an, str_uri, TRUE, ev); -} - -/* AlarmNotify::removeCalendar method */ -static void -AlarmNotify_removeCalendar (PortableServer_Servant servant, - const CORBA_char *str_uri, - CORBA_Environment *ev) -{ - AlarmNotify *an; - AlarmNotifyPrivate *priv; - LoadedClient *lc; - EUri *uri; - char *orig_str; - gboolean found; - - an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); - priv = an->priv; - - uri = e_uri_new (str_uri); - if (!uri) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI, - NULL); - return; - } - - remove_uri_to_load (uri); - - found = g_hash_table_lookup_extended (priv->uri_client_hash, str_uri, - (gpointer *) &orig_str, - (gpointer *) &lc); - e_uri_free (uri); - - if (!lc) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_AlarmNotify_NotFound, - NULL); - return; - } - - g_assert (lc->refcount > 0); - - lc->refcount--; - if (lc->refcount > 0) - return; - - g_hash_table_remove (priv->uri_client_hash, str_uri); - - g_free (orig_str); - g_signal_handlers_disconnect_matched (GTK_OBJECT (lc->client), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, lc); - if (lc->timeout_id != -1) - g_source_remove (lc->timeout_id); - alarm_queue_remove_client (lc->client); - g_object_unref (G_OBJECT (lc->client)); - e_uri_free (lc->uri); - g_free (lc); -} - - - -/** - * alarm_notify_new: - * - * Creates a new #AlarmNotify object. - * - * Return value: A newly-created #AlarmNotify, or NULL if its corresponding - * CORBA object could not be created. - **/ -AlarmNotify * -alarm_notify_new (void) -{ - AlarmNotify *an; - - an = g_object_new (TYPE_ALARM_NOTIFY, NULL); - return an; -} - -static gboolean -retry_timeout_cb (gpointer data) -{ - LoadedClient *lc = data; - char *str_uri; - - if (cal_client_get_load_state (lc->client) != CAL_CLIENT_LOAD_LOADED) { - str_uri = e_uri_to_string (lc->uri, FALSE); - cal_client_open_calendar (lc->client, str_uri, FALSE); - - g_free (str_uri); - } - - return FALSE; -} - -static void -cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) -{ - LoadedClient *lc = (LoadedClient *) data; - - if (status == CAL_CLIENT_OPEN_SUCCESS) { - add_uri_to_load (lc->uri); - alarm_queue_add_client (client); - lc->timeout_id = -1; - } - else { - remove_uri_to_load (lc->uri); - - /* we set a timeout of 5 mins before retrying */ - lc->timeout_id = g_timeout_add (300000, (GSourceFunc) retry_timeout_cb, lc); - } -} - -/** - * alarm_notify_add_calendar: - * @an: An alarm notification service. - * @uri: URI of the calendar to load. - * @load_afterwards: Whether this calendar should be loaded in the future - * when the alarm daemon starts up. - * @ev: CORBA environment for exceptions. - * - * Tells the alarm notification service to load a calendar and start monitoring - * its alarms. It can optionally be made to save the URI of this calendar so - * that it can be loaded in the future when the alarm daemon starts up. - **/ -void -alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_afterwards, - CORBA_Environment *ev) -{ - AlarmNotifyPrivate *priv; - EUri *uri; - CalClient *client; - LoadedClient *lc; - char *s; - - g_return_if_fail (an != NULL); - g_return_if_fail (IS_ALARM_NOTIFY (an)); - g_return_if_fail (str_uri != NULL); - g_return_if_fail (ev != NULL); - - priv = an->priv; - - uri = e_uri_new (str_uri); - if (!uri) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI, - NULL); - return; - } - - if (g_hash_table_lookup_extended (priv->uri_client_hash, str_uri, &s, &lc)) { - g_hash_table_remove (priv->uri_client_hash, str_uri); - - g_signal_handlers_disconnect_matched (G_OBJECT (lc->client), - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, lc); - if (lc->timeout_id != -1) - g_source_remove (lc->timeout_id); - alarm_queue_remove_client (lc->client); - g_object_unref (G_OBJECT (lc->client)); - e_uri_free (lc->uri); - - g_free (lc); - g_free (s); - } - - client = cal_client_new (); - - if (client) { - /* we only add the URI to load_afterwards if we open it - correctly */ - lc = g_new (LoadedClient, 1); - - g_signal_connect (G_OBJECT (client), "cal_opened", - G_CALLBACK (cal_opened_cb), - lc); - - if (cal_client_open_calendar (client, str_uri, FALSE)) { - lc->client = client; - lc->uri = uri; - lc->refcount = 1; - lc->timeout_id = -1; - g_hash_table_insert (priv->uri_client_hash, - g_strdup (str_uri), lc); - } else { - g_free (lc); - g_object_unref (G_OBJECT (client)); - client = NULL; - } - } - - if (!client) { - e_uri_free (uri); - - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError, - NULL); - return; - } -} diff --git a/calendar/gui/alarm-notify/alarm-notify.glade b/calendar/gui/alarm-notify/alarm-notify.glade deleted file mode 100644 index e71828ca53..0000000000 --- a/calendar/gui/alarm-notify/alarm-notify.glade +++ /dev/null @@ -1,220 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Evolution Calendar</name> - <program_name>evolution-calendar</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> -</project> - -<widget> - <class>GtkWindow</class> - <name>alarm-notify</name> - <title></title> - <type>GTK_WINDOW_DIALOG</type> - <position>GTK_WIN_POS_CENTER</position> - <modal>False</modal> - <allow_shrink>False</allow_shrink> - <allow_grow>False</allow_grow> - <auto_shrink>False</auto_shrink> - - <widget> - <class>GtkVBox</class> - <name>vbox2</name> - <border_width>4</border_width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkHBox</class> - <name>hbox3</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox5</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>heading</name> - <label></label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>True</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>message</name> - <label></label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>True</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>frame</name> - <creation_function>make_html_display</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 11 Oct 2001 08:19:04 GMT</last_modification_time> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox4</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>close</name> - <can_focus>True</can_focus> - <label>C_lose</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>snooze</name> - <can_focus>True</can_focus> - <label>Snoo_ze</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>edit</name> - <can_focus>True</can_focus> - <label>_Edit appointment</label> - <relief>GTK_RELIEF_NORMAL</relief> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator1</name> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox4</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label4</name> - <label>Snooze time (minutes)</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkSpinButton</class> - <name>snooze-time</name> - <can_focus>True</can_focus> - <climb_rate>1</climb_rate> - <digits>0</digits> - <numeric>False</numeric> - <update_policy>GTK_UPDATE_ALWAYS</update_policy> - <snap>False</snap> - <wrap>False</wrap> - <value>5</value> - <lower>1</lower> - <upper>1440</upper> - <step>1</step> - <page>5</page> - <page_size>5</page_size> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/calendar/gui/alarm-notify/alarm-notify.h b/calendar/gui/alarm-notify/alarm-notify.h deleted file mode 100644 index f3157000c0..0000000000 --- a/calendar/gui/alarm-notify/alarm-notify.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Evolution calendar - Alarm notification service object - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef ALARM_NOTIFY_H -#define ALARM_NOTIFY_H - -#include <bonobo/bonobo-object.h> -#include "evolution-calendar.h" - - - -#define TYPE_ALARM_NOTIFY (alarm_notify_get_type ()) -#define ALARM_NOTIFY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ALARM_NOTIFY, AlarmNotify)) -#define ALARM_NOTIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ALARM_NOTIFY, \ - AlarmNotifyClass)) -#define IS_ALARM_NOTIFY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ALARM_NOTIFY)) -#define IS_ALARM_NOTIFY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ALARM_NOTIFY)) - -typedef struct _AlarmNotify AlarmNotify; -typedef struct _AlarmNotifyClass AlarmNotifyClass; - -typedef struct _AlarmNotifyPrivate AlarmNotifyPrivate; - -struct _AlarmNotify { - BonoboObject xobject; - - /* Private data */ - AlarmNotifyPrivate *priv; -}; - -struct _AlarmNotifyClass { - BonoboObjectClass parent_class; - - POA_GNOME_Evolution_Calendar_AlarmNotify__epv epv; -}; - -GType alarm_notify_get_type (void); - -AlarmNotify *alarm_notify_new (void); - -void alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_afterwards, - CORBA_Environment *ev); - - - - -#endif diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c deleted file mode 100644 index 9dbaec56d7..0000000000 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ /dev/null @@ -1,1045 +0,0 @@ -/* Evolution calendar - Alarm queueing engine - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <bonobo-activation/bonobo-activation.h> -#include <bonobo/bonobo-object.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkbox.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkcheckbutton.h> -#include <gtk/gtkstock.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 <cal-util/timeutil.h> -#include "alarm.h" -#include "alarm-notify-dialog.h" -#include "alarm-queue.h" -#include "config-data.h" -#include "save.h" - - - -/* Whether the queueing system has been initialized */ -static gboolean alarm_queue_inited; - -/* When the alarm queue system is inited, this gets set to the last time an - * alarm notification was issued. This lets us present any notifications that - * should have happened while the alarm daemon was not running. - */ -static time_t saved_notification_time; - -/* Clients we are monitoring for alarms */ -static GHashTable *client_alarms_hash = NULL; - -/* Structure that stores a client we are monitoring */ -typedef struct { - /* Monitored client */ - CalClient *client; - - /* Number of times this client has been registered */ - int refcount; - - /* Hash table of component UID -> CompQueuedAlarms. If an element is - * present here, then it means its cqa->queued_alarms contains at least - * one queued alarm. When all the alarms for a component have been - * dequeued, the CompQueuedAlarms structure is removed from the hash - * table. Thus a CQA exists <=> it has queued alarms. - */ - GHashTable *uid_alarms_hash; -} ClientAlarms; - -/* Pair of a CalComponentAlarms and the mapping from queued alarm IDs to the - * actual alarm instance structures. - */ -typedef struct { - /* The parent client alarms structure */ - ClientAlarms *parent_client; - - /* The actual component and its alarm instances */ - CalComponentAlarms *alarms; - - /* List of QueuedAlarm structures */ - GSList *queued_alarms; -} CompQueuedAlarms; - -/* Pair of a queued alarm ID and the alarm trigger instance it refers to */ -typedef struct { - /* Alarm ID from alarm.h */ - gpointer alarm_id; - - /* Instance from our parent CompQueuedAlarms->alarms->alarms list */ - CalAlarmInstance *instance; - - /* Whether this is a snoozed queued alarm or a normal one */ - guint snooze : 1; -} QueuedAlarm; - -/* Alarm ID for the midnight refresh function */ -static gpointer midnight_refresh_id = NULL; - -static void display_notification (time_t trigger, CompQueuedAlarms *cqa, - gpointer alarm_id, gboolean use_description); -static void audio_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id); -static void mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id); -static void procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id); - - - -/* Alarm queue engine */ - -static void load_alarms_for_today (ClientAlarms *ca); -static void midnight_refresh_cb (gpointer alarm_id, time_t trigger, gpointer data); - -/* Queues an alarm trigger for midnight so that we can load the next day's worth - * of alarms. - */ -static void -queue_midnight_refresh (void) -{ - time_t midnight; - icaltimezone *zone; - - g_assert (midnight_refresh_id == NULL); - - zone = config_data_get_timezone (); - - midnight = time_day_end_with_zone (time (NULL), zone); - - midnight_refresh_id = alarm_add (midnight, midnight_refresh_cb, NULL, NULL); - if (!midnight_refresh_id) { - g_message ("queue_midnight_refresh(): Could not set up the midnight refresh alarm!"); - /* FIXME: what to do? */ - } -} - -/* Loads a client's alarms; called from g_hash_table_foreach() */ -static void -add_client_alarms_cb (gpointer key, gpointer value, gpointer data) -{ - ClientAlarms *ca; - - ca = value; - load_alarms_for_today (ca); -} - -/* Loads the alarms for the new day every midnight */ -static void -midnight_refresh_cb (gpointer alarm_id, time_t trigger, gpointer data) -{ - /* Re-load the alarms for all clients */ - - g_hash_table_foreach (client_alarms_hash, add_client_alarms_cb, NULL); - - /* Re-schedule the midnight update */ - - midnight_refresh_id = NULL; - queue_midnight_refresh (); -} - -/* Looks up a client in the client alarms hash table */ -static ClientAlarms * -lookup_client (CalClient *client) -{ - return g_hash_table_lookup (client_alarms_hash, client); -} - -/* Looks up a queued alarm based on its alarm ID */ -static QueuedAlarm * -lookup_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id) -{ - GSList *l; - QueuedAlarm *qa; - - qa = NULL; - - for (l = cqa->queued_alarms; l; l = l->next) { - qa = l->data; - if (qa->alarm_id == alarm_id) - return qa; - } - - /* not found, might have been updated/removed */ - return NULL; -} - -/* Removes an alarm from the list of alarms of a component. If the alarm was - * the last one listed for the component, it removes the component itself. - */ -static void -remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id) -{ - QueuedAlarm *qa; - const char *uid; - GSList *l; - - qa = NULL; - - for (l = cqa->queued_alarms; l; l = l->next) { - qa = l->data; - if (qa->alarm_id == alarm_id) - break; - } - - if (!l) - return; - - cqa->queued_alarms = g_slist_remove_link (cqa->queued_alarms, l); - g_slist_free_1 (l); - - g_free (qa); - - /* If this was the last queued alarm for this component, remove the - * component itself. - */ - - if (cqa->queued_alarms != NULL) - return; - - cal_component_get_uid (cqa->alarms->comp, &uid); - g_hash_table_remove (cqa->parent_client->uid_alarms_hash, uid); - cqa->parent_client = NULL; - - cal_component_alarms_free (cqa->alarms); - cqa->alarms = NULL; - - g_free (cqa); -} - -/* Callback used when an alarm triggers */ -static void -alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data) -{ - CompQueuedAlarms *cqa; - CalComponent *comp; - QueuedAlarm *qa; - CalComponentAlarm *alarm; - CalAlarmAction action; - - cqa = data; - comp = cqa->alarms->comp; - - save_notification_time (trigger); - - qa = lookup_queued_alarm (cqa, alarm_id); - if (!qa) - return; - - /* Decide what to do based on the alarm action. We use the trigger that - * is passed to us instead of the one from the instance structure - * because this may be a snoozed alarm instead of an original - * occurrence. - */ - - alarm = cal_component_get_alarm (comp, qa->instance->auid); - g_assert (alarm != NULL); - - cal_component_alarm_get_action (alarm, &action); - cal_component_alarm_free (alarm); - - switch (action) { - case CAL_ALARM_AUDIO: - audio_notification (trigger, cqa, alarm_id); - break; - - case CAL_ALARM_DISPLAY: - display_notification (trigger, cqa, alarm_id, TRUE); - break; - - case CAL_ALARM_EMAIL: - mail_notification (trigger, cqa, alarm_id); - break; - - case CAL_ALARM_PROCEDURE: - procedure_notification (trigger, cqa, alarm_id); - break; - - default: - g_assert_not_reached (); - break; - } -} - -/* Adds the alarms in a CalComponentAlarms structure to the alarms queued for a - * particular client. Also puts the triggers in the alarm timer queue. - */ -static void -add_component_alarms (ClientAlarms *ca, CalComponentAlarms *alarms) -{ - const char *uid; - CompQueuedAlarms *cqa; - GSList *l; - - /* No alarms? */ - if (alarms->alarms == NULL) { - cal_component_alarms_free (alarms); - return; - } - - cqa = g_new (CompQueuedAlarms, 1); - cqa->parent_client = ca; - cqa->alarms = alarms; - - cqa->queued_alarms = NULL; - - for (l = alarms->alarms; l; l = l->next) { - CalAlarmInstance *instance; - gpointer alarm_id; - QueuedAlarm *qa; - - instance = l->data; - - alarm_id = alarm_add (instance->trigger, alarm_trigger_cb, cqa, NULL); - if (!alarm_id) { - g_message ("add_component_alarms(): Could not schedule a trigger for " - "%ld, discarding...", (long) instance->trigger); - continue; - } - - qa = g_new (QueuedAlarm, 1); - qa->alarm_id = alarm_id; - qa->instance = instance; - qa->snooze = FALSE; - - cqa->queued_alarms = g_slist_prepend (cqa->queued_alarms, qa); - } - - cal_component_get_uid (alarms->comp, &uid); - - /* If we failed to add all the alarms, then we should get rid of the cqa */ - if (cqa->queued_alarms == NULL) { - g_message ("add_component_alarms(): Could not add any of the alarms " - "for the component `%s'; discarding it...", uid); - - cal_component_alarms_free (cqa->alarms); - cqa->alarms = NULL; - - g_free (cqa); - return; - } - - cqa->queued_alarms = g_slist_reverse (cqa->queued_alarms); - g_hash_table_insert (ca->uid_alarms_hash, (char *) uid, cqa); -} - -/* Loads the alarms of a client for a given range of time */ -static void -load_alarms (ClientAlarms *ca, time_t start, time_t end) -{ - GSList *comp_alarms; - GSList *l; - - comp_alarms = cal_client_get_alarms_in_range (ca->client, start, end); - - for (l = comp_alarms; l; l = l->next) { - CalComponentAlarms *alarms; - - alarms = l->data; - add_component_alarms (ca, alarms); - } - - g_slist_free (comp_alarms); -} - -/* Loads today's remaining alarms for a client */ -static void -load_alarms_for_today (ClientAlarms *ca) -{ - time_t now, day_end; - icaltimezone *zone; - - now = time (NULL); - - zone = config_data_get_timezone (); - - day_end = time_day_end_with_zone (now, zone); - load_alarms (ca, now, day_end); -} - -/* Adds any alarms that should have occurred while the alarm daemon was not - * running. - */ -static void -load_missed_alarms (ClientAlarms *ca) -{ - time_t now; - - now = time (NULL); - - g_assert (saved_notification_time != -1); - - /* We add 1 to the saved_notification_time to make the time ranges - * half-open; we do not want to display the "last" displayed alarm - * twice, once when it occurs and once when the alarm daemon restarts. - */ - load_alarms (ca, saved_notification_time + 1, now); -} - -/* Called when a calendar client finished loading; we load its alarms */ -static void -cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) -{ - ClientAlarms *ca; - - ca = data; - - if (status != CAL_CLIENT_OPEN_SUCCESS) - return; - - load_alarms_for_today (ca); - load_missed_alarms (ca); -} - -/* Looks up a component's queued alarm structure in a client alarms structure */ -static CompQueuedAlarms * -lookup_comp_queued_alarms (ClientAlarms *ca, const char *uid) -{ - return g_hash_table_lookup (ca->uid_alarms_hash, uid); -} - -/* Removes a component an its alarms */ -static void -remove_comp (ClientAlarms *ca, const char *uid) -{ - CompQueuedAlarms *cqa; - GSList *l; - - cqa = lookup_comp_queued_alarms (ca, uid); - if (!cqa) - return; - - /* If a component is present, then it means we must have alarms queued - * for it. - */ - g_assert (cqa->queued_alarms != NULL); - - for (l = cqa->queued_alarms; l;) { - QueuedAlarm *qa; - - qa = l->data; - - /* Get the next element here because the list element will go - * away in remove_queued_alarm(). The qa will be freed there as - * well. - */ - l = l->next; - - alarm_remove (qa->alarm_id); - remove_queued_alarm (cqa, qa->alarm_id); - } - - /* The list should be empty now, and thus the queued component alarms - * structure should have been freed and removed from the hash table. - */ - g_assert (lookup_comp_queued_alarms (ca, uid) == NULL); -} - -/* Called when a calendar component changes; we must reload its corresponding - * alarms. - */ -static void -obj_updated_cb (CalClient *client, const char *uid, gpointer data) -{ - ClientAlarms *ca; - time_t now, day_end; - CalComponentAlarms *alarms; - gboolean found; - icaltimezone *zone; - - ca = data; - - remove_comp (ca, uid); - - now = time (NULL); - - zone = config_data_get_timezone (); - - day_end = time_day_end_with_zone (now, zone); - - found = cal_client_get_alarms_for_object (ca->client, uid, now, day_end, &alarms); - - if (!found) - return; - - add_component_alarms (ca, alarms); -} - -/* Called when a calendar component is removed; we must delete its corresponding - * alarms. - */ -static void -obj_removed_cb (CalClient *client, const char *uid, gpointer data) -{ - ClientAlarms *ca; - - ca = data; - - remove_comp (ca, uid); -} - - - -/* Notification functions */ - -/* Creates a snooze alarm based on an existing one. The snooze offset is - * compued with respect to the current time. - */ -static void -create_snooze (CompQueuedAlarms *cqa, gpointer alarm_id, int snooze_mins) -{ - QueuedAlarm *orig_qa, *qa; - CalAlarmInstance *instance; - time_t t; - gpointer new_id; - - orig_qa = lookup_queued_alarm (cqa, alarm_id); - if (!orig_qa) - return; - - t = time (NULL); - t += snooze_mins * 60; - - new_id = alarm_add (t, alarm_trigger_cb, cqa, NULL); - if (!new_id) { - g_message ("create_snooze(): Could not schedule a trigger for " - "%ld, discarding...", (long) t); - return; - } - - instance = g_new (CalAlarmInstance, 1); - instance->auid = orig_qa->instance->auid; - instance->trigger = t; - instance->occur_start = orig_qa->instance->occur_start; - instance->occur_end = orig_qa->instance->occur_end; - - cqa->alarms->alarms = g_slist_prepend (cqa->alarms->alarms, instance); - - qa = g_new (QueuedAlarm, 1); - qa->alarm_id = new_id; - qa->instance = instance; - qa->snooze = TRUE; - - cqa->queued_alarms = g_slist_prepend (cqa->queued_alarms, qa); -} - -/* Launches a component editor for a component */ -static void -edit_component (CompQueuedAlarms *cqa) -{ - CalComponent *comp; - const char *uid; - const char *uri; - CORBA_Environment ev; - GNOME_Evolution_Calendar_CompEditorFactory factory; - - comp = cqa->alarms->comp; - cal_component_get_uid (comp, &uid); - - uri = cal_client_get_uri (cqa->parent_client->client); - - /* Get the factory */ - - CORBA_exception_init (&ev); - factory = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_CompEditorFactory", - 0, NULL, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("edit_component(): Could not activate the component editor factory"); - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); - - /* Edit the component */ - - CORBA_exception_init (&ev); - GNOME_Evolution_Calendar_CompEditorFactory_editExisting (factory, uri, (char *) uid, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("edit_component(): Exception while editing the component"); - - CORBA_exception_free (&ev); - - /* Get rid of the factory */ - - CORBA_exception_init (&ev); - bonobo_object_release_unref (factory, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("edit_component(): Could not unref the calendar component factory"); - - CORBA_exception_free (&ev); -} - -struct notify_dialog_closure { - CompQueuedAlarms *cqa; - gpointer alarm_id; -}; - -/* Callback used from the alarm notify dialog */ -static void -notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data) -{ - struct notify_dialog_closure *c; - - c = data; - - switch (result) { - case ALARM_NOTIFY_SNOOZE: - create_snooze (c->cqa, c->alarm_id, snooze_mins); - break; - - case ALARM_NOTIFY_EDIT: - edit_component (c->cqa); - break; - - case ALARM_NOTIFY_CLOSE: - /* Do nothing */ - break; - - default: - g_assert_not_reached (); - } - - remove_queued_alarm (c->cqa, c->alarm_id); - g_free (c); -} - -/* Performs notification of a display alarm */ -static void -display_notification (time_t trigger, CompQueuedAlarms *cqa, - gpointer alarm_id, gboolean use_description) -{ - CalComponent *comp; - CalComponentVType vtype; - CalComponentText text; - QueuedAlarm *qa; - const char *message; - struct notify_dialog_closure *c; - gboolean use_summary; - - comp = cqa->alarms->comp; - qa = lookup_queued_alarm (cqa, alarm_id); - if (!qa) - return; - - vtype = cal_component_get_vtype (comp); - - /* Pick a sensible notification message. First we try the DESCRIPTION - * from the alarm, then the SUMMARY of the component. - */ - - use_summary = TRUE; - message = NULL; - - 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; - } - } - - 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; - - if (!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"); -} - -/* Performs notification of an audio alarm */ -static void -audio_notification (time_t trigger, CompQueuedAlarms *cqa, - gpointer alarm_id) -{ - QueuedAlarm *qa; - CalComponent *comp; - CalComponentAlarm *alarm; - icalattach *attach; - - comp = cqa->alarms->comp; - qa = lookup_queued_alarm (cqa, alarm_id); - if (!qa) - return; - - alarm = cal_component_get_alarm (comp, qa->instance->auid); - g_assert (alarm != NULL); - - cal_component_alarm_get_attach (alarm, &attach); - cal_component_alarm_free (alarm); - - if (attach && icalattach_get_is_url (attach)) { - const char *url; - - url = icalattach_get_url (attach); - g_assert (url != NULL); - - gnome_sound_play (url); /* this sucks */ - } - - if (attach) - icalattach_unref (attach); - - /* We present a notification message in addition to playing the sound */ - display_notification (trigger, cqa, alarm_id, FALSE); -} - -/* Performs notification of a mail alarm */ -static void -mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id) -{ - GtkWidget *dialog; - GtkWidget *label; - - /* FIXME */ - - display_notification (trigger, cqa, alarm_id, FALSE); - - dialog = gtk_dialog_new_with_buttons (_("Warning"), - NULL, 0, - GTK_STOCK_OK, GTK_RESPONSE_CANCEL, - NULL); - label = gtk_label_new (_("Evolution does not support calendar reminders with\n" - "email notifications yet, but this reminder was\n" - "configured to send an email. Evolution will display\n" - "a normal reminder dialog box instead.")); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4); - - gtk_dialog_run (GTK_DIALOG (dialog)); -} - -/* Performs notification of a procedure alarm */ -static gboolean -procedure_notification_dialog (const char *cmd, const char *url) -{ - GtkWidget *dialog, *label, *checkbox; - char *str; - int btn; - - if (is_blessed_program (url)) - return TRUE; - - dialog = gtk_dialog_new_with_buttons (_("Warning"), - NULL, 0, - GTK_STOCK_NO, GTK_RESPONSE_CANCEL, - GTK_STOCK_YES, GTK_RESPONSE_OK, - NULL); - - str = g_strdup_printf (_("An Evolution Calendar reminder is about to trigger. " - "This reminder is configured to run the following program:\n\n" - " %s\n\n" - "Are you sure you want to run this program?"), - cmd); - label = gtk_label_new (str); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), - label, TRUE, TRUE, 4); - g_free (str); - - checkbox = gtk_check_button_new_with_label - (_("Do not ask me about this program again.")); - gtk_widget_show (checkbox); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), - checkbox, TRUE, TRUE, 4); - - /* Run the dialog */ - btn = gtk_dialog_run (GTK_DIALOG (dialog)); - if (btn == GTK_RESPONSE_OK && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox))) - save_blessed_program (url); - gtk_widget_destroy (dialog); - - return (btn == GNOME_YES); -} - -static void -procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id) -{ - QueuedAlarm *qa; - CalComponent *comp; - CalComponentAlarm *alarm; - CalComponentText description; - icalattach *attach; - const char *url; - char *cmd; - int result; - - comp = cqa->alarms->comp; - qa = lookup_queued_alarm (cqa, alarm_id); - if (!qa) - return; - - alarm = cal_component_get_alarm (comp, qa->instance->auid); - g_assert (alarm != NULL); - - cal_component_alarm_get_attach (alarm, &attach); - cal_component_alarm_get_description (alarm, &description); - cal_component_alarm_free (alarm); - - /* If the alarm has no attachment, simply display a notification dialog. */ - if (!attach) - goto fallback; - - if (!icalattach_get_is_url (attach)) { - icalattach_unref (attach); - goto fallback; - } - - url = icalattach_get_url (attach); - g_assert (url != NULL); - - /* Ask for confirmation before executing the stuff */ - if (description.value) - cmd = g_strconcat (url, " ", description.value, NULL); - else - cmd = (char *) url; - - result = 0; - if (procedure_notification_dialog (cmd, url)) - result = gnome_execute_shell (NULL, cmd); - - if (cmd != (char *) url) - g_free (cmd); - - icalattach_unref (attach); - - /* Fall back to display notification if we got an error */ - if (result < 0) - goto fallback; - - remove_queued_alarm (cqa, alarm_id); - return; - - fallback: - - display_notification (trigger, cqa, alarm_id, FALSE); -} - - - -/** - * alarm_queue_init: - * - * Initializes the alarm queueing system. This should be called near the - * beginning of the program. - **/ -void -alarm_queue_init (void) -{ - g_return_if_fail (alarm_queue_inited == FALSE); - - client_alarms_hash = g_hash_table_new (g_direct_hash, g_direct_equal); - queue_midnight_refresh (); - - saved_notification_time = get_saved_notification_time (); - if (saved_notification_time == -1) { - saved_notification_time = time (NULL); - save_notification_time (saved_notification_time); - } - - alarm_queue_inited = TRUE; -} - -/** - * alarm_queue_done: - * - * Shuts down the alarm queueing system. This should be called near the end - * of the program. All the monitored calendar clients should already have been - * unregistered with alarm_queue_remove_client(). - **/ -void -alarm_queue_done (void) -{ - g_return_if_fail (alarm_queue_inited); - - /* All clients must be unregistered by now */ - g_return_if_fail (g_hash_table_size (client_alarms_hash) == 0); - - g_hash_table_destroy (client_alarms_hash); - client_alarms_hash = NULL; - - g_assert (midnight_refresh_id != NULL); - alarm_remove (midnight_refresh_id); - midnight_refresh_id = NULL; - - alarm_queue_inited = FALSE; -} - -/** - * alarm_queue_add_client: - * @client: A calendar client. - * - * Adds a calendar client to the alarm queueing system. Alarm trigger - * notifications will be presented at the appropriate times. The client should - * be removed with alarm_queue_remove_client() when receiving notifications - * from it is no longer desired. - * - * A client can be added any number of times to the alarm queueing system, - * but any single alarm trigger will only be presented once for a particular - * client. The client must still be removed the same number of times from the - * queueing system when it is no longer wanted. - **/ -void -alarm_queue_add_client (CalClient *client) -{ - ClientAlarms *ca; - - g_return_if_fail (alarm_queue_inited); - g_return_if_fail (client != NULL); - g_return_if_fail (IS_CAL_CLIENT (client)); - - ca = lookup_client (client); - if (ca) { - ca->refcount++; - return; - } - - ca = g_new (ClientAlarms, 1); - - ca->client = client; - gtk_object_ref (GTK_OBJECT (ca->client)); - - ca->refcount = 1; - g_hash_table_insert (client_alarms_hash, client, ca); - - ca->uid_alarms_hash = g_hash_table_new (g_str_hash, g_str_equal); - - if (cal_client_get_load_state (client) != CAL_CLIENT_LOAD_LOADED) - gtk_signal_connect (GTK_OBJECT (client), "cal_opened", - GTK_SIGNAL_FUNC (cal_opened_cb), ca); - - gtk_signal_connect (GTK_OBJECT (client), "obj_updated", - GTK_SIGNAL_FUNC (obj_updated_cb), ca); - gtk_signal_connect (GTK_OBJECT (client), "obj_removed", - GTK_SIGNAL_FUNC (obj_removed_cb), ca); - - if (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED) { - load_alarms_for_today (ca); - load_missed_alarms (ca); - } -} - -/* Called from g_hash_table_foreach(); adds a component UID to a list */ -static void -add_uid_cb (gpointer key, gpointer value, gpointer data) -{ - GSList **uids; - const char *uid; - - uids = data; - uid = key; - - *uids = g_slist_prepend (*uids, (char *) uid); -} - -/* Removes all the alarms queued for a particular calendar client */ -static void -remove_client_alarms (ClientAlarms *ca) -{ - GSList *uids; - GSList *l; - - /* First we build a list of UIDs so that we can remove them one by one */ - - uids = NULL; - g_hash_table_foreach (ca->uid_alarms_hash, add_uid_cb, &uids); - - for (l = uids; l; l = l->next) { - const char *uid; - - uid = l->data; - - remove_comp (ca, uid); - } - - g_slist_free (uids); - - /* The hash table should be empty now */ - - g_assert (g_hash_table_size (ca->uid_alarms_hash) == 0); -} - -/** - * alarm_queue_remove_client: - * @client: A calendar client. - * - * Removes a calendar client from the alarm queueing system. - **/ -void -alarm_queue_remove_client (CalClient *client) -{ - ClientAlarms *ca; - - g_return_if_fail (alarm_queue_inited); - g_return_if_fail (client != NULL); - g_return_if_fail (IS_CAL_CLIENT (client)); - - ca = lookup_client (client); - g_return_if_fail (ca != NULL); - - g_assert (ca->refcount > 0); - ca->refcount--; - - if (ca->refcount > 0) - return; - - remove_client_alarms (ca); - - /* Clean up */ - - gtk_signal_disconnect_by_data (GTK_OBJECT (ca->client), ca); - - gtk_object_unref (GTK_OBJECT (ca->client)); - ca->client = NULL; - - g_hash_table_destroy (ca->uid_alarms_hash); - ca->uid_alarms_hash = NULL; - - g_free (ca); - - g_hash_table_remove (client_alarms_hash, client); -} diff --git a/calendar/gui/alarm-notify/alarm-queue.h b/calendar/gui/alarm-notify/alarm-queue.h deleted file mode 100644 index a37119145f..0000000000 --- a/calendar/gui/alarm-notify/alarm-queue.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Evolution calendar - Alarm queueing engine - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef ALARM_QUEUE_H -#define ALARM_QUEUE_H - -#include <cal-client/cal-client.h> - - -void alarm_queue_init (void); -void alarm_queue_done (void); - -void alarm_queue_add_client (CalClient *client); -void alarm_queue_remove_client (CalClient *client); - - -#endif diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c deleted file mode 100644 index 8c6c4c59cd..0000000000 --- a/calendar/gui/alarm-notify/alarm.c +++ /dev/null @@ -1,305 +0,0 @@ -/* Evolution calendar - Low-level alarm timer mechanism - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <unistd.h> -#include <time.h> -#include <fcntl.h> -#include <signal.h> -#include <sys/time.h> -#include <gdk/gdk.h> -#include "alarm.h" - - - -/* Our glib timeout */ -static guint timeout_id; - -/* The list of pending alarms */ -static GList *alarms = NULL; - -/* A queued alarm structure */ -typedef struct { - time_t trigger; - AlarmFunction alarm_fn; - gpointer data; - AlarmDestroyNotify destroy_notify_fn; -} AlarmRecord; - -static void setup_timeout (time_t now); - - - -/* Removes the head alarm from the queue. Does not touch the timeout_id. */ -static void -pop_alarm (void) -{ - AlarmRecord *ar; - GList *l; - - g_assert (alarms != NULL); - - ar = alarms->data; - - l = alarms; - alarms = g_list_remove_link (alarms, l); - g_list_free_1 (l); - - g_free (ar); -} - -/* Callback from the alarm timeout */ -static gboolean -alarm_ready_cb (gpointer data) -{ - time_t now; - - g_assert (alarms != NULL); - timeout_id = 0; - - now = time (NULL); - - while (alarms) { - AlarmRecord *notify_id, *ar; - AlarmRecord ar_copy; - - ar = alarms->data; - - if (ar->trigger > now) - break; - - notify_id = ar; - - ar_copy = *ar; - ar = &ar_copy; - - pop_alarm (); /* This will free the original AlarmRecord; that's why we copy it */ - - (* ar->alarm_fn) (notify_id, ar->trigger, ar->data); - - if (ar->destroy_notify_fn) - (* ar->destroy_notify_fn) (notify_id, ar->data); - } - - if (alarms) { - /* We need this check because one of the alarm_fn above may have - * re-entered and added an alarm of its own, so the timer will - * already be set up. - */ - if (timeout_id == 0) - setup_timeout (now); - } else - g_assert (timeout_id == 0); - - return FALSE; -} - -/* Sets up a timeout for the next minute. We do not need to be concerned with - * timezones here, as this is just a periodic check on the alarm queue. - */ -static void -setup_timeout (time_t now) -{ - time_t next, diff; - struct tm tm; - - g_assert (timeout_id == 0); - g_assert (alarms != NULL); - - tm = *localtime (&now); - tm.tm_sec = 0; - tm.tm_min++; /* next minute */ - - next = mktime (&tm); - g_assert (next != -1); - - diff = next - now; - - g_assert (diff >= 0); - timeout_id = g_timeout_add (diff * 1000, alarm_ready_cb, NULL); -} - -/* Used from g_list_insert_sorted(); compares the trigger times of two AlarmRecord structures. */ -static int -compare_alarm_by_time (gconstpointer a, gconstpointer b) -{ - const AlarmRecord *ara = a; - const AlarmRecord *arb = b; - time_t diff; - - diff = ara->trigger - arb->trigger; - return (diff < 0) ? -1 : (diff > 0) ? 1 : 0; -} - -/* Adds an alarm to the queue and sets up the timer */ -static void -queue_alarm (AlarmRecord *ar) -{ - time_t now; - AlarmRecord *old_head; - - if (alarms) { - g_assert (timeout_id != 0); - - old_head = alarms->data; - } else { - g_assert (timeout_id == 0); - - old_head = NULL; - } - - alarms = g_list_insert_sorted (alarms, ar, compare_alarm_by_time); - - if (old_head == alarms->data) - return; - - /* Set the timer for removal upon activation */ - - if (!old_head) { - now = time (NULL); - setup_timeout (now); - } -} - - - -/** - * alarm_add: - * @trigger: Time at which alarm will trigger. - * @alarm_fn: Callback for trigger. - * @data: Closure data for callback. - * - * Adds an alarm to trigger at the specified time. The @alarm_fn will be called - * with the provided data and the alarm will be removed from the trigger list. - * - * Return value: An identifier for this alarm; it can be used to remove the - * alarm later with alarm_remove(). If the trigger time occurs in the past, then - * the alarm will not be queued and the function will return NULL. - **/ -gpointer -alarm_add (time_t trigger, AlarmFunction alarm_fn, gpointer data, - AlarmDestroyNotify destroy_notify_fn) -{ - AlarmRecord *ar; - - g_return_val_if_fail (trigger != -1, NULL); - g_return_val_if_fail (alarm_fn != NULL, NULL); - - ar = g_new (AlarmRecord, 1); - ar->trigger = trigger; - ar->alarm_fn = alarm_fn; - ar->data = data; - ar->destroy_notify_fn = destroy_notify_fn; - - queue_alarm (ar); - - return ar; -} - -/** - * alarm_remove: - * @alarm: A queued alarm identifier. - * - * Removes an alarm from the alarm queue. - **/ -void -alarm_remove (gpointer alarm) -{ - AlarmRecord *notify_id, *ar; - AlarmRecord ar_copy; - AlarmRecord *old_head; - GList *l; - - g_return_if_fail (alarm != NULL); - - ar = alarm; - - l = g_list_find (alarms, ar); - if (!l) { - g_message ("alarm_remove(): Requested removal of nonexistent alarm!"); - return; - } - - old_head = alarms->data; - - notify_id = ar; - - if (old_head == ar) { - ar_copy = *ar; - ar = &ar_copy; - pop_alarm (); /* This will free the original AlarmRecord; that's why we copy it */ - } else { - alarms = g_list_remove_link (alarms, l); - g_list_free_1 (l); - } - - /* Reset the timeout */ - - g_assert (timeout_id != 0); - - if (!alarms) { - g_source_remove (timeout_id); - timeout_id = 0; - } - - /* Notify about destructiono of the alarm */ - - if (ar->destroy_notify_fn) - (* ar->destroy_notify_fn) (notify_id, ar->data); - -} - -/** - * alarm_done: - * - * Terminates the alarm timer mechanism. This should be called at the end of - * the program. - **/ -void -alarm_done (void) -{ - GList *l; - - if (timeout_id == 0) { - g_assert (alarms == NULL); - return; - } - - g_assert (alarms != NULL); - - g_source_remove (timeout_id); - timeout_id = 0; - - for (l = alarms; l; l = l->next) { - AlarmRecord *ar; - - ar = l->data; - - if (ar->destroy_notify_fn) - (* ar->destroy_notify_fn) (ar, ar->data); - - g_free (ar); - } - - g_list_free (alarms); - alarms = NULL; -} diff --git a/calendar/gui/alarm-notify/alarm.h b/calendar/gui/alarm-notify/alarm.h deleted file mode 100644 index 23fde886c9..0000000000 --- a/calendar/gui/alarm-notify/alarm.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Evolution calendar - Low-level alarm timer mechanism - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef ALARM_H -#define ALARM_H - -#include <time.h> -#include <glib.h> - - - -typedef void (* AlarmFunction) (gpointer alarm_id, time_t trigger, gpointer data); -typedef void (* AlarmDestroyNotify) (gpointer alarm_id, gpointer data); - -void alarm_done (void); - -gpointer alarm_add (time_t trigger, AlarmFunction alarm_fn, gpointer data, - AlarmDestroyNotify destroy_notify_fn); -void alarm_remove (gpointer alarm); - - - -#endif diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c deleted file mode 100644 index babb387e7a..0000000000 --- a/calendar/gui/alarm-notify/config-data.c +++ /dev/null @@ -1,116 +0,0 @@ -/* Evolution calendar - Configuration values for the alarm notification daemon - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "config-data.h" -#include "save.h" - - - -/* Whether we have initied ourselves by reading the data from the configuration engine */ -static gboolean inited = FALSE; -static EConfigListener *config; - - - -/* Copied from ../calendar-config.c; returns whether the locale has 'am' and - * 'pm' strings defined. - */ -static gboolean -locale_supports_12_hour_format (void) -{ - char s[16]; - time_t t = 0; - - strftime (s, sizeof s, "%p", gmtime (&t)); - return s[0] != '\0'; -} - -static void -do_cleanup (void) -{ - g_object_unref (G_OBJECT (config)); - config = NULL; - inited = FALSE; -} - -/* Ensures that the configuration values have been read */ -static void -ensure_inited (void) -{ - if (inited) - return; - - inited = TRUE; - - config = e_config_listener_new (); - if (!E_IS_CONFIG_LISTENER (config)) { - inited = FALSE; - return; - } - - g_atexit ((GVoidFunc) do_cleanup); -} - -EConfigListener * -config_data_get_listener (void) -{ - ensure_inited (); - return config; -} - -icaltimezone * -config_data_get_timezone (void) -{ - char *location; - icaltimezone *local_timezone; - - ensure_inited (); - - location = e_config_listener_get_string_with_default (config, - "/Calendar/Display/Timezone", - "UTC", NULL); - if (location && location[0]) { - local_timezone = icaltimezone_get_builtin_timezone (location); - } else { - local_timezone = icaltimezone_get_utc_timezone (); - } - - g_free (location); - - return local_timezone; -} - -gboolean -config_data_get_24_hour_format (void) -{ - ensure_inited (); - - if (locale_supports_12_hour_format ()) { - return e_config_listener_get_boolean_with_default ( - config, - "/Calendar/Display/Use24HourFormat", FALSE, NULL); - } - - return TRUE; -} diff --git a/calendar/gui/alarm-notify/config-data.h b/calendar/gui/alarm-notify/config-data.h deleted file mode 100644 index c7041be111..0000000000 --- a/calendar/gui/alarm-notify/config-data.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Evolution calendar - Configuration values for the alarm notification daemon - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CONFIG_DATA_H -#define CONFIG_DATA_H - -#include <glib.h> -#include <ical.h> -#include <e-util/e-config-listener.h> - -EConfigListener *config_data_get_listener (void); - -icaltimezone *config_data_get_timezone (void); -gboolean config_data_get_24_hour_format (void); - -#endif diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c deleted file mode 100644 index b4eb59ce1c..0000000000 --- a/calendar/gui/alarm-notify/notify-main.c +++ /dev/null @@ -1,200 +0,0 @@ -/* Evolution calendar - Alarm notification service main file - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <glib.h> -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-init.h> -#include <libgnomeui/gnome-client.h> -#include <libgnomevfs/gnome-vfs-init.h> -#include <glade/glade.h> -#include <bonobo/bonobo-main.h> -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo-activation/bonobo-activation.h> -#include "alarm.h" -#include "alarm-queue.h" -#include "alarm-notify.h" -#include "save.h" - - - -static GnomeClient *master_client = NULL; - -static BonoboGenericFactory *factory; - -static AlarmNotify *alarm_notify_service = NULL; - - -/* Callback for the master client's "die" signal. We must terminate the daemon - * since the session is ending. - */ -static void -client_die_cb (GnomeClient *client) -{ - gtk_main_quit (); -} - -/* Sees if a session manager is present. If so, it tells the SM how to restart - * the daemon when the session starts. It also sets the die callback so that - * the daemon can terminate properly when the session ends. - */ -static void -set_session_parameters (char **argv) -{ - int flags; - char *args[2]; - - master_client = gnome_master_client (); - flags = gnome_client_get_flags (master_client); - - if (!(flags & GNOME_CLIENT_IS_CONNECTED)) - return; - - /* The daemon should always be started up by the session manager when - * the session starts. The daemon will take care of loading whatever - * calendars it was told to load. - */ - gnome_client_set_restart_style (master_client, GNOME_RESTART_ANYWAY); - - args[0] = argv[0]; - args[1] = NULL; - - gnome_client_set_restart_command (master_client, 1, args); - - g_signal_connect (G_OBJECT (master_client), "die", - G_CALLBACK (client_die_cb), NULL); -} - -/* Factory function for the alarm notify service; just creates and references a - * singleton service object. - */ -static BonoboObject * -alarm_notify_factory_fn (BonoboGenericFactory *factory, const char *component_id, void *data) -{ - if (!alarm_notify_service) { - alarm_notify_service = alarm_notify_new (); - g_assert (alarm_notify_service != NULL); - } - - bonobo_object_ref (BONOBO_OBJECT (alarm_notify_service)); - return BONOBO_OBJECT (alarm_notify_service); -} - -/* Loads the calendars that the alarm daemon has been told to load in the past */ -static gboolean -load_calendars (gpointer user_data) -{ - GPtrArray *uris; - int i; - - alarm_queue_init (); - - /* create the alarm notification service */ - if (!alarm_notify_service) { - alarm_notify_service = alarm_notify_new (); - g_assert (alarm_notify_service != NULL); - } - - uris = get_calendars_to_load (); - if (!uris) { - g_message ("load_calendars(): Could not get the list of calendars to load"); - return TRUE; /* should we continue retrying? */; - } - - for (i = 0; i < uris->len; i++) { - char *uri; - CORBA_Environment ev; - - uri = uris->pdata[i]; - - CORBA_exception_init (&ev); - alarm_notify_add_calendar (alarm_notify_service, uri, FALSE, &ev); - - if (ev._major == CORBA_USER_EXCEPTION) { - char *ex_id; - - ex_id = CORBA_exception_id (&ev); - if (strcmp (ex_id, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI) == 0) - g_message ("load_calendars(): Invalid URI `%s'; will not load " - "that calendar.", uri); - else if (strcmp (ex_id, - ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError) - == 0) - g_message ("load_calendars(): Could not contact the backend " - "while trying to load `%s'", uri); - } else if (ev._major != CORBA_NO_EXCEPTION) - g_message ("load_calendars(): Exception while loading calendar `%s'", uri); - - CORBA_exception_free (&ev); - - g_free (uri); - } - - g_ptr_array_free (uris, TRUE); - - return FALSE; -} - -int -main (int argc, char **argv) -{ - free (malloc (8)); - - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - gnome_program_init ("evolution-alarm-notify", VERSION, LIBGNOME_MODULE, argc, argv, NULL); - bonobo_activation_init (argc, argv); - - if (bonobo_init (&argc, argv) == FALSE) - g_error (_("Could not initialize Bonobo")); - - if (!gnome_vfs_init ()) - g_error (_("Could not initialize gnome-vfs")); - - glade_gnome_init (); - - factory = bonobo_generic_factory_new ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory", - (BonoboFactoryCallback) alarm_notify_factory_fn, NULL); - if (!factory) - g_error (_("Could not create the alarm notify service factory")); - - set_session_parameters (argv); - - g_idle_add ((GSourceFunc) load_calendars, NULL); - - bonobo_main (); - - bonobo_object_unref (BONOBO_OBJECT (factory)); - factory = NULL; - - /* FIXME: free the alarm_notify_service */ - - alarm_queue_done (); - alarm_done (); - - gnome_vfs_shutdown (); - - return 0; -} diff --git a/calendar/gui/alarm-notify/save.c b/calendar/gui/alarm-notify/save.c deleted file mode 100644 index dc78686250..0000000000 --- a/calendar/gui/alarm-notify/save.c +++ /dev/null @@ -1,243 +0,0 @@ -/* Evolution calendar - Functions to save alarm notification times - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-arg.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-moniker-util.h> -#include "evolution-calendar.h" -#include "config-data.h" -#include "save.h" - - - -/* Key names for the configuration values */ - -#define KEY_LAST_NOTIFICATION_TIME "/Calendar/AlarmNotify/LastNotificationTime" -#define KEY_NUM_CALENDARS_TO_LOAD "/Calendar/AlarmNotify/NumCalendarsToLoad" -#define BASE_KEY_CALENDAR_TO_LOAD "/Calendar/AlarmNotify/CalendarToLoad" -#define KEY_NUM_BLESSED_PROGRAMS "/Calendar/AlarmNotify/NumBlessedPrograms" -#define BASE_KEY_BLESSED_PROGRAM "/Calendar/AlarmNotify/BlessedProgram" - - - -/** - * save_notification_time: - * @t: A time value. - * - * Saves the last notification time so that it can be fetched the next time the - * alarm daemon is run. This way the daemon can show alarms that should have - * triggered while it was not running. - **/ -void -save_notification_time (time_t t) -{ - EConfigListener *cl; - time_t current_t; - - g_return_if_fail (t != -1); - - if (!(cl = config_data_get_listener ())) - return; - - /* we only store the new notification time if it is bigger - than the already stored one */ - current_t = e_config_listener_get_long_with_default (cl, KEY_LAST_NOTIFICATION_TIME, - -1, NULL); - if (t > current_t) - e_config_listener_set_long (cl, KEY_LAST_NOTIFICATION_TIME, (long) t); -} - -/** - * get_saved_notification_time: - * - * Queries the last saved value for alarm notification times. - * - * Return value: The last saved value, or -1 if no value had been saved before. - **/ -time_t -get_saved_notification_time (void) -{ - EConfigListener *cl; - long t; - - if (!(cl = config_data_get_listener ())) - return -1; - - t = e_config_listener_get_long_with_default (cl, KEY_LAST_NOTIFICATION_TIME, -1, NULL); - - return (time_t) t; -} - -/** - * save_calendars_to_load: - * @uris: A list of URIs of calendars. - * - * Saves the list of calendars that should be loaded the next time the alarm - * daemon starts up. - **/ -void -save_calendars_to_load (GPtrArray *uris) -{ - EConfigListener *cl; - int len, i; - - g_return_if_fail (uris != NULL); - - if (!(cl = config_data_get_listener ())) - return; - - len = uris->len; - - e_config_listener_set_long (cl, KEY_NUM_CALENDARS_TO_LOAD, len); - - for (i = 0; i < len; i++) { - const char *uri; - char *key; - - uri = uris->pdata[i]; - - key = g_strdup_printf ("%s%d", BASE_KEY_CALENDAR_TO_LOAD, i); - e_config_listener_set_string (cl, key, uri); - g_free (key); - } -} - -/** - * get_calendars_to_load: - * - * Gets the list of calendars that should be loaded when the alarm daemon starts - * up. - * - * Return value: A list of URIs, or NULL if the value could not be retrieved. - **/ -GPtrArray * -get_calendars_to_load (void) -{ - EConfigListener *cl; - GPtrArray *uris; - int len, i; - - if (!(cl = config_data_get_listener ())) - return NULL; - - /* Getting the default value below is not necessarily an error, as we - * may not have saved the list of calendar yet. - */ - - len = e_config_listener_get_long_with_default (cl, KEY_NUM_CALENDARS_TO_LOAD, 0, NULL); - - uris = g_ptr_array_new (); - g_ptr_array_set_size (uris, len); - - for (i = 0; i < len; i++) { - char *key; - gboolean used_default; - - key = g_strdup_printf ("%s%d", BASE_KEY_CALENDAR_TO_LOAD, i); - uris->pdata[i] = e_config_listener_get_string_with_default (cl, key, "", &used_default); - if (used_default) - g_message ("get_calendars_to_load(): Could not read calendar name %d", i); - - g_free (key); - } - - return uris; -} - -/** - * save_blessed_program: - * @program: a program name - * - * Saves a program name as "blessed" - **/ -void -save_blessed_program (const char *program) -{ - EConfigListener *cl; - char *key; - int len; - - g_return_if_fail (program != NULL); - - if (!(cl = config_data_get_listener ())) - return; - - /* Up the number saved */ - len = e_config_listener_get_long_with_default (cl, KEY_NUM_BLESSED_PROGRAMS, 0, NULL); - len++; - - e_config_listener_set_long (cl, KEY_NUM_BLESSED_PROGRAMS, len); - - /* Save the program name */ - key = g_strdup_printf ("%s%d", BASE_KEY_BLESSED_PROGRAM, len - 1); - e_config_listener_set_string (cl, key, program); - g_free (key); -} - -/** - * is_blessed_program: - * @program: a program name - * - * Checks to see if a program is blessed - * - * Return value: TRUE if program is blessed, FALSE otherwise - **/ -gboolean -is_blessed_program (const char *program) -{ - EConfigListener *cl; - int len, i; - - g_return_val_if_fail (program != NULL, FALSE); - - if (!(cl = config_data_get_listener ())) - return FALSE; - - /* Getting the default value below is not necessarily an error, as we - * may not have saved the list of calendar yet. - */ - - len = e_config_listener_get_long_with_default (cl, KEY_NUM_BLESSED_PROGRAMS, 0, NULL); - - for (i = 0; i < len; i++) { - char *key, *value; - gboolean used_default; - - key = g_strdup_printf ("%s%d", BASE_KEY_BLESSED_PROGRAM, i); - value = e_config_listener_get_string_with_default (cl, key, "", &used_default); - if (used_default) - g_message ("get_calendars_to_load(): Could not read calendar name %d", i); - - if (value != NULL && !strcmp (value, program)) { - g_free (key); - g_free (value); - return TRUE; - } - - g_free (key); - g_free (value); - } - - return FALSE; -} diff --git a/calendar/gui/alarm-notify/save.h b/calendar/gui/alarm-notify/save.h deleted file mode 100644 index f7cc75955c..0000000000 --- a/calendar/gui/alarm-notify/save.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Evolution calendar - Functions to save alarm notification times - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef SAVE_H -#define SAVE_H - -#include <time.h> - -void save_notification_time (time_t t); -time_t get_saved_notification_time (void); - -void save_calendars_to_load (GPtrArray *uris); -GPtrArray *get_calendars_to_load (void); - -void save_blessed_program (const char *program); -gboolean is_blessed_program (const char *program); - -#endif diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c deleted file mode 100644 index 2483b2b126..0000000000 --- a/calendar/gui/cal-search-bar.c +++ /dev/null @@ -1,544 +0,0 @@ -/* Evolution calendar - Search bar widget for calendar views - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <gtk/gtkmenu.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtksignal.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include <gal/widgets/e-unicode.h> -#include "cal-search-bar.h" - - - -/* IDs and option items for the ESearchBar */ -enum { - SEARCH_ANY_FIELD_CONTAINS, - SEARCH_SUMMARY_CONTAINS, - SEARCH_DESCRIPTION_CONTAINS, - SEARCH_COMMENT_CONTAINS, - SEARCH_CATEGORY_IS, -}; - -static ESearchBarItem search_option_items[] = { - { N_("Any field contains"), SEARCH_ANY_FIELD_CONTAINS, NULL }, - { N_("Summary contains"), SEARCH_SUMMARY_CONTAINS, NULL }, - { N_("Description contains"), SEARCH_DESCRIPTION_CONTAINS, NULL }, - { N_("Comment contains"), SEARCH_COMMENT_CONTAINS, NULL }, - { N_("Category is"), SEARCH_CATEGORY_IS, NULL }, - { NULL, -1, NULL } -}; - -/* IDs for the categories suboptions */ -#define CATEGORIES_ALL 0 -#define CATEGORIES_UNMATCHED 1 -#define CATEGORIES_OFFSET 3 - -/* Private part of the CalSearchBar structure */ -struct CalSearchBarPrivate { - /* Array of categories */ - GPtrArray *categories; -}; - - - -static void cal_search_bar_class_init (CalSearchBarClass *class); -static void cal_search_bar_init (CalSearchBar *cal_search); -static void cal_search_bar_destroy (GtkObject *object); - -static void cal_search_bar_search_activated (ESearchBar *search); - -static ESearchBarClass *parent_class = NULL; - -/* Signal IDs */ -enum { - SEXP_CHANGED, - CATEGORY_CHANGED, - LAST_SIGNAL -}; - -static guint cal_search_bar_signals[LAST_SIGNAL] = { 0 }; - - - -/** - * cal_search_bar_get_type: - * - * Registers the #CalSearchBar class if necessary and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalSearchBar class. - **/ -GtkType -cal_search_bar_get_type (void) -{ - static GtkType cal_search_bar_type = 0; - - if (!cal_search_bar_type) { - static const GtkTypeInfo cal_search_bar_info = { - "CalSearchBar", - sizeof (CalSearchBar), - sizeof (CalSearchBarClass), - (GtkClassInitFunc) cal_search_bar_class_init, - (GtkObjectInitFunc) cal_search_bar_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_search_bar_type = gtk_type_unique (E_SEARCH_BAR_TYPE, &cal_search_bar_info); - } - - return cal_search_bar_type; -} - -/* Class initialization function for the calendar search bar */ -static void -cal_search_bar_class_init (CalSearchBarClass *class) -{ - ESearchBarClass *e_search_bar_class; - GtkObjectClass *object_class; - - e_search_bar_class = (ESearchBarClass *) class; - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (E_SEARCH_BAR_TYPE); - - cal_search_bar_signals[SEXP_CHANGED] = - gtk_signal_new ("sexp_changed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalSearchBarClass, sexp_changed), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - cal_search_bar_signals[CATEGORY_CHANGED] = - gtk_signal_new ("category_changed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (CalSearchBarClass, category_changed), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, cal_search_bar_signals, LAST_SIGNAL); - - class->sexp_changed = NULL; - class->category_changed = NULL; - - e_search_bar_class->search_activated = cal_search_bar_search_activated; - - object_class->destroy = cal_search_bar_destroy; -} - -/* Object initialization function for the calendar search bar */ -static void -cal_search_bar_init (CalSearchBar *cal_search) -{ - CalSearchBarPrivate *priv; - - priv = g_new (CalSearchBarPrivate, 1); - cal_search->priv = priv; - - priv->categories = g_ptr_array_new (); - g_ptr_array_set_size (priv->categories, 0); -} - -/* Frees an array of categories */ -static void -free_categories (GPtrArray *categories) -{ - int i; - - for (i = 0; i < categories->len; i++) { - g_assert (categories->pdata[i] != NULL); - g_free (categories->pdata[i]); - } - - g_ptr_array_free (categories, TRUE); -} - -/* Destroy handler for the calendar search bar */ -static void -cal_search_bar_destroy (GtkObject *object) -{ - CalSearchBar *cal_search; - CalSearchBarPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_SEARCH_BAR (object)); - - cal_search = CAL_SEARCH_BAR (object); - priv = cal_search->priv; - - if (priv->categories) { - free_categories (priv->categories); - priv->categories = NULL; - } - - g_free (priv); - cal_search->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* Emits the "sexp_changed" signal for the calendar search bar */ -static void -notify_sexp_changed (CalSearchBar *cal_search, const char *sexp) -{ - gtk_signal_emit (GTK_OBJECT (cal_search), cal_search_bar_signals[SEXP_CHANGED], - sexp); -} - -/* Returns the string of the currently selected category, NULL for "Unmatched", - * or (const char *) 1 for "All". - */ -static const char * -get_current_category (CalSearchBar *cal_search) -{ - CalSearchBarPrivate *priv; - int id, subid; - - priv = cal_search->priv; - - g_assert (priv->categories != NULL); - - id = e_search_bar_get_item_id (E_SEARCH_BAR (cal_search)); - if (id != SEARCH_CATEGORY_IS) - return NULL; - - subid = e_search_bar_get_subitem_id (E_SEARCH_BAR (cal_search)); - if (subid == CATEGORIES_ALL) - return (const char *) 1; - else if (subid == CATEGORIES_UNMATCHED) - return NULL; - else { - int i; - - i = subid - CATEGORIES_OFFSET; - g_assert (i >= 0 && i < priv->categories->len); - - return priv->categories->pdata[i]; - } -} - -/* Sets the query string to be (contains? "field" "text") */ -static void -notify_query_contains (CalSearchBar *cal_search, const char *field) -{ - char *text; - char *sexp; - - text = e_search_bar_get_text (E_SEARCH_BAR (cal_search)); - if (!text) - return; /* This is an error in the UTF8 conversion, not an empty string! */ - - sexp = g_strdup_printf ("(contains? \"%s\" \"%s\")", field, text); - g_free (text); - - notify_sexp_changed (cal_search, sexp); - g_free (sexp); -} - -/* Returns a sexp for the selected category in the drop-down menu. The "All" - * option is returned as (const char *) 1, and the "Unfiled" option is returned - * as NULL. - */ -static char * -get_category_sexp (CalSearchBar *cal_search) -{ - const char *category; - - category = get_current_category (cal_search); - - if (category == NULL) - return g_strdup ("(has-categories? #f)"); /* Unfiled items */ - else if (category == (const char *) 1) - return NULL; /* All items */ - else - return g_strdup_printf ("(has-categories? \"%s\")", category); /* Specific category */ -} - -/* Sets the query string to the appropriate match for categories */ -static void -notify_category_is (CalSearchBar *cal_search) -{ - char *sexp; - - sexp = get_category_sexp (cal_search); - if (!sexp) - notify_sexp_changed (cal_search, "#t"); /* Match all */ - else - notify_sexp_changed (cal_search, sexp); - - if (sexp) - g_free (sexp); -} - -/* Creates a new query from the values in the widgets and notifies upstream */ -static void -regen_query (CalSearchBar *cal_search) -{ - CalSearchBarPrivate *priv; - int id; - const char *category; - - priv = cal_search->priv; - - /* Fetch the data from the ESearchBar's entry widgets */ - - id = e_search_bar_get_item_id (E_SEARCH_BAR (cal_search)); - - /* Generate the different types of queries */ - - switch (id) { - case SEARCH_ANY_FIELD_CONTAINS: - notify_query_contains (cal_search, "any"); - break; - - case SEARCH_SUMMARY_CONTAINS: - notify_query_contains (cal_search, "summary"); - break; - - case SEARCH_DESCRIPTION_CONTAINS: - notify_query_contains (cal_search, "description"); - break; - - case SEARCH_COMMENT_CONTAINS: - notify_query_contains (cal_search, "comment"); - break; - - case SEARCH_CATEGORY_IS: - notify_category_is (cal_search); - - category = cal_search_bar_get_category (cal_search); - gtk_signal_emit (GTK_OBJECT (cal_search), cal_search_bar_signals[CATEGORY_CHANGED], - category); - break; - - default: - g_assert_not_reached (); - } -} - -/* search_activated handler for the calendar search bar */ -static void -cal_search_bar_search_activated (ESearchBar *search) -{ - CalSearchBar *cal_search; - - cal_search = CAL_SEARCH_BAR (search); - regen_query (cal_search); -} - - - -/* Creates the suboptions menu for the ESearchBar with the list of categories */ -static void -make_suboptions (CalSearchBar *cal_search) -{ - CalSearchBarPrivate *priv; - ESearchBarSubitem *subitems; - int i; - - priv = cal_search->priv; - - g_assert (priv->categories != NULL); - - /* Categories plus "all", "unmatched", separator, terminator */ - subitems = g_new (ESearchBarSubitem, priv->categories->len + 3 + 1); - - /* All, unmatched, separator */ - - subitems[0].text = _("Any Category"); - subitems[0].id = CATEGORIES_ALL; - subitems[0].translate = FALSE; - - subitems[1].text = _("Unmatched"); - subitems[1].id = CATEGORIES_UNMATCHED; - subitems[1].translate = FALSE; - - /* All the other items */ - - if (priv->categories->len > 0) { - subitems[2].text = NULL; /* separator */ - subitems[2].id = 0; - - for (i = 0; i < priv->categories->len; i++) { - const char *category; - char *str; - - category = priv->categories->pdata[i]; - str = e_utf8_to_gtk_string (GTK_WIDGET (cal_search), category); - if (!str) - str = g_strdup (""); - - subitems[i + CATEGORIES_OFFSET].text = str; - subitems[i + CATEGORIES_OFFSET].id = i + CATEGORIES_OFFSET; - subitems[i + CATEGORIES_OFFSET].translate = FALSE; - } - - subitems[i + CATEGORIES_OFFSET].id = -1; /* terminator */ - } else - subitems[2].id = -1; /* terminator */ - - e_search_bar_set_suboption (E_SEARCH_BAR (cal_search), SEARCH_CATEGORY_IS, subitems); - - /* Free the strings */ - for (i = 0; i < priv->categories->len; i++) - g_free (subitems[i + CATEGORIES_OFFSET].text); - - g_free (subitems); -} - -/** - * cal_search_bar_construct: - * @cal_search: A calendar search bar. - * - * Constructs a calendar search bar by binding its menu and option items. - * - * Return value: The same value as @cal_search. - **/ -CalSearchBar * -cal_search_bar_construct (CalSearchBar *cal_search) -{ - g_return_val_if_fail (cal_search != NULL, NULL); - g_return_val_if_fail (IS_CAL_SEARCH_BAR (cal_search), NULL); - - e_search_bar_construct (E_SEARCH_BAR (cal_search), NULL, search_option_items); - make_suboptions (cal_search); - - e_search_bar_set_ids (E_SEARCH_BAR (cal_search), SEARCH_CATEGORY_IS, CATEGORIES_ALL); - - return cal_search; -} - -/** - * cal_search_bar_new: - * - * Creates a new calendar search bar. - * - * Return value: A newly-created calendar search bar. You should connect to the - * "sexp_changed" signal to monitor changes in the generated sexps. - **/ -GtkWidget * -cal_search_bar_new (void) -{ - CalSearchBar *cal_search; - - cal_search = gtk_type_new (TYPE_CAL_SEARCH_BAR); - return GTK_WIDGET (cal_search_bar_construct (cal_search)); -} - -/* Used from qsort() */ -static int -compare_categories_cb (const void *a, const void *b) -{ - const char **ca, **cb; - - ca = (const char **) a; - cb = (const char **) b; - - /* FIXME: should use some utf8 strcoll() thingy */ - return strcmp (*ca, *cb); -} - -/* Creates a sorted array of categories based on the original one; copies the - * string values. - */ -static GPtrArray * -sort_categories (GPtrArray *categories) -{ - GPtrArray *c; - int i; - - c = g_ptr_array_new (); - g_ptr_array_set_size (c, categories->len); - - for (i = 0; i < categories->len; i++) - c->pdata[i] = g_strdup (categories->pdata[i]); - - qsort (c->pdata, c->len, sizeof (gpointer), compare_categories_cb); - - return c; -} - -/** - * cal_search_bar_set_categories: - * @cal_search: A calendar search bar. - * @categories: Array of pointers to strings for the category names. - * - * Sets the list of categories that are to be shown in the drop-down list - * of a calendar search bar. The search bar will automatically add an item - * for "unfiled" components, that is, those that have no categories assigned - * to them. - **/ -void -cal_search_bar_set_categories (CalSearchBar *cal_search, GPtrArray *categories) -{ - CalSearchBarPrivate *priv; - - g_return_if_fail (cal_search != NULL); - g_return_if_fail (IS_CAL_SEARCH_BAR (cal_search)); - g_return_if_fail (categories != NULL); - - priv = cal_search->priv; - - g_assert (priv->categories != NULL); - free_categories (priv->categories); - - priv->categories = sort_categories (categories); - make_suboptions (cal_search); -} - -/** - * cal_search_bar_get_category: - * @cal_search: A calendar search bar. - * - * Queries the currently selected category name in a calendar search bar. - * If "All" or "Unfiled" are selected, this function will return NULL. - * - * Return value: Name of the selected category, or NULL if there is no - * selected category. - **/ -const char * -cal_search_bar_get_category (CalSearchBar *cal_search) -{ - const char *category; - - category = get_current_category (cal_search); - - if (!category || category == (const char *) 1) - return NULL; - else - return category; -} diff --git a/calendar/gui/cal-search-bar.h b/calendar/gui/cal-search-bar.h deleted file mode 100644 index 5cfb29fa76..0000000000 --- a/calendar/gui/cal-search-bar.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Evolution calendar - Search bar widget for calendar views - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_SEARCH_BAR_H -#define CAL_SEARCH_BAR_H - -#include <libgnome/gnome-defs.h> -#include "widgets/misc/e-search-bar.h" -#include "widgets/misc/e-filter-bar.h" - -BEGIN_GNOME_DECLS - - - -#define TYPE_CAL_SEARCH_BAR (cal_search_bar_get_type ()) -#define CAL_SEARCH_BAR(obj) (GTK_CHECK_CAST ((obj), TYPE_CAL_SEARCH_BAR, CalSearchBar)) -#define CAL_SEARCH_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_CAL_SEARCH_BAR, \ - CalSearchBarClass)) -#define IS_CAL_SEARCH_BAR(obj) (GTK_CHECK_TYPE ((obj), TYPE_CAL_SEARCH_BAR)) -#define IS_CAL_SEARCH_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_CAL_SEARCH_BAR)) - -typedef struct CalSearchBarPrivate CalSearchBarPrivate; - -typedef struct { - ESearchBar search_bar; - - /* Private data */ - CalSearchBarPrivate *priv; -} CalSearchBar; - -typedef struct { - ESearchBarClass parent_class; - - /* Notification signals */ - - void (* sexp_changed) (CalSearchBar *cal_search, const char *sexp); - void (* category_changed) (CalSearchBar *cal_search, const char *category); -} CalSearchBarClass; - -GtkType cal_search_bar_get_type (void); - -CalSearchBar *cal_search_bar_construct (CalSearchBar *cal_search); - -GtkWidget *cal_search_bar_new (void); - -void cal_search_bar_set_categories (CalSearchBar *cal_search, GPtrArray *categories); - -const char *cal_search_bar_get_category (CalSearchBar *cal_search); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c deleted file mode 100644 index d288b8e77c..0000000000 --- a/calendar/gui/calendar-commands.c +++ /dev/null @@ -1,810 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Evolution calendar - Commands for the calendar GUI control - * - * Copyright (C) 1998 The Free Software Foundation - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> - * Seth Alves <alves@hungry.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <pwd.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> -#include <ctype.h> -#include <errno.h> - -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gtk/gtkfilesel.h> -#include <gtk/gtkmain.h> -#include <gtk/gtksignal.h> - -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-util.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-messagebox.h> -#include <libgnomeui/gnome-stock.h> -#include <libgnome/gnome-util.h> -#include <libgnome/gnome-i18n.h> -#include <bonobo/bonobo-ui-util.h> -#include <bonobo/bonobo-exception.h> -#include <cal-util/timeutil.h> -#include "shell/Evolution.h" -#include "calendar-commands.h" -#include "calendar-config.h" -#include "gnome-cal.h" -#include "goto.h" -#include "print.h" -#include "dialogs/cal-prefs-dialog.h" -#include "itip-utils.h" -#include "evolution-shell-component-utils.h" - -/* A list of all of the calendars started */ -static GList *all_calendars = NULL; - -/* Focusing information for the calendar view. We have to keep track of this - * ourselves because with Bonobo controls, we may get unpaired focus_out events. - */ -typedef struct { - guint calendar_focused : 1; - guint taskpad_focused : 1; -} FocusData; - -/* Prints the calendar at its current view and time range */ -static void -print (GnomeCalendar *gcal, gboolean preview) -{ - time_t start; - GnomeCalendarViewType view_type; - PrintView print_view; - - gnome_calendar_get_current_time_range (gcal, &start, NULL); - view_type = gnome_calendar_get_view (gcal); - - switch (view_type) { - case GNOME_CAL_DAY_VIEW: - print_view = PRINT_VIEW_DAY; - break; - - case GNOME_CAL_WORK_WEEK_VIEW: - case GNOME_CAL_WEEK_VIEW: - print_view = PRINT_VIEW_WEEK; - break; - - case GNOME_CAL_MONTH_VIEW: - print_view = PRINT_VIEW_MONTH; - break; - - default: - g_assert_not_reached (); - return; - } - - print_calendar (gcal, preview, start, print_view); -} - -/* File/Print callback */ -static void -file_print_cb (BonoboUIComponent *uic, gpointer data, const char *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - print (gcal, FALSE); -} - -static void -file_print_preview_cb (BonoboUIComponent *uic, gpointer data, const char *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - print (gcal, TRUE); -} - -/* This iterates over each calendar telling them to update their config - settings. */ -void -update_all_config_settings (void) -{ - GList *l; - - for (l = all_calendars; l; l = l->next) - gnome_calendar_update_config_settings (GNOME_CALENDAR (l->data), FALSE); -} - - -/* Sets a clock cursor for the specified calendar window */ -static void -set_clock_cursor (GnomeCalendar *gcal) -{ - GdkCursor *cursor; - - cursor = gdk_cursor_new (GDK_WATCH); - gdk_window_set_cursor (GTK_WIDGET (gcal)->window, cursor); - gdk_cursor_destroy (cursor); - gdk_flush (); -} - -/* Resets the normal cursor for the specified calendar window */ -static void -set_normal_cursor (GnomeCalendar *gcal) -{ - gdk_window_set_cursor (GTK_WIDGET (gcal)->window, NULL); - gdk_flush (); -} - -static void -previous_clicked (BonoboUIComponent *uic, gpointer data, const char *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - set_clock_cursor (gcal); - gnome_calendar_previous (gcal); - set_normal_cursor (gcal); -} - -static void -next_clicked (BonoboUIComponent *uic, gpointer data, const char *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - set_clock_cursor (gcal); - gnome_calendar_next (gcal); - set_normal_cursor (gcal); -} - -void -calendar_goto_today (GnomeCalendar *gcal) -{ - set_clock_cursor (gcal); - gnome_calendar_goto_today (gcal); - set_normal_cursor (gcal); -} - -static void -today_clicked (BonoboUIComponent *uic, gpointer data, const char *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - calendar_goto_today (gcal); -} - -static void -goto_clicked (BonoboUIComponent *uic, gpointer data, const char *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - goto_dialog (gcal); -} - -static void -show_day_view_clicked (BonoboUIComponent *uic, gpointer data, const char *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - gnome_calendar_set_view (gcal, GNOME_CAL_DAY_VIEW, FALSE, TRUE); -} - -static void -show_work_week_view_clicked (BonoboUIComponent *uic, gpointer data, const char *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - gnome_calendar_set_view (gcal, GNOME_CAL_WORK_WEEK_VIEW, FALSE, TRUE); -} - -static void -show_week_view_clicked (BonoboUIComponent *uic, gpointer data, const char *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - gnome_calendar_set_view (gcal, GNOME_CAL_WEEK_VIEW, FALSE, TRUE); -} - -static void -show_month_view_clicked (BonoboUIComponent *uic, gpointer data, const char *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - gnome_calendar_set_view (gcal, GNOME_CAL_MONTH_VIEW, FALSE, TRUE); -} - - - -static void -cut_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - set_clock_cursor (gcal); - gnome_calendar_cut_clipboard (gcal); - set_normal_cursor (gcal); -} - -static void -copy_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - set_clock_cursor (gcal); - gnome_calendar_copy_clipboard (gcal); - set_normal_cursor (gcal); -} - -static void -paste_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - set_clock_cursor (gcal); - gnome_calendar_paste_clipboard (gcal); - set_normal_cursor (gcal); -} - -static void -delete_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - GnomeCalendar *gcal; - - gcal = GNOME_CALENDAR (data); - - set_clock_cursor (gcal); - gnome_calendar_delete_selection (gcal); - set_normal_cursor (gcal); -} - -static void -publish_freebusy_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path) -{ - GnomeCalendar *gcal; - CalClient *client; - GList *comp_list; - icaltimezone *utc; - time_t start = time (NULL), end; - - gcal = GNOME_CALENDAR (data); - - utc = icaltimezone_get_utc_timezone (); - start = time_day_begin_with_zone (start, utc); - end = time_add_week_with_zone (start, 6, utc); - - client = gnome_calendar_get_cal_client (gcal); - comp_list = cal_client_get_free_busy (client, NULL, start, end); - if (comp_list) { - GList *l; - - for (l = comp_list; l; l = l->next) { - CalComponent *comp = CAL_COMPONENT (l->data); - itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp, client, NULL); - - gtk_object_unref (GTK_OBJECT (comp)); - } - - g_list_free (comp_list); - } -} - -/* Does a queryInterface on the control's parent control frame for the ShellView interface */ -static GNOME_Evolution_ShellView -get_shell_view_interface (BonoboControl *control) -{ - Bonobo_ControlFrame control_frame; - GNOME_Evolution_ShellView shell_view; - CORBA_Environment ev; - - control_frame = bonobo_control_get_control_frame (control); - - g_assert (control_frame != CORBA_OBJECT_NIL); - - CORBA_exception_init (&ev); - shell_view = Bonobo_Unknown_queryInterface (control_frame, - "IDL:GNOME/Evolution/ShellView:1.0", - &ev); - if (BONOBO_EX (&ev)) { - g_message ("get_shell_view_interface(): " - "Could not queryInterface() on the control frame"); - shell_view = CORBA_OBJECT_NIL; - goto out; - } - - CORBA_exception_free (&ev); - - out: - - return shell_view; -} - -/* 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; - char buffer[512], end_buffer[256]; - GnomeCalendarViewType view; - - gnome_calendar_get_visible_time_range (gcal, &start_time, &end_time); - zone = gnome_calendar_get_timezone (gcal); - - start_tt = icaltime_from_timet_with_zone (start_time, FALSE, zone); - start_tm.tm_year = start_tt.year - 1900; - start_tm.tm_mon = start_tt.month - 1; - start_tm.tm_mday = start_tt.day; - start_tm.tm_hour = start_tt.hour; - start_tm.tm_min = start_tt.minute; - start_tm.tm_sec = start_tt.second; - start_tm.tm_isdst = -1; - start_tm.tm_wday = time_day_of_week (start_tt.day, start_tt.month - 1, - start_tt.year); - - /* Take one off end_time so we don't get an extra day. */ - end_tt = icaltime_from_timet_with_zone (end_time - 1, FALSE, zone); - end_tm.tm_year = end_tt.year - 1900; - end_tm.tm_mon = end_tt.month - 1; - end_tm.tm_mday = end_tt.day; - end_tm.tm_hour = end_tt.hour; - end_tm.tm_min = end_tt.minute; - end_tm.tm_sec = end_tt.second; - end_tm.tm_isdst = -1; - end_tm.tm_wday = time_day_of_week (end_tt.day, end_tt.month - 1, - end_tt.year); - - view = gnome_calendar_get_view (gcal); - - switch (view) { - case GNOME_CAL_DAY_VIEW: - case GNOME_CAL_WORK_WEEK_VIEW: - case GNOME_CAL_WEEK_VIEW: - if (start_tm.tm_year == end_tm.tm_year - && start_tm.tm_mon == end_tm.tm_mon - && start_tm.tm_mday == end_tm.tm_mday) { - strftime (buffer, sizeof (buffer), - _("%A %d %B %Y"), &start_tm); - } else if (start_tm.tm_year == end_tm.tm_year) { - strftime (buffer, sizeof (buffer), - _("%a %d %b"), &start_tm); - strftime (end_buffer, sizeof (end_buffer), - _("%a %d %b %Y"), &end_tm); - strcat (buffer, " - "); - strcat (buffer, end_buffer); - } else { - strftime (buffer, sizeof (buffer), - _("%a %d %b %Y"), &start_tm); - strftime (end_buffer, sizeof (end_buffer), - _("%a %d %b %Y"), &end_tm); - strcat (buffer, " - "); - strcat (buffer, end_buffer); - } - break; - case GNOME_CAL_MONTH_VIEW: - if (start_tm.tm_year == end_tm.tm_year) { - if (start_tm.tm_mon == end_tm.tm_mon) { - strftime (buffer, sizeof (buffer), - "%d", &start_tm); - strftime (end_buffer, sizeof (end_buffer), - _("%d %B %Y"), &end_tm); - strcat (buffer, " - "); - strcat (buffer, end_buffer); - } else { - strftime (buffer, sizeof (buffer), - _("%d %B"), &start_tm); - strftime (end_buffer, sizeof (end_buffer), - _("%d %B %Y"), &end_tm); - strcat (buffer, " - "); - strcat (buffer, end_buffer); - } - } else { - strftime (buffer, sizeof (buffer), - _("%d %B %Y"), &start_tm); - strftime (end_buffer, sizeof (end_buffer), - _("%d %B %Y"), &end_tm); - strcat (buffer, " - "); - strcat (buffer, end_buffer); - } - break; - default: - g_assert_not_reached (); - } - - control_util_set_folder_bar_label (control, buffer); -} - -void -control_util_set_folder_bar_label (BonoboControl *control, char *label) -{ - GNOME_Evolution_ShellView shell_view; - CORBA_Environment ev; - - shell_view = get_shell_view_interface (control); - if (shell_view == CORBA_OBJECT_NIL) - return; - - CORBA_exception_init (&ev); - GNOME_Evolution_ShellView_setFolderBarLabel (shell_view, label, &ev); - - if (BONOBO_EX (&ev)) - g_message ("control_util_set_folder_bar_label(): Could not set the folder bar label"); - - CORBA_exception_free (&ev); -} - -void -control_util_show_settings (GnomeCalendar *gcal) -{ - BonoboControl *control; - GNOME_Evolution_ShellView shell_view; - CORBA_Environment ev; - - control = gtk_object_get_data (GTK_OBJECT (gcal), "control"); - if (control == NULL) - return; - - shell_view = get_shell_view_interface (control); - if (shell_view == CORBA_OBJECT_NIL) - return; - - CORBA_exception_init (&ev); - - GNOME_Evolution_ShellView_showSettings (shell_view, &ev); - - if (BONOBO_EX (&ev)) - g_message ("control_util_show_settings(): Could not show settings"); - - CORBA_exception_free (&ev); -} - -/* Sensitizes the UI Component menu/toolbar calendar commands based on the - * number of selected events. (This will always be 0 or 1 currently.) If enable - * is FALSE, all will be disabled. Otherwise, the currently-selected number of - * events will be used. - */ -static void -sensitize_calendar_commands (GnomeCalendar *gcal, BonoboControl *control, gboolean enable) -{ - BonoboUIComponent *uic; - int n_selected; - gboolean read_only; - - 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 (gnome_calendar_get_cal_client (gcal)); - - bonobo_ui_component_set_prop (uic, "/commands/Cut", "sensitive", - n_selected == 0 || read_only ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/Copy", "sensitive", - n_selected == 0 ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/Paste", "sensitive", - enable && !read_only ? "1" : "0", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/Delete", "sensitive", - n_selected == 0 || read_only ? "0" : "1", - NULL); -} - -/* Sensitizes the UI Component menu/toolbar tasks commands based on the number - * of selected tasks. If enable is FALSE, all will be disabled. Otherwise, the - * currently-selected number of tasks will be used. - */ -static void -sensitize_taskpad_commands (GnomeCalendar *gcal, BonoboControl *control, gboolean enable) -{ - BonoboUIComponent *uic; - int n_selected; - gboolean read_only; - - 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)); - - bonobo_ui_component_set_prop (uic, "/commands/Cut", "sensitive", - n_selected == 0 || read_only ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/Copy", "sensitive", - n_selected == 0 ? "0" : "1", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/Paste", "sensitive", - enable && !read_only ? "1" : "0", - NULL); - bonobo_ui_component_set_prop (uic, "/commands/Delete", "sensitive", - n_selected == 0 || read_only ? "0" : "1", - NULL); -} - -/* Callback used when the dates shown by the GnomeCalendar are changed. - We want to update the dates in the folder bar. */ -static void -gcal_calendar_dates_change_cb (GnomeCalendar *gcal, gpointer data) -{ - BonoboControl *control; - - control = BONOBO_CONTROL (data); - - calendar_set_folder_bar_label (gcal, control); -} - -/* Callback used when the selection in the calendar views changes */ -static void -gcal_calendar_selection_changed_cb (GnomeCalendar *gcal, gpointer data) -{ - BonoboControl *control; - - control = BONOBO_CONTROL (data); - - sensitize_calendar_commands (gcal, control, TRUE); -} - -/* Callback used when the selection in the taskpad changes */ -static void -gcal_taskpad_selection_changed_cb (GnomeCalendar *gcal, gpointer data) -{ - BonoboControl *control; - - control = BONOBO_CONTROL (data); - - sensitize_taskpad_commands (gcal, control, TRUE); -} - -/* Callback used when the focus changes for a calendar view */ -static void -gcal_calendar_focus_change_cb (GnomeCalendar *gcal, gboolean in, gpointer data) -{ - BonoboControl *control; - FocusData *focus; - - control = BONOBO_CONTROL (data); - - focus = gtk_object_get_data (GTK_OBJECT (control), "focus_data"); - g_assert (focus != NULL); - - if (in) { - gtk_signal_connect (GTK_OBJECT (gcal), "calendar_selection_changed", - GTK_SIGNAL_FUNC (gcal_calendar_selection_changed_cb), control); - sensitize_calendar_commands (gcal, control, TRUE); - focus->calendar_focused = TRUE; - } else if (focus->calendar_focused) { - gtk_signal_disconnect_by_func (GTK_OBJECT (gcal), - GTK_SIGNAL_FUNC (gcal_calendar_selection_changed_cb), - control); - sensitize_calendar_commands (gcal, control, FALSE); - focus->calendar_focused = FALSE; - } -} - -/* Callback used when the taskpad focus changes */ -static void -gcal_taskpad_focus_change_cb (GnomeCalendar *gcal, gboolean in, gpointer data) -{ - BonoboControl *control; - FocusData *focus; - - control = BONOBO_CONTROL (data); - - focus = gtk_object_get_data (GTK_OBJECT (control), "focus_data"); - g_assert (focus != NULL); - - if (in) { - gtk_signal_connect (GTK_OBJECT (gcal), "taskpad_selection_changed", - GTK_SIGNAL_FUNC (gcal_taskpad_selection_changed_cb), control); - sensitize_taskpad_commands (gcal, control, TRUE); - focus->taskpad_focused = TRUE; - } else if (focus->taskpad_focused) { - /* With Bonobo controls, we may get unpaired focus_out events. - * That is why we have to keep track of this ourselves instead - * of blindly assumming that we are getting this event because - * the taskpad was in fact focused. - */ - gtk_signal_disconnect_by_func (GTK_OBJECT (gcal), - GTK_SIGNAL_FUNC (gcal_taskpad_selection_changed_cb), - control); - sensitize_taskpad_commands (gcal, control, FALSE); - focus->taskpad_focused = FALSE; - } - -} - - -static BonoboUIVerb verbs [] = { - BONOBO_UI_VERB ("CalendarPrint", file_print_cb), - BONOBO_UI_VERB ("CalendarPrintPreview", file_print_preview_cb), - - BONOBO_UI_VERB ("Cut", cut_cmd), - BONOBO_UI_VERB ("Copy", copy_cmd), - BONOBO_UI_VERB ("Paste", paste_cmd), - BONOBO_UI_VERB ("Delete", delete_cmd), - - BONOBO_UI_VERB ("CalendarPrev", previous_clicked), - BONOBO_UI_VERB ("CalendarToday", today_clicked), - BONOBO_UI_VERB ("CalendarNext", next_clicked), - BONOBO_UI_VERB ("CalendarGoto", goto_clicked), - - BONOBO_UI_VERB ("ShowDayView", show_day_view_clicked), - BONOBO_UI_VERB ("ShowWorkWeekView", show_work_week_view_clicked), - BONOBO_UI_VERB ("ShowWeekView", show_week_view_clicked), - BONOBO_UI_VERB ("ShowMonthView", show_month_view_clicked), - - BONOBO_UI_VERB ("PublishFreeBusy", publish_freebusy_cmd), - - BONOBO_UI_VERB_END -}; - -static EPixmap pixmaps [] = -{ - E_PIXMAP ("/menu/EditPlaceholder/Edit/Cut", "16_cut.png"), - E_PIXMAP ("/menu/EditPlaceholder/Edit/Copy", "16_copy.png"), - E_PIXMAP ("/menu/EditPlaceholder/Edit/Paste", "16_paste.png"), - E_PIXMAP ("/menu/EditPlaceholder/Edit/Delete", "evolution-trash-mini.png"), - E_PIXMAP ("/menu/File/Print/Print", "print.xpm"), - E_PIXMAP ("/menu/File/Print/PrintPreview", "print-preview.xpm"), - E_PIXMAP ("/menu/View/ViewBegin/Goto", "goto-16.png"), - - E_PIXMAP ("/Toolbar/Print", "buttons/print.png"), - E_PIXMAP ("/Toolbar/Delete", "buttons/delete-message.png"), - E_PIXMAP ("/Toolbar/Prev", "buttons/arrow-left-24.png"), - E_PIXMAP ("/Toolbar/Next", "buttons/arrow-right-24.png"), - E_PIXMAP ("/Toolbar/Goto", "buttons/goto-24.png"), - E_PIXMAP ("/Toolbar/DayView", "buttons/dayview.xpm"), - E_PIXMAP ("/Toolbar/WorkWeekView", "buttons/workweekview.xpm"), - E_PIXMAP ("/Toolbar/WeekView", "buttons/weekview.xpm"), - E_PIXMAP ("/Toolbar/MonthView", "buttons/monthview.xpm"), - - E_PIXMAP_END -}; - -void -calendar_control_activate (BonoboControl *control, - GnomeCalendar *gcal) -{ - Bonobo_UIContainer remote_uih; - BonoboUIComponent *uic; - FocusData *focus; - - uic = bonobo_control_get_ui_component (control); - g_assert (uic != NULL); - - remote_uih = bonobo_control_get_remote_ui_container (control); - bonobo_ui_component_set_container (uic, remote_uih); - bonobo_object_release_unref (remote_uih, NULL); - - gnome_calendar_set_ui_component (gcal, uic); - - bonobo_ui_component_add_verb_list_with_data (uic, verbs, gcal); - - bonobo_ui_component_freeze (uic, NULL); - - bonobo_ui_util_set_ui (uic, EVOLUTION_DATADIR, - "evolution-calendar.xml", - "evolution-calendar"); - - e_pixmaps_update (uic, pixmaps); - - gnome_calendar_setup_view_menus (gcal, uic); - - gtk_signal_connect (GTK_OBJECT (gcal), "dates_shown_changed", - GTK_SIGNAL_FUNC (gcal_calendar_dates_change_cb), - control); - gtk_signal_connect (GTK_OBJECT (gcal), "calendar_focus_change", - GTK_SIGNAL_FUNC (gcal_calendar_focus_change_cb), control); - gtk_signal_connect (GTK_OBJECT (gcal), "taskpad_focus_change", - GTK_SIGNAL_FUNC (gcal_taskpad_focus_change_cb), control); - - sensitize_calendar_commands (gcal, control, FALSE); - sensitize_taskpad_commands (gcal, control, FALSE); - - bonobo_ui_component_thaw (uic, NULL); - - /* Show the dialog for setting the timezone if the user hasn't chosen - a default timezone already. This is done in the startup wizard now, - so we don't do it here. */ -#if 0 - calendar_config_check_timezone_set (); -#endif - - calendar_set_folder_bar_label (gcal, control); - - focus = g_new (FocusData, 1); - focus->calendar_focused = FALSE; - focus->taskpad_focused = FALSE; - - gtk_object_set_data (GTK_OBJECT (control), "focus_data", focus); -} - -void -calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal) -{ - FocusData *focus; - BonoboUIComponent *uic; - - uic = bonobo_control_get_ui_component (control); - g_assert (uic != NULL); - - gnome_calendar_set_ui_component (gcal, uic); - - focus = gtk_object_get_data (GTK_OBJECT (control), "focus_data"); - g_assert (focus != NULL); - - gtk_object_remove_data (GTK_OBJECT (control), "focus_data"); - g_free (focus); - - gnome_calendar_discard_view_menus (gcal); - - gtk_signal_disconnect_by_data (GTK_OBJECT (gcal), control); - - bonobo_ui_component_rm (uic, "/", NULL); - bonobo_ui_component_unset_container (uic); -} - -/* Removes a calendar from our list of all calendars when it is destroyed. */ -static void -on_calendar_destroyed (GnomeCalendar *gcal) -{ - all_calendars = g_list_remove (all_calendars, gcal); -} - -GnomeCalendar * -new_calendar (void) -{ - GtkWidget *gcal; - - gcal = gnome_calendar_new (); - if (!gcal) { - gnome_warning_dialog (_("Could not create the calendar view. Please check your " - "ORBit and OAF setup.")); - return NULL; - } - - gtk_signal_connect (GTK_OBJECT (gcal), "destroy", - GTK_SIGNAL_FUNC (on_calendar_destroyed), NULL); - - all_calendars = g_list_prepend (all_calendars, gcal); - - return GNOME_CALENDAR (gcal); -} diff --git a/calendar/gui/calendar-commands.h b/calendar/gui/calendar-commands.h deleted file mode 100644 index 9ebac6eef4..0000000000 --- a/calendar/gui/calendar-commands.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Evolution calendar - Commands for the calendar GUI control - * - * Copyright (C) 1998 The Free Software Foundation - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Miguel de Icaza <miguel@ximian.com> - * Federico Mena-Quintero <federico@ximian.com> - * Seth Alves <alves@hungry.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CALENDAR_COMMANDS_H -#define CALENDAR_COMMANDS_H - -#include "gnome-cal.h" - -#include <bonobo/bonobo-control.h> -#include <bonobo/bonobo-ui-component.h> - -/* This tells all the calendars to reload the config settings. */ -void update_all_config_settings (void); - -GnomeCalendar *new_calendar (void); - -void calendar_control_activate (BonoboControl *control, GnomeCalendar *gcal); -void calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal); - -void calendar_goto_today (GnomeCalendar *gcal); - -void calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control); - -/* Used by calendar and tasks control to set the folder title bar label. */ -void control_util_set_folder_bar_label (BonoboControl *control, char *label); - -/* Used by calendar views and tasks to show the settings dialog */ -void control_util_show_settings (GnomeCalendar *gcal); - -#endif /* CALENDAR_COMMANDS_H */ diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c deleted file mode 100644 index aa33766260..0000000000 --- a/calendar/gui/calendar-component.c +++ /dev/null @@ -1,788 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* component-factory.c - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -#include <config.h> - -#include <errno.h> -#include <libgnomevfs/gnome-vfs-types.h> -#include <libgnomevfs/gnome-vfs-uri.h> -#include <libgnomevfs/gnome-vfs-ops.h> -#include <libgnomevfs/gnome-vfs-directory.h> -#include <libgnomevfs/gnome-vfs-file-info.h> - -#include <bonobo/bonobo-generic-factory.h> -#include <bonobo/bonobo-context.h> -#include <bonobo/bonobo-exception.h> -#include "evolution-shell-component.h" -#include "calendar-offline-handler.h" -#include "component-factory.h" -#include "tasks-control-factory.h" -#include "config-control-factory.h" -#include "control-factory.h" -#include "calendar-config.h" -#include "tasks-control.h" -#include "tasks-migrate.h" -#include "e-comp-editor-registry.h" -#include "dialogs/comp-editor.h" - - -/* OAFIID for the component. */ -#define COMPONENT_ID "OAFIID:GNOME_Evolution_Calendar_ShellComponent" - -/* Folder type IDs */ -#define FOLDER_CALENDAR "calendar" -#define FOLDER_TASKS "tasks" -#define FOLDER_PUBLIC_CALENDAR "calendar/public" -#define FOLDER_PUBLIC_TASKS "tasks/public" - -/* IDs for user creatable items */ -#define CREATE_EVENT_ID "event" -#define CREATE_ALLDAY_EVENT_ID "allday-event" -#define CREATE_MEETING_ID "meeting" -#define CREATE_TASK_ID "task" - -char *evolution_dir; -EvolutionShellClient *global_shell_client = NULL; -extern ECompEditorRegistry *comp_editor_registry; - -static const EvolutionShellComponentFolderType folder_types[] = { - { FOLDER_CALENDAR, - "evolution-calendar.png", - N_("Calendar"), - N_("Folder containing appointments and events"), - TRUE, NULL, NULL }, - { FOLDER_PUBLIC_CALENDAR, - "evolution-calendar.png", - N_("Public Calendar"), - N_("Public folder containing appointments and events"), - FALSE, NULL, NULL }, - { FOLDER_TASKS, - "evolution-tasks.png", - N_("Tasks"), - N_("Folder containing to-do items"), - TRUE, NULL, NULL }, - { FOLDER_PUBLIC_TASKS, - "evolution-tasks.png", - N_("Public Tasks"), - N_("Public folder containing to-do items"), - FALSE, NULL, NULL }, - { NULL, NULL } -}; - - - -static inline gboolean -type_is_calendar (const char *type) -{ - return !strcmp (type, FOLDER_CALENDAR) || - !strcmp (type, FOLDER_PUBLIC_CALENDAR); -} - -static inline gboolean -type_is_tasks (const char *type) -{ - return !strcmp (type, FOLDER_TASKS) || - !strcmp (type, FOLDER_PUBLIC_TASKS); -} - -/* EvolutionShellComponent methods and signals. */ - -static EvolutionShellComponentResult -create_view (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const char *view_info, - BonoboControl **control_return, - void *closure) -{ - BonoboControl *control; - - if (type_is_calendar (type)) { - control = control_factory_new_control (); - if (!control) - return EVOLUTION_SHELL_COMPONENT_CORBAERROR; - } else if (type_is_tasks (type)) { - control = tasks_control_new (); - if (!control) - return EVOLUTION_SHELL_COMPONENT_CORBAERROR; - } else { - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE; - } - - bonobo_control_set_property (control, "folder_uri", physical_uri, NULL); - if (type_is_calendar (type) && *view_info) - bonobo_control_set_property (control, "view", view_info, NULL); - - *control_return = control; - - return EVOLUTION_SHELL_COMPONENT_OK; -} - -static void -create_folder (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const GNOME_Evolution_ShellComponentListener listener, - void *closure) -{ - CORBA_Environment ev; - GnomeVFSURI *uri; - - CORBA_exception_init (&ev); - - if (!type_is_calendar (type) && !type_is_tasks (type)) { - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, - &ev); - CORBA_exception_free (&ev); - return; - } - - uri = gnome_vfs_uri_new (physical_uri); - if (uri) { - /* we don't need to do anything */ - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, - GNOME_Evolution_ShellComponentListener_OK, &ev); - gnome_vfs_uri_unref (uri); - } - else { - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, - GNOME_Evolution_ShellComponentListener_INVALID_URI, - &ev); - } - - CORBA_exception_free (&ev); -} - -/* Asks the alarm daemon to stop monitoring the specified URI */ -static void -stop_alarms (GnomeVFSURI *uri) -{ - char *str_uri; - CORBA_Environment ev; - GNOME_Evolution_Calendar_AlarmNotify an; - - /* Activate the alarm notification service */ - - CORBA_exception_init (&ev); - an = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify", 0, NULL, &ev); - - if (BONOBO_EX (&ev)) { - g_message ("stop_alarms(): Could not activate the alarm notification service"); - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); - - /* Ask the service to remove the URI from its list of calendars */ - - str_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE); - g_assert (str_uri != NULL); - - CORBA_exception_init (&ev); - GNOME_Evolution_Calendar_AlarmNotify_removeCalendar (an, str_uri, &ev); - g_free (str_uri); - - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI)) { - g_message ("stop_alarms(): Invalid URI reported from the alarm notification service"); - } else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_NotFound)) { - /* This is OK; the service may not have loaded that calendar */ - } else if (BONOBO_EX (&ev)) { - g_message ("stop_alarms(): Could not issue the removeCalendar request"); - } - - CORBA_exception_free (&ev); - - /* Get rid of the service */ - - CORBA_exception_init (&ev); - bonobo_object_release_unref (an, &ev); - if (BONOBO_EX (&ev)) - g_message ("stop_alarms(): Could not unref the alarm notification service"); - CORBA_exception_free (&ev); -} - -static void -remove_folder (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - const GNOME_Evolution_ShellComponentListener listener, - void *closure) -{ - GnomeVFSURI *dir_uri, *data_uri, *backup_uri; - GnomeVFSResult data_result, backup_result; - - /* check type */ - if (!type_is_calendar (type) && !type_is_tasks (type)) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, - &ev); - - if (BONOBO_EX (&ev)) - g_message ("remove_folder(): Could not notify the listener of " - "an unsupported folder type"); - - CORBA_exception_free (&ev); - return; - } - - /* check URI */ - dir_uri = gnome_vfs_uri_new (physical_uri); - if (!dir_uri) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, - GNOME_Evolution_ShellComponentListener_INVALID_URI, - &ev); - CORBA_exception_free (&ev); - return; - } - - /* Compute the URIs of the appropriate files */ - - if (type_is_calendar (type)) { - data_uri = gnome_vfs_uri_append_file_name (dir_uri, "calendar.ics"); - backup_uri = gnome_vfs_uri_append_file_name (dir_uri, "calendar.ics~"); - } else if (type_is_tasks (type)) { - data_uri = gnome_vfs_uri_append_file_name (dir_uri, "tasks.ics"); - backup_uri = gnome_vfs_uri_append_file_name (dir_uri, "tasks.ics~"); - } else { - g_assert_not_reached (); - return; - } - - if (!data_uri || !backup_uri) { - CORBA_Environment ev; - - g_message ("remove_folder(): Could not generate the data/backup URIs"); - - CORBA_exception_init (&ev); - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, - GNOME_Evolution_ShellComponentListener_INVALID_URI, - &ev); - - if (BONOBO_EX (&ev)) - g_message ("remove_folder(): Could not notify the listener " - "of an invalid URI"); - - CORBA_exception_free (&ev); - - goto out; - } - - /* Ask the alarm daemon to stop monitoring this URI */ - - stop_alarms (data_uri); - - /* Delete the data and backup files; the shell will take care of the rest */ - - data_result = gnome_vfs_unlink_from_uri (data_uri); - backup_result = gnome_vfs_unlink_from_uri (backup_uri); - - if ((data_result == GNOME_VFS_OK || data_result == GNOME_VFS_ERROR_NOT_FOUND) - && (backup_result == GNOME_VFS_OK || backup_result == GNOME_VFS_ERROR_NOT_FOUND)) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, - GNOME_Evolution_ShellComponentListener_OK, - &ev); - - if (BONOBO_EX (&ev)) - g_message ("remove_folder(): Could not notify the listener about success"); - - CORBA_exception_free (&ev); - } else { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, - GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED, - &ev); - - if (BONOBO_EX (&ev)) - g_message ("remove_folder(): Could not notify the listener about failure"); - - CORBA_exception_free (&ev); - } - - out: - - gnome_vfs_uri_unref (dir_uri); - - if (data_uri) - gnome_vfs_uri_unref (data_uri); - - if (backup_uri) - gnome_vfs_uri_unref (backup_uri); -} - -static GNOME_Evolution_ShellComponentListener_Result -xfer_file (GnomeVFSURI *base_src_uri, - GnomeVFSURI *base_dest_uri, - const char *file_name, - int remove_source) -{ - GnomeVFSURI *src_uri, *dest_uri; - GnomeVFSHandle *hin, *hout; - GnomeVFSResult result; - GnomeVFSFileInfo file_info; - GnomeVFSFileSize size; - char *buffer; - - src_uri = gnome_vfs_uri_append_file_name (base_src_uri, file_name); - - result = gnome_vfs_open_uri (&hin, src_uri, GNOME_VFS_OPEN_READ); - if (result == GNOME_VFS_ERROR_NOT_FOUND) { - gnome_vfs_uri_unref (src_uri); - return GNOME_Evolution_ShellComponentListener_OK; /* No need to xfer anything. */ - } - if (result != GNOME_VFS_OK) { - gnome_vfs_uri_unref (src_uri); - return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED; - } - - result = gnome_vfs_get_file_info_uri (src_uri, &file_info, GNOME_VFS_FILE_INFO_DEFAULT); - if (result != GNOME_VFS_OK) { - gnome_vfs_uri_unref (src_uri); - return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED; - } - - dest_uri = gnome_vfs_uri_append_file_name (base_dest_uri, file_name); - - result = gnome_vfs_create_uri (&hout, dest_uri, GNOME_VFS_OPEN_WRITE, FALSE, 0600); - if (result != GNOME_VFS_OK) { - gnome_vfs_close (hin); - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED; - } - - /* write source file to destination file */ - buffer = g_malloc (file_info.size); - result = gnome_vfs_read (hin, buffer, file_info.size, &size); - if (result != GNOME_VFS_OK) { - gnome_vfs_close (hin); - gnome_vfs_close (hout); - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - g_free (buffer); - return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED; - } - - result = gnome_vfs_write (hout, buffer, file_info.size, &size); - if (result != GNOME_VFS_OK) { - gnome_vfs_close (hin); - gnome_vfs_close (hout); - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - g_free (buffer); - return GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED; - } - - if (remove_source) { - char *text_uri; - - /* Sigh, we have to do this as there is no gnome_vfs_unlink_uri(). :-( */ - - text_uri = gnome_vfs_uri_to_string (src_uri, GNOME_VFS_URI_HIDE_NONE); - result = gnome_vfs_unlink (text_uri); - g_free (text_uri); - } - - gnome_vfs_close (hin); - gnome_vfs_close (hout); - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - g_free (buffer); - - return GNOME_Evolution_ShellComponentListener_OK; -} - -static void -xfer_folder (EvolutionShellComponent *shell_component, - const char *source_physical_uri, - const char *destination_physical_uri, - const char *type, - gboolean remove_source, - const GNOME_Evolution_ShellComponentListener listener, - void *closure) -{ - CORBA_Environment ev; - GnomeVFSURI *src_uri; - GnomeVFSURI *dest_uri; - GnomeVFSResult result; - char *filename, *backup_filename; - - CORBA_exception_init (&ev); - - /* check type */ - if (!type_is_calendar (type) && !type_is_tasks (type)) { - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, - GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, - &ev); - CORBA_exception_free (&ev); - return; - } - - /* check URIs */ - src_uri = gnome_vfs_uri_new (source_physical_uri); - dest_uri = gnome_vfs_uri_new (destination_physical_uri); - if (!src_uri || ! dest_uri) { - GNOME_Evolution_ShellComponentListener_notifyResult ( - listener, - GNOME_Evolution_ShellComponentListener_INVALID_URI, - &ev); - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - CORBA_exception_free (&ev); - return; - } - - if (type_is_calendar (type)) { - filename = "calendar.ics"; - backup_filename = "calendar.ics~"; - } else if (type_is_tasks (type)) { - filename = "tasks.ics"; - backup_filename = "tasks.ics~"; - } else { - g_assert_not_reached (); - return; - } - - result = xfer_file (src_uri, dest_uri, filename, remove_source); - if (result == GNOME_Evolution_ShellComponentListener_OK) - result = xfer_file (src_uri, dest_uri, backup_filename, remove_source); - - GNOME_Evolution_ShellComponentListener_notifyResult (listener, result, &ev); - - gnome_vfs_uri_unref (src_uri); - gnome_vfs_uri_unref (dest_uri); - - CORBA_exception_free (&ev); -} - -static gboolean -request_quit (EvolutionShellComponent *shell_component, void *closure) -{ - return e_comp_editor_registry_close_all (comp_editor_registry); -} - -static GList *shells = NULL; - -static void -owner_set_cb (EvolutionShellComponent *shell_component, - EvolutionShellClient *shell_client, - const char *evolution_homedir, - gpointer user_data) -{ - static gboolean migrated = FALSE; - - evolution_dir = g_strdup (evolution_homedir); - - if (!migrated) { - tasks_migrate (); - migrated = TRUE; - } - - shells = g_list_append (shells, shell_component); - - global_shell_client = shell_client; - - config_control_factory_register (bonobo_object_corba_objref (BONOBO_OBJECT (shell_client))); -} - -static void -owner_unset_cb (EvolutionShellComponent *shell_component, - gpointer user_data) -{ - shells = g_list_remove (shells, shell_component); - - if (g_list_length (shells) == 0) - gtk_main_quit (); -} - -/* Computes the final URI for a calendar component */ -static char * -get_data_uri (const char *uri, CalComponentVType vtype) -{ - if (uri) { - if (*uri != '/' && strncmp (uri, "file:", 5) != 0) - return g_strdup (uri); - - if (vtype == CAL_COMPONENT_EVENT) - return cal_util_expand_uri ((char *) uri, FALSE); - else if (vtype == CAL_COMPONENT_TODO) - return cal_util_expand_uri ((char *) uri, TRUE); - else - g_assert_not_reached (); - } else { - if (vtype == CAL_COMPONENT_EVENT) - return g_concat_dir_and_file (g_get_home_dir (), - "evolution/local/Calendar/calendar.ics"); - else if (vtype == CAL_COMPONENT_TODO) - return g_concat_dir_and_file (g_get_home_dir (), - "evolution/local/Tasks/tasks.ics"); - else - g_assert_not_reached (); - } - - return NULL; -} - -/* Creates a calendar component at a specified URI. If the URI is NULL then it - * uses the default folder for that type of component. - */ -static void -create_component (const char *uri, GNOME_Evolution_Calendar_CompEditorFactory_CompEditorMode type) -{ - char *real_uri; - CORBA_Environment ev; - GNOME_Evolution_Calendar_CompEditorFactory factory; - CalComponentVType vtype; - - switch (type) { - case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT: - case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT: - case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING: - vtype = CAL_COMPONENT_EVENT; - break; - case GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO: - vtype = CAL_COMPONENT_TODO; - break; - default: - g_assert_not_reached (); - return; - } - - real_uri = get_data_uri (uri, vtype); - - /* Get the factory */ - - CORBA_exception_init (&ev); - factory = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_CompEditorFactory", - 0, NULL, &ev); - - if (BONOBO_EX (&ev)) { - g_message ("create_component(): Could not activate the component editor factory"); - CORBA_exception_free (&ev); - g_free (real_uri); - return; - } - CORBA_exception_free (&ev); - - /* Create the item */ - - CORBA_exception_init (&ev); - GNOME_Evolution_Calendar_CompEditorFactory_editNew (factory, real_uri, type, &ev); - - if (BONOBO_EX (&ev)) - g_message ("create_component(): Exception while creating the component"); - - CORBA_exception_free (&ev); - g_free (real_uri); - - /* Get rid of the factory */ - - CORBA_exception_init (&ev); - bonobo_object_release_unref (factory, &ev); - if (BONOBO_EX (&ev)) - g_message ("create_component(): Could not unref the calendar component factory"); - - CORBA_exception_free (&ev); -} - -/* Callback used when we must create a user-creatable item */ -static void -sc_user_create_new_item_cb (EvolutionShellComponent *shell_component, - const char *id, - const char *parent_folder_physical_uri, - const char *parent_folder_type) -{ - char *tmp_uri; - - if (strcmp (id, CREATE_EVENT_ID) == 0) { - if (type_is_calendar (parent_folder_type)) - create_component (parent_folder_physical_uri, - GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT); - else { - tmp_uri = calendar_config_default_calendar_folder (); - create_component (tmp_uri, - GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_EVENT); - g_free (tmp_uri); - } - } else if (strcmp (id, CREATE_ALLDAY_EVENT_ID) == 0) { - if (type_is_calendar (parent_folder_type)) - create_component (parent_folder_physical_uri, - GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT); - else { - tmp_uri = calendar_config_default_calendar_folder (); - create_component (tmp_uri, - GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_ALLDAY_EVENT); - g_free (tmp_uri); - } - } else if (strcmp (id, CREATE_MEETING_ID) == 0) { - if (type_is_calendar (parent_folder_type)) - create_component (parent_folder_physical_uri, - GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING); - else { - tmp_uri = calendar_config_default_calendar_folder (); - create_component (tmp_uri, - GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_MEETING); - g_free (tmp_uri); - } - } else if (strcmp (id, CREATE_TASK_ID) == 0) { - if (type_is_tasks (parent_folder_type)) - create_component (parent_folder_physical_uri, - GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO); - else { - tmp_uri = calendar_config_default_tasks_folder (); - create_component (tmp_uri, - GNOME_Evolution_Calendar_CompEditorFactory_EDITOR_MODE_TODO); - g_free (tmp_uri); - } - } else - g_assert_not_reached (); -} - - -/* The factory function. */ - -static void -add_creatable_item (EvolutionShellComponent *shell_component, - const char *id, - const char *description, - const char *menu_description, - const char *tooltip, - const char *folder_type, - char menu_shortcut, - const char *icon_name) -{ - char *icon_path; - GdkPixbuf *icon; - - if (icon_name == NULL) { - icon_path = NULL; - icon = NULL; - } else { - icon_path = g_concat_dir_and_file (EVOLUTION_ICONSDIR, icon_name); - icon = gdk_pixbuf_new_from_file (icon_path); - } - - evolution_shell_component_add_user_creatable_item (shell_component, - id, - description, - menu_description, - tooltip, - folder_type, - menu_shortcut, - icon); - - if (icon != NULL) - gdk_pixbuf_unref (icon); - g_free (icon_path); -} - -static BonoboObject * -create_object (void) -{ - EvolutionShellComponent *shell_component; - CalendarOfflineHandler *offline_handler; - - shell_component = evolution_shell_component_new (folder_types, - NULL, - create_view, - create_folder, - remove_folder, - xfer_folder, - NULL, /* populate_folder_context_menu_fn */ - NULL, /* unpopulate_folder_context_menu_fn */ - NULL, /* get_dnd_selection_fn */ - request_quit, - NULL /* closure */); - - /* Offline handler */ - offline_handler = calendar_offline_handler_new (); - bonobo_object_add_interface (BONOBO_OBJECT (shell_component), - BONOBO_OBJECT (offline_handler)); - - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set", - GTK_SIGNAL_FUNC (owner_set_cb), NULL); - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset", - GTK_SIGNAL_FUNC (owner_unset_cb), NULL); - - /* User creatable items */ - - add_creatable_item (shell_component, CREATE_EVENT_ID, - _("New appointment"), _("_Appointment"), - _("Create a new appointment"), - FOLDER_CALENDAR, 'a', "new_appointment.xpm"); - - add_creatable_item (shell_component, CREATE_MEETING_ID, - _("New meeting"), _("_Meeting"), - _("Create a new meeting request"), - FOLDER_CALENDAR, 's', "meeting-request-16.png"); - - add_creatable_item (shell_component, CREATE_TASK_ID, - _("New task"), _("_Task"), - _("Create a new task"), - FOLDER_TASKS, 't', "new_task-16.png"); - - add_creatable_item (shell_component, CREATE_ALLDAY_EVENT_ID, - _("New All Day Appointment"), _("All _Day Appointment"), - _("Create a new all-day appointment"), - FOLDER_CALENDAR, 'd', "new_all_day_event.png"); - - gtk_signal_connect (GTK_OBJECT (shell_component), "user_create_new_item", - GTK_SIGNAL_FUNC (sc_user_create_new_item_cb), NULL); - - return BONOBO_OBJECT (shell_component); -} - - -void -component_factory_init (void) -{ - BonoboObject *object; - int result; - - object = create_object (); - - result = oaf_active_server_register (COMPONENT_ID, bonobo_object_corba_objref (object)); - - if (result == OAF_REG_ERROR) - g_error ("Cannot initialize Evolution's calendar component."); -} diff --git a/calendar/gui/calendar-component.h b/calendar/gui/calendar-component.h deleted file mode 100644 index 576255cb6d..0000000000 --- a/calendar/gui/calendar-component.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* component-factory.h - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -#ifndef _COMPONENT_FACTORY_H_ -#define _COMPONENT_FACTORY_H_ - -extern char *evolution_dir; - -void component_factory_init (void); - -#endif /* _COMPONENT_FACTORY_H_ */ diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c deleted file mode 100644 index 1d52799787..0000000000 --- a/calendar/gui/calendar-config.c +++ /dev/null @@ -1,958 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Authors : - * Damon Chaplin <damon@ximian.com> - * Rodrigo Moya <rodrigo@ximian.com> - * - * Copyright 2000, Ximian, Inc. - * Copyright 2000, Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * calendar-config.c - functions to load/save/get/set user settings. - */ - -#include <config.h> -#include <time.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-config.h> -#include <libgnomeui/gnome-dialog.h> -#include <widgets/e-timezone-dialog/e-timezone-dialog.h> -#include <cal-util/timeutil.h> -#include "component-factory.h" -#include "calendar-commands.h" -#include "e-tasks.h" -#include "e-cell-date-edit-text.h" -#include "calendar-config.h" -#include "e-util/e-config-listener.h" - - -static EConfigListener *config = NULL; - -static void on_timezone_set (GnomeDialog *dialog, - int button, - ETimezoneDialog *etd); -static gboolean on_timezone_dialog_delete_event (GnomeDialog *dialog, - GdkEvent *event, - ETimezoneDialog *etd); - -static void -do_cleanup (void) -{ - gtk_object_unref (GTK_OBJECT (config)); - config = NULL; -} - -void -calendar_config_init (void) -{ - if (config) - return; - - config = e_config_listener_new (); - g_atexit ((GVoidFunc) do_cleanup); -} - -/* Returns TRUE if the locale has 'am' and 'pm' strings defined, in which - case the user can choose between 12 and 24-hour time formats. */ -gboolean -calendar_config_locale_supports_12_hour_format (void) -{ - char s[16]; - time_t t = 0; - - strftime (s, sizeof s, "%p", gmtime (&t)); - return s[0] != '\0'; -} - -/* Returns the string representation of a units value */ -static const char * -units_to_string (CalUnits units) -{ - switch (units) { - case CAL_DAYS: - return "days"; - - case CAL_HOURS: - return "hours"; - - case CAL_MINUTES: - return "minutes"; - - default: - g_assert_not_reached (); - return NULL; - } -} - -/* - * Calendar Settings. - */ - -/* The current timezone, e.g. "Europe/London". It may be NULL, in which case - you should assume UTC (though Evolution will show the timezone-setting - dialog the next time a calendar or task folder is selected). */ -gchar* -calendar_config_get_timezone (void) -{ - static char *timezone = NULL; - - if (timezone) - g_free (timezone); - - timezone = e_config_listener_get_string_with_default (config, - "/apps/Evolution/Calendar/Display/Timezone", - "UTC", NULL); - if (!timezone) - timezone = g_strdup ("UTC"); - - return timezone; -} - - -/* Sets the timezone. If set to NULL it defaults to UTC. - FIXME: Should check it is being set to a valid timezone. */ -void -calendar_config_set_timezone (gchar *timezone) -{ - if (timezone && timezone[0]) - e_config_listener_set_string (config, "/apps/Evolution/Calendar/Display/Timezone", timezone); - else - e_config_listener_set_string (config, "/apps/Evolution/Calendar/Display/Timezone", "UTC"); -} - - -/* Whether we use 24-hour format or 12-hour format (AM/PM). */ -gboolean -calendar_config_get_24_hour_format (void) -{ - /* If the locale defines 'am' and 'pm' strings then the user has the - choice of 12-hour or 24-hour time format, with 12-hour as the - default. If the locale doesn't have 'am' and 'pm' strings we have - to use 24-hour format, or strftime()/strptime() won't work. */ - if (calendar_config_locale_supports_12_hour_format ()) { - return e_config_listener_get_boolean_with_default ( - config, "/apps/Evolution/Calendar/Display/Use24HourFormat", FALSE, NULL); - } - - return TRUE; -} - - -void -calendar_config_set_24_hour_format (gboolean use_24_hour) -{ - e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Display/Use24HourFormat", use_24_hour); -} - - -/* The start day of the week (0 = Sun to 6 = Mon). */ -gint -calendar_config_get_week_start_day (void) -{ - return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/WeekStartDay", 1, NULL); -} - - -void -calendar_config_set_week_start_day (gint week_start_day) -{ - e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/WeekStartDay", week_start_day); -} - - -/* The start and end times of the work-day. */ -gint -calendar_config_get_day_start_hour (void) -{ - return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/DayStartHour", 9, NULL); -} - - -void -calendar_config_set_day_start_hour (gint day_start_hour) -{ - e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/DayStartHour", day_start_hour); -} - - -gint -calendar_config_get_day_start_minute (void) -{ - return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/DayStartMinute", 0, NULL); -} - - -void -calendar_config_set_day_start_minute (gint day_start_min) -{ - e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/DayStartMinute", day_start_min); -} - - -gint -calendar_config_get_day_end_hour (void) -{ - return e_config_listener_get_long_with_default (config, "/Calendar/Display/DayEndHour", 17, NULL); -} - - -void -calendar_config_set_day_end_hour (gint day_end_hour) -{ - e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/DayEndHour", day_end_hour); -} - - -gint -calendar_config_get_day_end_minute (void) -{ - return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/DayEndMinute", 0, NULL); -} - - -void -calendar_config_set_day_end_minute (gint day_end_min) -{ - e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/DayEndMinute", day_end_min); -} - - -/* The time divisions in the Day/Work-Week view in minutes (5/10/15/30/60). */ -gint -calendar_config_get_time_divisions (void) -{ - return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/TimeDivisions", 30, NULL); -} - - -void -calendar_config_set_time_divisions (gint divisions) -{ - e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/TimeDivisions", divisions); -} - - -/* Whether we show week numbers in the Date Navigator. */ -gboolean -calendar_config_get_dnav_show_week_no (void) -{ - return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/DateNavigator/ShowWeekNumbers", FALSE, NULL); -} - - -void -calendar_config_set_dnav_show_week_no (gboolean show_week_no) -{ - e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/DateNavigator/ShowWeekNumbers", show_week_no); -} - - -/* The view to show on start-up, 0 = Day, 1 = WorkWeek, 2 = Week, 3 = Month. */ -gint -calendar_config_get_default_view (void) -{ - return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Display/View", 0, NULL); -} - - -void -calendar_config_set_default_view (gint view) -{ - e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/View", view); -} - - -/* The positions of the panes in the normal and month views. */ -gfloat -calendar_config_get_hpane_pos (void) -{ - return e_config_listener_get_float_with_default (config, - "/apps/Evolution/Calendar/Display/HPanePosition", - 1.0, NULL); -} - - -void -calendar_config_set_hpane_pos (gfloat hpane_pos) -{ - e_config_listener_set_float (config, "/apps/Evolution/Calendar/Display/HPanePosition", hpane_pos); -} - - -gfloat -calendar_config_get_vpane_pos (void) -{ - return e_config_listener_get_float_with_default (config, "/apps/Evolution/Calendar/Display/VPanePosition", 1.0, NULL); -} - - -void -calendar_config_set_vpane_pos (gfloat vpane_pos) -{ - e_config_listener_set_float (config, "/apps/Evolution/Calendar/Display/VPanePosition", vpane_pos); -} - - -gfloat -calendar_config_get_month_hpane_pos (void) -{ - return e_config_listener_get_float_with_default (config, "/apps/Evolution/Calendar/Display/MonthHPanePosition", 0.0, NULL); -} - - -void -calendar_config_set_month_hpane_pos (gfloat hpane_pos) -{ - e_config_listener_set_float (config, "/apps/Evolution/Calendar/Display/MonthHPanePosition", hpane_pos); -} - - -gfloat -calendar_config_get_month_vpane_pos (void) -{ - return e_config_listener_get_float_with_default (config, "/apps/Evolution/Calendar/Display/MonthVPanePosition", 1.0, NULL); -} - - -void -calendar_config_set_month_vpane_pos (gfloat vpane_pos) -{ - e_config_listener_set_float (config, "/apps/Evolution/Calendar/Display/MonthVPanePosition", vpane_pos); -} - - -/* Whether we compress the weekend in the week/month views. */ -gboolean -calendar_config_get_compress_weekend (void) -{ - return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Display/CompressWeekend", TRUE, NULL); -} - - -void -calendar_config_set_compress_weekend (gboolean compress) -{ - e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Display/CompressWeekend", compress); -} - - -/* Whether we show event end times. */ -gboolean -calendar_config_get_show_event_end (void) -{ - return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Display/ShowEventEndTime", TRUE, NULL); -} - - -void -calendar_config_set_show_event_end (gboolean show_end) -{ - e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Display/ShowEventEndTime", show_end); -} - - -/* The working days of the week, a bit-wise combination of flags. */ -CalWeekdays -calendar_config_get_working_days (void) -{ - return e_config_listener_get_long_with_default (config, - "/Calendar/Display/WorkingDays", CAL_MONDAY | CAL_TUESDAY | - CAL_WEDNESDAY | CAL_THURSDAY | CAL_FRIDAY, NULL); -} - - -void -calendar_config_set_working_days (CalWeekdays days) -{ - e_config_listener_set_long (config, "/apps/Evolution/Calendar/Display/WorkingDays", days); -} - - -/* Settings to hide completed tasks. */ -gboolean -calendar_config_get_hide_completed_tasks (void) -{ - return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasks", FALSE, NULL); -} - - -void -calendar_config_set_hide_completed_tasks (gboolean hide) -{ - e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasks", hide); -} - - -CalUnits -calendar_config_get_hide_completed_tasks_units (void) -{ - char *units; - CalUnits cu; - - units = e_config_listener_get_string_with_default (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasksUnits", "days", NULL); - - if (!strcmp (units, "minutes")) - cu = CAL_MINUTES; - else if (!strcmp (units, "hours")) - cu = CAL_HOURS; - else - cu = CAL_DAYS; - - g_free (units); - - return cu; -} - - -void -calendar_config_set_hide_completed_tasks_units (CalUnits cu) -{ - char *units; - - switch (cu) { - case CAL_MINUTES : - units = g_strdup ("minutes"); - break; - case CAL_HOURS : - units = g_strdup ("hours"); - break; - default : - units = g_strdup ("days"); - } - - e_config_listener_set_string (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasksUnits", units); - - g_free (units); -} - - -gint -calendar_config_get_hide_completed_tasks_value (void) -{ - return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasksValue", 1, NULL); -} - - -void -calendar_config_set_hide_completed_tasks_value (gint value) -{ - e_config_listener_set_long (config, "/apps/Evolution/Calendar/Tasks/HideCompletedTasksValue", value); -} - -/** - * calendar_config_get_confirm_delete: - * - * Queries the configuration value for whether a confirmation dialog is - * presented when deleting calendar/tasks items. - * - * Return value: Whether confirmation is required when deleting items. - **/ -gboolean -calendar_config_get_confirm_delete (void) -{ - return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Other/ConfirmDelete", TRUE, NULL); -} - -/** - * calendar_config_set_confirm_delete: - * @confirm: Whether confirmation is required when deleting items. - * - * Sets the configuration value for whether a confirmation dialog is presented - * when deleting calendar/tasks items. - **/ -void -calendar_config_set_confirm_delete (gboolean confirm) -{ - e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Other/ConfirmDelete", confirm); -} - -/** - * calendar_config_get_confirm_expunge: - * - * Queries the configuration value for whether a confirmation dialog is - * presented when expunging calendar/tasks items. - * - * Return value: Whether confirmation is required when expunging items. - **/ -gboolean -calendar_config_get_confirm_expunge (void) -{ - return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Other/ConfirmExpunge", TRUE, NULL); -} - -/** - * calendar_config_set_confirm_expunge: - * @confirm: Whether confirmation is required when expunging items. - * - * Sets the configuration value for whether a confirmation dialog is presented - * when expunging calendar/tasks items. - **/ -void -calendar_config_set_confirm_expunge (gboolean confirm) -{ - e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Other/ConfirmExpunge", confirm); -} - -/* This sets all the common config settings for an ECalendar widget. - These are the week start day, and whether we show week numbers. */ -void -calendar_config_configure_e_calendar (ECalendar *cal) -{ - gboolean dnav_show_week_no; - gint week_start_day; - - g_return_if_fail (E_IS_CALENDAR (cal)); - - dnav_show_week_no = calendar_config_get_dnav_show_week_no (); - - /* Note that this is 0 (Sun) to 6 (Sat). */ - week_start_day = calendar_config_get_week_start_day (); - - /* Convert it to 0 (Mon) to 6 (Sun), which is what we use. */ - week_start_day = (week_start_day + 6) % 7; - - gnome_canvas_item_set (GNOME_CANVAS_ITEM (cal->calitem), - "show_week_numbers", dnav_show_week_no, - "week_start_day", week_start_day, - NULL); -} - - -/* This sets all the common config settings for an EDateEdit widget. - These are the week start day, whether we show week numbers, and whether we - use 24 hour format. */ -void -calendar_config_configure_e_date_edit (EDateEdit *dedit) -{ - gboolean dnav_show_week_no, use_24_hour; - gint week_start_day; - - g_return_if_fail (E_IS_DATE_EDIT (dedit)); - - dnav_show_week_no = calendar_config_get_dnav_show_week_no (); - - /* Note that this is 0 (Sun) to 6 (Sat). */ - week_start_day = calendar_config_get_week_start_day (); - - /* Convert it to 0 (Mon) to 6 (Sun), which is what we use. */ - week_start_day = (week_start_day + 6) % 7; - - use_24_hour = calendar_config_get_24_hour_format (); - - e_date_edit_set_week_start_day (dedit, week_start_day); - e_date_edit_set_show_week_numbers (dedit, dnav_show_week_no); - e_date_edit_set_use_24_hour_format (dedit, use_24_hour); -} - - -/* This sets all the common config settings for an ECellDateEdit ETable item. - These are the settings for the ECalendar popup and the time list (if we use - 24 hour format, and the hours of the working day). */ -void -calendar_config_configure_e_cell_date_edit (ECellDateEdit *ecde) -{ - gboolean use_24_hour; - gint start_hour, end_hour; - ECellPopup *ecp; - ECellDateEditText *ecd; - char *location; - icaltimezone *zone; - - g_return_if_fail (E_IS_CELL_DATE_EDIT (ecde)); - - ecp = E_CELL_POPUP (ecde); - ecd = E_CELL_DATE_EDIT_TEXT (ecp->child); - - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - - calendar_config_configure_e_calendar (E_CALENDAR (ecde->calendar)); - - use_24_hour = calendar_config_get_24_hour_format (); - - start_hour = calendar_config_get_day_start_hour (); - end_hour = calendar_config_get_day_end_hour (); - - /* Round up the end hour. */ - if (calendar_config_get_day_end_minute () != 0) - end_hour++; - - e_cell_date_edit_freeze (ecde); - gtk_object_set (GTK_OBJECT (ecde), - "use_24_hour_format", use_24_hour, -#if 0 - /* We use the default 0 - 24 now. */ - "lower_hour", start_hour, - "upper_hour", end_hour, -#endif - NULL); - e_cell_date_edit_thaw (ecde); - - e_cell_date_edit_text_set_timezone (ecd, zone); - e_cell_date_edit_text_set_use_24_hour_format (ecd, use_24_hour); -} - - -/* This sets all the common config settings for an ECalendarTable widget. - These are the settings for the ECalendar popup and the time list (if we use - 24 hour format, and the hours of the working day). */ -void -calendar_config_configure_e_calendar_table (ECalendarTable *cal_table) -{ - CalendarModel *model; - gboolean use_24_hour; - char *location; - icaltimezone *zone; - - g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); - - use_24_hour = calendar_config_get_24_hour_format (); - - model = e_calendar_table_get_model (cal_table); - calendar_model_set_use_24_hour_format (model, use_24_hour); - - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - calendar_model_set_timezone (model, zone); - - calendar_config_configure_e_cell_date_edit (cal_table->dates_cell); - - /* Reload the event/tasks, since the 'Hide Completed Tasks' option - may have been changed, so the query needs to be updated. */ - calendar_model_refresh (model); -} - - - -void -calendar_config_check_timezone_set () -{ - ETimezoneDialog *timezone_dialog; - GtkWidget *dialog; - GList *elem; - char *zone; - - zone = calendar_config_get_timezone (); - if (zone && zone[0]) - return; - - /* Show timezone dialog. */ - timezone_dialog = e_timezone_dialog_new (); - dialog = e_timezone_dialog_get_toplevel (timezone_dialog); - - /* Hide the cancel button, which is the 2nd button. */ - elem = g_list_nth (GNOME_DIALOG (dialog)->buttons, 1); - gtk_widget_hide (elem->data); - - gtk_signal_connect (GTK_OBJECT (dialog), "clicked", - GTK_SIGNAL_FUNC (on_timezone_set), - timezone_dialog); - gtk_signal_connect (GTK_OBJECT (dialog), "delete-event", - GTK_SIGNAL_FUNC (on_timezone_dialog_delete_event), - timezone_dialog); - - gtk_widget_show (dialog); -} - - -static void -on_timezone_set (GnomeDialog *dialog, - int button, - ETimezoneDialog *etd) -{ - char *display_name; - icaltimezone *zone; - - e_timezone_dialog_get_timezone (etd, &display_name); - - /* We know it can only be a builtin timezone, since there is no way - to set it to anything else. */ - zone = e_timezone_dialog_get_builtin_timezone (display_name); - if (zone) { - calendar_config_set_timezone (icaltimezone_get_location (zone)); - - update_all_config_settings (); - e_tasks_update_all_config_settings (); - } - - gtk_object_unref (GTK_OBJECT (etd)); -} - - -static gboolean -on_timezone_dialog_delete_event (GnomeDialog *dialog, - GdkEvent *event, - ETimezoneDialog *etd) -{ - gtk_object_unref (GTK_OBJECT (etd)); - return TRUE; -} - - -/** - * calendar_config_get_tasks_due_today_color: - * - * Queries the color to be used to display tasks that are due today. - * - * Return value: An X color specification. - **/ -const char * -calendar_config_get_tasks_due_today_color (void) -{ - static char *color = NULL; - - if (color) - g_free (color); - - color = e_config_listener_get_string_with_default (config, "/apps/Evolution/Calendar/Tasks/Colors/TasksDueToday", "blue", NULL); - return color; -} - -/** - * calendar_config_set_tasks_due_today_color: - * @color: X color specification - * - * Sets the color to be used to display tasks that are due today. - **/ -void -calendar_config_set_tasks_due_today_color (const char *color) -{ - g_return_if_fail (color != NULL); - - e_config_listener_set_string (config, "/apps/Evolution/Calendar/Tasks/Colors/TasksDueToday", color); -} - -/** - * calendar_config_get_tasks_overdue_color: - * - * Queries the color to be used to display overdue tasks. - * - * Return value: An X color specification. - **/ -const char * -calendar_config_get_tasks_overdue_color (void) -{ - static char *color = NULL; - - if (color) - g_free (color); - - color = e_config_listener_get_string_with_default (config, "/apps/Evolution/Calendar/Tasks/Colors/TasksOverdue", "red", NULL); - return color; -} - -/** - * calendar_config_set_tasks_overdue_color: - * @color: X color specification - * - * Sets the color to be used to display overdue tasks. - **/ -void -calendar_config_set_tasks_overdue_color (const char *color) -{ - g_return_if_fail (color != NULL); - - e_config_listener_set_string (config, "/apps/Evolution/Calendar/Tasks/Colors/TasksOverdue", color); -} - -/** - * calendar_config_get_use_default_reminder: - * - * Queries whether new appointments should be created with a default reminder. - * - * Return value: Boolean value indicating whether new appointments should be - * created with a default reminder from the values of - * calendar_config_get_default_reminder_interval() and - * calendar_config_get_default_reminder_units(). - **/ -gboolean -calendar_config_get_use_default_reminder (void) -{ - return e_config_listener_get_boolean_with_default (config, "/apps/Evolution/Calendar/Other/UseDefaultReminder", FALSE, NULL); -} - -/** - * calendar_config_set_use_default_reminder: - * @value: Whether to create new appointments with a default reminder. - * - * Sets whether newly-created appointments should get a default reminder set - * them. - **/ -void -calendar_config_set_use_default_reminder (gboolean value) -{ - e_config_listener_set_boolean (config, "/apps/Evolution/Calendar/Other/UseDefaultReminder", value); -} - -/** - * calendar_config_get_default_reminder_interval: - * - * Queries the interval for the default reminder of newly-created - * appointments, i.e. 5 in "5 minutes". - * - * Return value: Interval for default reminders. - **/ -int -calendar_config_get_default_reminder_interval (void) -{ - return e_config_listener_get_long_with_default (config, "/apps/Evolution/Calendar/Other/DefaultReminderInterval", 15, NULL); -} - -/** - * calendar_config_set_default_reminder_interval: - * @interval: Interval value, e.g. 5 for "5 minutes". - * - * Sets the interval that should be used for the default reminder in new - * appointments. - **/ -void -calendar_config_set_default_reminder_interval (int interval) -{ - e_config_listener_set_long (config, "/apps/Evolution/Calendar/Other/DefaultReminderInterval", interval); -} - -/** - * calendar_config_get_default_reminder_units: - * - * Queries the units of time in which default reminders should be created for - * new appointments, e.g. CAL_MINUTES for "5 minutes". - * - * Return value: Time units for default reminders. - **/ -CalUnits -calendar_config_get_default_reminder_units (void) -{ - char *units; - CalUnits cu; - - units = e_config_listener_get_string_with_default (config, "/apps/Evolution/Calendar/Other/DefaultReminderUnits", "minutes", NULL); - - if (!strcmp (units, "days")) - cu = CAL_DAYS; - else if (!strcmp (units, "hours")) - cu = CAL_HOURS; - else - cu = CAL_MINUTES; /* changed from above because - * if bonobo-config fucks up - * we want minutes, not days! - */ - g_free (units); - - return cu; -} - -/** - * calendar_config_set_default_reminder_units: - * @units: Time units, e.g. CAL_MINUTES for "5 minutes". - * - * Sets the units to be used for default reminders in new appointments. - **/ -void -calendar_config_set_default_reminder_units (CalUnits units) -{ - switch (units) { - case CAL_DAYS : - e_config_listener_set_string (config, "/apps/Evolution/Calendar/Other/DefaultReminderUnits", "days"); - break; - case CAL_HOURS : - e_config_listener_set_string (config, "/apps/Evolution/Calendar/Other/DefaultReminderUnits", "hours"); - break; - default : - e_config_listener_set_string (config, "/apps/Evolution/Calendar/Other/DefaultReminderUnits", "minutes"); - } -} - -/** - * calendar_config_get_hide_completed_tasks_sexp: - * - * Returns the subexpression to use to filter out completed tasks according - * to the config settings. The returned sexp should be freed. - **/ -char* -calendar_config_get_hide_completed_tasks_sexp (void) -{ - char *sexp = NULL; - - if (calendar_config_get_hide_completed_tasks ()) { - CalUnits units; - gint value; - - units = calendar_config_get_hide_completed_tasks_units (); - value = calendar_config_get_hide_completed_tasks_value (); - - if (value == 0) { - /* If the value is 0, we want to hide completed tasks - immediately, so we filter out all completed tasks.*/ - sexp = g_strdup ("(not is-completed?)"); - } else { - char *location, *isodate; - icaltimezone *zone; - struct icaltimetype tt; - time_t t; - - /* Get the current time, and subtract the appropriate - number of days/hours/minutes. */ - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - tt = icaltime_current_time_with_zone (zone); - - switch (units) { - case CAL_DAYS: - icaltime_adjust (&tt, -value, 0, 0, 0); - break; - case CAL_HOURS: - icaltime_adjust (&tt, 0, -value, 0, 0); - break; - case CAL_MINUTES: - icaltime_adjust (&tt, 0, 0, -value, 0); - break; - default: - g_assert_not_reached (); - } - - t = icaltime_as_timet_with_zone (tt, zone); - - /* Convert the time to an ISO date string, and build - the query sub-expression. */ - isodate = isodate_from_time_t (t); - sexp = g_strdup_printf ("(not (completed-before? (make-time \"%s\")))", isodate); - } - } - - return sexp; -} - -char * -calendar_config_default_calendar_folder (void) -{ - char *uri; - - uri = e_config_listener_get_string_with_default (config, "/apps/Evolution/DefaultFolders/calendar_uri", NULL, NULL); - return uri; -} - -char * -calendar_config_default_tasks_folder (void) -{ - char *uri; - - uri = e_config_listener_get_string_with_default (config, "/apps/Evolution/DefaultFolders/tasks_uri", NULL, NULL); - return uri; -} - diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h deleted file mode 100644 index 6f0a9ee0fd..0000000000 --- a/calendar/gui/calendar-config.h +++ /dev/null @@ -1,189 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Authors : - * Damon Chaplin <damon@ximian.com> - * Rodrigo Moya <rodrigo@ximian.com> - * - * Copyright 2000, Ximian, Inc. - * Copyright 2000, Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - * calendar-config.h - functions to load/save/get/set user settings. - */ - -#ifndef _CALENDAR_CONFIG_H_ -#define _CALENDAR_CONFIG_H_ - -#include <widgets/misc/e-calendar.h> -#include <widgets/misc/e-dateedit.h> -#include <widgets/misc/e-cell-date-edit.h> -#include "e-calendar-table.h" - - -/* These are used to get/set the working days in the week. The bit-flags are - combined together. The bits must be from 0 (Sun) to 6 (Sat) to match the - day values used by localtime etc. */ -typedef enum -{ - CAL_SUNDAY = 1 << 0, - CAL_MONDAY = 1 << 1, - CAL_TUESDAY = 1 << 2, - CAL_WEDNESDAY = 1 << 3, - CAL_THURSDAY = 1 << 4, - CAL_FRIDAY = 1 << 5, - CAL_SATURDAY = 1 << 6 -} CalWeekdays; - - -/* Units for settings. */ -typedef enum -{ - CAL_DAYS, - CAL_HOURS, - CAL_MINUTES -} CalUnits; - - -void calendar_config_init (void); -void calendar_config_write (void); -void calendar_config_write_on_exit (void); - - -/* - * Calendar Settings. - */ - -/* The current timezone, e.g. "Europe/London". */ -gchar* calendar_config_get_timezone (void); -void calendar_config_set_timezone (gchar *timezone); - -/* The working days of the week, a bit-wise combination of flags. */ -CalWeekdays calendar_config_get_working_days (void); -void calendar_config_set_working_days (CalWeekdays days); - -/* The start day of the week (0 = Sun to 6 = Sat). */ -gint calendar_config_get_week_start_day (void); -void calendar_config_set_week_start_day (gint week_start_day); - -/* The start and end times of the work-day. */ -gint calendar_config_get_day_start_hour (void); -void calendar_config_set_day_start_hour (gint day_start_hour); - -gint calendar_config_get_day_start_minute (void); -void calendar_config_set_day_start_minute (gint day_start_min); - -gint calendar_config_get_day_end_hour (void); -void calendar_config_set_day_end_hour (gint day_end_hour); - -gint calendar_config_get_day_end_minute (void); -void calendar_config_set_day_end_minute (gint day_end_min); - -/* Whether we use 24-hour format or 12-hour format (AM/PM). */ -gboolean calendar_config_get_24_hour_format (void); -void calendar_config_set_24_hour_format (gboolean use_24_hour); - -/* The time divisions in the Day/Work-Week view in minutes (5/10/15/30/60). */ -gint calendar_config_get_time_divisions (void); -void calendar_config_set_time_divisions (gint divisions); - -/* Whether we show event end times. */ -gboolean calendar_config_get_show_event_end (void); -void calendar_config_set_show_event_end (gboolean show_end); - -/* Whether we compress the weekend in the week/month views. */ -gboolean calendar_config_get_compress_weekend (void); -void calendar_config_set_compress_weekend (gboolean compress); - -/* Whether we show week numbers in the Date Navigator. */ -gboolean calendar_config_get_dnav_show_week_no (void); -void calendar_config_set_dnav_show_week_no (gboolean show_week_no); - -/* The view to show on start-up, 0 = Day, 1 = WorkWeek, 2 = Week, 3 = Month. */ -gint calendar_config_get_default_view (void); -void calendar_config_set_default_view (gint view); - -/* The positions of the panes in the normal and month views. */ -gfloat calendar_config_get_hpane_pos (void); -void calendar_config_set_hpane_pos (gfloat hpane_pos); - -gfloat calendar_config_get_vpane_pos (void); -void calendar_config_set_vpane_pos (gfloat vpane_pos); - -gfloat calendar_config_get_month_hpane_pos (void); -void calendar_config_set_month_hpane_pos (gfloat hpane_pos); - -gfloat calendar_config_get_month_vpane_pos (void); -void calendar_config_set_month_vpane_pos (gfloat vpane_pos); - -/* Colors for the task list */ -const char *calendar_config_get_tasks_due_today_color (void); -void calendar_config_set_tasks_due_today_color (const char *color); - -const char *calendar_config_get_tasks_overdue_color (void); -void calendar_config_set_tasks_overdue_color (const char *color); - -/* Settings to hide completed tasks. */ -gboolean calendar_config_get_hide_completed_tasks (void); -void calendar_config_set_hide_completed_tasks (gboolean hide); - -CalUnits calendar_config_get_hide_completed_tasks_units(void); -void calendar_config_set_hide_completed_tasks_units(CalUnits units); - -gint calendar_config_get_hide_completed_tasks_value(void); -void calendar_config_set_hide_completed_tasks_value(gint value); - -char* calendar_config_get_hide_completed_tasks_sexp (void); - -/* Confirmation options */ -gboolean calendar_config_get_confirm_delete (void); -void calendar_config_set_confirm_delete (gboolean confirm); - -gboolean calendar_config_get_confirm_expunge (void); -void calendar_config_set_confirm_expunge (gboolean confirm); - -/* Default reminder options */ -gboolean calendar_config_get_use_default_reminder (void); -void calendar_config_set_use_default_reminder (gboolean value); - -int calendar_config_get_default_reminder_interval (void); -void calendar_config_set_default_reminder_interval (int interval); - -CalUnits calendar_config_get_default_reminder_units (void); -void calendar_config_set_default_reminder_units (CalUnits units); - - -/* Convenience functions to configure common properties of ECalendar, - EDateEdit & ECalendarTable widgets, and the ECellDateEdit ETable cell. */ -void calendar_config_configure_e_calendar (ECalendar *cal); -void calendar_config_configure_e_date_edit (EDateEdit *dedit); -void calendar_config_configure_e_calendar_table (ECalendarTable *cal_table); -void calendar_config_configure_e_cell_date_edit (ECellDateEdit *ecde); - -/* Shows the timezone dialog if the user hasn't set a default timezone. */ -void calendar_config_check_timezone_set (void); - -/* Returns TRUE if the locale has 'am' and 'pm' strings defined, i.e. it - supports 12-hour time format. */ -gboolean calendar_config_locale_supports_12_hour_format(void); - -/* Default folders, read-only */ -char *calendar_config_default_calendar_folder (void); -char *calendar_config_default_tasks_folder (void); - -#endif /* _CALENDAR_CONFIG_H_ */ diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c deleted file mode 100644 index 83448d01f8..0000000000 --- a/calendar/gui/calendar-model.c +++ /dev/null @@ -1,2475 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* Evolution calendar - Data model for ETable - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> - -#include <math.h> -#include <sys/types.h> - -#include <ctype.h> - -#include <libgnomeui/gnome-messagebox.h> -#include <libgnomeui/gnome-stock.h> -#include <libgnome/gnome-i18n.h> -#include <gal/widgets/e-unicode.h> -#include <e-util/e-time-utils.h> -#include <cal-util/timeutil.h> -#include "calendar-commands.h" -#include "calendar-config.h" -#include "comp-util.h" -#include "itip-utils.h" -#include "calendar-model.h" -#include "evolution-activity-client.h" -#include "e-cell-date-edit-text.h" -#include "misc.h" - -/* This specifies how often we refresh the list, so that completed tasks are - hidden according to the config setting, and overdue tasks change color etc. - It is in milliseconds, so this is 10 minutes. - Note that if the user is editing an item in the list, they will probably - lose their edit, so this isn't ideal. */ -#define CALENDAR_MODEL_REFRESH_TIMEOUT 1000 * 60 * 10 - -/* These hold the date values of the objects, so we can free the values when - we no longer need them. */ -typedef struct _CalendarModelObjectData CalendarModelObjectData; -struct _CalendarModelObjectData { - ECellDateEditValue *dtstart; - ECellDateEditValue *dtend; - ECellDateEditValue *due; - ECellDateEditValue *completed; -}; - -/* We use a pointer to this value to indicate that the property is not set. */ -static ECellDateEditValue unset_date_edit_value; - -/* Private part of the ECalendarModel structure */ -struct _CalendarModelPrivate { - /* Calendar client we are using */ - CalClient *client; - - /* Types of objects we are dealing with */ - CalObjType type; - - /* S-expression for query and the query object */ - char *sexp; - CalQuery *query; - - /* Array of pointers to calendar objects */ - GArray *objects; - - /* Array of CalendarModelObjectData* holding data for each of the - objects in the objects array above. */ - GArray *objects_data; - - /* UID -> array index hash */ - GHashTable *uid_index_hash; - - /* Type of components to create when using click-to-add in the table */ - CalComponentVType new_comp_vtype; - - /* Whether we display dates in 24-hour format. */ - gboolean use_24_hour_format; - - /* The default category to use when creating new tasks, e.g. when the - filter is set to a certain category we use that category when - creating a new task. */ - gchar *default_category; - - /* Addresses for determining icons */ - GList *addresses; - - /* The current timezone. */ - icaltimezone *zone; - - /* The id of our timeout function for refreshing the list. */ - gint timeout_id; - - /* The activity client used to show messages on the status bar. */ - EvolutionActivityClient *activity; -}; - - - -static void calendar_model_class_init (CalendarModelClass *class); -static void calendar_model_init (CalendarModel *model); -static void calendar_model_destroy (GtkObject *object); - -static int calendar_model_column_count (ETableModel *etm); -static int calendar_model_row_count (ETableModel *etm); -static void *calendar_model_value_at (ETableModel *etm, int col, int row); -static void calendar_model_set_value_at (ETableModel *etm, int col, int row, const void *value); -static gboolean calendar_model_is_cell_editable (ETableModel *etm, int col, int row); -static void calendar_model_append_row (ETableModel *etm, ETableModel *source, gint row); -static void *calendar_model_duplicate_value (ETableModel *etm, int col, const void *value); -static void calendar_model_free_value (ETableModel *etm, int col, void *value); -static void *calendar_model_initialize_value (ETableModel *etm, int col); -static gboolean calendar_model_value_is_empty (ETableModel *etm, int col, const void *value); -static char * calendar_model_value_to_string (ETableModel *etm, int col, const void *value); -static int remove_object (CalendarModel *model, const char *uid); -static void ensure_task_complete (CalComponent *comp, - time_t completed_date); -static void ensure_task_not_complete (CalComponent *comp); - -static ETableModelClass *parent_class; - - - -/** - * calendar_model_get_type: - * @void: - * - * Registers the #CalendarModel class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalendarModel class. - **/ -GtkType -calendar_model_get_type (void) -{ - static GtkType calendar_model_type = 0; - - if (!calendar_model_type) { - static GtkTypeInfo calendar_model_info = { - "CalendarModel", - sizeof (CalendarModel), - sizeof (CalendarModelClass), - (GtkClassInitFunc) calendar_model_class_init, - (GtkObjectInitFunc) calendar_model_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - calendar_model_type = gtk_type_unique (E_TABLE_MODEL_TYPE, &calendar_model_info); - } - - return calendar_model_type; -} - -/* Class initialization function for the calendar table model */ -static void -calendar_model_class_init (CalendarModelClass *class) -{ - GtkObjectClass *object_class; - ETableModelClass *etm_class; - - object_class = (GtkObjectClass *) class; - etm_class = (ETableModelClass *) class; - - parent_class = gtk_type_class (E_TABLE_MODEL_TYPE); - - object_class->destroy = calendar_model_destroy; - - etm_class->column_count = calendar_model_column_count; - etm_class->row_count = calendar_model_row_count; - etm_class->value_at = calendar_model_value_at; - etm_class->set_value_at = calendar_model_set_value_at; - etm_class->is_cell_editable = calendar_model_is_cell_editable; - etm_class->append_row = calendar_model_append_row; - etm_class->duplicate_value = calendar_model_duplicate_value; - etm_class->free_value = calendar_model_free_value; - etm_class->initialize_value = calendar_model_initialize_value; - etm_class->value_is_empty = calendar_model_value_is_empty; - etm_class->value_to_string = calendar_model_value_to_string; -} - - -static gboolean -calendar_model_timeout_cb (gpointer data) -{ - CalendarModel *model; - - g_return_val_if_fail (IS_CALENDAR_MODEL (data), FALSE); - - model = CALENDAR_MODEL (data); - - GDK_THREADS_ENTER (); - - calendar_model_refresh (model); - - GDK_THREADS_LEAVE (); - return TRUE; -} - - -/* Object initialization function for the calendar table model */ -static void -calendar_model_init (CalendarModel *model) -{ - CalendarModelPrivate *priv; - - priv = g_new0 (CalendarModelPrivate, 1); - model->priv = priv; - - priv->sexp = g_strdup ("#t"); /* match all by default */ - priv->query = NULL; - - priv->objects = g_array_new (FALSE, TRUE, sizeof (CalComponent *)); - priv->objects_data = g_array_new (FALSE, FALSE, sizeof (CalendarModelObjectData)); - priv->uid_index_hash = g_hash_table_new (g_str_hash, g_str_equal); - priv->new_comp_vtype = CAL_COMPONENT_EVENT; - priv->use_24_hour_format = TRUE; - - priv->timeout_id = g_timeout_add (CALENDAR_MODEL_REFRESH_TIMEOUT, - calendar_model_timeout_cb, model); - - priv->addresses = itip_addresses_get (); - - priv->zone = NULL; - - priv->activity = NULL; - - /* Preload here, to avoid corba calls later */ - /* Gross hack because gnome-canvas is not re-entrant */ - calendar_config_get_tasks_due_today_color (); - calendar_config_get_tasks_overdue_color (); - g_free (calendar_config_get_hide_completed_tasks_sexp ()); -} - -static void -calendar_model_free_object_data (CalendarModel *model, - CalendarModelObjectData *object_data) -{ - if (object_data->dtstart != &unset_date_edit_value) - g_free (object_data->dtstart); - - if (object_data->dtend != &unset_date_edit_value) - g_free (object_data->dtend); - - if (object_data->due != &unset_date_edit_value) - g_free (object_data->due); - - if (object_data->completed != &unset_date_edit_value) - g_free (object_data->completed); -} - -/* Called from g_hash_table_foreach_remove(), frees a stored UID->index - * mapping. - */ -static gboolean -free_uid_index (gpointer key, gpointer value, gpointer data) -{ - int *idx; - - idx = value; - g_free (idx); - - return TRUE; -} - -/* Frees the objects stored in the calendar model */ -static void -free_objects (CalendarModel *model) -{ - CalendarModelPrivate *priv; - int i; - - priv = model->priv; - - g_hash_table_foreach_remove (priv->uid_index_hash, free_uid_index, NULL); - - for (i = 0; i < priv->objects->len; i++) { - CalComponent *comp; - CalendarModelObjectData *object_data; - - comp = g_array_index (priv->objects, CalComponent *, i); - g_assert (comp != NULL); - gtk_object_unref (GTK_OBJECT (comp)); - - object_data = &g_array_index (priv->objects_data, - CalendarModelObjectData, i); - calendar_model_free_object_data (model, object_data); - } - - g_array_set_size (priv->objects, 0); - g_array_set_size (priv->objects_data, 0); -} - -/* Destroy handler for the calendar table model */ -static void -calendar_model_destroy (GtkObject *object) -{ - CalendarModel *model; - CalendarModelPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CALENDAR_MODEL (object)); - - model = CALENDAR_MODEL (object); - priv = model->priv; - - if (priv->timeout_id) { - g_source_remove (priv->timeout_id); - priv->timeout_id = 0; - } - - /* Free the calendar client interface object */ - - if (priv->client) { - gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), model); - gtk_object_unref (GTK_OBJECT (priv->client)); - priv->client = NULL; - } - - if (priv->sexp) { - g_free (priv->sexp); - priv->sexp = NULL; - } - - if (priv->query) { - gtk_signal_disconnect_by_data (GTK_OBJECT (priv->query), model); - gtk_object_unref (GTK_OBJECT (priv->query)); - priv->query = NULL; - } - - /* Free the uid->index hash data and the array of UIDs */ - - free_objects (model); - - g_hash_table_destroy (priv->uid_index_hash); - priv->uid_index_hash = NULL; - - g_array_free (priv->objects, TRUE); - priv->objects = NULL; - - g_array_free (priv->objects_data, TRUE); - priv->objects_data = NULL; - - g_free (priv->default_category); - - itip_addresses_free (priv->addresses); - - if (priv->activity) { - gtk_object_unref (GTK_OBJECT (priv->activity)); - priv->activity = NULL; - } - - /* Free the private structure */ - - g_free (priv); - model->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* ETableModel methods */ - -/* column_count handler for the calendar table model */ -static int -calendar_model_column_count (ETableModel *etm) -{ - return CAL_COMPONENT_FIELD_NUM_FIELDS; -} - -/* row_count handler for the calendar table model */ -static int -calendar_model_row_count (ETableModel *etm) -{ - CalendarModel *model; - CalendarModelPrivate *priv; - - model = CALENDAR_MODEL (etm); - priv = model->priv; - - return priv->objects->len; -} - -/* Builds a string based on the list of CATEGORIES properties of a calendar - * component. - */ -static char * -get_categories (CalComponent *comp) -{ - const char *categories; - - cal_component_get_categories (comp, &categories); - - return categories ? (char*) categories : ""; -} - -/* Returns a string based on the CLASSIFICATION property of a calendar component */ -static char * -get_classification (CalComponent *comp) -{ - CalComponentClassification classif; - - cal_component_get_classification (comp, &classif); - - switch (classif) { - case CAL_COMPONENT_CLASS_PRIVATE: - return _("Private"); - - case CAL_COMPONENT_CLASS_CONFIDENTIAL: - return _("Confidential"); - - default: - return _("Public"); - } -} - -/* Returns an ECellDateEditValue* for a COMPLETED property of a - calendar component. Note that we cache these in the objects_data array so - we can free them eventually. */ -static ECellDateEditValue* -get_completed (CalendarModel *model, - CalComponent *comp, - int row) -{ - CalendarModelPrivate *priv; - CalendarModelObjectData *object_data; - struct icaltimetype *completed; - - priv = model->priv; - - object_data = &g_array_index (priv->objects_data, - CalendarModelObjectData, row); - - if (!object_data->completed) { - cal_component_get_completed (comp, &completed); - - if (completed) { - object_data->completed = g_new (ECellDateEditValue, 1); - object_data->completed->tt = *completed; - object_data->completed->zone = icaltimezone_get_utc_timezone (); - cal_component_free_icaltimetype (completed); - } else { - object_data->completed = &unset_date_edit_value; - } - } - - return (object_data->completed == &unset_date_edit_value) - ? NULL : object_data->completed; -} - -/* Returns an ECellDateEditValue* for a DTSTART, DTEND or DUE property of a - calendar component. Note that we cache these in the objects_data array so - we can free them eventually. */ -static ECellDateEditValue* -get_date_edit_value (CalendarModel *model, CalComponent *comp, - int col, int row) -{ - CalendarModelPrivate *priv; - CalComponentDateTime dt; - CalendarModelObjectData *object_data; - ECellDateEditValue **value; - - priv = model->priv; - - object_data = &g_array_index (priv->objects_data, - CalendarModelObjectData, row); - - if (col == CAL_COMPONENT_FIELD_DTSTART) - value = &object_data->dtstart; - else if (col == CAL_COMPONENT_FIELD_DTEND) - value = &object_data->dtend; - else - value = &object_data->due; - - if (!(*value)) { - if (col == CAL_COMPONENT_FIELD_DTSTART) - cal_component_get_dtstart (comp, &dt); - else if (col == CAL_COMPONENT_FIELD_DTEND) - cal_component_get_dtend (comp, &dt); - else - cal_component_get_due (comp, &dt); - - if (dt.value) { - CalClientGetStatus status; - icaltimezone *zone; - - /* For a DTEND with a DATE value, we subtract 1 from - the day to display it. */ - if (col == CAL_COMPONENT_FIELD_DTEND - && dt.value->is_date) { - icaltime_adjust (dt.value, -1, 0, 0, 0); - } - - *value = g_new (ECellDateEditValue, 1); - (*value)->tt = *dt.value; - - /* FIXME: TIMEZONES: Handle error. */ - status = cal_client_get_timezone (model->priv->client, - dt.tzid, &zone); - (*value)->zone = zone; - } else { - *value = &unset_date_edit_value; - } - - cal_component_free_datetime (&dt); - } - - return (*value == &unset_date_edit_value) ? NULL : *value; -} - -/* Builds a string for the GEO property of a calendar component */ -static char* -get_geo (CalComponent *comp) -{ - struct icalgeotype *geo; - static gchar buf[32]; - - cal_component_get_geo (comp, &geo); - - if (!geo) - buf[0] = '\0'; - else { - g_snprintf (buf, sizeof (buf), "%g %s, %g %s", - fabs (geo->lat), - geo->lat >= 0.0 ? _("N") : _("S"), - fabs (geo->lon), - geo->lon >= 0.0 ? _("E") : _("W")); - cal_component_free_geo (geo); - } - - return buf; -} - -/* Builds a string for the PERCENT property of a calendar component */ -static int -get_percent (CalComponent *comp) -{ - int *percent, retval; - - cal_component_get_percent (comp, &percent); - - if (percent) { - retval = *percent; - cal_component_free_percent (percent); - } else { - retval = -1; - } - - return retval; -} - -/* Builds a string for the PRIORITY property of a calendar component */ -static char * -get_priority (CalComponent *comp) -{ - int *priority; - char *retval = ""; - - cal_component_get_priority (comp, &priority); - - if (priority) { - retval = cal_util_priority_to_string (*priority); - cal_component_free_priority (priority); - } - - return retval; -} - -/* Builds a string for the SUMMARY property of a calendar component */ -static char * -get_summary (CalComponent *comp) -{ - CalComponentText summary; - - cal_component_get_summary (comp, &summary); - - if (summary.value) - return (char *) summary.value; - else - return ""; -} - -/* Builds a string for the TRANSPARENCY property of a calendar component */ -static char * -get_transparency (CalComponent *comp) -{ - CalComponentTransparency transp; - - cal_component_get_transparency (comp, &transp); - - if (transp == CAL_COMPONENT_TRANSP_TRANSPARENT) - return _("Free"); - else - return _("Busy"); -} - -/* Builds a string for the URL property of a calendar component */ -static char * -get_url (CalComponent *comp) -{ - const char *url; - - cal_component_get_url (comp, &url); - - if (url) - return (char *) url; - else - return ""; -} - -/* Returns whether the completion date has been set on a component */ -static gboolean -is_complete (CalComponent *comp) -{ - struct icaltimetype *t; - gboolean retval; - - cal_component_get_completed (comp, &t); - retval = (t != NULL); - - if (retval) - cal_component_free_icaltimetype (t); - - return retval; -} - -typedef enum { - CALENDAR_MODEL_DUE_NEVER, - CALENDAR_MODEL_DUE_FUTURE, - CALENDAR_MODEL_DUE_TODAY, - CALENDAR_MODEL_DUE_OVERDUE, - CALENDAR_MODEL_DUE_COMPLETE -} CalendarModelDueStatus; - - -static CalendarModelDueStatus -get_due_status (CalendarModel *model, CalComponent *comp) -{ - CalComponentDateTime dt; - CalendarModelDueStatus retval; - - cal_component_get_due (comp, &dt); - - /* First, do we have a due date? */ - - if (!dt.value) - retval = CALENDAR_MODEL_DUE_NEVER; - else { - struct icaltimetype now_tt; - CalClientGetStatus status; - icaltimezone *zone; - - /* Second, is it already completed? */ - - if (is_complete (comp)) { - retval = CALENDAR_MODEL_DUE_COMPLETE; - goto out; - } - - /* Third, are we overdue as of right now? */ - - if (dt.value->is_date) { - int cmp; - - now_tt = icaltime_today (); - cmp = icaltime_compare_date_only (*dt.value, now_tt); - - if (cmp < 0) - retval = CALENDAR_MODEL_DUE_OVERDUE; - else if (cmp == 0) - retval = CALENDAR_MODEL_DUE_TODAY; - else - retval = CALENDAR_MODEL_DUE_FUTURE; - } else { - /* Get the current time in the same timezone as the DUE date.*/ - /* FIXME: TIMEZONES: Handle error. */ - status = cal_client_get_timezone (model->priv->client, dt.tzid, - &zone); - now_tt = icaltime_current_time_with_zone (zone); - - if (icaltime_compare (*dt.value, now_tt) <= 0) - retval = CALENDAR_MODEL_DUE_OVERDUE; - else - if (icaltime_compare_date_only (*dt.value, now_tt) == 0) - retval = CALENDAR_MODEL_DUE_TODAY; - else - retval = CALENDAR_MODEL_DUE_FUTURE; - } - } - - out: - - cal_component_free_datetime (&dt); - - return retval; -} - -/* Returns whether a component is overdue. */ -static gboolean -is_overdue (CalendarModel *model, CalComponent *comp) -{ - switch (get_due_status (model, comp)) { - case CALENDAR_MODEL_DUE_NEVER: - case CALENDAR_MODEL_DUE_FUTURE: - case CALENDAR_MODEL_DUE_COMPLETE: - return FALSE; - case CALENDAR_MODEL_DUE_TODAY: - case CALENDAR_MODEL_DUE_OVERDUE: - return TRUE; - } - - return FALSE; -} - -/* Computes the color to be used to display a component */ -static const char * -get_color (CalendarModel *model, CalComponent *comp) -{ - switch (get_due_status (model, comp)) { - case CALENDAR_MODEL_DUE_NEVER: - case CALENDAR_MODEL_DUE_FUTURE: - case CALENDAR_MODEL_DUE_COMPLETE: - return NULL; - case CALENDAR_MODEL_DUE_TODAY: - return calendar_config_get_tasks_due_today_color (); - case CALENDAR_MODEL_DUE_OVERDUE: - return calendar_config_get_tasks_overdue_color (); - } - - return NULL; -} - -static void * -get_status (CalComponent *comp) -{ - icalproperty_status status; - - cal_component_get_status (comp, &status); - - switch (status) { - case ICAL_STATUS_NONE: - return ""; - - case ICAL_STATUS_NEEDSACTION: - return _("Not Started"); - - case ICAL_STATUS_INPROCESS: - return _("In Progress"); - - case ICAL_STATUS_COMPLETED: - return _("Completed"); - - case ICAL_STATUS_CANCELLED: - return _("Cancelled"); - - default: - g_assert_not_reached (); - return NULL; - } -} - -#if 0 -static void * -get_location (CalComponent *comp) -{ - const char *location; - - cal_component_get_location (comp, &location); - return (void*) location; -} -#endif - -/* value_at handler for the calendar table model */ -static void * -calendar_model_value_at (ETableModel *etm, int col, int row) -{ - CalendarModel *model; - CalendarModelPrivate *priv; - CalComponent *comp; - - model = CALENDAR_MODEL (etm); - priv = model->priv; - - g_return_val_if_fail (col >= 0 && col < CAL_COMPONENT_FIELD_NUM_FIELDS, NULL); - g_return_val_if_fail (row >= 0 && row < priv->objects->len, NULL); - - comp = g_array_index (priv->objects, CalComponent *, row); - g_assert (comp != NULL); - -#if 0 - g_print ("In calendar_model_value_at: %i\n", col); -#endif - - switch (col) { - case CAL_COMPONENT_FIELD_CATEGORIES: - return get_categories (comp); - - case CAL_COMPONENT_FIELD_CLASSIFICATION: - return get_classification (comp); - - case CAL_COMPONENT_FIELD_COMPLETED: - return get_completed (model, comp, row); - - case CAL_COMPONENT_FIELD_DTEND: - case CAL_COMPONENT_FIELD_DTSTART: - case CAL_COMPONENT_FIELD_DUE: - return get_date_edit_value (model, comp, col, row); - - case CAL_COMPONENT_FIELD_GEO: - return get_geo (comp); - - case CAL_COMPONENT_FIELD_PERCENT: - return GINT_TO_POINTER (get_percent (comp)); - - case CAL_COMPONENT_FIELD_PRIORITY: - return get_priority (comp); - - case CAL_COMPONENT_FIELD_SUMMARY: - return get_summary (comp); - - case CAL_COMPONENT_FIELD_TRANSPARENCY: - return get_transparency (comp); - - case CAL_COMPONENT_FIELD_URL: - return get_url (comp); - - case CAL_COMPONENT_FIELD_HAS_ALARMS: - return GINT_TO_POINTER (cal_component_has_alarms (comp)); - - case CAL_COMPONENT_FIELD_ICON: - { - ItipAddress *ia; - GSList *attendees = NULL, *sl; - gint retval = 0; - - if (cal_component_has_recurrences (comp)) - return GINT_TO_POINTER (1); - - if (itip_organizer_is_user (comp)) - return GINT_TO_POINTER (3); - - cal_component_get_attendee_list (comp, &attendees); - for (sl = attendees; sl != NULL; sl = sl->next) { - CalComponentAttendee *ca = sl->data; - const char *text; - GList *l; - - text = itip_strip_mailto (ca->value); - for (l = priv->addresses; l != NULL; l = l->next) { - ia = l->data; - - if (!strcmp (text, ia->address)) { - if (ca->delto != NULL) - retval = 3; - else - retval = 2; - goto cleanup; - } - } - } - - cleanup: - cal_component_free_attendee_list (attendees); - return GINT_TO_POINTER (retval); - break; - } - case CAL_COMPONENT_FIELD_COMPLETE: - return GINT_TO_POINTER (is_complete (comp)); - - case CAL_COMPONENT_FIELD_RECURRING: - return GINT_TO_POINTER (cal_component_has_recurrences (comp)); - - case CAL_COMPONENT_FIELD_OVERDUE: - return GINT_TO_POINTER (is_overdue (model, comp)); - - case CAL_COMPONENT_FIELD_COLOR: - return (void *) get_color (model, comp); - - case CAL_COMPONENT_FIELD_STATUS: - return get_status (comp); - - case CAL_COMPONENT_FIELD_COMPONENT: - return comp; - -#if 0 - case CAL_COMPONENT_FIELD_LOCATION : - return get_location (comp); -#endif - - default: - g_message ("calendar_model_value_at(): Requested invalid column %d", col); - g_assert_not_reached (); - return NULL; - } -} - -/* Builds a list of categories from a comma-delimited string */ -static GSList * -categories_from_string (const char *value) -{ - GSList *list; - const char *categ_start; - const char *categ_end; - const char *p; - - if (!value) - return NULL; - - list = NULL; - - categ_start = categ_end = NULL; - - for (p = value; *p; p++) { - if (categ_start) { - if (*p == ',') { - char *c; - - c = g_strndup (categ_start, categ_end - categ_start + 1); - list = g_slist_prepend (list, c); - - categ_start = categ_end = NULL; - } else if (!isspace (*p)) - categ_end = p; - } else if (!isspace (*p) && *p != ',') - categ_start = categ_end = p; - } - - if (categ_start) { - char *c; - - c = g_strndup (categ_start, categ_end - categ_start + 1); - list = g_slist_prepend (list, c); - } - - return g_slist_reverse (list); -} - -/* Sets the list of categories from a comma-delimited string */ -static void -set_categories (CalComponent *comp, const char *value) -{ - GSList *list; - GSList *l; - - list = categories_from_string (value); - - cal_component_set_categories_list (comp, list); - - for (l = list; l; l = l->next) { - char *s; - - s = l->data; - g_free (s); - } - - g_slist_free (list); -} - - -static void -set_classification (CalComponent *comp, - const char *value) -{ - CalComponentClassification classif; - - if (!g_strcasecmp (value, _("Private"))) - classif = CAL_COMPONENT_CLASS_PRIVATE; - else if (!g_strcasecmp (value, _("Confidential"))) - classif = CAL_COMPONENT_CLASS_CONFIDENTIAL; - else - classif = CAL_COMPONENT_CLASS_PUBLIC; - - cal_component_set_classification (comp, classif); -} - - -/* Called to set the "Date Completed" field. We also need to update the - Status and Percent fields to make sure they match. */ -static void -set_completed (CalendarModel *model, CalComponent *comp, const void *value) -{ - CalendarModelPrivate *priv = model->priv; - ECellDateEditValue *dv = (ECellDateEditValue*) value; - - if (!dv) { - ensure_task_not_complete (comp); - } else { - time_t t; - - if (dv->tt.is_date) { - /* If its a date, it will be floating, - but completed needs a date time value */ - dv->tt.is_date = FALSE; - t = icaltime_as_timet_with_zone (dv->tt, priv->zone); - } else { - /* We assume that COMPLETED is entered in the current timezone, - even though it gets stored in UTC. */ - t = icaltime_as_timet_with_zone (dv->tt, dv->zone); - } - - ensure_task_complete (comp, t); - } -} - -/* Sets a CalComponentDateTime value */ -static void -set_datetime (CalendarModel *model, CalComponent *comp, const void *value, - void (* set_func) (CalComponent *comp, CalComponentDateTime *dt), - gboolean is_dtend) -{ - ECellDateEditValue *dv = (ECellDateEditValue*) value; - - if (!dv) { - (* set_func) (comp, NULL); - } else { - CalComponentDateTime dt; - - dt.value = &dv->tt; - dt.tzid = icaltimezone_get_tzid (dv->zone); - - /* For a DTEND with a DATE value, we add 1 day to it. */ - if (is_dtend && dt.value->is_date) { - icaltime_adjust (dt.value, 1, 0, 0, 0); - } - - (* set_func) (comp, &dt); - } -} - -/* FIXME: We need to set the "transient_for" property for the dialog, but the - * model doesn't know anything about the windows. - */ -static void -show_geo_warning (void) -{ - GtkWidget *dialog; - - dialog = gnome_message_box_new (_("The geographical position must be entered " - "in the format: \n\n45.436845,125.862501"), - GNOME_MESSAGE_BOX_ERROR, - GNOME_STOCK_BUTTON_OK, NULL); - gtk_widget_show (dialog); -} - -/* Sets the geographical position value of a component */ -static void -set_geo (CalComponent *comp, const char *value) -{ - double latitude, longitude; - int matched; - struct icalgeotype geo; - - if (string_is_empty (value)) { - cal_component_set_geo (comp, NULL); - return; - } - - matched = sscanf (value, "%lg , %lg", &latitude, &longitude); - - if (matched != 2) { - show_geo_warning (); - return; - } - - geo.lat = latitude; - geo.lon = longitude; - cal_component_set_geo (comp, &geo); -} - -/* Sets the percent value of a calendar component */ -static void -set_percent (CalComponent *comp, const void *value) -{ - gint percent = GPOINTER_TO_INT (value); - - g_return_if_fail (percent >= -1); - g_return_if_fail (percent <= 100); - - /* A value of -1 means it isn't set. */ - if (percent == -1) { - cal_component_set_percent (comp, NULL); - ensure_task_not_complete (comp); - } else { - cal_component_set_percent (comp, &percent); - - if (percent == 100) - ensure_task_complete (comp, -1); - else { - ensure_task_not_complete (comp); - if (percent > 0) - cal_component_set_status (comp, ICAL_STATUS_INPROCESS); - } - } -} - -/* Sets the priority of a calendar component */ -static void -set_priority (CalComponent *comp, const char *value) -{ - int priority; - - priority = cal_util_priority_from_string (value); - /* If the priority is invalid (which should never happen) output a - warning and set it to undefined. */ - if (priority == -1) { - g_warning ("Invalid priority"); - priority = 0; - } - - cal_component_set_priority (comp, &priority); -} - -/* Sets the summary of a calendar component */ -static void -set_summary (CalComponent *comp, const char *value) -{ - CalComponentText text; - - if (string_is_empty (value)) { - cal_component_set_summary (comp, NULL); - return; - } - - text.value = value; - text.altrep = NULL; /* FIXME: should we preserve the old ALTREP? */ - - cal_component_set_summary (comp, &text); -} - -/* Sets the transparency of a calendar component */ -static void -set_transparency (CalComponent *comp, const char *value) -{ - CalComponentTransparency transp; - - if (!g_strcasecmp (value, _("Free"))) - transp = CAL_COMPONENT_TRANSP_TRANSPARENT; - else - transp = CAL_COMPONENT_TRANSP_OPAQUE; - - cal_component_set_transparency (comp, transp); -} - -/* Sets the URI of a calendar component */ -static void -set_url (CalComponent *comp, const char *value) -{ - if (string_is_empty (value)) { - cal_component_set_url (comp, NULL); - return; - } - - cal_component_set_url (comp, value); -} - -/* Called to set the checkbutton field which indicates whether a task is - complete. */ -static void -set_complete (CalComponent *comp, const void *value) -{ - gint state = GPOINTER_TO_INT (value); - - if (state) { - ensure_task_complete (comp, -1); - } else { - ensure_task_not_complete (comp); - } -} - -/* Sets the status of a calendar component. */ -static void -set_status (CalComponent *comp, const char *value) -{ - icalproperty_status status; - int percent; - - /* An empty string is the same as 'None'. */ - if (!value[0] || !g_strcasecmp (value, _("None"))) - status = ICAL_STATUS_NONE; - else if (!g_strcasecmp (value, _("Not Started"))) - status = ICAL_STATUS_NEEDSACTION; - else if (!g_strcasecmp (value, _("In Progress"))) - status = ICAL_STATUS_INPROCESS; - else if (!g_strcasecmp (value, _("Completed"))) - status = ICAL_STATUS_COMPLETED; - else if (!g_strcasecmp (value, _("Cancelled"))) - status = ICAL_STATUS_CANCELLED; - else { - g_warning ("Invalid status: %s\n", value); - return; - } - - cal_component_set_status (comp, status); - - if (status == ICAL_STATUS_NEEDSACTION) { - percent = 0; - cal_component_set_percent (comp, &percent); - cal_component_set_completed (comp, NULL); - } else if (status == ICAL_STATUS_INPROCESS) { - ensure_task_not_complete (comp); - percent = 50; - cal_component_set_percent (comp, &percent); - } else if (status == ICAL_STATUS_COMPLETED) { - ensure_task_complete (comp, -1); - } -} - -#if 0 -static void -set_location (CalComponent *comp, const char *value) -{ - if (string_is_empty (value)) { - cal_component_set_location (comp, NULL); - return; - } - - cal_component_set_location (comp, value); -} -#endif - -/* set_value_at handler for the calendar table model */ -static void -calendar_model_set_value_at (ETableModel *etm, int col, int row, const void *value) -{ - CalendarModel *model; - CalendarModelPrivate *priv; - CalComponent *comp; - - model = CALENDAR_MODEL (etm); - priv = model->priv; - - g_return_if_fail (col >= 0 && col < CAL_COMPONENT_FIELD_NUM_FIELDS); - g_return_if_fail (row >= 0 && row < priv->objects->len); - - comp = g_array_index (priv->objects, CalComponent *, row); - g_assert (comp != NULL); - -#if 0 - g_print ("In calendar_model_set_value_at: %i\n", col); -#endif - - switch (col) { - case CAL_COMPONENT_FIELD_CATEGORIES: - set_categories (comp, value); - break; - - case CAL_COMPONENT_FIELD_CLASSIFICATION: - set_classification (comp, value); - break; - - case CAL_COMPONENT_FIELD_COMPLETED: - set_completed (model, comp, value); - break; - - case CAL_COMPONENT_FIELD_DTEND: - /* FIXME: Need to reset dtstart if dtend happens before it */ - set_datetime (model, comp, value, cal_component_set_dtend, - TRUE); - break; - - case CAL_COMPONENT_FIELD_DTSTART: - /* FIXME: Need to reset dtend if dtstart happens after it */ - set_datetime (model, comp, value, cal_component_set_dtstart, - FALSE); - break; - - case CAL_COMPONENT_FIELD_DUE: - set_datetime (model, comp, value, cal_component_set_due, - FALSE); - break; - - case CAL_COMPONENT_FIELD_GEO: - set_geo (comp, value); - break; - - case CAL_COMPONENT_FIELD_PERCENT: - set_percent (comp, value); - break; - - case CAL_COMPONENT_FIELD_PRIORITY: - set_priority (comp, value); - break; - - case CAL_COMPONENT_FIELD_SUMMARY: - set_summary (comp, value); - break; - - case CAL_COMPONENT_FIELD_TRANSPARENCY: - set_transparency (comp, value); - break; - - case CAL_COMPONENT_FIELD_URL: - set_url (comp, value); - break; - - case CAL_COMPONENT_FIELD_COMPLETE: - set_complete (comp, value); - break; - - case CAL_COMPONENT_FIELD_STATUS: - set_status (comp, value); - break; - -#if 0 - case CAL_COMPONENT_FIELD_LOCATION : - set_location (comp, value); - break; -#endif - - default: - g_message ("calendar_model_set_value_at(): Requested invalid column %d", col); - g_assert_not_reached (); - return; - } - - if (cal_client_update_object (priv->client, comp) != CAL_CLIENT_RESULT_SUCCESS) - g_message ("calendar_model_set_value_at(): Could not update the object!"); -} - -/* is_cell_editable handler for the calendar table model */ -static gboolean -calendar_model_is_cell_editable (ETableModel *etm, int col, int row) -{ - CalendarModel *model; - CalendarModelPrivate *priv; - - model = CALENDAR_MODEL (etm); - priv = model->priv; - - g_return_val_if_fail (col >= 0 && col < CAL_COMPONENT_FIELD_NUM_FIELDS, FALSE); - - /* FIXME: We can't check this as 'click-to-add' passes row 0. */ - /*g_return_val_if_fail (row >= 0 && row < priv->objects->len, FALSE);*/ - - switch (col) { - case CAL_COMPONENT_FIELD_CATEGORIES: - case CAL_COMPONENT_FIELD_CLASSIFICATION: - case CAL_COMPONENT_FIELD_COMPLETED: - case CAL_COMPONENT_FIELD_DTEND: - case CAL_COMPONENT_FIELD_DTSTART: - case CAL_COMPONENT_FIELD_DUE: - case CAL_COMPONENT_FIELD_GEO: - case CAL_COMPONENT_FIELD_PERCENT: - case CAL_COMPONENT_FIELD_PRIORITY: - case CAL_COMPONENT_FIELD_SUMMARY: - case CAL_COMPONENT_FIELD_TRANSPARENCY: - case CAL_COMPONENT_FIELD_URL: - case CAL_COMPONENT_FIELD_COMPLETE: - case CAL_COMPONENT_FIELD_STATUS: - return TRUE; - - default: - return FALSE; - } -} - -/* append_row handler for the calendar model */ -static void -calendar_model_append_row (ETableModel *etm, ETableModel *source, gint row) -{ - CalendarModel *model; - CalendarModelPrivate *priv; - CalComponent *comp; - - model = CALENDAR_MODEL (etm); - priv = model->priv; - - /* FIXME: This should support other types of components, but for now it - * is only used for the task list. - */ - if (priv->new_comp_vtype == CAL_COMPONENT_EVENT) - comp = cal_comp_event_new_with_defaults (); - else { - comp = cal_component_new (); - cal_component_set_new_vtype (comp, priv->new_comp_vtype); - } - - set_categories (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_CATEGORIES, row)); - set_classification (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_CLASSIFICATION, row)); - set_completed (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_COMPLETED, row)); - /* FIXME: Need to reset dtstart if dtend happens before it */ - set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DTEND, row), cal_component_set_dtend, TRUE); - /* FIXME: Need to reset dtend if dtstart happens after it */ - set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DTSTART, row), cal_component_set_dtstart, FALSE); - set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DUE, row), cal_component_set_due, FALSE); - set_geo (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_GEO, row)); - set_percent (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_PERCENT, row)); - set_priority (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_PRIORITY, row)); - set_summary (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_SUMMARY, row)); - set_transparency (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_TRANSPARENCY, row)); - set_url (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_URL, row)); - set_complete (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_COMPLETE, row)); - set_status (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_STATUS, row)); - - if (cal_client_update_object (priv->client, comp) != CAL_CLIENT_RESULT_SUCCESS) { - /* FIXME: Show error dialog. */ - g_message ("calendar_model_append_row(): Could not add new object!"); - } - - gtk_object_unref (GTK_OBJECT (comp)); -} - -/* Duplicates a string value */ -static char * -dup_string (const char *value) -{ - return g_strdup (value); -} - -static void* -dup_date_edit_value (const void *value) -{ - ECellDateEditValue *dv, *orig_dv; - - if (value == NULL) - return NULL; - - orig_dv = (ECellDateEditValue*) value; - - dv = g_new (ECellDateEditValue, 1); - *dv = *orig_dv; - - return dv; -} - -/* duplicate_value handler for the calendar table model */ -static void * -calendar_model_duplicate_value (ETableModel *etm, int col, const void *value) -{ - g_return_val_if_fail (col >= 0 && col < CAL_COMPONENT_FIELD_NUM_FIELDS, NULL); - - /* They are almost all dup_string()s for now, but we'll have real fields - * later. - */ - - switch (col) { - case CAL_COMPONENT_FIELD_CATEGORIES: - case CAL_COMPONENT_FIELD_CLASSIFICATION: - case CAL_COMPONENT_FIELD_GEO: - case CAL_COMPONENT_FIELD_PRIORITY: - case CAL_COMPONENT_FIELD_SUMMARY: - case CAL_COMPONENT_FIELD_TRANSPARENCY: - case CAL_COMPONENT_FIELD_URL: - case CAL_COMPONENT_FIELD_STATUS: - return dup_string (value); - - case CAL_COMPONENT_FIELD_COMPLETED: - case CAL_COMPONENT_FIELD_DTEND: - case CAL_COMPONENT_FIELD_DTSTART: - case CAL_COMPONENT_FIELD_DUE: - return dup_date_edit_value (value); - - case CAL_COMPONENT_FIELD_HAS_ALARMS: - case CAL_COMPONENT_FIELD_ICON: - case CAL_COMPONENT_FIELD_COMPLETE: - case CAL_COMPONENT_FIELD_PERCENT: - case CAL_COMPONENT_FIELD_RECURRING: - case CAL_COMPONENT_FIELD_OVERDUE: - case CAL_COMPONENT_FIELD_COLOR: - return (void *) value; - - case CAL_COMPONENT_FIELD_COMPONENT: { - CalComponent *comp; - - comp = CAL_COMPONENT (value); - gtk_object_ref (GTK_OBJECT (comp)); - return comp; - } - - default: - g_message ("calendar_model_duplicate_value(): Requested invalid column %d", col); - return NULL; - } -} - -/* free_value handler for the calendar table model */ -static void -calendar_model_free_value (ETableModel *etm, int col, void *value) -{ - g_return_if_fail (col >= 0 && col < CAL_COMPONENT_FIELD_NUM_FIELDS); - - switch (col) { - case CAL_COMPONENT_FIELD_CATEGORIES: - if (value) - g_free (value); - break; - - case CAL_COMPONENT_FIELD_CLASSIFICATION: - break; - - case CAL_COMPONENT_FIELD_COMPLETED: - case CAL_COMPONENT_FIELD_DTEND: - case CAL_COMPONENT_FIELD_DTSTART: - case CAL_COMPONENT_FIELD_DUE: - case CAL_COMPONENT_FIELD_GEO: - case CAL_COMPONENT_FIELD_PRIORITY: - case CAL_COMPONENT_FIELD_SUMMARY: - case CAL_COMPONENT_FIELD_STATUS: - if (value) - g_free (value); - break; - - case CAL_COMPONENT_FIELD_TRANSPARENCY: - break; - - case CAL_COMPONENT_FIELD_URL: - if (value) - g_free (value); - break; - - case CAL_COMPONENT_FIELD_PERCENT: - case CAL_COMPONENT_FIELD_HAS_ALARMS: - case CAL_COMPONENT_FIELD_ICON: - case CAL_COMPONENT_FIELD_COMPLETE: - case CAL_COMPONENT_FIELD_RECURRING: - case CAL_COMPONENT_FIELD_OVERDUE: - case CAL_COMPONENT_FIELD_COLOR: - break; - - case CAL_COMPONENT_FIELD_COMPONENT: - if (value) - gtk_object_unref (GTK_OBJECT (value)); - break; - - default: - g_message ("calendar_model_free_value(): Requested invalid column %d", col); - } -} - -/* Initializes a string value */ -static char * -init_string (void) -{ - return g_strdup (""); -} - -/* initialize_value handler for the calendar table model */ -static void * -calendar_model_initialize_value (ETableModel *etm, int col) -{ - CalendarModel *model; - - g_return_val_if_fail (col >= 0 && col < CAL_COMPONENT_FIELD_NUM_FIELDS, NULL); - - model = CALENDAR_MODEL (etm); - - switch (col) { - case CAL_COMPONENT_FIELD_CATEGORIES: - return g_strdup (model->priv->default_category ? model->priv->default_category : ""); - - case CAL_COMPONENT_FIELD_CLASSIFICATION: - case CAL_COMPONENT_FIELD_GEO: - case CAL_COMPONENT_FIELD_PRIORITY: - case CAL_COMPONENT_FIELD_SUMMARY: - case CAL_COMPONENT_FIELD_TRANSPARENCY: - case CAL_COMPONENT_FIELD_URL: - case CAL_COMPONENT_FIELD_STATUS: - return init_string (); - - case CAL_COMPONENT_FIELD_COMPLETED: - case CAL_COMPONENT_FIELD_DTEND: - case CAL_COMPONENT_FIELD_DTSTART: - case CAL_COMPONENT_FIELD_DUE: - case CAL_COMPONENT_FIELD_HAS_ALARMS: - case CAL_COMPONENT_FIELD_ICON: - case CAL_COMPONENT_FIELD_COMPLETE: - case CAL_COMPONENT_FIELD_RECURRING: - case CAL_COMPONENT_FIELD_OVERDUE: - case CAL_COMPONENT_FIELD_COLOR: - case CAL_COMPONENT_FIELD_COMPONENT: - return NULL; - - case CAL_COMPONENT_FIELD_PERCENT: - return GINT_TO_POINTER (-1); - - default: - g_message ("calendar_model_initialize_value(): Requested invalid column %d", col); - return NULL; - } -} - -/* value_is_empty handler for the calendar model. This should return TRUE - unless a significant value has been set. The 'click-to-add' feature - checks all fields to see if any are not empty and if so it adds a new - row, so we only want to return FALSE if we have a useful object. */ -static gboolean -calendar_model_value_is_empty (ETableModel *etm, int col, const void *value) -{ - CalendarModel *model; - CalendarModelPrivate *priv; - - g_return_val_if_fail (col >= 0 && col < CAL_COMPONENT_FIELD_NUM_FIELDS, TRUE); - - model = CALENDAR_MODEL (etm); - priv = model->priv; - - switch (col) { - case CAL_COMPONENT_FIELD_CATEGORIES: - /* This could be a hack or not. If the categories field only - * contains the default category, then it possibly means that - * the user has not entered anything at all in the click-to-add; - * the category is in the value because we put it there in - * calendar_model_initialize_value(). - */ - if (priv->default_category && value && strcmp (priv->default_category, value) == 0) - return TRUE; - else - return string_is_empty (value); - - case CAL_COMPONENT_FIELD_CLASSIFICATION: /* actually goes here, not by itself */ - case CAL_COMPONENT_FIELD_GEO: - case CAL_COMPONENT_FIELD_PRIORITY: - case CAL_COMPONENT_FIELD_SUMMARY: - case CAL_COMPONENT_FIELD_TRANSPARENCY: - case CAL_COMPONENT_FIELD_URL: - case CAL_COMPONENT_FIELD_STATUS: - return string_is_empty (value); - - case CAL_COMPONENT_FIELD_COMPLETED: - case CAL_COMPONENT_FIELD_DTEND: - case CAL_COMPONENT_FIELD_DTSTART: - case CAL_COMPONENT_FIELD_DUE: - return value ? FALSE : TRUE; - - case CAL_COMPONENT_FIELD_PERCENT: - return (GPOINTER_TO_INT (value) < 0) ? TRUE : FALSE; - - case CAL_COMPONENT_FIELD_HAS_ALARMS: - case CAL_COMPONENT_FIELD_ICON: - case CAL_COMPONENT_FIELD_COMPLETE: - case CAL_COMPONENT_FIELD_RECURRING: - case CAL_COMPONENT_FIELD_OVERDUE: - case CAL_COMPONENT_FIELD_COLOR: - case CAL_COMPONENT_FIELD_COMPONENT: - return TRUE; - - default: - g_message ("calendar_model_value_is_empty(): Requested invalid column %d", col); - return TRUE; - } -} - -static char* -date_value_to_string (ETableModel *etm, const void *value) -{ - CalendarModel *model; - CalendarModelPrivate *priv; - ECellDateEditValue *dv = (ECellDateEditValue *) value; - struct icaltimetype tt; - struct tm tmp_tm; - char buffer[64]; - - model = CALENDAR_MODEL (etm); - priv = model->priv; - - if (!dv) - return g_strdup (""); - - /* We currently convert all the dates to the current timezone. */ - tt = dv->tt; - icaltimezone_convert_time (&tt, dv->zone, priv->zone); - - tmp_tm.tm_year = tt.year - 1900; - tmp_tm.tm_mon = tt.month - 1; - tmp_tm.tm_mday = tt.day; - tmp_tm.tm_hour = tt.hour; - tmp_tm.tm_min = tt.minute; - tmp_tm.tm_sec = tt.second; - tmp_tm.tm_isdst = -1; - - tmp_tm.tm_wday = time_day_of_week (tt.day, tt.month - 1, tt.year); - - e_time_format_date_and_time (&tmp_tm, priv->use_24_hour_format, - TRUE, FALSE, - buffer, sizeof (buffer)); - return e_utf8_from_locale_string (buffer); -} - - -static char * -calendar_model_value_to_string (ETableModel *etm, int col, const void *value) -{ - g_return_val_if_fail (col >= 0 && col < CAL_COMPONENT_FIELD_NUM_FIELDS, NULL); - - switch (col) { - case CAL_COMPONENT_FIELD_CATEGORIES: - case CAL_COMPONENT_FIELD_CLASSIFICATION: - case CAL_COMPONENT_FIELD_GEO: - case CAL_COMPONENT_FIELD_PRIORITY: - case CAL_COMPONENT_FIELD_SUMMARY: - case CAL_COMPONENT_FIELD_TRANSPARENCY: - case CAL_COMPONENT_FIELD_URL: - case CAL_COMPONENT_FIELD_STATUS: - return g_strdup (value); - - case CAL_COMPONENT_FIELD_COMPLETED: - case CAL_COMPONENT_FIELD_DTEND: - case CAL_COMPONENT_FIELD_DTSTART: - case CAL_COMPONENT_FIELD_DUE: - return date_value_to_string (etm, value); - - case CAL_COMPONENT_FIELD_ICON: - if (GPOINTER_TO_INT (value) == 0) - return e_utf8_from_locale_string (_("Normal")); - else if (GPOINTER_TO_INT (value) == 1) - return e_utf8_from_locale_string (_("Recurring")); - else - return e_utf8_from_locale_string (_("Assigned")); - - case CAL_COMPONENT_FIELD_HAS_ALARMS: - case CAL_COMPONENT_FIELD_COMPLETE: - case CAL_COMPONENT_FIELD_RECURRING: - case CAL_COMPONENT_FIELD_OVERDUE: - return e_utf8_from_locale_string (value ? _("Yes") : _("No")); - - case CAL_COMPONENT_FIELD_COLOR: - return NULL; - - case CAL_COMPONENT_FIELD_COMPONENT: - return NULL; - - case CAL_COMPONENT_FIELD_PERCENT: - if (GPOINTER_TO_INT (value) < 0) - return g_strdup ("N/A"); - else - return g_strdup_printf ("%i%%", GPOINTER_TO_INT (value)); - - default: - g_message ("calendar_model_value_as_string(): Requested invalid column %d", col); - return NULL; - } -} - - - -/** - * calendar_model_new: - * - * Creates a new calendar model. It must be told about the calendar client - * interface object it will monitor with calendar_model_set_cal_client(). - * - * Return value: A newly-created calendar model. - **/ -CalendarModel * -calendar_model_new (void) -{ - return CALENDAR_MODEL (gtk_type_new (TYPE_CALENDAR_MODEL)); -} - - -/* 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) -{ - CalendarModel *model; - CalendarModelPrivate *priv; - int orig_idx; - CalComponent *new_comp; - const char *new_comp_uid; - int *new_idx; - CalClientGetStatus status; - CalendarModelObjectData new_object_data = { NULL, NULL, NULL, NULL }; - - model = CALENDAR_MODEL (data); - priv = model->priv; - - e_table_model_pre_change (E_TABLE_MODEL (model)); - - orig_idx = remove_object (model, uid); - - status = cal_client_get_object (priv->client, uid, &new_comp); - - switch (status) { - case CAL_CLIENT_GET_SUCCESS: - /* Insert the object into the model */ - - cal_component_get_uid (new_comp, &new_comp_uid); - - if (orig_idx == -1) { - /* The object not in the model originally, so we just append it */ - - g_array_append_val (priv->objects, new_comp); - g_array_append_val (priv->objects_data, new_object_data); - - new_idx = g_new (int, 1); - *new_idx = priv->objects->len - 1; - - g_hash_table_insert (priv->uid_index_hash, (char *) new_comp_uid, new_idx); - e_table_model_row_inserted (E_TABLE_MODEL (model), *new_idx); - } else { - int i; - - /* Insert the new version of the object in its old position */ - - g_array_insert_val (priv->objects, orig_idx, new_comp); - g_array_insert_val (priv->objects_data, orig_idx, - new_object_data); - - new_idx = g_new (int, 1); - *new_idx = orig_idx; - g_hash_table_insert (priv->uid_index_hash, (char *) new_comp_uid, new_idx); - - /* Increase the indices of all subsequent objects */ - - for (i = orig_idx + 1; i < priv->objects->len; i++) { - CalComponent *comp; - int *comp_idx; - const char *comp_uid; - - comp = g_array_index (priv->objects, CalComponent *, i); - g_assert (comp != NULL); - - cal_component_get_uid (comp, &comp_uid); - - comp_idx = g_hash_table_lookup (priv->uid_index_hash, comp_uid); - g_assert (comp_idx != NULL); - - (*comp_idx)++; - } - - e_table_model_row_changed (E_TABLE_MODEL (model), *new_idx); - } - - break; - - case CAL_CLIENT_GET_NOT_FOUND: - /* Nothing; the object may have been removed from the server. We just - * notify that the old object was deleted. - */ - if (orig_idx != -1) - e_table_model_row_deleted (E_TABLE_MODEL (model), orig_idx); - else - e_table_model_no_change (E_TABLE_MODEL (model)); - - break; - - case CAL_CLIENT_GET_SYNTAX_ERROR: - g_message ("obj_updated_cb(): Syntax error when getting object `%s'", uid); - - /* Same notification as above */ - if (orig_idx != -1) - e_table_model_row_deleted (E_TABLE_MODEL (model), orig_idx); - else - e_table_model_no_change (E_TABLE_MODEL (model)); - - break; - - default: - g_assert_not_reached (); - } -} - -/* Callback used when a component is removed from the live query */ -static void -query_obj_removed_cb (CalQuery *query, const char *uid, gpointer data) -{ - CalendarModel *model; - int idx; - - model = CALENDAR_MODEL (data); - - e_table_model_pre_change (E_TABLE_MODEL (model)); - - idx = remove_object (model, uid); - - if (idx != -1) - e_table_model_row_deleted (E_TABLE_MODEL (model), idx); - else - e_table_model_no_change (E_TABLE_MODEL (model)); -} - -/* Callback used when a query ends */ -static void -query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *error_str, gpointer data) -{ - CalendarModel *model; - - model = CALENDAR_MODEL (data); - - /* FIXME */ - - calendar_model_set_status_message (model, NULL); - - if (status != CAL_QUERY_DONE_SUCCESS) - g_warning ("query done: %s\n", error_str); -} - -/* 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) -{ - CalendarModel *model; - - model = CALENDAR_MODEL (data); - - /* FIXME */ - - calendar_model_set_status_message (model, NULL); - - g_warning ("eval error: %s\n", error_str); -} - -/* Builds a complete query sexp for the calendar model by adding the predicates - * to filter only for the type of objects that the model supports, and - * whether we want completed tasks. - */ -static char * -adjust_query_sexp (CalendarModel *model, const char *sexp) -{ - CalendarModelPrivate *priv; - CalObjType type; - char *type_sexp; - char *completed_sexp; - char *new_sexp; - - priv = model->priv; - - type = priv->type; - - if (!(type & CALOBJ_TYPE_ANY)) - type_sexp = g_strdup ("#t"); - else - type_sexp = g_strdup_printf ( - "(or %s %s %s)", - (type & CALOBJ_TYPE_EVENT) ? "(= (get-vtype) \"VEVENT\")" : "", - (type & CALOBJ_TYPE_TODO) ? "(= (get-vtype) \"VTODO\")" : "", - (type & CALOBJ_TYPE_JOURNAL) ? "(= (get-vtype) \"VJOURNAL\")" : ""); - - /* Create a sub-expression for filtering out completed tasks, based on - the config settings. */ - completed_sexp = calendar_config_get_hide_completed_tasks_sexp (); - - new_sexp = g_strdup_printf ("(and %s %s %s)", type_sexp, - completed_sexp ? completed_sexp : "", - sexp); - g_free (type_sexp); - g_free (completed_sexp); - -#if 0 - g_print ("Calendar model sexp:\n%s\n", new_sexp); -#endif - - return new_sexp; -} - -/* Restarts a query */ -static void -update_query (CalendarModel *model) -{ - CalendarModelPrivate *priv; - CalQuery *old_query; - char *real_sexp; - - priv = model->priv; - - e_table_model_pre_change (E_TABLE_MODEL (model)); - free_objects (model); - e_table_model_changed (E_TABLE_MODEL (model)); - - if (!(priv->client - && cal_client_get_load_state (priv->client) == CAL_CLIENT_LOAD_LOADED)) - return; - - old_query = priv->query; - priv->query = NULL; - - if (old_query) { - gtk_signal_disconnect_by_data (GTK_OBJECT (old_query), model); - gtk_object_unref (GTK_OBJECT (old_query)); - } - - g_assert (priv->sexp != NULL); - real_sexp = adjust_query_sexp (model, priv->sexp); - - calendar_model_set_status_message (model, _("Searching")); - priv->query = cal_client_get_query (priv->client, real_sexp); - g_free (real_sexp); - - if (!priv->query) { - g_message ("update_query(): Could not create the query"); - calendar_model_set_status_message (model, NULL); - return; - } - - gtk_signal_connect (GTK_OBJECT (priv->query), "obj_updated", - GTK_SIGNAL_FUNC (query_obj_updated_cb), model); - gtk_signal_connect (GTK_OBJECT (priv->query), "obj_removed", - GTK_SIGNAL_FUNC (query_obj_removed_cb), model); - gtk_signal_connect (GTK_OBJECT (priv->query), "query_done", - GTK_SIGNAL_FUNC (query_query_done_cb), model); - gtk_signal_connect (GTK_OBJECT (priv->query), "eval_error", - GTK_SIGNAL_FUNC (query_eval_error_cb), model); -} - -/* Callback used when a calendar is opened into the server */ -static void -cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) -{ - CalendarModel *model; - - model = CALENDAR_MODEL (data); - - if (status != CAL_CLIENT_OPEN_SUCCESS) - return; - - update_query (model); -} - - -/* Removes an object from the model and updates all the indices that follow. - * Returns the index of the object that was removed, or -1 if no object with - * such UID was found. - */ -static int -remove_object (CalendarModel *model, const char *uid) -{ - CalendarModelPrivate *priv; - int *idx; - CalComponent *orig_comp; - int i; - int n; - CalendarModelObjectData *object_data; - - priv = model->priv; - - /* Find the index of the object to be removed */ - - idx = g_hash_table_lookup (priv->uid_index_hash, uid); - if (!idx) - return -1; - - orig_comp = g_array_index (priv->objects, CalComponent *, *idx); - g_assert (orig_comp != NULL); - - /* Decrease the indices of all the objects that follow in the array */ - - for (i = *idx + 1; i < priv->objects->len; i++) { - CalComponent *comp; - int *comp_idx; - const char *comp_uid; - - comp = g_array_index (priv->objects, CalComponent *, i); - g_assert (comp != NULL); - - cal_component_get_uid (comp, &comp_uid); - - comp_idx = g_hash_table_lookup (priv->uid_index_hash, comp_uid); - g_assert (comp_idx != NULL); - - (*comp_idx)--; - g_assert (*comp_idx >= 0); - } - - /* Remove this object from the array and hash */ - - g_hash_table_remove (priv->uid_index_hash, uid); - g_array_remove_index (priv->objects, *idx); - - object_data = &g_array_index (priv->objects_data, - CalendarModelObjectData, *idx); - calendar_model_free_object_data (model, object_data); - g_array_remove_index (priv->objects_data, *idx); - - gtk_object_unref (GTK_OBJECT (orig_comp)); - - n = *idx; - g_free (idx); - - return n; -} - -/* Displays messages on the status bar */ -#define EVOLUTION_TASKS_PROGRESS_IMAGE "evolution-tasks-mini.png" -static GdkPixbuf *progress_icon[2] = { NULL, NULL }; - -void -calendar_model_set_status_message (CalendarModel *model, const char *message) -{ - extern EvolutionShellClient *global_shell_client; /* ugly */ - CalendarModelPrivate *priv; - - g_return_if_fail (IS_CALENDAR_MODEL (model)); - - priv = model->priv; - - if (!message || !*message) { - if (priv->activity) { - gtk_object_unref (GTK_OBJECT (priv->activity)); - priv->activity = NULL; - } - } - else if (!priv->activity) { - int display; - char *client_id = g_strdup_printf ("%p", model); - - if (progress_icon[0] == NULL) - progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_TASKS_PROGRESS_IMAGE); - priv->activity = evolution_activity_client_new ( - global_shell_client, client_id, - progress_icon, message, TRUE, &display); - - g_free (client_id); - } - else - evolution_activity_client_update (priv->activity, message, -1.0); -} - -/** - * calendar_model_get_cal_client: - * @model: A calendar model. - * - * Queries the calendar client interface object that a calendar model is using. - * - * Return value: A calendar client interface object. - **/ -CalClient * -calendar_model_get_cal_client (CalendarModel *model) -{ - CalendarModelPrivate *priv; - - g_return_val_if_fail (model != NULL, NULL); - g_return_val_if_fail (IS_CALENDAR_MODEL (model), NULL); - - priv = model->priv; - - return priv->client; -} - - -/** - * calendar_model_set_cal_client: - * @model: A calendar model. - * @client: A calendar client interface object. - * @type: Type of objects to present. - * - * Sets the calendar client interface object that a calendar model will monitor. - * It also sets the types of objects this model will present to an #ETable. - **/ -void -calendar_model_set_cal_client (CalendarModel *model, CalClient *client, CalObjType type) -{ - CalendarModelPrivate *priv; - - g_return_if_fail (model != NULL); - g_return_if_fail (IS_CALENDAR_MODEL (model)); - - if (client) - g_return_if_fail (IS_CAL_CLIENT (client)); - - priv = model->priv; - - if (priv->client == client && priv->type == type) - return; - - if (client) - gtk_object_ref (GTK_OBJECT (client)); - - if (priv->client) { - gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), model); - gtk_object_unref (GTK_OBJECT (priv->client)); - } - - priv->client = client; - priv->type = type; - - if (priv->client) { - if (cal_client_get_load_state (priv->client) == CAL_CLIENT_LOAD_LOADED) - update_query (model); - else - gtk_signal_connect (GTK_OBJECT (priv->client), "cal_opened", - GTK_SIGNAL_FUNC (cal_opened_cb), model); - } -} - -/** - * calendar_model_set_query: - * @model: A calendar model. - * @sexp: Sexp that defines the query. - * - * Sets the query sexp that a calendar model will use to filter its contents. - **/ -void -calendar_model_set_query (CalendarModel *model, const char *sexp) -{ - CalendarModelPrivate *priv; - - g_return_if_fail (model != NULL); - g_return_if_fail (IS_CALENDAR_MODEL (model)); - g_return_if_fail (sexp != NULL); - - priv = model->priv; - - if (priv->sexp) - g_free (priv->sexp); - - priv->sexp = g_strdup (sexp); - - update_query (model); -} - - -/** - * calendar_model_set_new_comp_vtype: - * @model: A calendar model. - * @vtype: Type of calendar components to create. - * - * Sets the type of calendar components that will be created by a calendar table - * model when the click-to-add functionality of the table is used. - **/ -void -calendar_model_set_new_comp_vtype (CalendarModel *model, CalComponentVType vtype) -{ - CalendarModelPrivate *priv; - - g_return_if_fail (model != NULL); - g_return_if_fail (IS_CALENDAR_MODEL (model)); - g_return_if_fail (vtype != CAL_COMPONENT_NO_TYPE); - - priv = model->priv; - priv->new_comp_vtype = vtype; -} - -/** - * calendar_model_get_new_comp_vtype: - * @model: A calendar model. - * - * Queries the type of calendar components that are created by a calendar table - * model when using the click-to-add functionality in a table. - * - * Return value: Type of components that are created. - **/ -CalComponentVType -calendar_model_get_new_comp_vtype (CalendarModel *model) -{ - CalendarModelPrivate *priv; - - g_return_val_if_fail (model != NULL, CAL_COMPONENT_NO_TYPE); - g_return_val_if_fail (IS_CALENDAR_MODEL (model), CAL_COMPONENT_NO_TYPE); - - priv = model->priv; - return priv->new_comp_vtype; -} - - -void -calendar_model_mark_task_complete (CalendarModel *model, - gint row) -{ - CalendarModelPrivate *priv; - CalComponent *comp; - - g_return_if_fail (model != NULL); - g_return_if_fail (IS_CALENDAR_MODEL (model)); - - priv = model->priv; - - g_return_if_fail (row >= 0 && row < priv->objects->len); - - comp = g_array_index (priv->objects, CalComponent *, row); - g_assert (comp != NULL); - - ensure_task_complete (comp, -1); - - if (cal_client_update_object (priv->client, comp) != CAL_CLIENT_RESULT_SUCCESS) - g_message ("calendar_model_mark_task_complete(): Could not update the object!"); -} - - -/** - * calendar_model_get_component: - * @model: A calendar model. - * @row: Row number of sought calendar component. - * - * Queries a calendar component from a calendar model based on its row number. - * - * Return value: The sought calendar component. - **/ -CalComponent * -calendar_model_get_component (CalendarModel *model, - gint row) -{ - CalendarModelPrivate *priv; - - g_return_val_if_fail (model != NULL, NULL); - g_return_val_if_fail (IS_CALENDAR_MODEL (model), NULL); - - priv = model->priv; - - g_return_val_if_fail (row >= 0 && row < priv->objects->len, NULL); - - return g_array_index (priv->objects, CalComponent *, row); -} - - -/* This makes sure a task is marked as complete. - It makes sure the "Date Completed" property is set. If the completed_date - is not -1, then that is used, otherwise if the "Date Completed" property - is not already set it is set to the current time. - It makes sure the percent is set to 100, and that the status is "Completed". - Note that this doesn't update the component on the server. */ -static void -ensure_task_complete (CalComponent *comp, - time_t completed_date) -{ - struct icaltimetype *old_completed = NULL; - int *old_percent, new_percent; - icalproperty_status status; - gboolean set_completed = TRUE; - - /* Date Completed. */ - if (completed_date == -1) { - cal_component_get_completed (comp, &old_completed); - - if (old_completed) { - cal_component_free_icaltimetype (old_completed); - set_completed = FALSE; - } else { - completed_date = time (NULL); - } - } - - if (set_completed) { - icaltimezone *utc_zone; - struct icaltimetype new_completed; - - /* COMPLETED is stored in UTC. */ - utc_zone = icaltimezone_get_utc_timezone (); - new_completed = icaltime_from_timet_with_zone (completed_date, - FALSE, - utc_zone); - cal_component_set_completed (comp, &new_completed); - } - - /* Percent. */ - cal_component_get_percent (comp, &old_percent); - if (!old_percent || *old_percent != 100) { - new_percent = 100; - cal_component_set_percent (comp, &new_percent); - } - if (old_percent) - cal_component_free_percent (old_percent); - - /* Status. */ - cal_component_get_status (comp, &status); - if (status != ICAL_STATUS_COMPLETED) { - cal_component_set_status (comp, ICAL_STATUS_COMPLETED); - } -} - - -/* This makes sure a task is marked as incomplete. It clears the - "Date Completed" property. If the percent is set to 100 it removes it, - and if the status is "Completed" it sets it to "Needs Action". - Note that this doesn't update the component on the client. */ -static void -ensure_task_not_complete (CalComponent *comp) -{ - icalproperty_status old_status; - int *old_percent; - - /* Date Completed. */ - cal_component_set_completed (comp, NULL); - - /* Percent. */ - cal_component_get_percent (comp, &old_percent); - if (old_percent && *old_percent == 100) - cal_component_set_percent (comp, NULL); - if (old_percent) - cal_component_free_percent (old_percent); - - /* Status. */ - cal_component_get_status (comp, &old_status); - if (old_status == ICAL_STATUS_COMPLETED) - cal_component_set_status (comp, ICAL_STATUS_NEEDSACTION); -} - - -/* Whether we use 24 hour format to display the times. */ -gboolean -calendar_model_get_use_24_hour_format (CalendarModel *model) -{ - g_return_val_if_fail (IS_CALENDAR_MODEL (model), TRUE); - - return model->priv->use_24_hour_format; -} - - -void -calendar_model_set_use_24_hour_format (CalendarModel *model, - gboolean use_24_hour_format) -{ - g_return_if_fail (IS_CALENDAR_MODEL (model)); - - if (model->priv->use_24_hour_format != use_24_hour_format) { - e_table_model_pre_change (E_TABLE_MODEL (model)); - model->priv->use_24_hour_format = use_24_hour_format; - /* Get the views to redraw themselves. */ - e_table_model_changed (E_TABLE_MODEL (model)); - } -} - - -void -calendar_model_set_default_category (CalendarModel *model, - const char *default_category) -{ - g_return_if_fail (IS_CALENDAR_MODEL (model)); - - g_free (model->priv->default_category); - model->priv->default_category = g_strdup (default_category); -} - - - -/* The current timezone. */ -icaltimezone* -calendar_model_get_timezone (CalendarModel *model) -{ - g_return_val_if_fail (IS_CALENDAR_MODEL (model), NULL); - - return model->priv->zone; -} - - -void -calendar_model_set_timezone (CalendarModel *model, - icaltimezone *zone) -{ - g_return_if_fail (IS_CALENDAR_MODEL (model)); - - if (model->priv->zone != zone) { - e_table_model_pre_change (E_TABLE_MODEL (model)); - model->priv->zone = zone; - - /* The timezone affects the times shown for COMPLETED and - maybe other fields, so we need to redisplay everything. */ - e_table_model_changed (E_TABLE_MODEL (model)); - } -} - - -/** - * calendar_model_refresh: - * @model: A calendar model. - * - * Refreshes the calendar model, reloading the events/tasks from the server. - * Be careful about doing this when the user is editing an event/task. - **/ -void -calendar_model_refresh (CalendarModel *model) -{ - g_return_if_fail (model != NULL); - g_return_if_fail (IS_CALENDAR_MODEL (model)); - - update_query (model); -} diff --git a/calendar/gui/calendar-model.h b/calendar/gui/calendar-model.h deleted file mode 100644 index 6ac175034c..0000000000 --- a/calendar/gui/calendar-model.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Evolution calendar - Data model for ETable - * - * Copyright (C) 2000 Ximian, Inc. - * Copyright (C) 2000 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CALENDAR_MODEL_H -#define CALENDAR_MODEL_H - -#include <libgnome/gnome-defs.h> -#include <gal/e-table/e-table-model.h> -#include <cal-client/cal-client.h> - -BEGIN_GNOME_DECLS - - - -#define TYPE_CALENDAR_MODEL (calendar_model_get_type ()) -#define CALENDAR_MODEL(obj) (GTK_CHECK_CAST ((obj), TYPE_CALENDAR_MODEL, CalendarModel)) -#define CALENDAR_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_CALENDAR_MODEL, \ - CalendarModelClass)) -#define IS_CALENDAR_MODEL(obj) (GTK_CHECK_TYPE ((obj), TYPE_CALENDAR_MODEL)) -#define IS_CALENDAR_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_CALENDAR_MODEL)) - -typedef struct _CalendarModel CalendarModel; -typedef struct _CalendarModelClass CalendarModelClass; - -typedef struct _CalendarModelPrivate CalendarModelPrivate; - -struct _CalendarModel { - ETableModel model; - - /* Private data */ - CalendarModelPrivate *priv; -}; - -struct _CalendarModelClass { - ETableModelClass parent_class; -}; - -GtkType calendar_model_get_type (void); - -CalendarModel* calendar_model_new (void); - -CalClient* calendar_model_get_cal_client (CalendarModel *model); -void calendar_model_set_cal_client (CalendarModel *model, - CalClient *client, - CalObjType type); - -void calendar_model_set_query (CalendarModel *model, - const char *sexp); - -void calendar_model_refresh (CalendarModel *model); - -void calendar_model_set_new_comp_vtype (CalendarModel *model, - CalComponentVType vtype); -CalComponentVType calendar_model_get_new_comp_vtype (CalendarModel *model); - -void calendar_model_mark_task_complete (CalendarModel *model, - gint row); - -CalComponent* calendar_model_get_component (CalendarModel *model, - gint row); - -/* Whether we use 24 hour format to display the times. */ -gboolean calendar_model_get_use_24_hour_format (CalendarModel *model); -void calendar_model_set_use_24_hour_format (CalendarModel *model, - gboolean use_24_hour_format); - -/* The current timezone. */ -icaltimezone* calendar_model_get_timezone (CalendarModel *model); -void calendar_model_set_timezone (CalendarModel *model, - icaltimezone *zone); - -void calendar_model_set_default_category (CalendarModel *model, - const char *default_category); - -void calendar_model_set_status_message (CalendarModel *model, - const char *message); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/gui/calendar-offline-handler.c b/calendar/gui/calendar-offline-handler.c deleted file mode 100644 index a01d3fa160..0000000000 --- a/calendar/gui/calendar-offline-handler.c +++ /dev/null @@ -1,282 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* calendar-offline-handler.c - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Authors: - * Ettore Perazzoli <ettore@ximian.com> - * Dan Winship <danw@ximian.com> - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtkmain.h> -#include <gtk/gtksignal.h> -#include <bonobo/bonobo-exception.h> -#include <gal/util/e-util.h> -#include "e-util/e-url.h" -#include <cal-client/cal-client.h> -#include "calendar-offline-handler.h" - -#define PARENT_TYPE bonobo_x_object_get_type () -static BonoboXObjectClass *parent_class = NULL; - -struct _CalendarOfflineHandlerPrivate { - CalClient *client; - - GNOME_Evolution_OfflineProgressListener listener_interface; - - gboolean is_offline; -}; - -static void -add_connection (gpointer data, gpointer user_data) -{ - EUri *uri = e_uri_new (data); - GNOME_Evolution_ConnectionList *list = user_data; - - g_return_if_fail (uri != NULL); - - if (uri->host != NULL) - list->_buffer[list->_length].hostName = CORBA_string_dup (uri->host); - else - list->_buffer[list->_length].hostName = CORBA_string_dup ("Unknown"); - if (uri->protocol != NULL) - list->_buffer[list->_length].type = CORBA_string_dup (uri->protocol); - else - list->_buffer[list->_length].type = CORBA_string_dup ("Unknown"); - list->_length++; - - e_uri_free (uri); -} - -static GNOME_Evolution_ConnectionList * -create_connection_list (CalendarOfflineHandler *offline_handler) -{ - CalendarOfflineHandlerPrivate *priv; - GNOME_Evolution_ConnectionList *list; - GList *uris; - - priv = offline_handler->priv; - - uris = cal_client_uri_list (priv->client, CAL_MODE_REMOTE); - - list = GNOME_Evolution_ConnectionList__alloc (); - list->_length = 0; - list->_maximum = g_list_length (uris); - list->_buffer = CORBA_sequence_GNOME_Evolution_Connection_allocbuf (list->_maximum); - - g_list_foreach (uris, add_connection, list); - - return list; -} - -/* GNOME::Evolution::Offline methods. */ -static CORBA_boolean -impl__get_isOffline (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - CalendarOfflineHandler *offline_handler; - CalendarOfflineHandlerPrivate *priv; - - offline_handler = CALENDAR_OFFLINE_HANDLER (bonobo_object_from_servant (servant)); - priv = offline_handler->priv; - - return priv->is_offline; -} - -static void -impl_prepareForOffline (PortableServer_Servant servant, - GNOME_Evolution_ConnectionList **active_connection_list, - CORBA_Environment *ev) -{ - CalendarOfflineHandler *offline_handler; - CalendarOfflineHandlerPrivate *priv; - - offline_handler = CALENDAR_OFFLINE_HANDLER (bonobo_object_from_servant (servant)); - priv = offline_handler->priv; - - *active_connection_list = create_connection_list (offline_handler); -} - -static void -update_offline (CalendarOfflineHandler *offline_handler) -{ - CalendarOfflineHandlerPrivate *priv; - GNOME_Evolution_ConnectionList *connection_list; - CORBA_Environment ev; - - priv = offline_handler->priv; - - connection_list = create_connection_list (offline_handler); - - CORBA_exception_init (&ev); - - GNOME_Evolution_OfflineProgressListener_updateProgress (priv->listener_interface, - connection_list, &ev); - - if (BONOBO_EX (&ev)) - g_warning ("Error updating offline progress"); - - CORBA_exception_free (&ev); -} - -static void -backend_cal_set_mode (CalClient *client, CalClientSetModeStatus status, CalMode mode, gpointer data) -{ - CalendarOfflineHandler *offline_handler = data; - - update_offline (offline_handler); -} - -static void -backend_cal_opened (CalClient *client, CalClientOpenStatus status, gpointer data) -{ - CalendarOfflineHandler *offline_handler = data; - - if (status != CAL_CLIENT_OPEN_SUCCESS) { - update_offline (offline_handler); - gtk_object_unref (GTK_OBJECT (client)); - return; - } - - gtk_signal_connect (GTK_OBJECT (client), "cal_set_mode", - backend_cal_set_mode, offline_handler); - cal_client_set_mode (client, CAL_MODE_LOCAL); -} - -static void -backend_go_offline (gpointer data, gpointer user_data) -{ - CalendarOfflineHandler *offline_handler = user_data; - char *uri = data; - CalClient *client; - gboolean success; - - client = cal_client_new (); - gtk_signal_connect (GTK_OBJECT (client), "cal_opened", - backend_cal_opened, offline_handler); - success = cal_client_open_calendar (client, uri, TRUE); - if (!success) { - update_offline (offline_handler); - gtk_object_unref (GTK_OBJECT (client)); - return; - } -} - -static void -impl_goOffline (PortableServer_Servant servant, - const GNOME_Evolution_OfflineProgressListener progress_listener, - CORBA_Environment *ev) -{ - CalendarOfflineHandler *offline_handler; - CalendarOfflineHandlerPrivate *priv; - GList *uris; - - offline_handler = CALENDAR_OFFLINE_HANDLER (bonobo_object_from_servant (servant)); - priv = offline_handler->priv; - - /* To update the status */ - priv->listener_interface = CORBA_Object_duplicate (progress_listener, ev); - - uris = cal_client_uri_list (priv->client, CAL_MODE_REMOTE); - - g_list_foreach (uris, backend_go_offline, offline_handler); -} - -static void -impl_goOnline (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - CalendarOfflineHandler *offline_handler; - CalendarOfflineHandlerPrivate *priv; - - offline_handler = CALENDAR_OFFLINE_HANDLER (bonobo_object_from_servant (servant)); - priv = offline_handler->priv; -} - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - CalendarOfflineHandler *offline_handler; - CalendarOfflineHandlerPrivate *priv; - - offline_handler = CALENDAR_OFFLINE_HANDLER (object); - priv = offline_handler->priv; - - if (priv->listener_interface != CORBA_OBJECT_NIL) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->listener_interface, &ev); - CORBA_exception_free (&ev); - } - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -/* GTK+ type initialization. */ - -static void -calendar_offline_handler_class_init (CalendarOfflineHandlerClass *klass) -{ - GtkObjectClass *object_class; - POA_GNOME_Evolution_Offline__epv *epv; - - object_class = GTK_OBJECT_CLASS (klass); - object_class->destroy = impl_destroy; - - epv = & klass->epv; - epv->_get_isOffline = impl__get_isOffline; - epv->prepareForOffline = impl_prepareForOffline; - epv->goOffline = impl_goOffline; - epv->goOnline = impl_goOnline; - - parent_class = gtk_type_class (PARENT_TYPE); -} - -static void -calendar_offline_handler_init (CalendarOfflineHandler *offline_handler) -{ - CalendarOfflineHandlerPrivate *priv; - - priv = g_new (CalendarOfflineHandlerPrivate, 1); - offline_handler->priv = priv; - - priv->client = cal_client_new (); - priv->listener_interface = CORBA_OBJECT_NIL; - priv->is_offline = FALSE; -} - -CalendarOfflineHandler * -calendar_offline_handler_new (void) -{ - CalendarOfflineHandler *new; - - new = gtk_type_new (calendar_offline_handler_get_type ()); - - return new; -} - -BONOBO_X_TYPE_FUNC_FULL (CalendarOfflineHandler, GNOME_Evolution_Offline, PARENT_TYPE, calendar_offline_handler); diff --git a/calendar/gui/calendar-offline-handler.h b/calendar/gui/calendar-offline-handler.h deleted file mode 100644 index 4b87fd659f..0000000000 --- a/calendar/gui/calendar-offline-handler.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* calendar-offline-handler.h - * - * Copyright (C) 2001 Ximian, Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: Ettore Perazzoli <ettore@ximian.com> - */ - -#ifndef _CALENDAR_OFFLINE_HANDLER_H_ -#define _CALENDAR_OFFLINE_HANDLER_H_ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-xobject.h> -#include "Evolution.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define CALENDAR_TYPE_OFFLINE_HANDLER (calendar_offline_handler_get_type ()) -#define CALENDAR_OFFLINE_HANDLER(obj) (GTK_CHECK_CAST ((obj), CALENDAR_TYPE_OFFLINE_HANDLER, CalendarOfflineHandler)) -#define CALENDAR_OFFLINE_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CALENDAR_TYPE_OFFLINE_HANDLER, CalendarOfflineHandlerClass)) -#define CALENDAR_IS_OFFLINE_HANDLER(obj) (GTK_CHECK_TYPE ((obj), CALENDAR_TYPE_OFFLINE_HANDLER)) -#define CALENDAR_IS_OFFLINE_HANDLER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), CALENDAR_TYPE_OFFLINE_HANDLER)) - - -typedef struct _CalendarOfflineHandler CalendarOfflineHandler; -typedef struct _CalendarOfflineHandlerPrivate CalendarOfflineHandlerPrivate; -typedef struct _CalendarOfflineHandlerClass CalendarOfflineHandlerClass; - -struct _CalendarOfflineHandler { - BonoboXObject parent; - - CalendarOfflineHandlerPrivate *priv; -}; - -struct _CalendarOfflineHandlerClass { - BonoboXObjectClass parent_class; - - POA_GNOME_Evolution_Offline__epv epv; -}; - - -GtkType calendar_offline_handler_get_type (void); -CalendarOfflineHandler *calendar_offline_handler_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* _CALENDAR_OFFLINE_HANDLER_H_ */ diff --git a/calendar/gui/calendar-view-factory.c b/calendar/gui/calendar-view-factory.c deleted file mode 100644 index 0c3f0562f9..0000000000 --- a/calendar/gui/calendar-view-factory.c +++ /dev/null @@ -1,252 +0,0 @@ -/* Evolution calendar - Generic view factory for calendar views - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> -#include "calendar-view-factory.h" -#include "calendar-view.h" - - - -/* Private part of the CalendarViewFactory structure */ -struct _CalendarViewFactoryPrivate { - /* Type of views created by this factory */ - GnomeCalendarViewType view_type; -}; - - - -static void calendar_view_factory_class_init (CalendarViewFactoryClass *class); -static void calendar_view_factory_init (CalendarViewFactory *cal_view_factory); -static void calendar_view_factory_destroy (GtkObject *object); - -static const char *calendar_view_factory_get_title (GalViewFactory *factory); -static const char *calendar_view_factory_get_type_code (GalViewFactory *factory); -static GalView *calendar_view_factory_new_view (GalViewFactory *factory, const char *name); - -static GalViewFactoryClass *parent_class = NULL; - - - -/** - * calendar_view_factory_get_type: - * - * Registers the #CalendarViewFactory class if necessary, and returns the type - * ID associated to it. - * - * Return value: The type ID of the #CalendarViewFactory class. - **/ -GtkType -calendar_view_factory_get_type (void) -{ - static GtkType calendar_view_factory_type; - - if (!calendar_view_factory_type) { - static const GtkTypeInfo calendar_view_factory_info = { - "CalendarViewFactory", - sizeof (CalendarViewFactory), - sizeof (CalendarViewFactoryClass), - (GtkClassInitFunc) calendar_view_factory_class_init, - (GtkObjectInitFunc) calendar_view_factory_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - calendar_view_factory_type = gtk_type_unique (GAL_VIEW_FACTORY_TYPE, - &calendar_view_factory_info); - } - - return calendar_view_factory_type; -} - -/* Class initialization function for the calendar view factory */ -static void -calendar_view_factory_class_init (CalendarViewFactoryClass *class) -{ - GalViewFactoryClass *gal_view_factory_class; - GtkObjectClass *object_class; - - parent_class = gtk_type_class (GAL_VIEW_FACTORY_TYPE); - - gal_view_factory_class = (GalViewFactoryClass *) class; - object_class = (GtkObjectClass *) class; - - gal_view_factory_class->get_title = calendar_view_factory_get_title; - gal_view_factory_class->get_type_code = calendar_view_factory_get_type_code; - gal_view_factory_class->new_view = calendar_view_factory_new_view; - - object_class->destroy = calendar_view_factory_destroy; -} - -/* Object initialization class for the calendar view factory */ -static void -calendar_view_factory_init (CalendarViewFactory *cal_view_factory) -{ - CalendarViewFactoryPrivate *priv; - - priv = g_new0 (CalendarViewFactoryPrivate, 1); - cal_view_factory->priv = priv; -} - -/* Destroy method for the calendar view factory */ -static void -calendar_view_factory_destroy (GtkObject *object) -{ - CalendarViewFactory *cal_view_factory; - CalendarViewFactoryPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CALENDAR_VIEW_FACTORY (object)); - - cal_view_factory = CALENDAR_VIEW_FACTORY (object); - priv = cal_view_factory->priv; - - g_free (priv); - cal_view_factory->priv = NULL; - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* get_title method for the calendar view factory */ -static const char * -calendar_view_factory_get_title (GalViewFactory *factory) -{ - CalendarViewFactory *cal_view_factory; - CalendarViewFactoryPrivate *priv; - - cal_view_factory = CALENDAR_VIEW_FACTORY (factory); - priv = cal_view_factory->priv; - - switch (priv->view_type) { - case GNOME_CAL_DAY_VIEW: - return _("Day View"); - - case GNOME_CAL_WORK_WEEK_VIEW: - return _("Work Week View"); - - case GNOME_CAL_WEEK_VIEW: - return _("Week View"); - - case GNOME_CAL_MONTH_VIEW: - return _("Month View"); - - default: - g_assert_not_reached (); - return NULL; - } -} - -/* get_type_code method for the calendar view factory */ -static const char * -calendar_view_factory_get_type_code (GalViewFactory *factory) -{ - CalendarViewFactory *cal_view_factory; - CalendarViewFactoryPrivate *priv; - - cal_view_factory = CALENDAR_VIEW_FACTORY (factory); - priv = cal_view_factory->priv; - - switch (priv->view_type) { - case GNOME_CAL_DAY_VIEW: - return "day_view"; - - case GNOME_CAL_WORK_WEEK_VIEW: - return "work_week_view"; - - case GNOME_CAL_WEEK_VIEW: - return "week_view"; - - case GNOME_CAL_MONTH_VIEW: - return "month_view"; - - default: - g_assert_not_reached (); - return NULL; - } -} - -/* new_view method for the calendar view factory */ -static GalView * -calendar_view_factory_new_view (GalViewFactory *factory, const char *name) -{ - CalendarViewFactory *cal_view_factory; - CalendarViewFactoryPrivate *priv; - CalendarView *cal_view; - - cal_view_factory = CALENDAR_VIEW_FACTORY (factory); - priv = cal_view_factory->priv; - - cal_view = calendar_view_new (priv->view_type, name); - return GAL_VIEW (cal_view); -} - - - -/** - * calendar_view_factory_construct: - * @cal_view_factory: A calendar view factory. - * @view_type: Type of calendar views that the factory will create. - * - * Constructs a calendar view factory by setting the type of views it will - * create. - * - * Return value: The same value as @cal_view_factory. - **/ -CalendarViewFactory * -calendar_view_factory_construct (CalendarViewFactory *cal_view_factory, - GnomeCalendarViewType view_type) -{ - CalendarViewFactoryPrivate *priv; - - g_return_val_if_fail (cal_view_factory != NULL, NULL); - g_return_val_if_fail (IS_CALENDAR_VIEW_FACTORY (cal_view_factory), NULL); - - priv = cal_view_factory->priv; - - priv->view_type = view_type; - - return cal_view_factory; -} - -/** - * calendar_view_factory_new: - * @view_type: Type of calendar views that the factory will create. - * - * Creates a new factory for calendar views. - * - * Return value: A newly-created calendar view factory. - **/ -CalendarViewFactory * -calendar_view_factory_new (GnomeCalendarViewType view_type) -{ - CalendarViewFactory *cal_view_factory; - - cal_view_factory = gtk_type_new (TYPE_CALENDAR_VIEW_FACTORY); - return calendar_view_factory_construct (cal_view_factory, view_type); -} diff --git a/calendar/gui/calendar-view-factory.h b/calendar/gui/calendar-view-factory.h deleted file mode 100644 index 6b3409afeb..0000000000 --- a/calendar/gui/calendar-view-factory.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Evolution calendar - Generic view factory for calendar views - * - * Copyright (C) 2001 Ximian, Inc. - * - * Author: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |