[california] Set start/end date in another month: Bug #734407
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [california] Set start/end date in another month: Bug #734407
- Date: Thu, 7 Aug 2014 20:31:34 +0000 (UTC)
commit decd266bfe92b2c9443eba406b396f26b5a5382f
Author: Jim Nelson <jim yorba org>
Date: Thu Aug 7 13:31:24 2014 -0700
Set start/end date in another month: Bug #734407
src/host/host-date-time-widget.vala | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/host/host-date-time-widget.vala b/src/host/host-date-time-widget.vala
index f707ed3..5556b13 100644
--- a/src/host/host-date-time-widget.vala
+++ b/src/host/host-date-time-widget.vala
@@ -229,6 +229,13 @@ public class DateTimeWidget : Gtk.Box {
return exact_time.clamp(floor, ceiling).equal_to(exact_time);
}
+ private Calendar.ExactTime get_clamped(Calendar.Date proposed_date, Calendar.WallTime proposed_time) {
+ Calendar.ExactTime exact_time = new Calendar.ExactTime(Calendar.Timezone.local, proposed_date,
+ proposed_time);
+
+ return exact_time.clamp(floor, ceiling);
+ }
+
private Calendar.Date? get_selected_date() {
if (calendar.day == 0)
return null;
@@ -250,11 +257,11 @@ public class DateTimeWidget : Gtk.Box {
disconnect_property_signals();
Calendar.Date? selected = get_selected_date();
- if (selected != null && is_valid_date_time(selected, wall_time) && !selected.equal_to(date))
- date = selected;
-
- // even if user picked invalid date, this resets selection to valid one
- on_date_changed();
+ if (selected != null) {
+ date = new Calendar.Date.from_exact_time(get_clamped(selected, wall_time));
+ if (!selected.equal_to(date))
+ on_date_changed();
+ }
connect_property_signals();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]