aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog78
-rw-r--r--calendar/cal-util/cal-util.c48
-rw-r--r--calendar/cal-util/cal-util.h4
-rw-r--r--calendar/gui/calendar-commands.c8
-rw-r--r--calendar/gui/calendar-model.c49
-rw-r--r--calendar/gui/dialogs/alarm-page.c1
-rw-r--r--calendar/gui/dialogs/comp-editor-page.h6
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c70
-rw-r--r--calendar/gui/dialogs/comp-editor-util.h2
-rw-r--r--calendar/gui/dialogs/comp-editor.c1
-rw-r--r--calendar/gui/dialogs/event-page.c188
-rw-r--r--calendar/gui/dialogs/recurrence-page.c28
-rw-r--r--calendar/gui/dialogs/task-page.c21
-rw-r--r--calendar/gui/e-calendar-table.c66
-rw-r--r--calendar/gui/e-calendar-table.etspec12
-rw-r--r--calendar/gui/e-day-view-layout.c4
-rw-r--r--calendar/gui/e-day-view.c32
-rw-r--r--calendar/gui/e-week-view.c28
-rw-r--r--calendar/gui/gnome-cal.c7
-rw-r--r--calendar/gui/tag-calendar.c46
-rw-r--r--calendar/gui/tag-calendar.h3
21 files changed, 525 insertions, 177 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index b1a9bdf457..e57b7d107f 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,80 @@
+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.
@@ -322,7 +399,6 @@
(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
diff --git a/calendar/cal-util/cal-util.c b/calendar/cal-util/cal-util.c
index 1df57bacec..774b9aca11 100644
--- a/calendar/cal-util/cal-util.c
+++ b/calendar/cal-util/cal-util.c
@@ -22,6 +22,9 @@
#include <config.h>
#include <stdlib.h>
+#include <glib.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
#include "cal-util.h"
@@ -400,3 +403,48 @@ cal_util_generate_alarms_for_list (GList *comps,
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;
+}
diff --git a/calendar/cal-util/cal-util.h b/calendar/cal-util/cal-util.h
index 362d9eaae5..9e7c7ce5e4 100644
--- a/calendar/cal-util/cal-util.h
+++ b/calendar/cal-util/cal-util.h
@@ -79,6 +79,10 @@ int cal_util_generate_alarms_for_list (GList *comps,
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);
+
+
END_GNOME_DECLS
#endif
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 366026dc96..3fe7e4bdae 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -575,10 +575,10 @@ static EPixmap pixmaps [] =
{
E_PIXMAP ("/menu/File/New/NewFirstItem/NewAppointment", "new_appointment.xpm"),
E_PIXMAP ("/menu/File/New/NewFirstItem/NewTask", "new_task-16.png"),
- E_PIXMAP ("/menu/Edit/CutEvent", "16_cut.png"),
- E_PIXMAP ("/menu/Edit/CopyEvent", "16_copy.png"),
- E_PIXMAP ("/menu/Edit/PasteEvent", "16_paste.png"),
- E_PIXMAP ("/menu/Edit/DeleteEvent", "evolution-trash-mini.png"),
+ E_PIXMAP ("/menu/EditPlaceholder/Edit/CutEvent", "16_cut.png"),
+ E_PIXMAP ("/menu/EditPlaceholder/Edit/CopyEvent", "16_copy.png"),
+ E_PIXMAP ("/menu/EditPlaceholder/Edit/PasteEvent", "16_paste.png"),
+ E_PIXMAP ("/menu/EditPlaceholder/Edit/DeleteEvent", "evolution-trash-mini.png"),
E_PIXMAP ("/menu/File/Print/Print", "print.xpm"),
E_PIXMAP ("/menu/File/Print/PrintPreview", "print-preview.xpm"),
E_PIXMAP ("/menu/ComponentActionsPlaceholder/Actions/NewAppointment", "new_appointment.xpm"),
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 8a26af5faf..c83d29d04d 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -528,21 +528,14 @@ static char *
get_priority (CalComponent *comp)
{
int *priority;
- char *retval;
+ char *retval = "";
cal_component_get_priority (comp, &priority);
- if (!priority || *priority == 0)
- retval = "";
- else if (*priority <= 4)
- retval = _("High");
- else if (*priority == 5)
- retval = _("Normal");
- else
- retval = _("Low");
-
- if (priority)
+ if (priority) {
+ retval = cal_util_priority_to_string (*priority);
cal_component_free_priority (priority);
+ }
return retval;
}
@@ -1157,38 +1150,18 @@ set_percent (CalComponent *comp, const char *value)
ensure_task_not_complete (comp);
}
-/* FIXME: We won't need this eventually, since the user won't be allowed to
- * edit the field.
- */
-static void
-show_priority_warning (void)
-{
- GtkWidget *dialog;
-
- dialog = gnome_message_box_new (_("The priority must be 'High', 'Normal', 'Low' or 'Undefined'."),
- GNOME_MESSAGE_BOX_ERROR,
- GNOME_STOCK_BUTTON_OK, NULL);
- gtk_widget_show (dialog);
-}
-
/* Sets the priority of a calendar component */
static void
set_priority (CalComponent *comp, const char *value)
{
int priority;
- /* An empty string is the same as 'None'. */
- if (!value[0] || !g_strcasecmp (value, _("Undefined")))
+ 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;
- else if (!g_strcasecmp (value, _("High")))
- priority = 3;
- else if (!g_strcasecmp (value, _("Normal")))
- priority = 5;
- else if (!g_strcasecmp (value, _("Low")))
- priority = 7;
- else {
- show_priority_warning ();
- return;
}
cal_component_set_priority (comp, &priority);
@@ -1956,7 +1929,9 @@ adjust_query_sexp (CalendarModel *model, const char *sexp)
if (free_completed_sexp)
g_free (completed_sexp);
- g_print ("Calendar mode sexp:\n%s\n", new_sexp);
+#if 0
+ g_print ("Calendar model sexp:\n%s\n", new_sexp);
+#endif
return new_sexp;
}
diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c
index 811760eb6f..649a86f025 100644
--- a/calendar/gui/dialogs/alarm-page.c
+++ b/calendar/gui/dialogs/alarm-page.c
@@ -506,6 +506,7 @@ alarm_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* Dates */
comp_editor_dates (&dates, comp);
alarm_page_set_dates (page, &dates);
+ comp_editor_free_dates (&dates);
/* List */
if (!cal_component_has_alarms (comp))
diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h
index 6565d9888e..af8fe1f389 100644
--- a/calendar/gui/dialogs/comp-editor-page.h
+++ b/calendar/gui/dialogs/comp-editor-page.h
@@ -39,9 +39,9 @@ BEGIN_GNOME_DECLS
#define IS_COMP_EDITOR_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), TYPE_COMP_EDITOR_PAGE))
typedef struct {
- struct icaltimetype *start;
- struct icaltimetype *end;
- struct icaltimetype *due;
+ CalComponentDateTime *start;
+ CalComponentDateTime *end;
+ CalComponentDateTime *due;
struct icaltimetype *complete;
} CompEditorPageDates;
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index 375d51918f..5d10942a5e 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -46,20 +46,13 @@
* @comp: The component to extract the dates from
*
* Extracts the dates from the calendar component into the
- * CompEditorPageDates structure. Note that it returns pointers to static
- * structs, so these will be overwritten in the next call.
+ * CompEditorPageDates structure. Call comp_editor_free_dates() to free the
+ * results.
**/
void
comp_editor_dates (CompEditorPageDates *dates, CalComponent *comp)
{
- static struct icaltimetype start;
- static struct icaltimetype end;
- static struct icaltimetype due;
- static struct icaltimetype complete;
-
CalComponentDateTime dt;
- struct icaltimetype *comp_complete;
-
dates->start = NULL;
dates->end = NULL;
@@ -68,33 +61,46 @@ comp_editor_dates (CompEditorPageDates *dates, CalComponent *comp)
cal_component_get_dtstart (comp, &dt);
if (dt.value) {
- start = *dt.value;
- dates->start = &start;
+ dates->start = g_new (CalComponentDateTime, 1);
+ *dates->start = dt;
}
- cal_component_free_datetime (&dt);
cal_component_get_dtend (comp, &dt);
if (dt.value) {
- end = *dt.value;
- dates->end = &end;
+ dates->end = g_new (CalComponentDateTime, 1);
+ *dates->end = dt;
}
- cal_component_free_datetime (&dt);
cal_component_get_due (comp, &dt);
if (dt.value) {
- due = *dt.value;
- dates->due = &due;
+ dates->due = g_new (CalComponentDateTime, 1);
+ *dates->due = dt;
}
- cal_component_free_datetime (&dt);
- cal_component_get_completed (comp, &comp_complete);
- if (comp_complete) {
- complete = *comp_complete;
- dates->complete = &complete;
- cal_component_free_icaltimetype (comp_complete);
- }
+ cal_component_get_completed (comp, &dates->complete);
}
+
+/* This frees the dates in the CompEditorPageDates struct. But it doesn't free
+ * the struct (as that is usually static).
+ */
+void
+comp_editor_free_dates (CompEditorPageDates *dates)
+{
+ if (dates->start)
+ cal_component_free_datetime (dates->start);
+
+ if (dates->end)
+ cal_component_free_datetime (dates->end);
+
+ if (dates->due)
+ cal_component_free_datetime (dates->due);
+
+ if (dates->complete)
+ cal_component_free_icaltimetype (dates->complete);
+}
+
+
static void
write_label_piece (struct icaltimetype *tt, char *buffer, int size,
char *stext, char *etext)
@@ -143,20 +149,22 @@ comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label)
buffer[0] = '\0';
- if (dates->start && !icaltime_is_null_time (*dates->start))
+ if (dates->start && !icaltime_is_null_time (*dates->start->value))
start_set = TRUE;
- if (dates->end && !icaltime_is_null_time (*dates->end))
+ if (dates->end && !icaltime_is_null_time (*dates->end->value))
end_set = TRUE;
if (dates->complete && !icaltime_is_null_time (*dates->complete))
complete_set = TRUE;
- if (dates->due && !icaltime_is_null_time (*dates->due))
+ if (dates->due && !icaltime_is_null_time (*dates->due->value))
due_set = TRUE;
if (start_set)
- write_label_piece (dates->start, buffer, 1024, NULL, NULL);
+ write_label_piece (dates->start->value, buffer, 1024,
+ NULL, NULL);
if (start_set && end_set)
- write_label_piece (dates->end, buffer, 1024, _(" to "), NULL);
+ write_label_piece (dates->end->value, buffer, 1024,
+ _(" to "), NULL);
if (complete_set) {
if (start_set)
@@ -167,9 +175,9 @@ comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label)
if (due_set && dates->complete == NULL) {
if (start_set)
- write_label_piece (dates->due, buffer, 1024, _(" (Due "), ")");
+ write_label_piece (dates->due->value, buffer, 1024, _(" (Due "), ")");
else
- write_label_piece (dates->due, buffer, 1024, _("Due "), NULL);
+ write_label_piece (dates->due->value, buffer, 1024, _("Due "), NULL);
}
gtk_label_set_text (GTK_LABEL (label), buffer);
diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h
index 23f3937a9a..37c1c0d5f7 100644
--- a/calendar/gui/dialogs/comp-editor-util.h
+++ b/calendar/gui/dialogs/comp-editor-util.h
@@ -28,6 +28,8 @@
#include "comp-editor-page.h"
void comp_editor_dates (CompEditorPageDates *date, CalComponent *comp);
+void comp_editor_free_dates (CompEditorPageDates *dates);
+
void comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label);
GtkWidget *comp_editor_new_date_edit (gboolean show_date, gboolean show_time,
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index dcec6bb251..593544c11f 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -116,7 +116,6 @@ static EPixmap pixmaps [] =
E_PIXMAP ("/Toolbar/FileSaveAndClose", "buttons/save-24.png"),
E_PIXMAP ("/Toolbar/FilePrint", "buttons/print.png"),
- E_PIXMAP ("/Toolbar/FilePrintPreview", "buttons/print-preview-24.png"),
E_PIXMAP ("/Toolbar/FileDelete", "buttons/delete-message.png"),
E_PIXMAP_END
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 74fdecb6ee..8a1415b9d2 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -561,7 +561,7 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
char *cat, *str;
CalComponentClassification classif;
CalComponentTransparency transparency;
- icaltimezone *zone = NULL;
+ icaltimezone *start_zone, *end_zone;
epage = EVENT_PAGE (page);
priv = epage->priv;
@@ -619,13 +619,13 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
all_day_event = e_dialog_toggle_get (priv->all_day_event);
if (all_day_event) {
- char *location;
-
- location = calendar_config_get_timezone ();
- zone = icaltimezone_get_builtin_timezone (location);
+ char *location = calendar_config_get_timezone ();
+ start_zone = end_zone = icaltimezone_get_builtin_timezone (location);
+ } else {
+ start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone));
}
-
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_time),
&icaltime.year,
&icaltime.month,
@@ -634,10 +634,7 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
&icaltime.hour,
&icaltime.minute);
g_assert (date_set);
- if (!all_day_event)
- zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
- if (zone)
- date.tzid = icaltimezone_get_tzid (zone);
+ date.tzid = icaltimezone_get_tzid (start_zone);
cal_component_set_dtstart (comp, &date);
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->end_time),
@@ -656,10 +653,7 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
icaltime_adjust (&icaltime, 1, 0, 0, 0);
}
- if (!all_day_event)
- zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone));
- if (zone)
- date.tzid = icaltimezone_get_tzid (zone);
+ date.tzid = icaltimezone_get_tzid (end_zone);
cal_component_set_dtend (comp, &date);
@@ -787,27 +781,79 @@ summary_changed_cb (GtkEditable *editable, gpointer data)
g_free (summary);
}
-/* Callback used when the start or end date widgets change. We check that the
- * start date < end date and we set the "all day event" button as appropriate.
- */
+
static void
-date_changed_cb (EDateEdit *dedit, gpointer data)
+notify_dates_changed (EventPage *epage, struct icaltimetype *start_tt,
+ struct icaltimetype *end_tt)
{
- EventPage *epage;
EventPagePrivate *priv;
CompEditorPageDates dates;
+ CalComponentDateTime start_dt, end_dt;
+ gboolean all_day_event;
+ icaltimezone *start_zone, *end_zone;
+
+ priv = epage->priv;
+
+ all_day_event = e_dialog_toggle_get (priv->all_day_event);
+
+ start_dt.value = start_tt;
+ end_dt.value = end_tt;
+
+ if (all_day_event) {
+ /* FIXME: When we switch to using DATE values we'll set the
+ TZIDs to NULL. */
+ char *location;
+
+ location = calendar_config_get_timezone ();
+ start_zone = end_zone = icaltimezone_get_builtin_timezone (location);
+ } else {
+ start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone));
+ }
+
+ start_dt.tzid = start_zone ? icaltimezone_get_tzid (start_zone) : NULL;
+ end_dt.tzid = end_zone ? icaltimezone_get_tzid (end_zone) : NULL;
+
+ dates.start = &start_dt;
+ dates.end = &end_dt;
+
+ dates.due = NULL;
+ dates.complete = NULL;
+ comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (epage),
+ &dates);
+}
+
+
+/*
+ * This is called whenever the start or end dates or timezones is changed.
+ * It makes sure that the start date < end date, and currently sets the
+ * "all day event" checkbox as appropriate (but won't when we use DATE values).
+ * It also emits the notification signals so the other event editor pages
+ * update their labels etc.
+ *
+ * If adjust_end_time is TRUE, if the start time < end time it will adjust
+ * the end time. If FALSE it will adjust the start time. If the user sets the
+ * start or end time, the other time is adjusted to make it valid.
+ */
+static void
+times_updated (EventPage *epage, gboolean adjust_end_time)
+{
+ EventPagePrivate *priv;
struct icaltimetype start_tt = icaltime_null_time();
struct icaltimetype end_tt = icaltime_null_time();
+ struct icaltimetype end_tt_copy;
int cmp;
- gboolean date_set;
+ gboolean date_set, all_day_event;
+ icaltimezone *start_zone, *end_zone;
- epage = EVENT_PAGE (data);
priv = epage->priv;
if (priv->updating)
return;
- /* Ensure that start < end */
+ /* Fetch the start and end times and timezones from the widgets. */
+ all_day_event = e_dialog_toggle_get (priv->all_day_event);
+
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_time),
&start_tt.year,
&start_tt.month,
@@ -826,25 +872,34 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
&end_tt.minute);
g_assert (date_set);
- /* FIXME: TIMEZONES. */
- cmp = icaltime_compare (start_tt, end_tt);
- if (cmp >= 0) {
- if (cmp == 0 && start_tt.hour == 0
- && start_tt.minute == 0
- && start_tt.second == 0) {
- /* If the start and end times are the same, but both
- * are on day boundaries, then that is OK since it
- * means we have an all-day event lasting 1 day. So
- * we do nothing here.
- */
- } else if (GTK_WIDGET (dedit) == priv->start_time) {
- /* Modify the end time, to be the start + 1 hour. */
-
- /* FIXME: TIMEZONES - Probably want to leave the
- timezone as it is, so we need to convert the time.*/
+ if (all_day_event) {
+ char *location = calendar_config_get_timezone ();
+ start_zone = end_zone = icaltimezone_get_builtin_timezone (location);
+ } else {
+ start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone));
+ }
+
+ /* Convert the end time to the same timezone as the start time. */
+ end_tt_copy = end_tt;
+ icaltimezone_convert_time (&end_tt_copy, end_zone, start_zone);
+
+ /* Now check if the start time is after the end time. If it is, we need
+ to modify one of the times. */
+ cmp = icaltime_compare (start_tt, end_tt_copy);
+ if (cmp > 0) {
+ if (adjust_end_time) {
+ /* Modify the end time, to be the start + 1 hour,
+ or the same as the start time for all-day events.
+ We copy the start time, add on one hour, then
+ convert it to the original end timezone. */
end_tt = start_tt;
- icaltime_adjust (&end_tt, 0, 1, 0, 0);
+ if (!all_day_event) {
+ icaltime_adjust (&end_tt, 0, 1, 0, 0);
+ icaltimezone_convert_time (&end_tt, start_zone,
+ end_zone);
+ }
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->end_time), epage);
@@ -857,14 +912,17 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
end_tt.minute);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->end_time), epage);
- } else if (GTK_WIDGET (dedit) == priv->end_time) {
- /* Modify the start time, to be the end - 1 hour. */
-
- /* FIXME: TIMEZONES - Probably want to leave the
- timezone as it is, so we need to convert the time.*/
-
+ } else {
+ /* Modify the start time, to be the end - 1 hour,
+ or the same as the start time for all-day events.
+ We copy the end time, subtract one hour, then
+ convert it to the original start timezone. */
start_tt = end_tt;
- icaltime_adjust (&start_tt, 0, -1, 0, 0);
+ if (!all_day_event) {
+ icaltime_adjust (&start_tt, 0, -1, 0, 0);
+ icaltimezone_convert_time (&start_tt, end_zone,
+ start_zone);
+ }
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), epage);
@@ -877,22 +935,30 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
start_tt.minute);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_time), epage);
- } else
- g_assert_not_reached ();
+ }
}
/* Set the "all day event" button as appropriate */
check_all_day (epage);
/* Notify upstream */
- dates.start = &start_tt;
- dates.end = &end_tt;
- dates.due = NULL;
- dates.complete = NULL;
- comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (epage),
- &dates);
+ notify_dates_changed (epage, &start_tt, &end_tt);
}
+/* Callback used when the start or end date widgets change. We check that the
+ * start date < end date and we set the "all day event" button as appropriate.
+ */
+static void
+date_changed_cb (GtkWidget *dedit, gpointer data)
+{
+ EventPage *epage;
+
+ epage = EVENT_PAGE (data);
+
+ times_updated (epage, dedit == epage->priv->start_time);
+}
+
+
/* Callback used when the start timezone is changed. If sync_timezones is set,
* we set the end timezone to the same value. It also updates the start time
* labels on the other notebook pages.
@@ -909,8 +975,12 @@ start_timezone_changed_cb (GtkWidget *widget, gpointer data)
if (priv->sync_timezones) {
zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ priv->updating = TRUE;
e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), zone);
+ priv->updating = FALSE;
}
+
+ times_updated (epage, TRUE);
}
@@ -931,6 +1001,8 @@ end_timezone_changed_cb (GtkWidget *widget, gpointer data)
end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone));
priv->sync_timezones = (start_zone == end_zone) ? TRUE : FALSE;
+
+ times_updated (epage, TRUE);
}
/* Callback: all day event button toggled.
@@ -944,7 +1016,6 @@ all_day_event_toggled_cb (GtkWidget *toggle, gpointer data)
EventPage *epage;
EventPagePrivate *priv;
gboolean all_day;
- CompEditorPageDates dates;
struct icaltimetype start_tt = icaltime_null_time();
struct icaltimetype end_tt = icaltime_null_time();
gboolean date_set;
@@ -1061,12 +1132,7 @@ all_day_event_toggled_cb (GtkWidget *toggle, gpointer data)
}
/* Notify upstream */
- dates.start = &start_tt;
- dates.end = &end_tt;
- dates.due = NULL;
- dates.complete = NULL;
- comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (epage),
- &dates);
+ notify_dates_changed (epage, &start_tt, &end_tt);
}
/* Callback used when the contacts button is clicked; we must bring up the
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index 7a1982da17..10946805ed 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -886,7 +886,7 @@ preview_recur (RecurrencePage *rpage)
fill_component (rpage, comp);
tag_calendar_by_comp (E_CALENDAR (priv->preview_calendar), comp,
- COMP_EDITOR_PAGE (rpage)->client, TRUE);
+ COMP_EDITOR_PAGE (rpage)->client, TRUE, FALSE);
gtk_object_unref (GTK_OBJECT (comp));
}
@@ -1405,6 +1405,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* Dates */
comp_editor_dates (&dates, comp);
recurrence_page_set_dates (page, &dates);
+ comp_editor_free_dates (&dates);
/* Exceptions */
fill_exception_widgets (rpage, comp);
@@ -1741,7 +1742,7 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
{
RecurrencePage *rpage;
RecurrencePagePrivate *priv;
- CalComponentDateTime dt, old_dt;
+ CalComponentDateTime dt;
struct icaltimetype icaltime;
guint8 mask;
@@ -1758,27 +1759,15 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
dt.value = &icaltime;
if (dates->start) {
- icaltime = *dates->start;
-
- /* 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 = old_dt.tzid;
-
+ icaltime = *dates->start->value;
+ dt.tzid = dates->start->tzid;
cal_component_set_dtstart (priv->comp, &dt);
- cal_component_free_datetime (&old_dt);
}
if (dates->end) {
- icaltime = *dates->end;
-
- /* 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 = old_dt.tzid;
-
+ icaltime = *dates->end->value;
+ dt.tzid = dates->end->tzid;
cal_component_set_dtend (priv->comp, &dt);
- cal_component_free_datetime (&old_dt);
}
/* Update the weekday picker if necessary */
@@ -1795,6 +1784,9 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
weekday_picker_set_blocked_days (WEEKDAY_PICKER (priv->weekday_picker),
priv->weekday_blocked_day_mask);
}
+
+ /* Make sure the preview gets updated. */
+ preview_recur (rpage);
}
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 048adf31ad..2c3f8d18ec 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -676,6 +676,7 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
TaskPagePrivate *priv;
CompEditorPageDates dates;
gboolean date_set;
+ CalComponentDateTime start_dt, due_dt;
struct icaltimetype start_tt = icaltime_null_time();
struct icaltimetype due_tt = icaltime_null_time();
@@ -692,8 +693,13 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_date),
&start_tt.hour,
&start_tt.minute);
- if (!date_set)
+ if (date_set) {
+ icaltimezone *zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ start_dt.tzid = icaltimezone_get_tzid (zone);
+ } else {
start_tt = icaltime_null_time ();
+ start_dt.tzid = NULL;
+ }
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->due_date),
&due_tt.year,
@@ -702,12 +708,19 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
e_date_edit_get_time_of_day (E_DATE_EDIT (priv->due_date),
&due_tt.hour,
&due_tt.minute);
- if (!date_set)
+ if (date_set) {
+ icaltimezone *zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->due_timezone));
+ due_dt.tzid = icaltimezone_get_tzid (zone);
+ } else {
due_tt = icaltime_null_time ();
+ due_dt.tzid = NULL;
+ }
- dates.start = &start_tt;
+ start_dt.value = &start_tt;
+ dates.start = &start_dt;
dates.end = NULL;
- dates.due = &due_tt;
+ due_dt.value = &due_tt;
+ dates.due = &due_dt;
dates.complete = NULL;
/* Notify upstream */
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 1b37c8662e..8d8856ed2a 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -186,6 +186,12 @@ compare_priorities (int *a, int *b)
/* Comparison function for the task-sort column. Sorts by due date and then by
* priority.
+ *
+ * FIXME: Does this ever get called?? It doesn't seem to.
+ * I specified that the table should be sorted by this column, but it still
+ * never calls this function.
+ * Also, this assumes it is passed pointers to CalComponents, but I think it
+ * may just be passed pointers to the 2 cell values.
*/
static gint
task_compare_cb (gconstpointer a, gconstpointer b)
@@ -195,6 +201,8 @@ task_compare_cb (gconstpointer a, gconstpointer b)
int *prio_a, *prio_b;
int retval;
+ g_print ("In task_compare_cb\n");
+
ca = CAL_COMPONENT (a);
cb = CAL_COMPONENT (b);
@@ -206,7 +214,8 @@ task_compare_cb (gconstpointer a, gconstpointer b)
if (due_a.value && due_b.value) {
int v;
- /* FIXME: TIMEZONES. */
+ /* FIXME: TIMEZONES. But currently we have no way to get the
+ CalClient, so we can't get the timezone. */
v = icaltime_compare (*due_a.value, *due_b.value);
if (v == 0)
@@ -232,6 +241,54 @@ task_compare_cb (gconstpointer a, gconstpointer b)
return retval;
}
+static gint
+date_compare_cb (gconstpointer a, gconstpointer b)
+{
+ const char *value1 = a, *value2 = b;
+
+ g_print ("In date_compare_cb '%s' '%s'\n", value1, value2);
+
+ return 0;
+}
+
+static gint
+percent_compare_cb (gconstpointer a, gconstpointer b)
+{
+ const char *value1 = a, *value2 = b;
+
+ /* FIXME: Currently this isn't working as the ETableSorter caches
+ all the values in the table before sorting, but our get_value()
+ function returns a pointer to a static buffer. So all the cached
+ pointers point to the same buffer. */
+
+ g_print ("In percent_compare_cb '%s' '%s'\n", value1, value2);
+
+ return 0;
+}
+
+static gint
+priority_compare_cb (gconstpointer a, gconstpointer b)
+{
+ int priority1, priority2;
+
+ priority1 = cal_util_priority_from_string ((const char*) a);
+ priority2 = cal_util_priority_from_string ((const char*) b);
+
+ /* We change undefined priorities so they appear after 'Low'. */
+ if (priority1 <= 0)
+ priority1 = 10;
+ if (priority2 <= 0)
+ priority2 = 10;
+
+ /* We'll just use the ordering of the priority values. */
+ if (priority1 < priority2)
+ return -1;
+ else if (priority1 > priority2)
+ return 1;
+ else
+ return 0;
+}
+
static void
e_calendar_table_init (ECalendarTable *cal_table)
{
@@ -413,6 +470,13 @@ e_calendar_table_init (ECalendarTable *cal_table)
*/
e_table_extras_add_compare (extras, "task-sort", task_compare_cb);
+ e_table_extras_add_compare (extras, "date-compare",
+ date_compare_cb);
+ e_table_extras_add_compare (extras, "percent-compare",
+ percent_compare_cb);
+ e_table_extras_add_compare (extras, "priority-compare",
+ priority_compare_cb);
+
/* Create pixmaps */
if (!icon_pixbufs[0])
diff --git a/calendar/gui/e-calendar-table.etspec b/calendar/gui/e-calendar-table.etspec
index b6a81f7fea..f0f717c006 100644
--- a/calendar/gui/e-calendar-table.etspec
+++ b/calendar/gui/e-calendar-table.etspec
@@ -1,13 +1,13 @@
<ETableSpecification click-to-add="true" _click-to-add-message="Click to add a task" draw-grid="true">
<ETableColumn model_col= "0" _title="Categories" expansion="1.0" minimum_width="10" resizable="true" cell="calstring" compare="string"/>
<ETableColumn model_col= "1" _title="Classification" expansion="1.0" minimum_width="10" resizable="true" cell="classification" compare="string"/>
- <ETableColumn model_col= "2" _title="Completion Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="string"/>
- <ETableColumn model_col= "3" _title="End Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="string"/>
- <ETableColumn model_col= "4" _title="Start Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="string"/>
- <ETableColumn model_col= "5" _title="Due Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="string"/>
+ <ETableColumn model_col= "2" _title="Completion Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare"/>
+ <ETableColumn model_col= "3" _title="End Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare"/>
+ <ETableColumn model_col= "4" _title="Start Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare"/>
+ <ETableColumn model_col= "5" _title="Due Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare"/>
<ETableColumn model_col= "6" _title="Geographical Position" expansion="1.0" minimum_width="10" resizable="true" cell="calstring" compare="string"/>
- <ETableColumn model_col= "7" _title="% Complete" expansion="1.0" minimum_width="10" resizable="true" cell="percent" compare="string"/>
- <ETableColumn model_col= "8" _title="Priority" expansion="1.0" minimum_width="10" resizable="true" cell="priority" compare="string"/>
+ <ETableColumn model_col= "7" _title="% Complete" expansion="1.0" minimum_width="10" resizable="true" cell="percent" compare="percent-compare"/>
+ <ETableColumn model_col= "8" _title="Priority" expansion="1.0" minimum_width="10" resizable="true" cell="priority" compare="priority-compare"/>
<ETableColumn model_col= "9" _title="Summary" expansion="3.0" minimum_width="10" resizable="true" cell="calstring" compare="string"/>
<ETableColumn model_col="10" _title="Show Time As" expansion="1.0" minimum_width="10" resizable="true" cell="transparency" compare="string"/>
<ETableColumn model_col="11" _title="URL" expansion="2.0" minimum_width="10" resizable="true" cell="calstring" compare="string"/>
diff --git a/calendar/gui/e-day-view-layout.c b/calendar/gui/e-day-view-layout.c
index 00a448d7ec..67527b0feb 100644
--- a/calendar/gui/e-day-view-layout.c
+++ b/calendar/gui/e-day-view-layout.c
@@ -201,6 +201,8 @@ e_day_view_layout_day_event (EDayViewEvent *event,
start_row = event->start_minute / mins_per_row;
end_row = (event->end_minute - 1) / mins_per_row;
+ if (end_row < start_row)
+ end_row = start_row;
event->num_columns = 0;
@@ -292,6 +294,8 @@ e_day_view_expand_day_event (EDayViewEvent *event,
start_row = event->start_minute / mins_per_row;
end_row = (event->end_minute - 1) / mins_per_row;
+ if (end_row < start_row)
+ end_row = start_row;
/* Try each column until we find a free one. */
clashed = FALSE;
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 80b79bf2f5..77343b4763 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -3255,6 +3255,8 @@ e_day_view_on_event_click (EDayView *day_view,
day_view->resize_drag_pos = pos;
day_view->resize_start_row = event->start_minute / day_view->mins_per_row;
day_view->resize_end_row = (event->end_minute - 1) / day_view->mins_per_row;
+ if (day_view->resize_end_row < day_view->resize_start_row)
+ day_view->resize_end_row = day_view->resize_start_row;
day_view->resize_bars_event_day = day;
day_view->resize_bars_event_num = event_num;
@@ -3526,8 +3528,27 @@ e_day_view_on_new_appointment (GtkWidget *widget, gpointer data)
{
EDayView *day_view = E_DAY_VIEW (data);
time_t dtstart, dtend;
+ struct icaltimetype itt;
- e_day_view_get_selected_time_range (day_view, &dtstart, &dtend);
+ /* Edit a new event. If only one day is selected in the top canvas,
+ we set the time to the first 1/2-hour of the working day. */
+ if (day_view->selection_in_top_canvas
+ && day_view->selection_start_day != -1
+ && day_view->selection_start_day == day_view->selection_end_day) {
+ dtstart = day_view->day_starts[day_view->selection_start_day];
+ itt = icaltime_from_timet_with_zone (dtstart, FALSE,
+ day_view->zone);
+ itt.hour = calendar_config_get_day_start_hour ();
+ itt.minute = calendar_config_get_day_start_minute ();
+ dtstart = icaltime_as_timet_with_zone (itt, day_view->zone);
+
+ icaltime_adjust (&itt, 0, 0, 30, 0);
+ dtend = icaltime_as_timet_with_zone (itt, day_view->zone);
+ } else {
+ e_day_view_get_selected_time_range (day_view, &dtstart,
+ &dtend);
+ }
+
gnome_calendar_new_appointment_for (
day_view->calendar, dtstart, dtend, FALSE);
}
@@ -5834,6 +5855,9 @@ e_day_view_get_event_position (EDayView *day_view,
start_row = event->start_minute / day_view->mins_per_row;
end_row = (event->end_minute - 1) / day_view->mins_per_row;
+ if (end_row < start_row)
+ end_row = start_row;
+
cols_in_row = day_view->cols_per_row[day][start_row];
start_col = event->start_row_or_col;
num_columns = event->num_columns;
@@ -6320,6 +6344,9 @@ e_day_view_update_main_canvas_drag (EDayView *day_view,
day_view->drag_event_num);
start_row = event->start_minute / day_view->mins_per_row;
end_row = (event->end_minute - 1) / day_view->mins_per_row;
+ if (end_row < start_row)
+ end_row = start_row;
+
num_rows = end_row - start_row + 1;
}
@@ -6690,6 +6717,9 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
/* Calculate time offset from start row. */
start_row = event->start_minute / day_view->mins_per_row;
end_row = (event->end_minute - 1) / day_view->mins_per_row;
+ if (end_row < start_row)
+ end_row = start_row;
+
num_rows = end_row - start_row + 1;
start_offset = event->start_minute % day_view->mins_per_row;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index b9bc5199d1..22f776b557 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -52,6 +52,7 @@
#include "comp-util.h"
#include "cal-util/timeutil.h"
#include "calendar-commands.h"
+#include "calendar-config.h"
#include "goto.h"
#include "e-week-view-event-item.h"
#include "e-week-view-layout.h"
@@ -641,6 +642,13 @@ e_week_view_style_set (GtkWidget *widget,
week_view->row_height = font->ascent + font->descent + E_WEEK_VIEW_EVENT_BORDER_HEIGHT * 2 + E_WEEK_VIEW_EVENT_TEXT_Y_PAD * 2;
week_view->row_height = MAX (week_view->row_height, E_WEEK_VIEW_ICON_HEIGHT + E_WEEK_VIEW_ICON_Y_PAD + E_WEEK_VIEW_EVENT_BORDER_HEIGHT * 2);
+ /* Check that the small font is smaller than the default font.
+ If it isn't, we won't use it. */
+ if (week_view->small_font) {
+ if (font->ascent + font->descent <= week_view->small_font->ascent + week_view->small_font->descent)
+ week_view->use_small_font = FALSE;
+ }
+
/* Set the height of the top canvas. */
gtk_widget_set_usize (week_view->titles_canvas, -1,
font->ascent + font->descent + 5);
@@ -3367,9 +3375,25 @@ e_week_view_on_new_appointment (GtkWidget *widget, gpointer data)
{
EWeekView *week_view = E_WEEK_VIEW (data);
time_t dtstart, dtend;
+ struct icaltimetype itt;
- dtstart = week_view->day_starts[week_view->selection_start_day];
- dtend = week_view->day_starts[week_view->selection_end_day + 1];
+ /* Edit a new event. If only one day is selected we set the time to
+ the first 1/2-hour of the working day. */
+ if (week_view->selection_start_day == week_view->selection_end_day) {
+ dtstart = week_view->day_starts[week_view->selection_start_day];
+ itt = icaltime_from_timet_with_zone (dtstart, FALSE,
+ week_view->zone);
+ itt.hour = calendar_config_get_day_start_hour ();
+ itt.minute = calendar_config_get_day_start_minute ();
+ dtstart = icaltime_as_timet_with_zone (itt, week_view->zone);
+
+ icaltime_adjust (&itt, 0, 0, 30, 0);
+ dtend = icaltime_as_timet_with_zone (itt, week_view->zone);
+ } else {
+ dtstart = week_view->day_starts[week_view->selection_start_day];
+ dtend = week_view->day_starts[week_view->selection_end_day + 1];
+ }
+
gnome_calendar_new_appointment_for (
week_view->calendar, dtstart, dtend, FALSE);
}
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index a2282ba2f1..bed5b0e3e9 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -287,7 +287,8 @@ dn_query_obj_updated_cb (CalQuery *query, const char *uid,
return;
}
- tag_calendar_by_comp (priv->date_navigator, comp, priv->client, FALSE);
+ tag_calendar_by_comp (priv->date_navigator, comp, priv->client, FALSE,
+ TRUE);
gtk_object_unref (GTK_OBJECT (comp));
}
@@ -1961,7 +1962,7 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp)
}
/**
- * gnome_calendar_new_appointment:
+ * gnome_calendar_new_appointment_for:
* @gcal: An Evolution calendar.
* @dtstart: a Unix time_t that marks the beginning of the appointment.
* @dtend: a Unix time_t that marks the end of the appointment.
@@ -2233,6 +2234,7 @@ gnome_calendar_update_date_navigator (GnomeCalendar *gcal)
end_date = start_date;
g_date_add_days (&end_date, days_shown - 1);
+ g_print ("Updating date navigator selection\n");
e_calendar_item_set_selection (priv->date_navigator->calitem,
&start_date, &end_date);
}
@@ -2325,6 +2327,7 @@ static void
gnome_calendar_on_date_navigator_date_range_changed (ECalendarItem *calitem,
GnomeCalendar *gcal)
{
+ g_print ("In gnome_calendar_on_date_navigator_date_range_changed\n");
update_query (gcal);
}
diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c
index 30ee02520c..08a2636ec0 100644
--- a/calendar/gui/tag-calendar.c
+++ b/calendar/gui/tag-calendar.c
@@ -152,6 +152,32 @@ tag_calendar_by_client (ECalendar *ecal, CalClient *client)
tag_calendar_cb, &c);
}
+/* Resolves TZIDs for the recurrence generator, for when the comp is not on
+ the server. We need to try to use builtin timezones first, as they may not
+ be added to the server yet. */
+icaltimezone*
+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);
+
+ /* Try to find the builtin timezone first. */
+ zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
+
+ if (!zone) {
+ /* FIXME: Handle errors. */
+ status = cal_client_get_timezone (client, tzid, &zone);
+ }
+
+ return zone;
+}
+
/**
* tag_calendar_by_comp:
* @ecal: Calendar widget to tag.
@@ -161,9 +187,13 @@ tag_calendar_by_client (ECalendar *ecal, CalClient *client)
* Tags an #ECalendar widget with any occurrences of a specific calendar
* component that occur within the calendar's current time range.
* Note that TRANSPARENT events are also tagged here.
+ *
+ * If comp_is_on_server is FALSE, it will try to resolve TZIDs using builtin
+ * timezones first, before querying the server, since the timezones may not
+ * have been added to the calendar on the server yet.
**/
void
-tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp, CalClient *client, gboolean clear_first)
+tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp, CalClient *client, gboolean clear_first, gboolean comp_is_on_server)
{
struct calendar_tag_closure c;
@@ -184,7 +214,15 @@ tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp, CalClient *client, gb
#if 0
g_print ("DateNavigator generating instances\n");
#endif
- cal_recur_generate_instances (comp, c.start_time, c.end_time,
- tag_calendar_cb, &c,
- cal_client_resolve_tzid_cb, client);
+ if (comp_is_on_server) {
+ cal_recur_generate_instances (comp, c.start_time, c.end_time,
+ tag_calendar_cb, &c,
+ cal_client_resolve_tzid_cb,
+ client);
+ } else {
+ cal_recur_generate_instances (comp, c.start_time, c.end_time,
+ tag_calendar_cb, &c,
+ resolve_tzid_cb,
+ client);
+ }
}
diff --git a/calendar/gui/tag-calendar.h b/calendar/gui/tag-calendar.h
index 0ec7b5a148..4b5ede9267 100644
--- a/calendar/gui/tag-calendar.h
+++ b/calendar/gui/tag-calendar.h
@@ -28,6 +28,7 @@
void tag_calendar_by_client (ECalendar *ecal, CalClient *client);
void tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp,
- CalClient *client, gboolean clear_first);
+ CalClient *client, gboolean clear_first,
+ gboolean comp_is_on_server);
#endif