ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #03511
[Merge] lp:~karl-qdh/indicator-datetime/monthappointments into lp:indicator-datetime
Karl Lattimer has proposed merging lp:~karl-qdh/indicator-datetime/monthappointments into lp:indicator-datetime.
Requested reviews:
Ted Gould (ted)
Related bugs:
Bug #746713 in Indicator Date and Time: "Upcoming events aren't listed if they are in a different month"
https://bugs.launchpad.net/indicator-datetime/+bug/746713
For more details, see:
https://code.launchpad.net/~karl-qdh/indicator-datetime/monthappointments/+merge/55877
make sure we get at least 7 days worth of events past the end of the month, just in case there are appointments there.
--
https://code.launchpad.net/~karl-qdh/indicator-datetime/monthappointments/+merge/55877
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.
=== modified file 'src/datetime-service.c'
--- src/datetime-service.c 2011-03-30 21:55:14 +0000
+++ src/datetime-service.c 2011-04-01 08:30:59 +0000
@@ -656,6 +656,8 @@
const int mon = today->tm_mon;
const int year = today->tm_year;
+ int start_month_saved = mon;
+
struct tm *start_tm = NULL;
int this_year = today->tm_year + 1900;
int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
@@ -667,6 +669,7 @@
if (start_time_appointments > 0) {
start_tm = localtime(&start_time_appointments);
int start_month = start_tm->tm_mon;
+ start_month_saved = start_month;
int start_year = start_tm->tm_year + 1900;
if ((start_month != mon) || (start_year != this_year)) {
// Set t1 to the start of that month.
@@ -681,6 +684,7 @@
g_debug("Will highlight %d days from %s", highlightdays, ctime(&t1));
+ highlightdays = highlightdays + 7; // Minimum of 7 days ahead
t2 = t1 + (time_t) (highlightdays * 24 * 60 * 60);
if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) {
@@ -781,10 +785,12 @@
const int dmon = due->tm_mon;
const int dyear = due->tm_year;
- // Mark day
- g_debug("Adding marked date %s, %d", ctime(&ci->start), dmday);
- g_variant_builder_add (&markeddays, "i", dmday);
-
+ if (start_month_saved == dmon) {
+ // Mark day if our query hasn't hit the next month.
+ g_debug("Adding marked date %s, %d", ctime(&ci->start), dmday);
+ g_variant_builder_add (&markeddays, "i", dmday);
+ }
+
// If the appointment time is less than the selected date,
// don't create an appointment item for it.
if (vtype == E_CAL_COMPONENT_EVENT) {
Follow ups