Skip to content

Commit

Permalink
Listen to first day of week changes in calendar applet
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertJP committed Nov 10, 2014
1 parent df52989 commit d1f17a7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion files/usr/share/cinnamon/applets/[email protected]/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const Settings = imports.ui.settings;
const MSECS_IN_DAY = 24 * 60 * 60 * 1000;
const WEEKDATE_HEADER_WIDTH_DIGITS = 3;
const SHOW_WEEKDATE_KEY = 'show-weekdate';
const FIRST_WEEKDAY_KEY = 'first-day-of-week';
const DESKTOP_SCHEMA = 'org.cinnamon.desktop.interface';

String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
Expand Down Expand Up @@ -175,6 +177,8 @@ Calendar.prototype = {
this.settings = settings;

this.settings.connect("changed::show-week-numbers", Lang.bind(this, this._onSettingsChange));
this.desktop_settings = new Gio.Settings({ schema: DESKTOP_SCHEMA });
this.desktop_settings.connect("changed::" + FIRST_WEEKDAY_KEY, Lang.bind(this, this._onSettingsChange));
this.show_week_numbers = this.settings.getValue("show-week-numbers");

// Find the ordering for month/year in the calendar heading
Expand Down Expand Up @@ -206,7 +210,14 @@ Calendar.prototype = {
},

_onSettingsChange: function(object, key, old_val, new_val) {
this.show_week_numbers = new_val;
switch (key) {
case SHOW_WEEKDATE_KEY:
this.show_week_numbers = new_val;
break;
case FIRST_WEEKDAY_KEY:
this._weekStart = Cinnamon.util_get_week_start();
break;
}
this._buildHeader();
this._update(false);
},
Expand Down

0 comments on commit d1f17a7

Please sign in to comment.