aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-08-07 08:46:56 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-08-07 08:46:56 +0800
commit9d8f94804917a0338a08be9f36a8e047ccedd939 (patch)
tree4e29f6218af7cbdc4a84933d9cffddd1b7caa61c /calendar
parent5949b39e3437ebbf7e7461c58df50424e0993809 (diff)
downloadgsoc2013-evolution-9d8f94804917a0338a08be9f36a8e047ccedd939.tar.gz
gsoc2013-evolution-9d8f94804917a0338a08be9f36a8e047ccedd939.tar.zst
gsoc2013-evolution-9d8f94804917a0338a08be9f36a8e047ccedd939.zip
added 'different_timezone' fields to EDayViewEvent and EWeekViewEvent, to
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. svn path=/trunk/; revision=11717
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog62
-rw-r--r--calendar/cal-util/cal-component.c41
-rw-r--r--calendar/cal-util/cal-component.h3
-rw-r--r--calendar/gui/calendar-commands.c68
-rw-r--r--calendar/gui/calendar-commands.h5
-rw-r--r--calendar/gui/calendar-model.c90
-rw-r--r--calendar/gui/comp-util.c96
-rw-r--r--calendar/gui/comp-util.h9
-rw-r--r--calendar/gui/control-factory.c10
-rw-r--r--calendar/gui/dialogs/event-page.c53
-rw-r--r--calendar/gui/dialogs/event-page.glade160
-rw-r--r--calendar/gui/dialogs/recurrence-page.glade5
-rw-r--r--calendar/gui/e-calendar-table.c6
-rw-r--r--calendar/gui/e-calendar-table.etspec2
-rw-r--r--calendar/gui/e-day-view-main-item.c27
-rw-r--r--calendar/gui/e-day-view.c31
-rw-r--r--calendar/gui/e-day-view.h9
-rw-r--r--calendar/gui/e-week-view-event-item.c2
-rw-r--r--calendar/gui/e-week-view.c29
-rw-r--r--calendar/gui/e-week-view.h10
-rw-r--r--calendar/gui/gnome-cal.c48
-rw-r--r--calendar/gui/gnome-cal.h6
-rw-r--r--calendar/gui/tag-calendar.c16
-rw-r--r--calendar/gui/tasks-control.c3
-rw-r--r--calendar/pcs/cal-backend-file.c17
25 files changed, 575 insertions, 233 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 94aa81721d..f0539b2fe2 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,65 @@
+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
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index b806f8e3e7..7bacfb5432 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -4934,44 +4934,3 @@ cal_component_event_dates_match (CalComponent *comp1,
return TRUE;
}
-/* Returns TRUE if the TZIDs are equivalent, i.e. both NULL or the same. */
-static gboolean
-cal_component_compare_tzid (const char *tzid1, const char *tzid2)
-{
- gboolean retval = TRUE;
-
- if (tzid1) {
- if (!tzid2 || strcmp (tzid1, tzid2))
- retval = FALSE;
- } else {
- if (tzid2)
- retval = FALSE;
- }
-
- return retval;
-}
-
-/* Returns TRUE if the component uses the given timezones for both DTSTART
- and DTEND. */
-gboolean
-cal_component_compare_event_timezone (CalComponent *comp, icaltimezone *zone)
-{
- CalComponentDateTime datetime;
- const char *tzid;
- gboolean match;
-
- tzid = icaltimezone_get_tzid (zone);
-
- cal_component_get_dtstart (comp, &datetime);
- match = cal_component_compare_tzid (tzid, datetime.tzid);
- cal_component_free_datetime (&datetime);
- if (!match)
- return FALSE;
-
- /* FIXME: DURATION may be used instead. */
- cal_component_get_dtend (comp, &datetime);
- match = cal_component_compare_tzid (tzid, datetime.tzid);
- cal_component_free_datetime (&datetime);
-
- return match;
-}
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index f0628cb967..e1f4022b91 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -335,9 +335,6 @@ void cal_component_set_attendee_list (CalComponent *comp, GSList *attendee_list)
gboolean cal_component_event_dates_match (CalComponent *comp1, CalComponent *comp2);
-/* Returns TRUE if the component uses the given timezones for both DTSTART
- and DTEND. */
-gboolean cal_component_compare_event_timezone (CalComponent *comp, icaltimezone *zone);
/* Functions to free returned values */
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 22640d2629..8fd3bb038e 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -356,11 +356,9 @@ get_shell_view_interface (BonoboControl *control)
/* 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 (GnomeCalendar *gcal, BonoboControl *control)
+void
+calendar_set_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;
@@ -368,8 +366,7 @@ clear_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
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);
+ 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);
@@ -383,7 +380,8 @@ clear_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
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);
+ /* 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;
@@ -398,12 +396,14 @@ clear_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
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) {
+ 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),
@@ -421,12 +421,17 @@ clear_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
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);
+ if (start_tm.tm_mon == end_tm.tm_mon) {
+ strftime (buffer, sizeof (buffer),
+ _("%B %Y"), &start_tm);
+ } else {
+ 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);
@@ -440,17 +445,24 @@ clear_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
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);
-#if 0
- GNOME_Evolution_ShellView_setFolderBarLabel (shell_view, buffer, &ev);
-#endif
- GNOME_Evolution_ShellView_setFolderBarLabel (shell_view, "", &ev);
+ GNOME_Evolution_ShellView_setFolderBarLabel (shell_view, label, &ev);
+
if (ev._major != CORBA_NO_EXCEPTION)
- g_message ("clear_folder_bar_label(): Could not set the folder bar label");
+ g_message ("control_util_set_folder_bar_label(): Could not set the folder bar label");
CORBA_exception_free (&ev);
}
@@ -531,7 +543,7 @@ calendar_control_activate (BonoboControl *control,
a default timezone already. */
calendar_config_check_timezone_set ();
- clear_folder_bar_label (gcal, control);
+ calendar_set_folder_bar_label (gcal, control);
}
void
@@ -553,13 +565,6 @@ 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)
{
@@ -574,9 +579,6 @@ 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-commands.h b/calendar/gui/calendar-commands.h
index 93962e1fb7..fd3658853b 100644
--- a/calendar/gui/calendar-commands.h
+++ b/calendar/gui/calendar-commands.h
@@ -39,4 +39,9 @@ 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);
+
#endif /* CALENDAR_COMMANDS_H */
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 43195071f0..f61b76cd88 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -351,24 +351,14 @@ get_classification (CalComponent *comp)
cal_component_get_classification (comp, &classif);
switch (classif) {
- case CAL_COMPONENT_CLASS_NONE:
- return "";
-
- case CAL_COMPONENT_CLASS_PUBLIC:
- return _("Public");
-
case CAL_COMPONENT_CLASS_PRIVATE:
return _("Private");
case CAL_COMPONENT_CLASS_CONFIDENTIAL:
return _("Confidential");
- case CAL_COMPONENT_CLASS_UNKNOWN:
- return _("Unknown");
-
default:
- g_assert_not_reached ();
- return "";
+ return _("Public");
}
}
@@ -535,21 +525,10 @@ get_transparency (CalComponent *comp)
cal_component_get_transparency (comp, &transp);
- switch (transp) {
- case CAL_COMPONENT_TRANSP_NONE:
- case CAL_COMPONENT_TRANSP_UNKNOWN:
- return "";
-
- case CAL_COMPONENT_TRANSP_TRANSPARENT:
- return _("Transparent");
-
- case CAL_COMPONENT_TRANSP_OPAQUE:
- return _("Opaque");
-
- default:
- g_assert_not_reached ();
- return NULL;
- }
+ if (transp == CAL_COMPONENT_TRANSP_TRANSPARENT)
+ return _("Free");
+ else
+ return _("Busy");
}
/* Builds a string for the URL property of a calendar component */
@@ -937,40 +916,18 @@ set_categories (CalComponent *comp, const char *value)
}
-/* FIXME: We won't need this eventually, since the user won't be allowed to
- * edit the field.
- */
-static void
-show_classification_warning (void)
-{
- GtkWidget *dialog;
-
- dialog = gnome_message_box_new (_("The classification must be 'Public', 'Private', 'Confidential' or 'None'"),
- GNOME_MESSAGE_BOX_ERROR,
- GNOME_STOCK_BUTTON_OK, NULL);
- gtk_widget_show (dialog);
-}
-
-
static void
set_classification (CalComponent *comp,
const char *value)
{
CalComponentClassification classif;
- /* An empty string is the same as 'None'. */
- if (!value[0] || !g_strcasecmp (value, _("None")))
- classif = CAL_COMPONENT_CLASS_NONE;
- else if (!g_strcasecmp (value, _("Public")))
- classif = CAL_COMPONENT_CLASS_PUBLIC;
- else if (!g_strcasecmp (value, _("Private")))
+ if (!g_strcasecmp (value, _("Private")))
classif = CAL_COMPONENT_CLASS_PRIVATE;
else if (!g_strcasecmp (value, _("Confidential")))
classif = CAL_COMPONENT_CLASS_CONFIDENTIAL;
- else {
- show_classification_warning ();
- return;
- }
+ else
+ classif = CAL_COMPONENT_CLASS_PUBLIC;
cal_component_set_classification (comp, classif);
}
@@ -1178,41 +1135,16 @@ set_summary (CalComponent *comp, const char *value)
cal_component_set_summary (comp, &text);
}
-/* FIXME: We won't need this eventually, since the user won't be allowed to
- * edit the field.
- */
-static void
-show_transparency_warning (void)
-{
- GtkWidget *dialog;
-
- dialog = gnome_message_box_new (_("The transparency must be 'Transparent', 'Opaque', or 'None'."),
- GNOME_MESSAGE_BOX_ERROR,
- GNOME_STOCK_BUTTON_OK, NULL);
- gtk_widget_show (dialog);
-}
-
-/* Sets the URI of a calendar component */
+/* Sets the transparency of a calendar component */
static void
set_transparency (CalComponent *comp, const char *value)
{
CalComponentTransparency transp;
- g_print ("In calendar model set_transparency: %s\n", value);
-
- /* An empty string is the same as 'None'. */
- if (!value[0] || !g_strcasecmp (value, _("None")))
- transp = CAL_COMPONENT_TRANSP_NONE;
- else if (!g_strcasecmp (value, _("Transparent")))
+ if (!g_strcasecmp (value, _("Free")))
transp = CAL_COMPONENT_TRANSP_TRANSPARENT;
- else if (!g_strcasecmp (value, _("Opaque"))) {
+ else
transp = CAL_COMPONENT_TRANSP_OPAQUE;
- } else {
- show_transparency_warning ();
- return;
- }
-
- g_print (" transp: %i\n", transp);
cal_component_set_transparency (comp, transp);
}
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index 5aa8d22a01..f0376e2a99 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -56,3 +56,99 @@ cal_comp_util_add_exdate (CalComponent *comp, time_t t, icaltimezone *zone)
cal_component_set_exdate_list (comp, list);
cal_component_free_exdate_list (list);
}
+
+
+
+/* Returns TRUE if the TZIDs are equivalent, i.e. both NULL or the same. */
+static gboolean
+cal_component_compare_tzid (const char *tzid1, const char *tzid2)
+{
+ gboolean retval = TRUE;
+
+ if (tzid1) {
+ if (!tzid2 || strcmp (tzid1, tzid2))
+ retval = FALSE;
+ } else {
+ if (tzid2)
+ retval = FALSE;
+ }
+
+ return retval;
+}
+
+/**
+ * cal_comp_util_compare_event_timezones:
+ * @comp: A calendar component object.
+ * @client: A #CalClient.
+ *
+ * Checks if the component uses the given timezone for both the start and
+ * the end time, or if the UTC offsets of the start and end times are the same
+ * as in the given zone.
+ *
+ * Returns: TRUE if the component's start and end time are at the same UTC
+ * offset in the given timezone.
+ **/
+gboolean
+cal_comp_util_compare_event_timezones (CalComponent *comp,
+ CalClient *client,
+ icaltimezone *zone)
+{
+ CalClientGetStatus status;
+ CalComponentDateTime start_datetime, end_datetime;
+ const char *tzid;
+ gboolean retval = FALSE;
+ icaltimezone *start_zone, *end_zone;
+ int offset1, offset2;
+
+ tzid = icaltimezone_get_tzid (zone);
+
+ cal_component_get_dtstart (comp, &start_datetime);
+ cal_component_get_dtend (comp, &end_datetime);
+
+ /* FIXME: DURATION may be used instead. */
+ if (cal_component_compare_tzid (tzid, start_datetime.tzid)
+ && cal_component_compare_tzid (tzid, end_datetime.tzid)) {
+ /* If both TZIDs are the same as the given zone's TZID, then
+ we know the timezones are the same so we return TRUE. */
+ retval = TRUE;
+ } else {
+ /* If the TZIDs differ, we have to compare the UTC offsets
+ of the start and end times, using their own timezones and
+ the given timezone. */
+ status = cal_client_get_timezone (client,
+ start_datetime.tzid,
+ &start_zone);
+ if (status != CAL_CLIENT_GET_SUCCESS)
+ goto out;
+
+ offset1 = icaltimezone_get_utc_offset (start_zone,
+ start_datetime.value,
+ NULL);
+ offset2 = icaltimezone_get_utc_offset (zone,
+ start_datetime.value,
+ NULL);
+ if (offset1 == offset2) {
+ status = cal_client_get_timezone (client,
+ end_datetime.tzid,
+ &end_zone);
+ if (status != CAL_CLIENT_GET_SUCCESS)
+ goto out;
+
+ offset1 = icaltimezone_get_utc_offset (end_zone,
+ end_datetime.value,
+ NULL);
+ offset2 = icaltimezone_get_utc_offset (zone,
+ end_datetime.value,
+ NULL);
+ if (offset1 == offset2)
+ retval = TRUE;
+ }
+ }
+
+ out:
+
+ cal_component_free_datetime (&start_datetime);
+ cal_component_free_datetime (&end_datetime);
+
+ return retval;
+}
diff --git a/calendar/gui/comp-util.h b/calendar/gui/comp-util.h
index d0c39259ab..efc09a8fe9 100644
--- a/calendar/gui/comp-util.h
+++ b/calendar/gui/comp-util.h
@@ -24,7 +24,16 @@
#define COMP_UTIL_H
#include <cal-util/cal-component.h>
+#include <cal-client/cal-client.h>
void cal_comp_util_add_exdate (CalComponent *comp, time_t t, icaltimezone *zone);
+
+/* Returns TRUE if the component uses the given timezone for both DTSTART
+ and DTEND, or if the UTC offsets of the start and end times are the same
+ as in the given zone. */
+gboolean cal_comp_util_compare_event_timezones (CalComponent *comp,
+ CalClient *client,
+ icaltimezone *zone);
+
#endif
diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c
index 756a4c3a46..928b8e45ab 100644
--- a/calendar/gui/control-factory.c
+++ b/calendar/gui/control-factory.c
@@ -188,6 +188,13 @@ calendar_persist_init (GnomeCalendar *gcal, BonoboControl *control)
bonobo_object_add_interface (BONOBO_OBJECT (control), BONOBO_OBJECT (f));
}
+static void
+on_calendar_dates_shown_changed (GnomeCalendar *gcal, BonoboControl *control)
+{
+ calendar_set_folder_bar_label (gcal, control);
+}
+
+
BonoboControl *
control_factory_new_control (void)
{
@@ -211,6 +218,9 @@ control_factory_new_control (void)
gtk_signal_connect (GTK_OBJECT (control), "activate",
GTK_SIGNAL_FUNC (control_activate_cb), gcal);
+ gtk_signal_connect (GTK_OBJECT (gcal), "dates_shown_changed",
+ GTK_SIGNAL_FUNC (on_calendar_dates_shown_changed),
+ control);
return control;
}
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 6093718453..50b1fa3ba7 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -65,6 +65,9 @@ struct _EventPagePrivate {
GtkWidget *classification_private;
GtkWidget *classification_confidential;
+ GtkWidget *show_time_as_free;
+ GtkWidget *show_time_as_busy;
+
GtkWidget *contacts_btn;
GtkWidget *contacts;
@@ -172,6 +175,8 @@ event_page_init (EventPage *epage)
priv->classification_public = NULL;
priv->classification_private = NULL;
priv->classification_confidential = NULL;
+ priv->show_time_as_free = NULL;
+ priv->show_time_as_busy = NULL;
priv->contacts_btn = NULL;
priv->contacts = NULL;
priv->categories_btn = NULL;
@@ -215,6 +220,12 @@ static const int classification_map[] = {
-1
};
+static const int transparency_map[] = {
+ CAL_COMPONENT_TRANSP_TRANSPARENT,
+ CAL_COMPONENT_TRANSP_OPAQUE,
+ -1
+};
+
/* get_widget handler for the event page */
static GtkWidget *
event_page_get_widget (CompEditorPage *page)
@@ -305,6 +316,10 @@ clear_widgets (EventPage *epage)
e_dialog_radio_set (priv->classification_public,
CAL_COMPONENT_CLASS_PRIVATE, classification_map);
+ /* Show Time As (Transparency) */
+ e_dialog_radio_set (priv->show_time_as_free,
+ CAL_COMPONENT_TRANSP_OPAQUE, transparency_map);
+
/* Categories */
e_dialog_editable_set (priv->categories, NULL);
}
@@ -317,6 +332,7 @@ event_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
EventPagePrivate *priv;
CalComponentText text;
CalComponentClassification cl;
+ CalComponentTransparency transparency;
CalComponentDateTime start_date, end_date;
GSList *l;
const char *categories;
@@ -449,6 +465,25 @@ event_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
*/
}
+
+ /* Show Time As (Transparency) */
+ cal_component_get_transparency (comp, &transparency);
+ switch (transparency) {
+ case CAL_COMPONENT_TRANSP_TRANSPARENT:
+ e_dialog_radio_set (priv->show_time_as_free,
+ CAL_COMPONENT_TRANSP_TRANSPARENT,
+ transparency_map);
+ break;
+
+ default:
+ e_dialog_radio_set (priv->show_time_as_free,
+ CAL_COMPONENT_TRANSP_OPAQUE,
+ transparency_map);
+ break;
+ }
+
+
+
/* Categories */
cal_component_get_categories (comp, &categories);
e_dialog_editable_set (priv->categories, categories);
@@ -467,6 +502,7 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
gboolean all_day_event, date_set;
char *cat, *str;
CalComponentClassification classif;
+ CalComponentTransparency transparency;
icaltimezone *zone;
epage = EVENT_PAGE (page);
@@ -570,6 +606,12 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
classif = e_dialog_radio_get (priv->classification_public,
classification_map);
cal_component_set_classification (comp, classif);
+
+ /* Show Time As (Transparency) */
+
+ transparency = e_dialog_radio_get (priv->show_time_as_free,
+ transparency_map);
+ cal_component_set_transparency (comp, transparency);
}
/* set_summary handler for the event page */
@@ -626,6 +668,9 @@ get_widgets (EventPage *epage)
priv->classification_private = GW ("classification-private");
priv->classification_confidential = GW ("classification-confidential");
+ priv->show_time_as_free = GW ("show-time-as-free");
+ priv->show_time_as_busy = GW ("show-time-as-busy");
+
priv->contacts_btn = GW ("contacts-button");
priv->contacts = GW ("contacts");
@@ -644,6 +689,8 @@ get_widgets (EventPage *epage)
&& priv->classification_public
&& priv->classification_private
&& priv->classification_confidential
+ && priv->show_time_as_free
+ && priv->show_time_as_busy
&& priv->contacts_btn
&& priv->contacts
&& priv->categories_btn
@@ -1039,6 +1086,12 @@ init_widgets (EventPage *epage)
gtk_signal_connect (GTK_OBJECT (priv->classification_confidential),
"toggled", GTK_SIGNAL_FUNC (field_changed_cb),
epage);
+ gtk_signal_connect (GTK_OBJECT (priv->show_time_as_free),
+ "toggled", GTK_SIGNAL_FUNC (field_changed_cb),
+ epage);
+ gtk_signal_connect (GTK_OBJECT (priv->show_time_as_busy),
+ "toggled", GTK_SIGNAL_FUNC (field_changed_cb),
+ epage);
gtk_signal_connect (GTK_OBJECT (priv->categories), "changed",
GTK_SIGNAL_FUNC (field_changed_cb), epage);
diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade
index bd1c094357..380b99302f 100644
--- a/calendar/gui/dialogs/event-page.glade
+++ b/calendar/gui/dialogs/event-page.glade
@@ -325,11 +325,10 @@
</widget>
<widget>
- <class>GtkFrame</class>
- <name>frame32</name>
- <label>Classification</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <class>GtkHBox</class>
+ <name>hbox54</name>
+ <homogeneous>False</homogeneous>
+ <spacing>4</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
@@ -337,55 +336,118 @@
</child>
<widget>
- <class>GtkHBox</class>
- <name>hbox52</name>
- <border_width>2</border_width>
- <homogeneous>False</homogeneous>
- <spacing>4</spacing>
+ <class>GtkFrame</class>
+ <name>frame32</name>
+ <label>Classification</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
<widget>
- <class>GtkRadioButton</class>
- <name>classification-public</name>
- <can_focus>True</can_focus>
- <label>Pu_blic</label>
- <active>True</active>
- <draw_indicator>True</draw_indicator>
- <group>classification_radio_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
+ <class>GtkHBox</class>
+ <name>hbox52</name>
+ <border_width>2</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>4</spacing>
- <widget>
- <class>GtkRadioButton</class>
- <name>classification-private</name>
- <can_focus>True</can_focus>
- <label>Pri_vate</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>classification_radio_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>classification-public</name>
+ <can_focus>True</can_focus>
+ <label>Pu_blic</label>
+ <active>True</active>
+ <draw_indicator>True</draw_indicator>
+ <group>classification_radio_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>classification-private</name>
+ <can_focus>True</can_focus>
+ <label>Pri_vate</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>classification_radio_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>classification-confidential</name>
+ <can_focus>True</can_focus>
+ <label>Con_fidential</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>classification_radio_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
</widget>
+ </widget>
+
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame33</name>
+ <label>Show Time As</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
<widget>
- <class>GtkRadioButton</class>
- <name>classification-confidential</name>
- <can_focus>True</can_focus>
- <label>_Confidential</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>classification_radio_group</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
+ <class>GtkHBox</class>
+ <name>hbox55</name>
+ <homogeneous>False</homogeneous>
+ <spacing>4</spacing>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>show-time-as-free</name>
+ <can_focus>True</can_focus>
+ <label>F_ree</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>show_time_as_radio_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkRadioButton</class>
+ <name>show-time-as-busy</name>
+ <can_focus>True</can_focus>
+ <label>B_usy</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <group>show_time_as_radio_group</group>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
</widget>
</widget>
</widget>
@@ -405,7 +467,6 @@
<class>GtkButton</class>
<name>contacts-button</name>
<can_focus>True</can_focus>
- <relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@@ -444,7 +505,6 @@
<class>GtkButton</class>
<name>categories-button</name>
<can_focus>True</can_focus>
- <relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
diff --git a/calendar/gui/dialogs/recurrence-page.glade b/calendar/gui/dialogs/recurrence-page.glade
index 92e0712ed9..aaf3f7e05a 100644
--- a/calendar/gui/dialogs/recurrence-page.glade
+++ b/calendar/gui/dialogs/recurrence-page.glade
@@ -447,8 +447,7 @@ forever
<class>GtkButton</class>
<name>exception-add</name>
<can_focus>True</can_focus>
- <label>_Add</label>
- <relief>GTK_RELIEF_NORMAL</relief>
+ <label>A_dd</label>
<child>
<padding>0</padding>
<expand>False</expand>
@@ -461,7 +460,6 @@ forever
<name>exception-modify</name>
<can_focus>True</can_focus>
<label>_Modify</label>
- <relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
@@ -474,7 +472,6 @@ forever
<name>exception-delete</name>
<can_focus>True</can_focus>
<label>_Delete</label>
- <relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index a1bfa3c597..ac3c2c1d1e 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -303,7 +303,6 @@ e_calendar_table_init (ECalendarTable *cal_table)
gtk_object_unref (GTK_OBJECT (cell));
strings = NULL;
- strings = g_list_append (strings, _("None"));
strings = g_list_append (strings, _("Public"));
strings = g_list_append (strings, _("Private"));
strings = g_list_append (strings, _("Confidential"));
@@ -378,9 +377,8 @@ e_calendar_table_init (ECalendarTable *cal_table)
gtk_object_unref (GTK_OBJECT (cell));
strings = NULL;
- strings = g_list_append (strings, _("None"));
- strings = g_list_append (strings, _("Opaque"));
- strings = g_list_append (strings, _("Transparent"));
+ strings = g_list_append (strings, _("Free"));
+ strings = g_list_append (strings, _("Busy"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
diff --git a/calendar/gui/e-calendar-table.etspec b/calendar/gui/e-calendar-table.etspec
index 0b759a1580..17a11e6dc0 100644
--- a/calendar/gui/e-calendar-table.etspec
+++ b/calendar/gui/e-calendar-table.etspec
@@ -9,7 +9,7 @@
<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= "9" _title="Summary" expansion="3.0" minimum_width="10" resizable="true" cell="calstring" compare="string"/>
- <ETableColumn model_col="10" _title="Transparency" expansion="1.0" minimum_width="10" resizable="true" cell="transparency" 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"/>
<ETableColumn model_col="12" _title="Alarms" expansion="1.0" minimum_width="10" resizable="true" cell="calstring" compare="string"/>
<ETableColumn model_col="13" pixbuf="icon" _title="Type" expansion="1.0" minimum_width="16" resizable="false" cell="icon" compare="integer"/>
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index f17eff457e..5dab65b7f8 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -339,6 +339,7 @@ e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem,
EDayViewEvent *event;
GdkGC *gc;
gint grid_x, event_num, bar_y, bar_h;
+ CalComponentTransparency transparency;
day_view = dvmitem->day_view;
@@ -353,6 +354,11 @@ e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem,
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
+ /* If the event is TRANSPARENT, skip it. */
+ cal_component_get_transparency (event->comp, &transparency);
+ if (transparency == CAL_COMPONENT_TRANSP_TRANSPARENT)
+ continue;
+
/* We can skip the events in the first column since they will
draw over this anyway. */
if (event->num_columns > 0 && event->start_row_or_col == 0)
@@ -383,6 +389,7 @@ e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem,
EDayViewEvent *event;
gint event_num, start_day, end_day, day, bar_y1, bar_y2, grid_x;
GdkGC *gc;
+ CalComponentTransparency transparency;
day_view = dvmitem->day_view;
@@ -394,6 +401,11 @@ e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem,
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
+ /* If the event is TRANSPARENT, skip it. */
+ cal_component_get_transparency (event->comp, &transparency);
+ if (transparency == CAL_COMPONENT_TRANSP_TRANSPARENT)
+ continue;
+
if (!e_day_view_find_long_event_days (event,
day_view->days_shown,
day_view->day_starts,
@@ -469,6 +481,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
gint max_icon_w, max_icon_h;
gboolean draw_reminder_icon, draw_recurrence_icon, draw_timezone_icon;
GSList *categories_list, *elem;
+ CalComponentTransparency transparency;
day_view = dvmitem->day_view;
@@ -499,7 +512,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
column of the day, we might not want to paint over the vertical bar,
since that is used for multiple events. But then you can't see
where the event in the first column finishes. */
-#if 0
+#if 1
if (event->start_row_or_col == 0)
gdk_draw_rectangle (drawable, style->white_gc, TRUE,
item_x + E_DAY_VIEW_BAR_WIDTH, item_y + 1,
@@ -533,9 +546,13 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
bar_y2 = item_y + item_h - 1;
}
- gdk_draw_rectangle (drawable, gc, TRUE,
- item_x + 1, bar_y1,
- E_DAY_VIEW_BAR_WIDTH - 2, bar_y2 - bar_y1);
+ /* Only fill it in if the event isn't TRANSPARENT. */
+ cal_component_get_transparency (event->comp, &transparency);
+ if (transparency != CAL_COMPONENT_TRANSP_TRANSPARENT) {
+ gdk_draw_rectangle (drawable, gc, TRUE,
+ item_x + 1, bar_y1,
+ E_DAY_VIEW_BAR_WIDTH - 2, bar_y2 - bar_y1);
+ }
/* Draw the box around the entire event. Do this after drawing
the colored bar so we don't have to worry about being 1
@@ -581,7 +598,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
/* If the DTSTART or DTEND are in a different timezone to our current
timezone, we display the timezone icon. */
- if (!cal_component_compare_event_timezone (comp, day_view->zone)) {
+ if (event->different_timezone) {
draw_timezone_icon = TRUE;
num_icons++;
}
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index e1b5a7b444..560efd0ffa 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -4377,6 +4377,11 @@ e_day_view_add_event (CalComponent *comp,
event.start_row_or_col = -1;
event.num_columns = -1;
+ event.different_timezone = FALSE;
+ if (!cal_comp_util_compare_event_timezones (comp, day_view->client,
+ day_view->zone))
+ event.different_timezone = TRUE;
+
/* Find out which array to add the event to. */
for (day = 0; day < day_view->days_shown; day++) {
if (start >= day_view->day_starts[day]
@@ -4553,9 +4558,7 @@ e_day_view_reshape_long_event (EDayView *day_view,
num_icons++;
if (cal_component_has_recurrences (comp))
num_icons++;
-
- if (!cal_component_compare_event_timezone (comp,
- day_view->zone))
+ if (event->different_timezone)
num_icons++;
cal_component_get_categories_list (comp, &categories_list);
@@ -4694,9 +4697,7 @@ e_day_view_reshape_day_event (EDayView *day_view,
num_icons++;
if (cal_component_has_recurrences (comp))
num_icons++;
-
- if (!cal_component_compare_event_timezone (comp,
- day_view->zone))
+ if (event->different_timezone)
num_icons++;
cal_component_get_categories_list (comp, &categories_list);
@@ -6813,3 +6814,21 @@ selection_received (GtkWidget *invisible,
gtk_object_unref (GTK_OBJECT (comp));
}
}
+
+
+/* Gets the visible time range. Returns FALSE if no time range has been set. */
+gboolean
+e_day_view_get_visible_time_range (EDayView *day_view,
+ time_t *start_time,
+ time_t *end_time)
+{
+ /* If the date isn't set, return FALSE. */
+ if (day_view->lower == 0 && day_view->upper == 0)
+ return FALSE;
+
+ *start_time = day_view->day_starts[0];
+ *end_time = day_view->day_starts[day_view->days_shown];
+
+ return TRUE;
+}
+
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index bc663d7a6c..d8a5372c8c 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -191,6 +191,10 @@ struct _EDayViewEvent {
always shown as we just increase the height of the top canvas. */
guint8 num_columns;
+ /* TRUE if the event is at a different UTC offset than our current
+ timezone, i.e. it is in a different timezone. */
+ guint different_timezone : 1;
+
/* These are minute offsets from the first time shown in the view.
They range from 0 to 24 * 60. Currently the main canvas always
starts at 12am and the code to handle starting at other times
@@ -519,6 +523,11 @@ void e_day_view_get_selected_time_range (EDayView *day_view,
time_t *start_time,
time_t *end_time);
+/* Gets the visible time range. Returns FALSE if no time range has been set. */
+gboolean e_day_view_get_visible_time_range (EDayView *day_view,
+ time_t *start_time,
+ time_t *end_time);
+
/* Whether we are displaying a work-week, in which case the display always
starts on the first day of the working week. */
gboolean e_day_view_get_work_week_view (EDayView *day_view);
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index e5970445ce..7726f6b445 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -582,7 +582,7 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
num_icons++;
}
- if (!cal_component_compare_event_timezone (comp, week_view->zone)) {
+ if (event->different_timezone) {
draw_timezone_icon = TRUE;
num_icons++;
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 5d269cf471..0fa54c75b5 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -2313,6 +2313,11 @@ e_week_view_add_event (CalComponent *comp,
if (event.end_minute == 0 && start != end)
event.end_minute = 24 * 60;
+ event.different_timezone = FALSE;
+ if (!cal_comp_util_compare_event_timezones (comp, week_view->client,
+ week_view->zone))
+ event.different_timezone = TRUE;
+
g_array_append_val (week_view->events, event);
week_view->events_sorted = FALSE;
week_view->events_need_layout = TRUE;
@@ -2493,9 +2498,7 @@ e_week_view_reshape_event_span (EWeekView *week_view,
num_icons++;
if (cal_component_has_recurrences (comp))
num_icons++;
-
- if (!cal_component_compare_event_timezone (comp,
- week_view->zone))
+ if (event->different_timezone)
num_icons++;
cal_component_get_categories_list (comp, &categories_list);
@@ -3724,3 +3727,23 @@ selection_received (GtkWidget *invisible,
gtk_object_unref (GTK_OBJECT (comp));
}
}
+
+
+/* Gets the visible time range. Returns FALSE if no time range has been set. */
+gboolean
+e_week_view_get_visible_time_range (EWeekView *week_view,
+ time_t *start_time,
+ time_t *end_time)
+{
+ gint num_days;
+
+ /* If we don't have a valid date set yet, return FALSE. */
+ if (!g_date_valid (&week_view->first_day_shown))
+ return FALSE;
+
+ num_days = week_view->multi_week_view ? week_view->weeks_shown * 7 : 7;
+ *start_time = week_view->day_starts[0];
+ *end_time = week_view->day_starts[num_days];
+
+ return TRUE;
+}
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index a75cc5df5e..7060d97bf7 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -157,7 +157,11 @@ struct _EWeekViewEvent {
guint16 start_minute; /* Minutes from the start of the day. */
guint16 end_minute;
gint spans_index;
- guint num_spans;
+ guint8 num_spans;
+
+ /* TRUE if the event is at a different UTC offset than our current
+ timezone, i.e. it is in a different timezone. */
+ guint different_timezone : 1;
};
@@ -397,6 +401,10 @@ void e_week_view_set_selected_time_range (EWeekView *week_view,
time_t start_time,
time_t end_time);
+/* Gets the visible time range. Returns FALSE if no time range has been set. */
+gboolean e_week_view_get_visible_time_range (EWeekView *week_view,
+ time_t *start_time,
+ time_t *end_time);
/* Whether to display 1 week or 1 month (5 weeks). It defaults to 1 week. */
gboolean e_week_view_get_multi_week_view (EWeekView *week_view);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 2588d4dee2..2af032b184 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1750,6 +1750,7 @@ gnome_calendar_set_selected_time_range (GnomeCalendar *gcal,
priv->selection_end_time = end_time;
gnome_calendar_update_date_navigator (gcal);
+ gnome_calendar_notify_dates_shown_changed (gcal);
}
/**
@@ -1861,7 +1862,8 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp)
* @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.
- * @all_day: if true, the dtstart and dtend are expanded to cover the entire day.
+ * @all_day: if true, the dtstart and dtend are expanded to cover the entire
+ * day, and the event is set to TRANSPARENT.
*
* Opens an event editor dialog for a new appointment.
*
@@ -1875,6 +1877,7 @@ gnome_calendar_new_appointment_for (GnomeCalendar *cal,
struct icaltimetype itt;
CalComponentDateTime dt;
CalComponent *comp;
+ CalComponentTransparency transparency;
const char *category;
g_return_if_fail (cal != NULL);
@@ -1904,6 +1907,11 @@ gnome_calendar_new_appointment_for (GnomeCalendar *cal,
}
cal_component_set_dtend (comp, &dt);
+ transparency = all_day ? CAL_COMPONENT_TRANSP_TRANSPARENT
+ : CAL_COMPONENT_TRANSP_OPAQUE;
+ cal_component_set_transparency (comp, transparency);
+
+
/* Category */
category = cal_search_bar_get_category (CAL_SEARCH_BAR (priv->search_bar));
@@ -1977,6 +1985,44 @@ gnome_calendar_get_current_time_range (GnomeCalendar *gcal,
}
+/* Gets the visible time range for the current view. Returns FALSE if no
+ time range has been set yet. */
+gboolean
+gnome_calendar_get_visible_time_range (GnomeCalendar *gcal,
+ time_t *start_time,
+ time_t *end_time)
+{
+ GnomeCalendarPrivate *priv;
+ gboolean retval = FALSE;
+
+ priv = gcal->priv;
+
+ switch (priv->current_view_type) {
+ case GNOME_CAL_DAY_VIEW:
+ retval = e_day_view_get_visible_time_range (E_DAY_VIEW (priv->day_view), start_time, end_time);
+ break;
+
+ case GNOME_CAL_WORK_WEEK_VIEW:
+ retval = e_day_view_get_visible_time_range (E_DAY_VIEW (priv->work_week_view), start_time, end_time);
+ break;
+
+ case GNOME_CAL_WEEK_VIEW:
+ retval = e_week_view_get_visible_time_range (E_WEEK_VIEW (priv->week_view), start_time, end_time);
+ break;
+
+ case GNOME_CAL_MONTH_VIEW:
+ retval = e_week_view_get_visible_time_range (E_WEEK_VIEW (priv->month_view), start_time, end_time);
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+
+ return retval;
+}
+
+
+
static void
get_days_shown (GnomeCalendar *gcal, GDate *start_date, gint *days_shown)
{
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 85f490aea0..443a0f38da 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -121,6 +121,12 @@ void gnome_calendar_get_current_time_range (GnomeCalendar *gcal,
time_t *start_time,
time_t *end_time);
+/* Gets the visible time range for the current view. Returns FALSE if no
+ time range has been set yet. */
+gboolean gnome_calendar_get_visible_time_range (GnomeCalendar *gcal,
+ time_t *start_time,
+ time_t *end_time);
+
/* Tells the calendar to reload all config settings. initializing should be
TRUE when we are setting the config settings for the first time. */
void gnome_calendar_update_config_settings (GnomeCalendar *gcal,
diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c
index de59407c20..30ee02520c 100644
--- a/calendar/gui/tag-calendar.c
+++ b/calendar/gui/tag-calendar.c
@@ -35,6 +35,8 @@ struct calendar_tag_closure {
icaltimezone *zone;
time_t start_time;
time_t end_time;
+
+ gboolean skip_transparent_events;
};
/* Clears all the tags in a calendar and fills a closure structure with the
@@ -90,6 +92,15 @@ tag_calendar_cb (CalComponent *comp,
{
struct calendar_tag_closure *c = data;
struct icaltimetype start_tt, end_tt;
+ CalComponentTransparency transparency;
+
+ /* If we are skipping TRANSPARENT events, return if the event is
+ transparent. */
+ if (c->skip_transparent_events) {
+ cal_component_get_transparency (comp, &transparency);
+ if (transparency == CAL_COMPONENT_TRANSP_TRANSPARENT)
+ return TRUE;
+ }
start_tt = icaltime_from_timet_with_zone (istart, FALSE, c->zone);
end_tt = icaltime_from_timet_with_zone (iend - 1, FALSE, c->zone);
@@ -131,6 +142,8 @@ tag_calendar_by_client (ECalendar *ecal, CalClient *client)
if (!prepare_tag (ecal, &c, TRUE))
return;
+ c.skip_transparent_events = TRUE;
+
#if 0
g_print ("DateNavigator generating instances\n");
#endif
@@ -147,6 +160,7 @@ 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.
**/
void
tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp, CalClient *client, gboolean clear_first)
@@ -165,6 +179,8 @@ tag_calendar_by_comp (ECalendar *ecal, CalComponent *comp, CalClient *client, gb
if (!prepare_tag (ecal, &c, clear_first))
return;
+ c.skip_transparent_events = FALSE;
+
#if 0
g_print ("DateNavigator generating instances\n");
#endif
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 2aa32f1f30..0a447db78d 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -31,6 +31,7 @@
#include <bonobo/bonobo-ui-util.h>
#include "dialogs/cal-prefs-dialog.h"
#include "calendar-config.h"
+#include "calendar-commands.h"
#include "e-tasks.h"
#include "tasks-control.h"
#include "evolution-shell-component-utils.h"
@@ -297,6 +298,8 @@ tasks_control_activate (BonoboControl *control, ETasks *tasks)
/* Show the dialog for setting the timezone if the user hasn't chosen
a default timezone already. */
calendar_config_check_timezone_set ();
+
+ control_util_set_folder_bar_label (control, "");
}
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 58879c8c3c..bda5f5f825 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -1200,10 +1200,15 @@ cal_backend_file_get_free_busy (CalBackend *backend, time_t start, time_t end)
for (l = uids; l != NULL; l = l->next) {
char *comp_str;
icalcomponent *icalcomp;
- icalproperty *icalprop;
+ icalproperty *icalprop, *prop;
struct icalperiodtype ipt;
char *uid = (char *) l->data;
+ /* FIXME: This looks quite inefficient. It is converting the
+ component to a string and then parsing it again. It would
+ be better to use lookup_component(). It needs to handle
+ timezones as well, so it is probably easier to use the
+ CalComponent wrapper functions. - Damon. */
comp_str = cal_backend_get_object (CAL_BACKEND (cbfile), uid);
if (!comp_str)
continue;
@@ -1213,6 +1218,16 @@ cal_backend_file_get_free_busy (CalBackend *backend, time_t start, time_t end)
if (!icalcomp)
continue;
+ /* If the event is TRANSPARENT, skip it. */
+ prop = icalcomponent_get_first_property (icalcomp,
+ ICAL_TRANSP_PROPERTY);
+ if (prop) {
+ const char *transp_val = icalproperty_get_transp (prop);
+ if (transp_val
+ && !strcasecmp (transp_val, "TRANSPARENT"))
+ continue;
+ }
+
ipt.start = icalcomponent_get_dtstart (icalcomp);
ipt.end = icalcomponent_get_dtend (icalcomp);
ipt.duration = icalcomponent_get_duration (icalcomp);