aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog14
-rw-r--r--calendar/gui/e-meeting-time-sel.c64
2 files changed, 60 insertions, 18 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 23b9cb2beb..ed11d86095 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,17 @@
+2001-11-07 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-meeting-time-sel.c
+ (e_meeting_time_selector_on_start_time_changed): emit changed
+ signal
+ (e_meeting_time_selector_on_end_time_changed): emit changed
+ signal, if end time is now before start time and all day event,
+ make sure a whole day is still selected
+ (e_meeting_time_selector_drag_meeting_time): calculate the first
+ and last_time's in whole days for all day events
+ (e_meeting_time_selector_timeout_handler): calculate the drag time
+ to be whole days for all day events and scroll the canvas even if
+ we don't update the time so the user can see where they're headed
+
2001-11-06 JP Rosevear <jpr@ximian.com>
* gui/dialogs/event-editor.c (event_editor_edit_comp): make sure
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index a8becd47bc..d24b762798 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -2177,6 +2177,8 @@ e_meeting_time_selector_on_start_time_changed (GtkWidget *widget,
e_meeting_time_selector_ensure_meeting_time_shown (mts);
gtk_widget_queue_draw (mts->display_top);
gtk_widget_queue_draw (mts->display_main);
+
+ gtk_signal_emit (GTK_OBJECT (mts), mts_signals [CHANGED]);
}
@@ -2212,10 +2214,12 @@ e_meeting_time_selector_on_end_time_changed (GtkWidget *widget,
mts->meeting_end_time = mtstime;
/* If the start time is after the end time, set it to the same time. */
- if (e_meeting_time_selector_compare_times (&mtstime, &mts->meeting_start_time) < 0) {
+ if (e_meeting_time_selector_compare_times (&mtstime, &mts->meeting_start_time) <= 0) {
/* We set it first, before updating the widget, so the signal
handler will just return. */
mts->meeting_start_time = mtstime;
+ if (mts->all_day)
+ g_date_subtract_days (&mts->meeting_start_time.date, 1);
e_meeting_time_selector_update_start_date_edit (mts);
}
@@ -2223,6 +2227,8 @@ e_meeting_time_selector_on_end_time_changed (GtkWidget *widget,
e_meeting_time_selector_ensure_meeting_time_shown (mts);
gtk_widget_queue_draw (mts->display_top);
gtk_widget_queue_draw (mts->display_main);
+
+ gtk_signal_emit (GTK_OBJECT (mts), mts_signals [CHANGED]);
}
@@ -2322,15 +2328,24 @@ e_meeting_time_selector_drag_meeting_time (EMeetingTimeSelector *mts,
e_meeting_time_selector_calculate_time (mts, scroll_x, &first_time);
e_meeting_time_selector_calculate_time (mts, scroll_x + canvas_width - 1,
&last_time);
- if (mts->zoomed_out) {
- if (first_time.minute > 30)
- first_time.hour++;
+ if (!mts->all_day) {
+ if (mts->zoomed_out) {
+ if (first_time.minute > 30)
+ first_time.hour++;
+ first_time.minute = 0;
+ last_time.minute = 0;
+ } else {
+ first_time.minute += 15;
+ first_time.minute -= first_time.minute % 30;
+ last_time.minute -= last_time.minute % 30;
+ }
+ } else {
+ if (first_time.hour > 0 || first_time.minute > 0)
+ g_date_add_days (&first_time.date, 1);
+ first_time.hour = 0;
first_time.minute = 0;
+ last_time.hour = 0;
last_time.minute = 0;
- } else {
- first_time.minute += 15;
- first_time.minute -= first_time.minute % 30;
- last_time.minute -= last_time.minute % 30;
}
e_meeting_time_selector_fix_time_overflows (&first_time);
e_meeting_time_selector_fix_time_overflows (&last_time);
@@ -2476,21 +2491,33 @@ e_meeting_time_selector_timeout_handler (gpointer data)
e_meeting_time_selector_calculate_time (mts,
scroll_x + canvas_width - 1,
&drag_time);
- if (mts->zoomed_out) {
- drag_time.minute = 0;
+ if (!mts->all_day) {
+ if (mts->zoomed_out) {
+ drag_time.minute = 0;
+ } else {
+ drag_time.minute -= drag_time.minute % 30;
+ }
} else {
- drag_time.minute -= drag_time.minute % 30;
+ drag_time.hour = 0;
+ drag_time.minute = 0;
}
} else {
e_meeting_time_selector_calculate_time (mts, scroll_x,
&drag_time);
- if (mts->zoomed_out) {
- if (drag_time.minute > 30)
- drag_time.hour++;
- drag_time.minute = 0;
+ if (!mts->all_day) {
+ if (mts->zoomed_out) {
+ if (drag_time.minute > 30)
+ drag_time.hour++;
+ drag_time.minute = 0;
+ } else {
+ drag_time.minute += 15;
+ drag_time.minute -= drag_time.minute % 30;
+ }
} else {
- drag_time.minute += 15;
- drag_time.minute -= drag_time.minute % 30;
+ if (drag_time.hour > 0 || drag_time.minute > 0)
+ g_date_add_days (&drag_time.date, 1);
+ drag_time.hour = 0;
+ drag_time.minute = 0;
}
}
e_meeting_time_selector_fix_time_overflows (&drag_time);
@@ -2504,7 +2531,7 @@ e_meeting_time_selector_timeout_handler (gpointer data)
/* If the time is unchanged, just return. */
if (e_meeting_time_selector_compare_times (time_to_set, &drag_time) == 0) {
GDK_THREADS_LEAVE ();
- return TRUE;
+ goto scroll;
}
*time_to_set = drag_time;
@@ -2540,6 +2567,7 @@ e_meeting_time_selector_timeout_handler (gpointer data)
|| mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_START)
gtk_signal_emit (GTK_OBJECT (mts), mts_signals [CHANGED]);
+ scroll:
/* Redraw the canvases. We freeze and thaw the layouts so that they
get redrawn completely. Otherwise the pixels get scrolled left or
right which is not good for us (since our vertical bars have been