From 44d3f6715ae3aa7b46cbf9d8991eff11c60dcc17 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Sun, 11 Nov 2001 21:07:43 +0000 Subject: new protos 001-11-11 JP Rosevear * 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 svn path=/trunk/; revision=14669 --- calendar/ChangeLog | 15 +++++++- calendar/gui/dialogs/schedule-page.c | 3 +- calendar/gui/e-meeting-model.c | 67 ++++++++++++++++++++++++++---------- calendar/gui/e-meeting-model.h | 3 ++ 4 files changed, 68 insertions(+), 20 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 546e83e404..863403d649 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,16 @@ +2001-11-11 JP Rosevear + + * 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 * gui/e-week-view.c (e_week_view_key_press): don't subtract a day @@ -31,7 +44,7 @@ CalComponent we create 2001-11-08 JP Rosevear - + * 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 diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index c1397d24c1..f9ee7a10a9 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -265,7 +265,8 @@ update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponent if (start_zone != end_zone) { icaltimezone_convert_time (&end_tt, end_zone, start_zone); } - + e_meeting_model_set_zone (priv->model, priv->zone); + all_day = (start_tt.is_date && end_tt.is_date) ? TRUE : FALSE; /* For All Day Events, if DTEND is after DTSTART, we subtract 1 day diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c index e6ecadbf46..f8daf00cf8 100644 --- a/calendar/gui/e-meeting-model.c +++ b/calendar/gui/e-meeting-model.c @@ -75,6 +75,7 @@ struct _EMeetingModelPrivate ETableWithout *without; CalClient *client; + icaltimezone *zone; EBook *ebook; gboolean book_loaded; @@ -390,7 +391,6 @@ append_row (ETableModel *etm, ETableModel *source, int row) address = (char *) e_table_model_value_at (source, ITIP_ADDRESS_COL, row); if (find_match (im, address, NULL) != NULL) { -// duplicate_error (); return; } @@ -659,6 +659,7 @@ init (EMeetingModel *im) e_table_without_hide (priv->without, g_strdup ("delegator")); priv->client = NULL; + priv->zone = icaltimezone_get_builtin_timezone (calendar_config_get_timezone ()); priv->ebook = NULL; priv->book_loaded = FALSE; @@ -723,6 +724,32 @@ e_meeting_model_set_cal_client (EMeetingModel *im, CalClient *client) priv->client = client; } +icaltimezone * +e_meeting_model_get_zone (EMeetingModel *im) +{ + EMeetingModelPrivate *priv; + + g_return_val_if_fail (im != NULL, NULL); + g_return_val_if_fail (E_IS_MEETING_MODEL (im), NULL); + + priv = im->priv; + + return priv->zone; +} + +void +e_meeting_model_set_zone (EMeetingModel *im, icaltimezone *zone) +{ + EMeetingModelPrivate *priv; + + g_return_if_fail (im != NULL); + g_return_if_fail (E_IS_MEETING_MODEL (im)); + + priv = im->priv; + + priv->zone = zone; +} + static ETableScrolled * build_etable (ETableModel *model, const gchar *spec_file, const gchar *state_file) { @@ -1017,13 +1044,13 @@ convert_time (struct icaltimetype itt, icaltimezone *from, icaltimezone *to) } static void -process_free_busy_comp (EMeetingAttendee *ia, icalcomponent *fb_comp, icalcomponent *tz_top_level) +process_free_busy_comp (EMeetingAttendee *ia, + icalcomponent *fb_comp, + icaltimezone *zone, + icalcomponent *tz_top_level) { icalproperty *ip; - icaltimezone *view_zone; - view_zone = icaltimezone_get_builtin_timezone (calendar_config_get_timezone ()); - ip = icalcomponent_get_first_property (fb_comp, ICAL_DTSTART_PROPERTY); if (ip != NULL) { struct icaltimetype dtstart; @@ -1033,7 +1060,7 @@ process_free_busy_comp (EMeetingAttendee *ia, icalcomponent *fb_comp, icalcompon if (!dtstart.is_utc) { ds_zone = find_zone (ip, tz_top_level); if (ds_zone != NULL) - dtstart = convert_time (dtstart, ds_zone, view_zone); + dtstart = convert_time (dtstart, ds_zone, zone); } e_meeting_attendee_set_start_busy_range (ia, @@ -1053,7 +1080,7 @@ process_free_busy_comp (EMeetingAttendee *ia, icalcomponent *fb_comp, icalcompon if (!dtend.is_utc) { de_zone = find_zone (ip, tz_top_level); if (de_zone != NULL) - dtend = convert_time (dtend, de_zone, view_zone); + dtend = convert_time (dtend, de_zone, zone); } e_meeting_attendee_set_end_busy_range (ia, @@ -1093,8 +1120,8 @@ process_free_busy_comp (EMeetingAttendee *ia, icalcomponent *fb_comp, icalcompon } if (busy_type != E_MEETING_FREE_BUSY_LAST) { - fb.start = convert_time (fb.start, NULL, view_zone); - fb.end = convert_time (fb.end, NULL, view_zone); + fb.start = convert_time (fb.start, NULL, zone); + fb.end = convert_time (fb.end, NULL, zone); e_meeting_attendee_add_busy_period (ia, fb.start.year, fb.start.month, @@ -1167,13 +1194,13 @@ process_free_busy (EMeetingModel *im, EMeetingAttendee *ia, char *text) iter = icalcomponent_begin_component (main_comp, ICAL_VFREEBUSY_COMPONENT); while ((sub_comp = icalcompiter_deref (&iter)) != NULL) { - process_free_busy_comp (ia, sub_comp, tz_top_level); + process_free_busy_comp (ia, sub_comp, priv->zone, tz_top_level); icalcompiter_next (&iter); } icalcomponent_free (tz_top_level); } else if (kind == ICAL_VFREEBUSY_COMPONENT) { - process_free_busy_comp (ia, main_comp, NULL); + process_free_busy_comp (ia, main_comp, priv->zone, NULL); } else { return; } @@ -1341,13 +1368,14 @@ e_meeting_model_refresh_busy_periods (EMeetingModel *im, EMeetingModelRefreshCal ia = NULL; } - if (ia != NULL) - process_free_busy (im, ia, cal_component_get_as_string (comp)); - - process_callbacks (im); + if (ia != NULL) { + char *comp_str; + + comp_str = cal_component_get_as_string (comp); + process_free_busy (im, ia, comp_str); + g_free (comp_str); + } } - - } /* Look for fburl's of attendee with no free busy info on server */ @@ -1372,7 +1400,10 @@ e_meeting_model_refresh_busy_periods (EMeetingModel *im, EMeetingModelRefreshCal } g_string_append_c (string, ')'); - e_book_get_cursor (priv->ebook, string->str, cursor_cb, im); + if (not_found->len > 0) + e_book_get_cursor (priv->ebook, string->str, cursor_cb, im); + else + process_callbacks (im); g_ptr_array_free (not_found, FALSE); g_string_free (string, TRUE); diff --git a/calendar/gui/e-meeting-model.h b/calendar/gui/e-meeting-model.h index 562ddd82af..3ca40af380 100644 --- a/calendar/gui/e-meeting-model.h +++ b/calendar/gui/e-meeting-model.h @@ -68,6 +68,9 @@ GtkObject *e_meeting_model_new (void); CalClient *e_meeting_model_get_cal_client (EMeetingModel *im); void e_meeting_model_set_cal_client (EMeetingModel *im, CalClient *client); +icaltimezone *e_meeting_model_get_zone (EMeetingModel *im); +void e_meeting_model_set_zone (EMeetingModel *im, icaltimezone *zone); + void e_meeting_model_add_attendee (EMeetingModel *im, EMeetingAttendee *ia); EMeetingAttendee *e_meeting_model_add_attendee_with_defaults (EMeetingModel *im); -- cgit v1.2.3