From b7e0730aab5e67535dd8bcd70e400869fa55601b Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Mon, 30 Jul 2001 22:21:13 +0000 Subject: started some code to show the currently displayed dates in the folder 2001-07-30 Damon Chaplin * 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. svn path=/trunk/; revision=11494 --- calendar/ChangeLog | 47 ++++++++++++- calendar/cal-client/cal-client.c | 3 - calendar/cal-util/cal-component.c | 13 ++-- calendar/cal-util/cal-recur.c | 5 ++ calendar/conduits/calendar/calendar-conduit.c | 2 + calendar/conduits/todo/todo-conduit.c | 1 + calendar/gui/calendar-commands.c | 98 ++++++++++++++++++++++++++- calendar/gui/calendar-config.c | 8 ++- calendar/gui/calendar-model.c | 3 +- calendar/gui/comp-util.c | 2 +- calendar/gui/dialogs/recurrence-page.c | 71 ++++++++----------- calendar/gui/e-calendar-table.c | 59 ++++++++++------ calendar/gui/e-day-view.c | 42 ++++++------ calendar/gui/e-itip-control.c | 12 +++- calendar/gui/e-week-view-layout.c | 2 +- calendar/gui/e-week-view.c | 39 ++++++----- calendar/gui/gnome-cal.c | 42 ++++++++++++ calendar/gui/gnome-cal.h | 3 + calendar/gui/tag-calendar.c | 2 +- calendar/gui/tasks-control.c | 5 +- 20 files changed, 337 insertions(+), 122 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 40729af584..8a50c4e6c4 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,49 @@ +2001-07-30 Damon Chaplin + + * 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 * gui/dialogs/cal-prefs-dialog.glade: added Help button. Though of @@ -183,7 +229,6 @@ value from cal_component_get_as_string and don't call GNOME_Evolution_Calendar_Cal_updateObjects if NULL ->>>>>>> 1.1002 2001-07-25 Damon Chaplin * gui/dialogs/comp-editor.c (pixmaps): used the new print preview icon. diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index ff93470405..007466ddad 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -936,7 +936,6 @@ cal_client_get_timezone (CalClient *client, goto out; } - g_print (" parsing zone:\n%s\n", comp_str); icalcomp = icalparser_parse_string (comp_str); CORBA_free (comp_str); @@ -945,7 +944,6 @@ cal_client_get_timezone (CalClient *client, goto out; } - g_print (" creating icaltimezone\n"); tmp_zone = icaltimezone_new (); if (!tmp_zone) { /* FIXME: Needs better error code - out of memory. Or just @@ -963,7 +961,6 @@ cal_client_get_timezone (CalClient *client, g_hash_table_insert (priv->timezones, icaltimezone_get_tzid (tmp_zone), tmp_zone); - g_print (" returning icaltimezone\n"); *zone = tmp_zone; retval = CAL_CLIENT_GET_SUCCESS; diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c index 596618733d..b806f8e3e7 100644 --- a/calendar/cal-util/cal-component.c +++ b/calendar/cal-util/cal-component.c @@ -1825,9 +1825,9 @@ get_datetime (struct datetime *datetime, /* 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 = icalparameter_get_tzid (datetime->tzid_param); + dt->tzid = g_strdup (icalparameter_get_tzid (datetime->tzid_param)); else if (dt->value && dt->value->is_utc) - dt->tzid = "UTC"; + dt->tzid = g_strdup ("UTC"); else dt->tzid = NULL; } @@ -2254,7 +2254,7 @@ cal_component_get_exdate_list (CalComponent *comp, GSList **exdate_list) *cdt->value = icalproperty_get_exdate (dt->prop); if (dt->tzid_param) - cdt->tzid = icalparameter_get_tzid (dt->tzid_param); + cdt->tzid = g_strdup (icalparameter_get_tzid (dt->tzid_param)); else cdt->tzid = NULL; @@ -2290,6 +2290,8 @@ cal_component_set_exdate_list (CalComponent *comp, GSList *exdate_list) 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); @@ -3842,8 +3844,8 @@ cal_component_free_datetime (CalComponentDateTime *dt) { g_return_if_fail (dt != NULL); - if (dt->value) - g_free (dt->value); + g_free (dt->value); + g_free ((char*)dt->tzid); } /** @@ -3866,6 +3868,7 @@ cal_component_free_exdate_list (GSList *exdate_list) g_assert (cdt->value != NULL); g_free (cdt->value); + g_free ((char*)cdt->tzid); g_free (cdt); } diff --git a/calendar/cal-util/cal-recur.c b/calendar/cal-util/cal-recur.c index 13c9f0533f..9afcee9784 100644 --- a/calendar/cal-util/cal-recur.c +++ b/calendar/cal-util/cal-recur.c @@ -675,6 +675,11 @@ cal_recur_generate_instances_of_rule (CalComponent *comp, goto out; } + /* FIXME: All floating times, including those from recurrence rules, + should be converted to the current timezone, otherwise the time_t + values may be outside the given range. This may also mean that + we need to add a timezone argument to the IDL method. */ + if (dtstart.tzid && tz_cb) start_zone = (*tz_cb) (dtstart.tzid, tz_cb_data); if (dtend.tzid && tz_cb) diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c index 823f1a8021..87f766cb37 100644 --- a/calendar/conduits/calendar/calendar-conduit.c +++ b/calendar/conduits/calendar/calendar-conduit.c @@ -452,6 +452,7 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC local->appt->begin = *localtime (&dt_time); } + cal_component_free_datetime (&dt); cal_component_get_dtend (comp, &dt); if (dt.value && time_add_day (dt_time, 1) != icaltime_as_timet_with_zone (*dt.value, get_timezone (ctxt->client, dt.tzid))) { @@ -462,6 +463,7 @@ local_record_from_comp (ECalLocalRecord *local, CalComponent *comp, ECalConduitC } else { local->appt->event = 1; } + cal_component_free_datetime (&dt); /* Recurrence Rules */ local->appt->repeatType = repeatNone; diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index e0b3d6384d..05451ed754 100644 --- a/calendar/conduits/todo/todo-conduit.c +++ b/calendar/conduits/todo/todo-conduit.c @@ -408,6 +408,7 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui } else { local->todo->indefinite = 1; } + cal_component_free_datetime (&due); cal_component_get_completed (comp, &completed); if (completed) { diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index a0366685c9..f51a4142ca 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -354,18 +354,100 @@ get_shell_view_interface (BonoboControl *control) return shell_view; } -/* Clears the folder bar label on the shell view */ +/* Displays the currently displayed time range in the folder bar label on the + shell view, according to which view we are showing. */ static void -clear_folder_bar_label (BonoboControl *control) +clear_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control) { GNOME_Evolution_ShellView shell_view; CORBA_Environment ev; + 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; + + /* FIXME: This isn't the same as the currently visible time range. */ + gnome_calendar_get_selected_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); + + end_tt = icaltime_from_timet_with_zone (end_time, 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: + strftime (buffer, sizeof (buffer), + _("%A %d %B %Y"), &start_tm); + break; + case GNOME_CAL_WORK_WEEK_VIEW: + case GNOME_CAL_WEEK_VIEW: + 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) { + strftime (buffer, sizeof (buffer), + _("%B"), &start_tm); + strftime (end_buffer, sizeof (end_buffer), + _("%B %Y"), &end_tm); + strcat (buffer, " - "); + strcat (buffer, end_buffer); + } else { + strftime (buffer, sizeof (buffer), + _("%B %Y"), &start_tm); + strftime (end_buffer, sizeof (end_buffer), + _("%B %Y"), &end_tm); + strcat (buffer, " - "); + strcat (buffer, end_buffer); + } + break; + default: + g_assert_not_reached (); + } shell_view = get_shell_view_interface (control); if (shell_view == CORBA_OBJECT_NIL) return; CORBA_exception_init (&ev); +#if 0 + GNOME_Evolution_ShellView_setFolderBarLabel (shell_view, buffer, &ev); +#endif GNOME_Evolution_ShellView_setFolderBarLabel (shell_view, "", &ev); if (ev._major != CORBA_NO_EXCEPTION) g_message ("clear_folder_bar_label(): Could not set the folder bar label"); @@ -465,7 +547,7 @@ calendar_control_activate (BonoboControl *control, a default timezone already. */ calendar_config_check_timezone_set (); - clear_folder_bar_label (control); + clear_folder_bar_label (gcal, control); } void @@ -487,6 +569,13 @@ on_calendar_destroyed (GnomeCalendar *gcal) all_calendars = g_list_remove (all_calendars, gcal); } +static void +on_calendar_dates_shown_changed (GnomeCalendar *gcal) +{ + g_print ("In on_calendar_dates_shown_changed\n"); +} + + GnomeCalendar * new_calendar (void) { @@ -501,6 +590,9 @@ new_calendar (void) gtk_signal_connect (GTK_OBJECT (gcal), "destroy", GTK_SIGNAL_FUNC (on_calendar_destroyed), NULL); + gtk_signal_connect (GTK_OBJECT (gcal), "dates_shown_changed", + GTK_SIGNAL_FUNC (on_calendar_dates_shown_changed), + NULL); all_calendars = g_list_prepend (all_calendars, gcal); diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 7b133075f4..9b6d005259 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -281,12 +281,14 @@ calendar_config_get_timezone (void) /* Sets the timezone. You shouldn't really set it to the empty string or NULL, as this means that Evolution will show the timezone-setting dialog to ask - the user for the timezone. */ + the user for the timezone. It copies the string. */ void calendar_config_set_timezone (gchar *timezone) { + g_free (config->timezone); + if (timezone && timezone[0]) - config->timezone = timezone; + config->timezone = g_strdup (timezone); else config->timezone = NULL; } @@ -689,6 +691,8 @@ on_timezone_set (GnomeDialog *dialog, e_timezone_dialog_get_timezone (etd, &display_name); + g_print ("Location: %s\n", display_name ? display_name : ""); + if (display_name && display_name[0]) { calendar_config_set_timezone (display_name); diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c index 7fccf3937a..0cdd97b7d6 100644 --- a/calendar/gui/calendar-model.c +++ b/calendar/gui/calendar-model.c @@ -1068,7 +1068,8 @@ set_datetime (CalendarModel *model, CalComponent *comp, const char *value, itt.second = tmp_tm.tm_sec; dt.value = &itt; - /* We assume it is being set to the current timezone. */ + /* FIXME: We assume it is being set to the current timezone. + Is that OK? */ dt.tzid = icaltimezone_get_tzid (model->priv->zone); (* set_func) (comp, &dt); diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c index 944b5dcdce..5aa8d22a01 100644 --- a/calendar/gui/comp-util.c +++ b/calendar/gui/comp-util.c @@ -50,7 +50,7 @@ cal_comp_util_add_exdate (CalComponent *comp, time_t t, icaltimezone *zone) cdt = g_new (CalComponentDateTime, 1); cdt->value = g_new (struct icaltimetype, 1); *cdt->value = icaltime_from_timet_with_zone (t, TRUE, zone); - cdt->tzid = icaltimezone_get_tzid (zone); + cdt->tzid = g_strdup (icaltimezone_get_tzid (zone)); list = g_slist_append (list, cdt); cal_component_set_exdate_list (comp, list); diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index b60a9f6b48..5c7e7d65cb 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -44,10 +44,6 @@ -/* We set this as the TZID on all exceptions added. When we actually fill - the component, we replace it with the TZID from DTSTART. */ -static char *DUMMY_TZID = "DUMMY"; - enum month_day_options { MONTH_DAY_NTH, MONTH_DAY_MON, @@ -146,7 +142,7 @@ struct _RecurrencePagePrivate { /* For ending date, created by hand */ GtkWidget *ending_date_edit; - time_t ending_date; + struct icaltimetype ending_date_tt; /* For ending count of occurrences, created by hand */ GtkWidget *ending_count_spin; @@ -298,6 +294,7 @@ free_exception_clist_data (RecurrencePage *rpage) dt = gtk_clist_get_row_data (clist, i); g_free (dt->value); + g_free ((char*)dt->tzid); g_free (dt); gtk_clist_set_row_data (clist, i, NULL); } @@ -403,7 +400,7 @@ clear_widgets (RecurrencePage *rpage) freq_map); gtk_signal_handler_unblock_by_data (GTK_OBJECT (menu), rpage); - priv->ending_date = time (NULL); + priv->ending_date_tt = icaltime_today (); priv->ending_count = 1; menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (priv->ending_menu)); @@ -456,7 +453,7 @@ append_exception (RecurrencePage *rpage, CalComponentDateTime *datetime) dt = g_new (CalComponentDateTime, 1); dt->value = g_new (struct icaltimetype, 1); *dt->value = *datetime->value; - dt->tzid = datetime->tzid; + dt->tzid = g_strdup (datetime->tzid); clist = GTK_CLIST (priv->exception_list); @@ -760,15 +757,16 @@ simple_recur_to_comp (RecurrencePage *rpage, CalComponent *comp) g_assert (priv->ending_date_edit != NULL); g_assert (E_IS_DATE_EDIT (priv->ending_date_edit)); + /* We only allow a DATE value to be set for the UNTIL property, + since we don't support sub-day recurrences. */ date_set = e_date_edit_get_date (E_DATE_EDIT (priv->ending_date_edit), &r.until.year, &r.until.month, &r.until.day); - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->ending_date_edit), - &r.until.hour, - &r.until.minute); g_assert (date_set); + r.until.is_date = 1; + break; case ENDING_FOREVER: @@ -794,11 +792,9 @@ static void fill_component (RecurrencePage *rpage, CalComponent *comp) { RecurrencePagePrivate *priv; - CalComponentDateTime start_date; enum recur_type recur_type; GtkCList *exception_list; GSList *list; - const char *tzid; int i; priv = rpage->priv; @@ -828,10 +824,6 @@ fill_component (RecurrencePage *rpage, CalComponent *comp) /* Set exceptions */ - cal_component_get_dtstart (comp, &start_date); - tzid = start_date.tzid; - cal_component_free_datetime (&start_date); - list = NULL; exception_list = GTK_CLIST (priv->exception_list); for (i = 0; i < exception_list->rows; i++) { @@ -844,15 +836,9 @@ fill_component (RecurrencePage *rpage, CalComponent *comp) g_assert (dt != NULL); *cdt->value = *dt->value; + cdt->tzid = g_strdup (dt->tzid); - /* If the dummy TZID was used, we use the TZID from the - start date. We do this because we don't allow editing - of timezones for RDATEs, so we try to use the same timezone - as the DTSTART for all new exceptions added. */ - if (dt->tzid == DUMMY_TZID) - cdt->tzid = tzid; - else - cdt->tzid = dt->tzid; + g_print ("Adding exception is_date: %i\n", cdt->value->is_date); list = g_slist_prepend (list, cdt); } @@ -1236,7 +1222,9 @@ make_ending_until_special (RecurrencePage *rpage) /* Set the value */ - e_date_edit_set_time (de, priv->ending_date); + e_date_edit_set_date (de, priv->ending_date_tt.year, + priv->ending_date_tt.month, + priv->ending_date_tt.day); gtk_signal_connect (GTK_OBJECT (de), "changed", GTK_SIGNAL_FUNC (ending_until_changed_cb), rpage); @@ -1365,8 +1353,7 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r) } else { /* Ending date */ - /* FIXME: UNTIL needs to be checked. */ - priv->ending_date = icaltime_as_timet (r->until); + priv->ending_date_tt = r->until; e_dialog_option_menu_set (priv->ending_menu, ENDING_UNTIL, ending_types_map); @@ -1787,12 +1774,10 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) /* Copy the TZID from the old property. FIXME: Should get notified when the TZID changes.*/ cal_component_get_dtstart (priv->comp, &old_dt); - dt.tzid = NULL; - if (old_dt.tzid) - dt.tzid = old_dt.tzid; - cal_component_free_datetime (&old_dt); + dt.tzid = old_dt.tzid; cal_component_set_dtstart (priv->comp, &dt); + cal_component_free_datetime (&old_dt); } if (dates->end) { @@ -1801,12 +1786,10 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates) /* Copy the TZID from the old property. FIXME: Should get notified when the TZID changes.*/ cal_component_get_dtend (priv->comp, &old_dt); - dt.tzid = NULL; - if (old_dt.tzid) - dt.tzid = old_dt.tzid; - cal_component_free_datetime (&old_dt); + dt.tzid = old_dt.tzid; cal_component_set_dtend (priv->comp, &dt); + cal_component_free_datetime (&old_dt); } /* Update the weekday picker if necessary */ @@ -1977,19 +1960,15 @@ exception_add_cb (GtkWidget *widget, gpointer data) field_changed (rpage); dt.value = &icaltime; - /* We set this to the dummy TZID for now. When we fill the component - we will replace it with the TZID from DTSTART. */ - dt.tzid = DUMMY_TZID; + /* We use DATE values for exceptions, so we don't need a TZID. */ + dt.tzid = NULL; icaltime.is_date = 1; date_set = e_date_edit_get_date (E_DATE_EDIT (priv->exception_date), &icaltime.year, &icaltime.month, &icaltime.day); - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->exception_date), - &icaltime.hour, - &icaltime.minute); g_assert (date_set); append_exception (rpage, &dt); @@ -2022,9 +2001,14 @@ exception_modify_cb (GtkWidget *widget, gpointer data) tt = dt->value; e_date_edit_get_date (E_DATE_EDIT (priv->exception_date), &tt->year, &tt->month, &tt->day); - e_date_edit_get_time_of_day (E_DATE_EDIT (priv->exception_date), - &tt->hour, &tt->minute); + tt->hour = 0; + tt->minute = 0; tt->second = 0; + tt->is_date = 1; + + /* We get rid of any old TZID, since we are using a DATE value now. */ + g_free ((char*)dt->tzid); + dt->tzid = NULL; gtk_clist_set_text (clist, sel, 0, get_exception_string (dt)); @@ -2055,6 +2039,7 @@ exception_delete_cb (GtkWidget *widget, gpointer data) dt = gtk_clist_get_row_data (clist, sel); g_assert (dt != NULL); g_free (dt->value); + g_free ((char*)dt->tzid); g_free (dt); gtk_clist_remove (clist, sel); diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index a513dbf6f5..d49a571608 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "e-calendar-table.h" #include "calendar-config.h" @@ -836,25 +837,38 @@ delete_cb (GtkWidget *menuitem, gpointer data) e_calendar_table_delete_selected (cal_table); } -static GnomeUIInfo tasks_popup_one[] = { - GNOMEUIINFO_ITEM_NONE (N_("Edit this task"), NULL, e_calendar_table_on_open_task), - GNOMEUIINFO_ITEM_NONE (N_("Cut"), NULL, e_calendar_table_on_cut), - GNOMEUIINFO_ITEM_NONE (N_("Copy"), NULL, e_calendar_table_on_copy), - GNOMEUIINFO_ITEM_NONE (N_("Paste"), NULL, e_calendar_table_on_paste), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("Mark as complete"), NULL, mark_as_complete_cb), - GNOMEUIINFO_ITEM_NONE (N_("Delete this task"), NULL, delete_cb), - GNOMEUIINFO_END + +enum { + MASK_SINGLE = 1 << 0, /* For commands that work on 1 task. */ + MASK_MULTIPLE = 1 << 1, /* For commands for multiple tasks. */ }; -static GnomeUIInfo tasks_popup_many[] = { - GNOMEUIINFO_ITEM_NONE (N_("Cut"), NULL, e_calendar_table_on_cut), - GNOMEUIINFO_ITEM_NONE (N_("Copy"), NULL, e_calendar_table_on_copy), - GNOMEUIINFO_ITEM_NONE (N_("Paste"), NULL, e_calendar_table_on_paste), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("Mark tasks as complete"), NULL, mark_as_complete_cb), - GNOMEUIINFO_ITEM_NONE (N_("Delete selected tasks"), NULL, delete_cb), - GNOMEUIINFO_END + +static EPopupMenu tasks_popup_menu [] = { + { N_("_Open"), NULL, + e_calendar_table_on_open_task, NULL, MASK_SINGLE }, + { "", NULL, NULL, NULL, MASK_SINGLE }, + + { N_("C_ut"), NULL, + e_calendar_table_on_cut, NULL, 0 }, + { N_("_Copy"), NULL, + e_calendar_table_on_copy, NULL, 0 }, + { N_("_Paste"), NULL, + e_calendar_table_on_paste, NULL, 0 }, + + { "", NULL, NULL, NULL, 0 }, + + { N_("_Mark as Complete"), NULL, + mark_as_complete_cb, NULL, MASK_SINGLE }, + { N_("_Delete this Task"), NULL, + delete_cb, NULL, MASK_SINGLE }, + + { N_("_Mark Tasks as Complete"), NULL, + mark_as_complete_cb, NULL, MASK_MULTIPLE }, + { N_("_Delete Selected Tasks"), NULL, + delete_cb, NULL, MASK_MULTIPLE }, + + { NULL, NULL, NULL, NULL, 0 } }; static gint @@ -864,19 +878,20 @@ e_calendar_table_on_right_click (ETable *table, GdkEventButton *event, ECalendarTable *cal_table) { - GtkWidget *popup_menu; int n_selected; + int hide_mask = 0; + int disable_mask = 0; n_selected = e_table_selected_count (table); g_assert (n_selected > 0); if (n_selected == 1) - popup_menu = gnome_popup_menu_new (tasks_popup_one); + hide_mask = MASK_MULTIPLE; else - popup_menu = gnome_popup_menu_new (tasks_popup_many); + hide_mask = MASK_SINGLE; - gnome_popup_menu_do_popup_modal (popup_menu, NULL, NULL, event, cal_table); - gtk_widget_destroy (popup_menu); + e_popup_menu_run (tasks_popup_menu, (GdkEvent *) event, + disable_mask, hide_mask, cal_table); return TRUE; } diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 7f11e2d7b5..ca12b87176 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -3280,7 +3280,7 @@ e_day_view_on_event_double_click (EDayView *day_view, enum { /* - * This is used to "flag" events that can not be editted + * This is used to "flag" events that can not be edited */ MASK_EDITABLE = 1, @@ -3303,49 +3303,53 @@ enum { }; static EPopupMenu main_items [] = { - { N_("Paste"), NULL, - e_day_view_on_paste, NULL, 0 }, + { N_("New _Appointment"), NULL, + e_day_view_on_new_appointment, NULL, 0 }, + { N_("New All Day _Event"), NULL, + e_day_view_on_new_event, NULL, 0 }, { "", NULL, NULL, NULL, 0 }, - { N_("New Appointment"), NULL, - e_day_view_on_new_appointment, NULL, 0 }, - { N_("New All Day Event"), NULL, - e_day_view_on_new_event, NULL, 0 }, + { N_("_Paste"), NULL, + e_day_view_on_paste, NULL, 0 }, { "", NULL, NULL, NULL, 0 }, - { N_("Go to Today"), NULL, + { N_("Go to _Today"), NULL, e_day_view_on_goto_today, NULL, 0 }, - { N_("Go to Date..."), NULL, + { N_("_Go to Date..."), NULL, e_day_view_on_goto_date, NULL, 0 }, { NULL, NULL, NULL, NULL, 0 } }; static EPopupMenu child_items [] = { - { N_("Open"), NULL, + { N_("_Open"), NULL, e_day_view_on_edit_appointment, NULL, MASK_EDITABLE | MASK_EDITING }, - { N_("Delete this Appointment"), NULL, + { N_("_Delete this Appointment"), NULL, e_day_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING }, - { N_("Cut"), NULL, + + /* Only show this separator if one of the above is shown. */ + { "", NULL, NULL, NULL, MASK_EDITABLE | MASK_EDITING }, + + + { N_("C_ut"), NULL, e_day_view_on_cut, NULL, MASK_EDITABLE | MASK_EDITING }, - { N_("Copy"), NULL, + { N_("_Copy"), NULL, e_day_view_on_copy, NULL, 0 }, - { N_("Paste"), NULL, + { N_("_Paste"), NULL, e_day_view_on_paste, NULL, 0 }, - { "", NULL, NULL, NULL, MASK_SINGLE}, /* * The following are only shown if this is a recurring event */ - { "", NULL, NULL, NULL, MASK_SINGLE}, - { N_("Make this Occurrence Movable"), NULL, + { "", NULL, NULL, NULL, MASK_RECURRING | MASK_EDITING }, + { N_("Make this Occurrence _Movable"), NULL, e_day_view_on_unrecur_appointment, NULL, MASK_RECURRING | MASK_EDITING }, - { N_("Delete this Occurrence"), NULL, + { N_("Delete this _Occurrence"), NULL, e_day_view_on_delete_occurrence, NULL, MASK_RECURRING | MASK_EDITING }, - { N_("Delete all Occurrences"), NULL, + { N_("Delete _All Occurrences"), NULL, e_day_view_on_delete_appointment, NULL, MASK_RECURRING | MASK_EDITING }, { NULL, NULL, NULL, NULL, 0 } diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index c22c0a643f..45f49421ae 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -600,15 +600,23 @@ set_date_label (GtkWidget *lbl, CalComponent *comp) cal_component_get_dtstart (comp, &datetime); if (datetime.value) start = icaltime_as_timet (*datetime.value); + cal_component_free_datetime (&datetime); + cal_component_get_dtend (comp, &datetime); if (datetime.value) end = icaltime_as_timet (*datetime.value); + cal_component_free_datetime (&datetime); + cal_component_get_due (comp, &datetime); if (datetime.value) due = icaltime_as_timet (*datetime.value); + cal_component_free_datetime (&datetime); + cal_component_get_completed (comp, &datetime.value); - if (datetime.value) + if (datetime.value) { complete = icaltime_as_timet (*datetime.value); + cal_component_free_icaltimetype (datetime.value); + } buffer[0] = '\0'; @@ -1020,7 +1028,7 @@ send_freebusy (EItipControl *itip) priv = itip->priv; - /* FIXME: timezones. */ + /* FIXME: timezones and free these. */ cal_component_get_dtstart (priv->comp, &datetime); start = icaltime_as_timet (*datetime.value); cal_component_get_dtend (priv->comp, &datetime); diff --git a/calendar/gui/e-week-view-layout.c b/calendar/gui/e-week-view-layout.c index 21552e5f17..5e8331c76c 100644 --- a/calendar/gui/e-week-view-layout.c +++ b/calendar/gui/e-week-view-layout.c @@ -131,7 +131,7 @@ e_week_view_layout_event (EWeekViewEvent *event, gint free_row, row, day, span_num, spans_index, num_spans, days_shown; EWeekViewEventSpan span, *old_span; - days_shown = multi_week_view ? weeks_shown * 7 - 1 : 7 - 1; + days_shown = multi_week_view ? weeks_shown * 7 : 7; start_day = e_week_view_find_day (event->start, FALSE, days_shown, day_starts); end_day = e_week_view_find_day (event->end, TRUE, days_shown, diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 0f230c21fe..9fbf7cb660 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -3141,40 +3141,45 @@ enum { }; static EPopupMenu main_items [] = { - { N_("Paste"), NULL, - e_week_view_on_paste, NULL, 0 }, + { N_("New _Appointment..."), NULL, + e_week_view_on_new_appointment, NULL, 0 }, + { N_("New All Day _Event"), NULL, + e_week_view_on_new_event, NULL, 0 }, { "", NULL, NULL, NULL, 0 }, - { N_("New Appointment..."), NULL, - e_week_view_on_new_appointment, NULL, 0 }, - { N_("New All Day Event"), NULL, - e_week_view_on_new_event, NULL, 0 }, + { N_("_Paste"), NULL, + e_week_view_on_paste, NULL, 0 }, { "", NULL, NULL, NULL, 0 }, - { N_("Go to Today"), NULL, + { N_("Go to _Today"), NULL, e_week_view_on_goto_today, NULL, 0 }, - { N_("Go to Date..."), NULL, + { N_("_Go to Date..."), NULL, e_week_view_on_goto_date, NULL, 0 }, { NULL, NULL, NULL, NULL, 0 } }; static EPopupMenu child_items [] = { - { N_("Open"), NULL, + { N_("_Open"), NULL, e_week_view_on_edit_appointment, NULL, MASK_EDITABLE | MASK_EDITING }, - { N_("Delete this Appointment"), NULL, + { N_("_Delete this Appointment"), NULL, e_week_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING }, - { N_("Cut"), NULL, + + /* Only show this separator if one of the above is shown. */ + { "", NULL, NULL, NULL, MASK_EDITABLE | MASK_EDITING }, + + + { N_("C_ut"), NULL, e_week_view_on_cut, NULL, MASK_EDITING | MASK_EDITABLE }, - { N_("Copy"), NULL, + { N_("_Copy"), NULL, e_week_view_on_copy, NULL, MASK_EDITING | MASK_EDITABLE }, - { N_("Paste"), NULL, + { N_("_Paste"), NULL, e_week_view_on_paste, NULL, 0 }, { "", NULL, NULL, NULL, 0}, - { N_("New Appointment..."), NULL, + { N_("New _Appointment..."), NULL, e_week_view_on_new_appointment, NULL, 0 }, { "", NULL, NULL, NULL, MASK_SINGLE }, @@ -3183,11 +3188,11 @@ static EPopupMenu child_items [] = { * The following are only shown if this is a recurring event */ { "", NULL, NULL, NULL, MASK_SINGLE}, - { N_("Make this Occurrence Movable"), NULL, + { N_("Make this Occurrence _Movable"), NULL, e_week_view_on_unrecur_appointment, NULL, MASK_RECURRING | MASK_EDITING }, - { N_("Delete this Occurrence"), NULL, + { N_("Delete this _Occurrence"), NULL, e_week_view_on_delete_occurrence, NULL, MASK_RECURRING | MASK_EDITING }, - { N_("Delete All Occurrences"), NULL, + { N_("Delete _All Occurrences"), NULL, e_week_view_on_delete_appointment, NULL, MASK_RECURRING | MASK_EDITING }, { NULL, NULL, NULL, NULL, 0 } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 7a50df5389..96f7fbc405 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -137,6 +137,16 @@ struct _GnomeCalendarPrivate { icaltimezone *zone; }; +/* Signal IDs */ + +enum { + DATES_SHOWN_CHANGED, + LAST_SIGNAL +}; + +static guint gnome_calendar_signals[LAST_SIGNAL]; + + static void gnome_calendar_class_init (GnomeCalendarClass *class); @@ -158,6 +168,8 @@ static void gnome_calendar_on_date_navigator_date_range_changed (ECalendarItem * GnomeCalendar *gcal); static void gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, GnomeCalendar *gcal); +static void gnome_calendar_notify_dates_shown_changed (GnomeCalendar *gcal); + static GtkVBoxClass *parent_class; @@ -197,7 +209,22 @@ gnome_calendar_class_init (GnomeCalendarClass *class) parent_class = gtk_type_class (GTK_TYPE_VBOX); + gnome_calendar_signals[DATES_SHOWN_CHANGED] = + gtk_signal_new ("dates_shown_changed", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (GnomeCalendarClass, + dates_shown_changed), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + gtk_object_class_add_signals (object_class, + gnome_calendar_signals, + LAST_SIGNAL); + object_class->destroy = gnome_calendar_destroy; + + class->dates_shown_changed = NULL; } /** @@ -496,6 +523,7 @@ gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time) gnome_calendar_update_view_times (gcal); gnome_calendar_update_date_navigator (gcal); + gnome_calendar_notify_dates_shown_changed (gcal); } @@ -588,6 +616,7 @@ gnome_calendar_direction (GnomeCalendar *gcal, int direction) gnome_calendar_update_view_times (gcal); gnome_calendar_update_date_navigator (gcal); + gnome_calendar_notify_dates_shown_changed (gcal); } void @@ -784,6 +813,7 @@ gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, set_view (gcal, view_type, range_selected, grab_focus); gnome_calendar_update_view_times (gcal); gnome_calendar_update_date_navigator (gcal); + gnome_calendar_notify_dates_shown_changed (gcal); } /* Callback used when the view collection asks us to display a particular view */ @@ -1366,6 +1396,7 @@ gnome_calendar_update_config_settings (GnomeCalendar *gcal, /* The range of days shown may have changed, so we update the date navigator if needed. */ gnome_calendar_update_date_navigator (gcal); + gnome_calendar_notify_dates_shown_changed (gcal); } @@ -1713,11 +1744,13 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, set_view (gcal, GNOME_CAL_MONTH_VIEW, TRUE, FALSE); gnome_calendar_update_date_navigator (gcal); + gnome_calendar_notify_dates_shown_changed (gcal); } else if (new_days_shown == 7 && starts_on_week_start_day) { e_week_view_set_first_day_shown (E_WEEK_VIEW (priv->week_view), &new_start_date); set_view (gcal, GNOME_CAL_WEEK_VIEW, TRUE, FALSE); gnome_calendar_update_date_navigator (gcal); + gnome_calendar_notify_dates_shown_changed (gcal); } else { gint start_year, start_month, start_day; gint end_year, end_month, end_day; @@ -2013,3 +2046,12 @@ gnome_calendar_get_timezone (GnomeCalendar *gcal) return gcal->priv->zone; } + +static void +gnome_calendar_notify_dates_shown_changed (GnomeCalendar *gcal) +{ + g_return_if_fail (GNOME_IS_CALENDAR (gcal)); + + gtk_signal_emit (GTK_OBJECT (gcal), + gnome_calendar_signals[DATES_SHOWN_CHANGED]); +} diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index 492d6bcfd1..5409c6f55e 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -65,6 +65,9 @@ struct _GnomeCalendar { struct _GnomeCalendarClass { GtkVBoxClass parent_class; + + /* Notification signals */ + void (* dates_shown_changed) (GnomeCalendar *gcal); }; diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c index 8cdbac8462..a84f4e965e 100644 --- a/calendar/gui/tag-calendar.c +++ b/calendar/gui/tag-calendar.c @@ -91,7 +91,7 @@ tag_calendar_cb (CalComponent *comp, struct icaltimetype start_tt, end_tt; start_tt = icaltime_from_timet_with_zone (istart, FALSE, c->zone); - end_tt = icaltime_from_timet_with_zone (iend, FALSE, c->zone); + end_tt = icaltime_from_timet_with_zone (iend - 1, FALSE, c->zone); e_calendar_item_mark_days (c->calitem, start_tt.year, start_tt.month - 1, start_tt.day, diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index df3236fff0..f2d594610a 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -240,7 +240,10 @@ static BonoboUIVerb verbs [] = { static EPixmap pixmaps [] = { E_PIXMAP ("/menu/File/New/NewFirstItem/NewTask", "evolution-tasks-mini.png"), - E_PIXMAP ("/menu/File/Print/Print", "print.xpm"), + E_PIXMAP ("/menu/File/Print/Print", "print.xpm"), + E_PIXMAP ("/menu/File/Print/Print Preview", "print-preview.xpm"), + E_PIXMAP ("/Toolbar/New", "buttons/new_appointment.png"), + E_PIXMAP ("/Toolbar/Print", "buttons/print.png"), E_PIXMAP_END }; -- cgit