aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog30
-rw-r--r--calendar/cal-util/cal-component.c25
-rw-r--r--calendar/cal-util/cal-component.h1
-rw-r--r--calendar/cal-util/cal-recur.c58
-rw-r--r--calendar/cal-util/test-recur.c1
-rw-r--r--calendar/cal-util/timeutil.c1
-rw-r--r--calendar/gui/calendar-config.c2
-rw-r--r--calendar/gui/e-calendar-table.c5
-rw-r--r--calendar/gui/e-day-view-main-item.c5
-rw-r--r--calendar/gui/e-day-view-top-item.c5
-rw-r--r--calendar/gui/e-day-view.c21
-rw-r--r--calendar/gui/e-week-view-event-item.c5
-rw-r--r--calendar/gui/e-week-view.c7
-rw-r--r--calendar/gui/gnome-cal.c2
14 files changed, 124 insertions, 44 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 78e0b26619..cf8609cd5f 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,33 @@
+2000-10-20 Damon Chaplin <damon@helixcode.com>
+
+ * gui/e-calendar-table.c (E_CALENDAR_TABLE_SPEC): added
+ _click-to-add-message, though I'm not sure if i18n will work.
+
+ * cal-util/cal-recur.c (cal_obj_time_add_hours):
+ (cal_obj_time_add_minutes):
+ (cal_obj_time_add_seconds): updated to handle -ve args.
+
+ * cal-util/timeutil.c (time_add_day): set tm_isdst to -1 before calling
+ mktime().
+
+ * cal-util/cal-recur.c (generate_instances_for_chunk): don't call the
+ callback if the event ends exactly on the interval start time.
+
+ * gui/e-week-view.c (e_week_view_reshape_event_span):
+ * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons):
+ * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event):
+ * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event):
+ * gui/e-day-view.c (e_day_view_reshape_long_event):
+ (e_day_view_reshape_day_event): use cal_component_has_alarms().
+
+ * cal-util/cal-component.[hc]: added cal_component_has_alarms().
+
+2000-10-16 Damon Chaplin <damon@helixcode.com>
+
+ * gui/calendar-config.c (config_read): set default MonthVPanePosition
+ to 1 rather than 0, so if you move the hpane you'll see the date
+ navigator.
+
2000-10-19 Jesse Pavel <jpavel@helixcode.com>
* gui/event-editor.[ch]: added a public function which causes the
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index 4efb29a610..42185fec4f 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -3228,6 +3228,31 @@ cal_component_free_text_list (GSList *text_list)
+/**
+ * cal_component_has_alarms:
+ * @comp: A calendar component object.
+ *
+ * Checks whether the component has any alarms.
+ *
+ * Return value: TRUE if the component has any alarms.
+ **/
+gboolean
+cal_component_has_alarms (CalComponent *comp)
+{
+ CalComponentPrivate *priv;
+ icalcomponent *subcomp;
+
+ g_return_val_if_fail (comp != NULL, FALSE);
+ g_return_val_if_fail (IS_CAL_COMPONENT (comp), FALSE);
+
+ priv = comp->priv;
+ g_return_val_if_fail (priv->icalcomp != NULL, FALSE);
+
+ subcomp = icalcomponent_get_first_component (priv->icalcomp, ICAL_VALARM_COMPONENT);
+
+ return subcomp != NULL ? TRUE : FALSE;
+}
+
/* Scans an icalproperty from a calendar component and adds its mapping to our
* own alarm structure.
*/
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index 91d62ae548..32c3449b55 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -294,6 +294,7 @@ typedef struct {
} u;
} CalComponentAlarmTrigger;
+gboolean cal_component_has_alarms (CalComponent *comp);
CalComponentAlarm *cal_component_get_first_alarm (CalComponent *comp);
CalComponentAlarm *cal_component_get_next_alarm (CalComponent *comp);
diff --git a/calendar/cal-util/cal-recur.c b/calendar/cal-util/cal-recur.c
index 74a0dbf6f7..057bde1368 100644
--- a/calendar/cal-util/cal-recur.c
+++ b/calendar/cal-util/cal-recur.c
@@ -578,6 +578,11 @@ cal_recur_generate_instances (CalComponent *comp,
CalRecurInstanceFn cb,
gpointer cb_data)
{
+#if 0
+ g_print ("In cal_recur_generate_instances comp: %p\n", comp);
+ g_print (" start: %li - %s", start, ctime (&start));
+ g_print (" end : %li - %s", end, ctime (&end));
+#endif
cal_recur_generate_instances_of_rule (comp, NULL, start, end,
cb, cb_data);
}
@@ -1119,7 +1124,7 @@ generate_instances_for_chunk (CalComponent *comp,
break;
}
- if (end_time < interval_start_time)
+ if (end_time <= interval_start_time)
continue;
cb_status = (*cb) (comp, start_time, end_time, cb_data);
@@ -3171,13 +3176,22 @@ static void
cal_obj_time_add_hours (CalObjTime *cotime,
gint hours)
{
- guint hour;
+ gint hour, days;
- /* We use a guint to avoid overflow on the guint8. */
+ /* We use a gint to avoid overflow on the guint8. */
hour = cotime->hour + hours;
cotime->hour = hour % 24;
- if (hour >= 24)
- cal_obj_time_add_days (cotime, hour / 24);
+ if (hour >= 0) {
+ if (hour >= 24)
+ cal_obj_time_add_days (cotime, hour / 24);
+ } else {
+ days = hour / 24;
+ if (cotime->hour != 0) {
+ cotime->hour += 24;
+ days -= 1;
+ }
+ cal_obj_time_add_days (cotime, days);
+ }
}
@@ -3187,13 +3201,22 @@ static void
cal_obj_time_add_minutes (CalObjTime *cotime,
gint minutes)
{
- guint minute;
+ gint minute, hours;
- /* We use a guint to avoid overflow on the guint8. */
+ /* We use a gint to avoid overflow on the guint8. */
minute = cotime->minute + minutes;
cotime->minute = minute % 60;
- if (minute >= 60)
- cal_obj_time_add_hours (cotime, minute / 60);
+ if (minute >= 0) {
+ if (minute >= 60)
+ cal_obj_time_add_hours (cotime, minute / 60);
+ } else {
+ hours = minute / 60;
+ if (cotime->minute != 0) {
+ cotime->minute += 60;
+ hours -= 1;
+ }
+ cal_obj_time_add_hours (cotime, hours);
+ }
}
@@ -3203,13 +3226,22 @@ static void
cal_obj_time_add_seconds (CalObjTime *cotime,
gint seconds)
{
- guint second;
+ gint second, minutes;
- /* We use a guint to avoid overflow on the guint8. */
+ /* We use a gint to avoid overflow on the guint8. */
second = cotime->second + seconds;
cotime->second = second % 60;
- if (second >= 60)
- cal_obj_time_add_minutes (cotime, second / 60);
+ if (second >= 0) {
+ if (second >= 60)
+ cal_obj_time_add_minutes (cotime, second / 60);
+ } else {
+ minutes = second / 60;
+ if (cotime->second != 0) {
+ cotime->second += 60;
+ minutes -= 1;
+ }
+ cal_obj_time_add_minutes (cotime, minutes);
+ }
}
diff --git a/calendar/cal-util/test-recur.c b/calendar/cal-util/test-recur.c
index 620e65c185..6ec214b18b 100644
--- a/calendar/cal-util/test-recur.c
+++ b/calendar/cal-util/test-recur.c
@@ -141,6 +141,7 @@ generate_occurrences (icalcomponent *icalcomp)
g_print ("#############################################################################\n");
g_print ("%s\n\n", icalcomponent_as_ical_string (tmp_icalcomp));
+ occurrences = 0;
cal_recur_generate_instances (comp, -1, -1,
occurrence_cb, &occurrences);
diff --git a/calendar/cal-util/timeutil.c b/calendar/cal-util/timeutil.c
index 1281e6fe92..a509bd3cba 100644
--- a/calendar/cal-util/timeutil.c
+++ b/calendar/cal-util/timeutil.c
@@ -136,6 +136,7 @@ time_add_day (time_t time, int days)
#endif
tm->tm_mday += days;
+ tm->tm_isdst = -1;
if ((new_time = mktime (tm)) == -1){
g_message ("time_add_day(): mktime() could not handling adding %d days with\n",
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 6664ca775d..dc726191be 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -96,7 +96,7 @@ config_read (void)
config->hpane_pos = gnome_config_get_float ("HPanePosition=1");
config->vpane_pos = gnome_config_get_float ("VPanePosition=1");
config->month_hpane_pos = gnome_config_get_float ("MonthHPanePosition=0");
- config->month_vpane_pos = gnome_config_get_float ("MonthVPanePosition=0");
+ config->month_vpane_pos = gnome_config_get_float ("MonthVPanePosition=1");
config->compress_weekend = gnome_config_get_bool ("CompressWeekend=1");
config->show_event_end = gnome_config_get_bool ("ShowEventEndTime=1");
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index b372a1c03b..b771b338e6 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -134,7 +134,7 @@ e_calendar_table_class_init (ECalendarTableClass *class)
#define E_CALENDAR_TABLE_SPEC \
- "<ETableSpecification click-to-add=\"true\"> draw-grid=\"true\"" \
+ "<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=\"string\" compare=\"string\"/>" \
"<ETableColumn model_col= \"1\" _title=\"Classification\" expansion=\"1.0\" minimum_width=\"10\" resizable=\"true\" cell=\"string\" compare=\"string\"/>" \
"<ETableColumn model_col= \"2\" _title=\"Completion Date\" expansion=\"1.0\" minimum_width=\"10\" resizable=\"true\" cell=\"string\" compare=\"string\"/>" \
@@ -221,9 +221,6 @@ e_calendar_table_init (ECalendarTable *cal_table)
/* Create the table */
table = e_table_scrolled_new (model, extras, E_CALENDAR_TABLE_SPEC, NULL);
- gtk_object_set (GTK_OBJECT (table),
- "click_to_add_message", "Click here to add a new Task",
- NULL);
gtk_table_attach (GTK_TABLE (cal_table), table, 0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (table);
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 304a07854e..edcb0b4b82 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -563,13 +563,10 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
+ E_DAY_VIEW_ICON_Y_PAD;
comp = event->comp;
-#if 0
- if (ico->dalarm.enabled || ico->malarm.enabled
- || ico->palarm.enabled || ico->aalarm.enabled) {
+ if (cal_component_has_alarms (comp)) {
draw_reminder_icon = TRUE;
num_icons++;
}
-#endif
if (cal_component_has_recurrences (comp)) {
draw_recurrence_icon = TRUE;
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index 6b00f34a60..8a85983592 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -451,9 +451,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
icon_x -= icon_x_inc;
}
-#if 0
- if (ico->dalarm.enabled || ico->malarm.enabled
- || ico->palarm.enabled || ico->aalarm.enabled) {
+ if (cal_component_has_alarms (comp)) {
gdk_gc_set_clip_origin (gc, icon_x, icon_y);
gdk_gc_set_clip_mask (gc, day_view->reminder_mask);
gdk_draw_pixmap (drawable, gc,
@@ -464,7 +462,6 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
icon_x -= icon_x_inc;
}
gdk_gc_set_clip_mask (gc, NULL);
-#endif
/* Draw the start & end times, if necessary.
Note that GtkLabel adds 1 to the ascent so we must do that to be
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index f8a3002e2c..50f6639f58 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -1342,7 +1342,9 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
#endif
/* The dates have changed, so we need to remove the
old occurrrences before adding the new ones. */
+#if 0
g_print ("dates changed - removing occurrences\n");
+#endif
e_day_view_foreach_event_with_uid (day_view, uid,
e_day_view_remove_event_cb,
NULL);
@@ -3586,6 +3588,13 @@ e_day_view_add_event (CalComponent *comp,
day_view = E_DAY_VIEW (data);
+#if 0
+ g_print ("Day view lower: %s", ctime (&day_view->lower));
+ g_print ("Day view upper: %s", ctime (&day_view->upper));
+ g_print ("Event start: %s", ctime (&start));
+ g_print ("Event end : %s\n", ctime (&end));
+#endif
+
/* Check that the event times are valid. */
g_return_val_if_fail (start <= end, TRUE);
g_return_val_if_fail (start < day_view->upper, TRUE);
@@ -3841,15 +3850,12 @@ e_day_view_reshape_long_event (EDayView *day_view,
use_max_width = TRUE;
}
-#if 0
if (show_icons) {
- if (ico->dalarm.enabled || ico->malarm.enabled
- || ico->palarm.enabled || ico->aalarm.enabled)
+ if (cal_component_has_alarms (comp))
num_icons++;
- if (ico->recur)
+ if (cal_component_has_recurrences (comp))
num_icons++;
}
-#endif
if (!event->canvas_item) {
event->canvas_item =
@@ -4192,11 +4198,8 @@ e_day_view_reshape_day_event (EDayView *day_view,
if (day_view->resize_drag_pos == E_DAY_VIEW_POS_NONE
|| day_view->resize_event_day != day
|| day_view->resize_event_num != event_num) {
-#if 0
- if (ico->dalarm.enabled || ico->malarm.enabled
- || ico->palarm.enabled || ico->aalarm.enabled)
+ if (cal_component_has_alarms (comp))
num_icons++;
-#endif
if (cal_component_has_recurrences (comp))
num_icons++;
}
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 8f221bd17f..074aebe486 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -507,13 +507,10 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
gc = week_view->main_gc;
-#if 0
- if (ico->dalarm.enabled || ico->malarm.enabled
- || ico->palarm.enabled || ico->aalarm.enabled) {
+ if (cal_component_has_alarms (comp)) {
draw_reminder_icon = TRUE;
num_icons++;
}
-#endif
if (cal_component_has_recurrences (comp)) {
draw_recurrence_icon = TRUE;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index ab38f92c1a..eadc3c9bd3 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -2235,15 +2235,12 @@ e_week_view_reshape_event_span (EWeekView *week_view,
}
num_icons = 0;
-#if 0
if (show_icons) {
- if (ico->dalarm.enabled || ico->malarm.enabled
- || ico->palarm.enabled || ico->aalarm.enabled)
+ if (cal_component_has_alarms (comp))
num_icons++;
- if (ico->recur)
+ if (cal_component_has_recurrences (comp))
num_icons++;
}
-#endif
/* Create the background canvas item if necessary. */
if (!span->background_item) {
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 6b80823dfa..46eb66e58e 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -522,6 +522,8 @@ gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time)
priv->selection_end_time = time_add_day (priv->selection_start_time, 1);
if (priv->day_button)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->day_button), TRUE);
+ else
+ gnome_calendar_set_view (gcal, "dayview", FALSE, TRUE);
}
void