~mterry/indicator-datetime/update-after-resume

« back to all changes in this revision

Viewing changes to src/datetime-service.c

  • Committer: Ted Gould
  • Date: 2011-04-04 15:49:36 UTC
  • mfrom: (95.1.1 idatetime-31-3-2011)
  • Revision ID: ted@gould.cx-20110404154936-ascj9iupqlwyn6q1
Making it so that months boundries can't block our events.

Show diffs side-by-side

added added

removed removed

Lines of Context:
656
656
        const int mon = today->tm_mon;
657
657
        const int year = today->tm_year;
658
658
 
 
659
        int start_month_saved = mon;
 
660
 
659
661
        struct tm *start_tm = NULL;
660
662
        int this_year = today->tm_year + 1900;
661
663
        int days[12]={31,28,31,30,31,30,31,31,30,31,30,31};
667
669
        if (start_time_appointments > 0) {
668
670
                start_tm = localtime(&start_time_appointments);
669
671
                int start_month = start_tm->tm_mon;
 
672
                start_month_saved = start_month;
670
673
                int start_year = start_tm->tm_year + 1900;
671
674
                if ((start_month != mon) || (start_year != this_year)) {
672
675
                        // Set t1 to the start of that month.
681
684
        
682
685
        g_debug("Will highlight %d days from %s", highlightdays, ctime(&t1));
683
686
 
 
687
        highlightdays = highlightdays + 7; // Minimum of 7 days ahead 
684
688
        t2 = t1 + (time_t) (highlightdays * 24 * 60 * 60);
685
689
        
686
690
        if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) {
781
785
                const int dmon = due->tm_mon;
782
786
                const int dyear = due->tm_year;
783
787
                
784
 
                // Mark day
785
 
                g_debug("Adding marked date %s, %d", ctime(&ci->start), dmday);
786
 
                g_variant_builder_add (&markeddays, "i", dmday);
787
 
 
 
788
                if (start_month_saved == dmon) {
 
789
                        // Mark day if our query hasn't hit the next month. 
 
790
                        g_debug("Adding marked date %s, %d", ctime(&ci->start), dmday);
 
791
                        g_variant_builder_add (&markeddays, "i", dmday);
 
792
                }
 
793
                
788
794
                // If the appointment time is less than the selected date, 
789
795
                // don't create an appointment item for it.
790
796
                if (vtype == E_CAL_COMPONENT_EVENT) {