Calendar Updates

Time of Coding!

Updates on my project as a Google Summer of Code Intern. As you all know, I’m working on the Gnome-Calendar to make the much-required week-view. Here is the proposed mock up for the same:


The week-view already had good amount of code written for it. So the basic files were already existing. My first task was to activate the already written week-view, which after a few changes in the main Application file, resulted in:


Which is pretty far from the mock up.

All of the previously written code for week-view was in a single class, but in my proposal, we divided it into multiple classes.

  • WeekHeader for displaying the week-names, dates and labels of month, week number(s) and year.
  • WeekGrid to display the time periods of the 7 days of the week.

The events would go to each class based on the duration they last.

The initial task was a major clean up of the previously written week-view code, which was a pretty difficult task, given it was 2 years old code, and LOT of things have changed. The code was a sight which one wouldn’t like to see.

The clean up done, it was time to set up new classes and templates.

So here’s how you do it for calendar

  1. Make the ui, c and header file.
  2. For making the calendar use the ui file
    1. Save the ui in the correct place, data/ui/
    2. Convert the file into binary, so that no one messes with it, by including it in the data/calendar.gresource.xml
    3. Include the file(or alias if you’ve set it to anything different) in the data/
  3. For making the calendar use the .c and .h files:
    1. Just include the files in the src/

From week-view, we will be using a separate folder to include the views, which is src/views/ So how do we include headers of files inside a subfolder? Simple enough if you know it- Add -I$(srcdir)/views to the CPPFlags of Makefile.

And there you have it newly introduced classes which are ready to use for coding and testing.

Next blog about the WeekHeader.

P.S.-My hackergotchi is here 😀 , Thanks a lot danielgc for making it 🙂


Bug Fix #2

Last blog of pre-GSoC coding. This is the story which dates back to the application period.

The month view of the calendar is a pretty important aspect of the calendar. The keyboard arrow keys allowed a user to switch between days in a specific month. But on reaching the end of the month, a user couldn’t go any further.


The fix to which was a simple change to the key_press()

The calendar, in the past, used a ‘gint’ variable for locating the present location of the selector. So, on going beyond a date in the calendar, it would go to an invalid cell, which would cause nothing to happen. After the patch for bug #763198, it would go to the next month but since it used the cell position, the selection dates for creating new events went bad.

Next comes,

The simple fix-Make the ‘gint’ variables to ‘GDateTime’ variables to track the date rather than a ‘gint’ variable to track the cell position.

The difficulties- The month-view was heavily dependent on those two variables (start_date_cell and end_date_cell) On changing a variable on gint to GDateTime, a lot of changes had to be made.

The result was a huge patch which changed the code at every position of occurrence of tracking variables-

Segment faults are hard!!!

Thanks to the awesome community, an apparent error in the code was pointed out, resulting in the reopening of the bug #763641.

After much trying and failing, comes feaneron! Who solved the error in a few quick patches.

After all this, what has improved-

  • User can navigate to the next and previous month by navigating to the end of the current month.
  • User can create events spanning across multiple months with just the keyboard

What can still be done: The patch was pretty biased towards a keyboard user, there were no additions made for a mouse user, which should and will be done soon.

Next Up: The long forgotten week-view rises!!