evolution-3.6.4/modules/calendar/e-cal-shell-settings.c

No issues found

  1 /*
  2  * e-cal-shell-settings.c
  3  *
  4  * This program is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU Lesser General Public
  6  * License as published by the Free Software Foundation; either
  7  * version 2 of the License, or (at your option) version 3.
  8  *
  9  * This program is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 12  * Lesser General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU Lesser General Public
 15  * License along with the program; if not, see <http://www.gnu.org/licenses/>
 16  *
 17  *
 18  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
 19  *
 20  */
 21 
 22 #ifdef HAVE_CONFIG_H
 23 #include <config.h>
 24 #endif
 25 
 26 #include "e-cal-shell-settings.h"
 27 
 28 #include <libecal/libecal.h>
 29 
 30 #include <e-util/e-util.h>
 31 #include <e-util/e-util-enumtypes.h>
 32 
 33 #define CALENDAR_SCHEMA "org.gnome.evolution.calendar"
 34 #define EDS_CALENDAR_CONTACTS_SCHEMA "org.gnome.evolution-data-server.calendar"
 35 
 36 static gboolean
 37 transform_string_to_icaltimezone (GBinding *binding,
 38                                   const GValue *source_value,
 39                                   GValue *target_value,
 40                                   gpointer user_data)
 41 {
 42 	EShellSettings *shell_settings;
 43 	gboolean use_system_timezone;
 44 	const gchar *location = NULL;
 45 	icaltimezone *timezone = NULL;
 46 
 47 	shell_settings = E_SHELL_SETTINGS (user_data);
 48 
 49 	use_system_timezone = e_shell_settings_get_boolean (
 50 		shell_settings, "cal-use-system-timezone");
 51 
 52 	if (use_system_timezone)
 53 		timezone = e_cal_util_get_system_timezone ();
 54 	else
 55 		location = g_value_get_string (source_value);
 56 
 57 	if (location != NULL && *location != '\0')
 58 		timezone = icaltimezone_get_builtin_timezone (location);
 59 
 60 	if (timezone == NULL)
 61 		timezone = icaltimezone_get_utc_timezone ();
 62 
 63 	g_value_set_pointer (target_value, timezone);
 64 
 65 	return TRUE;
 66 }
 67 
 68 static gboolean
 69 transform_icaltimezone_to_string (GBinding *binding,
 70                                   const GValue *source_value,
 71                                   GValue *target_value,
 72                                   gpointer user_data)
 73 {
 74 	EShellSettings *shell_settings;
 75 	gboolean use_system_timezone;
 76 	const gchar *location = NULL;
 77 	gchar *location_str = NULL;
 78 	icaltimezone *timezone;
 79 
 80 	shell_settings = E_SHELL_SETTINGS (user_data);
 81 
 82 	use_system_timezone = e_shell_settings_get_boolean (
 83 		shell_settings, "cal-use-system-timezone");
 84 
 85 	if (use_system_timezone) {
 86 		location_str = e_shell_settings_get_string (
 87 			shell_settings, "cal-timezone-string");
 88 		location = location_str;
 89 	} else {
 90 		timezone = g_value_get_pointer (source_value);
 91 
 92 		if (timezone != NULL)
 93 			location = icaltimezone_get_location (timezone);
 94 	}
 95 
 96 	if (location == NULL)
 97 		location = "UTC";
 98 
 99 	g_value_set_string (target_value, location);
100 
101 	g_free (location_str);
102 
103 	return TRUE;
104 }
105 
106 static gboolean
107 transform_weekdays_settings_to_evolution (GBinding *binding,
108                                           const GValue *source_value,
109                                           GValue *target_value,
110                                           gpointer user_data)
111 {
112 	GDateWeekday weekday;
113 
114 	/* XXX At some point, Evolution changed its weekday numbering
115 	 *     from 0 = Sunday to 0 = Monday, but did not migrate the
116 	 *     "week_start_day" key.  Both enumerations are of course
117 	 *     different from GDateWeekday.  We should have saved the
118 	 *     weekday as a string instead. */
119 
120 	/* This is purposefully verbose for better readability. */
121 
122 	/* setting numbering */
123 	switch (g_value_get_int (source_value)) {
124 		case 0:
125 			weekday = G_DATE_SUNDAY;
126 			break;
127 		case 1:
128 			weekday = G_DATE_MONDAY;
129 			break;
130 		case 2:
131 			weekday = G_DATE_TUESDAY;
132 			break;
133 		case 3:
134 			weekday = G_DATE_WEDNESDAY;
135 			break;
136 		case 4:
137 			weekday = G_DATE_THURSDAY;
138 			break;
139 		case 5:
140 			weekday = G_DATE_FRIDAY;
141 			break;
142 		case 6:
143 			weekday = G_DATE_SATURDAY;
144 			break;
145 		default:
146 			return FALSE;
147 	}
148 
149 	/* Evolution numbering */
150 	switch (weekday) {
151 		case G_DATE_MONDAY:
152 			g_value_set_int (target_value, 0);
153 			break;
154 		case G_DATE_TUESDAY:
155 			g_value_set_int (target_value, 1);
156 			break;
157 		case G_DATE_WEDNESDAY:
158 			g_value_set_int (target_value, 2);
159 			break;
160 		case G_DATE_THURSDAY:
161 			g_value_set_int (target_value, 3);
162 			break;
163 		case G_DATE_FRIDAY:
164 			g_value_set_int (target_value, 4);
165 			break;
166 		case G_DATE_SATURDAY:
167 			g_value_set_int (target_value, 5);
168 			break;
169 		case G_DATE_SUNDAY:
170 			g_value_set_int (target_value, 6);
171 			break;
172 		default:
173 			return FALSE;
174 	}
175 
176 	return TRUE;
177 }
178 
179 static gboolean
180 transform_weekdays_evolution_to_settings (GBinding *binding,
181                                           const GValue *source_value,
182                                           GValue *target_value,
183                                           gpointer user_data)
184 {
185 	GDateWeekday weekday;
186 
187 	/* XXX At some point, Evolution changed its weekday numbering
188 	 *     from 0 = Sunday to 0 = Monday, but did not migrate the
189 	 *     "week_start_day" key.  Both enumerations are of course
190 	 *     different from GDateWeekday.  We should have saved the
191 	 *     weekday as a string instead. */
192 
193 	/* This is purposefully verbose for better readability. */
194 
195 	/* setting numbering */
196 	switch (g_value_get_int (source_value)) {
197 		case 0:
198 			weekday = G_DATE_MONDAY;
199 			break;
200 		case 1:
201 			weekday = G_DATE_TUESDAY;
202 			break;
203 		case 2:
204 			weekday = G_DATE_WEDNESDAY;
205 			break;
206 		case 3:
207 			weekday = G_DATE_THURSDAY;
208 			break;
209 		case 4:
210 			weekday = G_DATE_FRIDAY;
211 			break;
212 		case 5:
213 			weekday = G_DATE_SATURDAY;
214 			break;
215 		case 6:
216 			weekday = G_DATE_SUNDAY;
217 			break;
218 		default:
219 			return FALSE;
220 	}
221 
222 	/* Evolution numbering */
223 	switch (weekday) {
224 		case G_DATE_MONDAY:
225 			g_value_set_int (target_value, 1);
226 			break;
227 		case G_DATE_TUESDAY:
228 			g_value_set_int (target_value, 2);
229 			break;
230 		case G_DATE_WEDNESDAY:
231 			g_value_set_int (target_value, 3);
232 			break;
233 		case G_DATE_THURSDAY:
234 			g_value_set_int (target_value, 4);
235 			break;
236 		case G_DATE_FRIDAY:
237 			g_value_set_int (target_value, 5);
238 			break;
239 		case G_DATE_SATURDAY:
240 			g_value_set_int (target_value, 6);
241 			break;
242 		case G_DATE_SUNDAY:
243 			g_value_set_int (target_value, 0);
244 			break;
245 		default:
246 			return FALSE;
247 	}
248 
249 	return TRUE;
250 }
251 
252 /* Working day flags */
253 enum {
254 	WORKING_DAY_SUNDAY	= 1 << 0,
255 	WORKING_DAY_MONDAY	= 1 << 1,
256 	WORKING_DAY_TUESDAY	= 1 << 2,
257 	WORKING_DAY_WEDNESDAY	= 1 << 3,
258 	WORKING_DAY_THURSDAY	= 1 << 4,
259 	WORKING_DAY_FRIDAY	= 1 << 5,
260 	WORKING_DAY_SATURDAY	= 1 << 6
261 };
262 
263 static gboolean
264 transform_working_days_bitset_to_sunday (GBinding *binding,
265                                          const GValue *source_value,
266                                          GValue *target_value,
267                                          gpointer user_data)
268 {
269 	gint bitset;
270 	gboolean working_day;
271 
272 	bitset = g_value_get_int (source_value);
273 	working_day = ((bitset & WORKING_DAY_SUNDAY) != 0);
274 	g_value_set_boolean (target_value, working_day);
275 
276 	return TRUE;
277 }
278 
279 static gboolean
280 transform_working_days_sunday_to_bitset (GBinding *binding,
281                                          const GValue *source_value,
282                                          GValue *target_value,
283                                          gpointer user_data)
284 {
285 	EShellSettings *shell_settings;
286 	gint bitset, bit;
287 
288 	shell_settings = E_SHELL_SETTINGS (user_data);
289 
290 	bitset = e_shell_settings_get_int (
291 		shell_settings, "cal-working-days-bitset");
292 
293 	bit = g_value_get_boolean (source_value) ? WORKING_DAY_SUNDAY : 0;
294 	g_value_set_int (target_value, (bitset & ~WORKING_DAY_SUNDAY) | bit);
295 
296 	return TRUE;
297 }
298 
299 static gboolean
300 transform_working_days_bitset_to_monday (GBinding *binding,
301                                          const GValue *source_value,
302                                          GValue *target_value,
303                                          gpointer user_data)
304 {
305 	gint bitset;
306 	gboolean working_day;
307 
308 	bitset = g_value_get_int (source_value);
309 	working_day = ((bitset & WORKING_DAY_MONDAY) != 0);
310 	g_value_set_boolean (target_value, working_day);
311 
312 	return TRUE;
313 }
314 
315 static gboolean
316 transform_working_days_monday_to_bitset (GBinding *binding,
317                                          const GValue *source_value,
318                                          GValue *target_value,
319                                          gpointer user_data)
320 {
321 	EShellSettings *shell_settings;
322 	gint bitset, bit;
323 
324 	shell_settings = E_SHELL_SETTINGS (user_data);
325 
326 	bitset = e_shell_settings_get_int (
327 		shell_settings, "cal-working-days-bitset");
328 
329 	bit = g_value_get_boolean (source_value) ? WORKING_DAY_MONDAY : 0;
330 	g_value_set_int (target_value, (bitset & ~WORKING_DAY_MONDAY) | bit);
331 
332 	return TRUE;
333 }
334 
335 static gboolean
336 transform_working_days_bitset_to_tuesday (GBinding *binding,
337                                           const GValue *source_value,
338                                           GValue *target_value,
339                                           gpointer user_data)
340 {
341 	gint bitset;
342 	gboolean working_day;
343 
344 	bitset = g_value_get_int (source_value);
345 	working_day = ((bitset & WORKING_DAY_TUESDAY) != 0);
346 	g_value_set_boolean (target_value, working_day);
347 
348 	return TRUE;
349 }
350 
351 static gboolean
352 transform_working_days_tuesday_to_bitset (GBinding *binding,
353                                           const GValue *source_value,
354                                           GValue *target_value,
355                                           gpointer user_data)
356 {
357 	EShellSettings *shell_settings;
358 	gint bitset, bit;
359 
360 	shell_settings = E_SHELL_SETTINGS (user_data);
361 
362 	bitset = e_shell_settings_get_int (
363 		shell_settings, "cal-working-days-bitset");
364 
365 	bit = g_value_get_boolean (source_value) ? WORKING_DAY_TUESDAY : 0;
366 	g_value_set_int (target_value, (bitset & ~WORKING_DAY_TUESDAY) | bit);
367 
368 	return TRUE;
369 }
370 
371 static gboolean
372 transform_working_days_bitset_to_wednesday (GBinding *binding,
373                                             const GValue *source_value,
374                                             GValue *target_value,
375                                             gpointer user_data)
376 {
377 	gint bitset;
378 	gboolean working_day;
379 
380 	bitset = g_value_get_int (source_value);
381 	working_day = ((bitset & WORKING_DAY_WEDNESDAY) != 0);
382 	g_value_set_boolean (target_value, working_day);
383 
384 	return TRUE;
385 }
386 
387 static gboolean
388 transform_working_days_wednesday_to_bitset (GBinding *binding,
389                                             const GValue *source_value,
390                                             GValue *target_value,
391                                             gpointer user_data)
392 {
393 	EShellSettings *shell_settings;
394 	gint bitset, bit;
395 
396 	shell_settings = E_SHELL_SETTINGS (user_data);
397 
398 	bitset = e_shell_settings_get_int (
399 		shell_settings, "cal-working-days-bitset");
400 
401 	bit = g_value_get_boolean (source_value) ? WORKING_DAY_WEDNESDAY : 0;
402 	g_value_set_int (target_value, (bitset & ~WORKING_DAY_WEDNESDAY) | bit);
403 
404 	return TRUE;
405 }
406 
407 static gboolean
408 transform_working_days_bitset_to_thursday (GBinding *binding,
409                                            const GValue *source_value,
410                                            GValue *target_value,
411                                            gpointer user_data)
412 {
413 	gint bitset;
414 	gboolean working_day;
415 
416 	bitset = g_value_get_int (source_value);
417 	working_day = ((bitset & WORKING_DAY_THURSDAY) != 0);
418 	g_value_set_boolean (target_value, working_day);
419 
420 	return TRUE;
421 }
422 
423 static gboolean
424 transform_working_days_thursday_to_bitset (GBinding *binding,
425                                            const GValue *source_value,
426                                            GValue *target_value,
427                                            gpointer user_data)
428 {
429 	EShellSettings *shell_settings;
430 	gint bitset, bit;
431 
432 	shell_settings = E_SHELL_SETTINGS (user_data);
433 
434 	bitset = e_shell_settings_get_int (
435 		shell_settings, "cal-working-days-bitset");
436 
437 	bit = g_value_get_boolean (source_value) ? WORKING_DAY_THURSDAY : 0;
438 	g_value_set_int (target_value, (bitset & ~WORKING_DAY_THURSDAY) | bit);
439 
440 	return TRUE;
441 }
442 
443 static gboolean
444 transform_working_days_bitset_to_friday (GBinding *binding,
445                                          const GValue *source_value,
446                                          GValue *target_value,
447                                          gpointer user_data)
448 {
449 	gint bitset;
450 	gboolean working_day;
451 
452 	bitset = g_value_get_int (source_value);
453 	working_day = ((bitset & WORKING_DAY_FRIDAY) != 0);
454 	g_value_set_boolean (target_value, working_day);
455 
456 	return TRUE;
457 }
458 
459 static gboolean
460 transform_working_days_friday_to_bitset (GBinding *binding,
461                                          const GValue *source_value,
462                                          GValue *target_value,
463                                          gpointer user_data)
464 {
465 	EShellSettings *shell_settings;
466 	gint bitset, bit;
467 
468 	shell_settings = E_SHELL_SETTINGS (user_data);
469 
470 	bitset = e_shell_settings_get_int (
471 		shell_settings, "cal-working-days-bitset");
472 
473 	bit = g_value_get_boolean (source_value) ? WORKING_DAY_FRIDAY : 0;
474 	g_value_set_int (target_value, (bitset & ~WORKING_DAY_FRIDAY) | bit);
475 
476 	return TRUE;
477 }
478 
479 static gboolean
480 transform_working_days_bitset_to_saturday (GBinding *binding,
481                                            const GValue *source_value,
482                                            GValue *target_value,
483                                            gpointer user_data)
484 {
485 	gint bitset;
486 	gboolean working_day;
487 
488 	bitset = g_value_get_int (source_value);
489 	working_day = ((bitset & WORKING_DAY_SATURDAY) != 0);
490 	g_value_set_boolean (target_value, working_day);
491 
492 	return TRUE;
493 }
494 
495 static gboolean
496 transform_working_days_saturday_to_bitset (GBinding *binding,
497                                            const GValue *source_value,
498                                            GValue *target_value,
499                                            gpointer user_data)
500 {
501 	EShellSettings *shell_settings;
502 	gint bitset, bit;
503 
504 	shell_settings = E_SHELL_SETTINGS (user_data);
505 
506 	bitset = e_shell_settings_get_int (
507 		shell_settings, "cal-working-days-bitset");
508 
509 	bit = g_value_get_boolean (source_value) ? WORKING_DAY_SATURDAY : 0;
510 	g_value_set_int (target_value, (bitset & ~WORKING_DAY_SATURDAY) | bit);
511 
512 	return TRUE;
513 }
514 
515 static void
516 cal_use_system_timezone_changed_cb (GObject *shell_settings)
517 {
518 	g_object_notify (shell_settings, "cal-timezone-string");
519 }
520 
521 void
522 e_cal_shell_backend_init_settings (EShell *shell)
523 {
524 	EShellSettings *shell_settings;
525 
526 	shell_settings = e_shell_get_shell_settings (shell);
527 
528 	e_shell_settings_install_property_for_key (
529 		"cal-ba-reminder-interval",
530 		EDS_CALENDAR_CONTACTS_SCHEMA,
531 		"contacts-reminder-interval");
532 
533 	e_shell_settings_install_property_for_key (
534 		"cal-ba-reminder-units-string",
535 		EDS_CALENDAR_CONTACTS_SCHEMA,
536 		"contacts-reminder-units");
537 
538 	e_shell_settings_install_property_for_key (
539 		"cal-compress-weekend",
540 		CALENDAR_SCHEMA,
541 		"compress-weekend");
542 
543 	e_shell_settings_install_property_for_key (
544 		"cal-confirm-delete",
545 		CALENDAR_SCHEMA,
546 		"confirm-delete");
547 
548 	e_shell_settings_install_property_for_key (
549 		"cal-confirm-purge",
550 		CALENDAR_SCHEMA,
551 		"confirm-purge");
552 
553 	e_shell_settings_install_property_for_key (
554 		"cal-default-reminder-interval",
555 		CALENDAR_SCHEMA,
556 		"default-reminder-interval");
557 
558 	/* Do not bind to this.
559 	 * Use "cal-default-reminder-units" instead. */
560 	e_shell_settings_install_property_for_key (
561 		"cal-default-reminder-units-string",
562 		CALENDAR_SCHEMA,
563 		"default-reminder-units");
564 
565 	e_shell_settings_install_property_for_key (
566 		"cal-free-busy-template",
567 		CALENDAR_SCHEMA,
568 		"publish-template");
569 
570 	e_shell_settings_install_property_for_key (
571 		"cal-hide-completed-tasks",
572 		CALENDAR_SCHEMA,
573 		"hide-completed-tasks");
574 
575 	/* Do not bind to this.
576 	 * Use "cal-hide-completed-tasks-units" instead. */
577 	e_shell_settings_install_property_for_key (
578 		"cal-hide-completed-tasks-units-string",
579 		CALENDAR_SCHEMA,
580 		"hide-completed-tasks-units");
581 
582 	e_shell_settings_install_property_for_key (
583 		"cal-hide-completed-tasks-value",
584 		CALENDAR_SCHEMA,
585 		"hide-completed-tasks-value");
586 
587 	e_shell_settings_install_property_for_key (
588 		"cal-marcus-bains-day-view-color",
589 		CALENDAR_SCHEMA,
590 		"marcus-bains-color-dayview");
591 
592 	e_shell_settings_install_property_for_key (
593 		"cal-marcus-bains-time-bar-color",
594 		CALENDAR_SCHEMA,
595 		"marcus-bains-color-timebar");
596 
597 	e_shell_settings_install_property_for_key (
598 		"cal-marcus-bains-show-line",
599 		CALENDAR_SCHEMA,
600 		"marcus-bains-line");
601 
602 	e_shell_settings_install_property_for_key (
603 		"cal-month-scroll-by-week",
604 		CALENDAR_SCHEMA,
605 		"month-scroll-by-week");
606 
607 	e_shell_settings_install_property_for_key (
608 		"cal-primary-calendar",
609 		CALENDAR_SCHEMA,
610 		"primary-calendar");
611 
612 	e_shell_settings_install_property_for_key (
613 		"cal-primary-memo-list",
614 		CALENDAR_SCHEMA,
615 		"primary-memos");
616 
617 	e_shell_settings_install_property_for_key (
618 		"cal-primary-task-list",
619 		CALENDAR_SCHEMA,
620 		"primary-tasks");
621 
622 	e_shell_settings_install_property_for_key (
623 		"cal-recur-events-italic",
624 		CALENDAR_SCHEMA,
625 		"recur-events-italic");
626 
627 	e_shell_settings_install_property_for_key (
628 		"cal-search-range-years",
629 		CALENDAR_SCHEMA,
630 		"search-range-years");
631 
632 	e_shell_settings_install_property_for_key (
633 		"cal-show-event-end-times",
634 		CALENDAR_SCHEMA,
635 		"show-event-end");
636 
637 	e_shell_settings_install_property_for_key (
638 		"cal-show-week-numbers",
639 		CALENDAR_SCHEMA,
640 		"show-week-numbers");
641 
642 	e_shell_settings_install_property_for_key (
643 		"cal-tasks-highlight-due-today",
644 		CALENDAR_SCHEMA,
645 		"task-due-today-highlight");
646 
647 	e_shell_settings_install_property_for_key (
648 		"cal-tasks-color-due-today",
649 		CALENDAR_SCHEMA,
650 		"task-due-today-color");
651 
652 	e_shell_settings_install_property_for_key (
653 		"cal-tasks-highlight-overdue",
654 		CALENDAR_SCHEMA,
655 		"task-overdue-highlight");
656 
657 	e_shell_settings_install_property_for_key (
658 		"cal-tasks-color-overdue",
659 		CALENDAR_SCHEMA,
660 		"task-overdue-color");
661 
662 	e_shell_settings_install_property_for_key (
663 		"cal-time-divisions",
664 		CALENDAR_SCHEMA,
665 		"time-divisions");
666 
667 	/* Do not bind to this.  Use "cal-timezone" instead. */
668 	e_shell_settings_install_property_for_key (
669 		"cal-timezone-string",
670 		CALENDAR_SCHEMA,
671 		"timezone");
672 
673 	e_shell_settings_install_property_for_key (
674 		"cal-use-24-hour-format",
675 		CALENDAR_SCHEMA,
676 		"use-24hour-format");
677 
678 	e_shell_settings_install_property_for_key (
679 		"cal-use-ba-reminder",
680 		EDS_CALENDAR_CONTACTS_SCHEMA,
681 		"contacts-reminder-enabled");
682 
683 	e_shell_settings_install_property_for_key (
684 		"cal-use-default-reminder",
685 		CALENDAR_SCHEMA,
686 		"use-default-reminder");
687 
688 	e_shell_settings_install_property_for_key (
689 		"cal-use-system-timezone",
690 		CALENDAR_SCHEMA,
691 		"use-system-timezone");
692 
693 	/* Do not bind to this.  Use "cal-week-start-day" instead. */
694 	e_shell_settings_install_property_for_key (
695 		"cal-week-start-day-setting",
696 		CALENDAR_SCHEMA,
697 		"week-start-day");
698 
699 	e_shell_settings_install_property_for_key (
700 		"cal-work-day-end-hour",
701 		CALENDAR_SCHEMA,
702 		"day-end-hour");
703 
704 	e_shell_settings_install_property_for_key (
705 		"cal-work-day-end-minute",
706 		CALENDAR_SCHEMA,
707 		"day-end-minute");
708 
709 	e_shell_settings_install_property_for_key (
710 		"cal-work-day-start-hour",
711 		CALENDAR_SCHEMA,
712 		"day-start-hour");
713 
714 	e_shell_settings_install_property_for_key (
715 		"cal-work-day-start-minute",
716 		CALENDAR_SCHEMA,
717 		"day-start-minute");
718 
719 	e_shell_settings_install_property_for_key (
720 		"cal-working-days-bitset",
721 		CALENDAR_SCHEMA,
722 		"working-days");
723 
724 	e_shell_settings_install_property_for_key (
725 		"cal-prefer-new-item",
726 		CALENDAR_SCHEMA,
727 		"prefer-new-item");
728 
729 	/* These properties use transform functions to convert
730 	 * GSettings values to forms more useful to Evolution.
731 	 */
732 
733 	e_shell_settings_install_property (
734 		g_param_spec_enum (
735 			"cal-ba-reminder-units",
736 			NULL,
737 			NULL,
738 			E_TYPE_DURATION_TYPE,
739 			E_DURATION_MINUTES,
740 			G_PARAM_READWRITE));
741 
742 	g_object_bind_property_full (
743 		shell_settings, "cal-ba-reminder-units-string",
744 		shell_settings, "cal-ba-reminder-units",
745 		G_BINDING_BIDIRECTIONAL |
746 		G_BINDING_SYNC_CREATE,
747 		e_binding_transform_enum_nick_to_value,
748 		e_binding_transform_enum_value_to_nick,
749 		NULL, (GDestroyNotify) NULL);
750 
751 	e_shell_settings_install_property (
752 		g_param_spec_enum (
753 			"cal-default-reminder-units",
754 			NULL,
755 			NULL,
756 			E_TYPE_DURATION_TYPE,
757 			E_DURATION_MINUTES,
758 			G_PARAM_READWRITE));
759 
760 	g_object_bind_property_full (
761 		shell_settings, "cal-default-reminder-units-string",
762 		shell_settings, "cal-default-reminder-units",
763 		G_BINDING_BIDIRECTIONAL |
764 		G_BINDING_SYNC_CREATE,
765 		e_binding_transform_enum_nick_to_value,
766 		e_binding_transform_enum_value_to_nick,
767 		NULL, (GDestroyNotify) NULL);
768 
769 	e_shell_settings_install_property (
770 		g_param_spec_enum (
771 			"cal-hide-completed-tasks-units",
772 			NULL,
773 			NULL,
774 			E_TYPE_DURATION_TYPE,
775 			E_DURATION_MINUTES,
776 			G_PARAM_READWRITE));
777 
778 	g_object_bind_property_full (
779 		shell_settings, "cal-hide-completed-tasks-units-string",
780 		shell_settings, "cal-hide-completed-tasks-units",
781 		G_BINDING_BIDIRECTIONAL |
782 		G_BINDING_SYNC_CREATE,
783 		e_binding_transform_enum_nick_to_value,
784 		e_binding_transform_enum_value_to_nick,
785 		NULL, (GDestroyNotify) NULL);
786 
787 	e_shell_settings_install_property (
788 		g_param_spec_pointer (
789 			"cal-timezone",
790 			NULL,
791 			NULL,
792 			G_PARAM_READWRITE));
793 
794 	g_object_bind_property_full (
795 		shell_settings, "cal-timezone-string",
796 		shell_settings, "cal-timezone",
797 		G_BINDING_BIDIRECTIONAL |
798 		G_BINDING_SYNC_CREATE,
799 		transform_string_to_icaltimezone,
800 		transform_icaltimezone_to_string,
801 		g_object_ref (shell_settings),
802 		(GDestroyNotify) g_object_unref);
803 
804 	e_shell_settings_install_property (
805 		g_param_spec_int (
806 			"cal-week-start-day",
807 			NULL,
808 			NULL,
809 			0,  /* Monday */
810 			6,  /* Sunday */
811 			0,
812 			G_PARAM_READWRITE));
813 
814 	g_object_bind_property_full (
815 		shell_settings, "cal-week-start-day-setting",
816 		shell_settings, "cal-week-start-day",
817 		G_BINDING_BIDIRECTIONAL |
818 		G_BINDING_SYNC_CREATE,
819 		transform_weekdays_settings_to_evolution,
820 		transform_weekdays_evolution_to_settings,
821 		NULL, (GDestroyNotify) NULL);
822 
823 	/* XXX These are my favorite.  Storing a bit array in GSettings
824 	 *     instead of separate boolean keys.  Brilliant move. */
825 
826 	e_shell_settings_install_property (
827 		g_param_spec_boolean (
828 			"cal-working-days-sunday",
829 			NULL,
830 			NULL,
831 			FALSE,
832 			G_PARAM_READWRITE));
833 
834 	g_object_bind_property_full (
835 		shell_settings, "cal-working-days-bitset",
836 		shell_settings, "cal-working-days-sunday",
837 		G_BINDING_BIDIRECTIONAL |
838 		G_BINDING_SYNC_CREATE,
839 		transform_working_days_bitset_to_sunday,
840 		transform_working_days_sunday_to_bitset,
841 		g_object_ref (shell_settings),
842 		(GDestroyNotify) g_object_unref);
843 
844 	e_shell_settings_install_property (
845 		g_param_spec_boolean (
846 			"cal-working-days-monday",
847 			NULL,
848 			NULL,
849 			TRUE,
850 			G_PARAM_READWRITE));
851 
852 	g_object_bind_property_full (
853 		shell_settings, "cal-working-days-bitset",
854 		shell_settings, "cal-working-days-monday",
855 		G_BINDING_BIDIRECTIONAL |
856 		G_BINDING_SYNC_CREATE,
857 		transform_working_days_bitset_to_monday,
858 		transform_working_days_monday_to_bitset,
859 		g_object_ref (shell_settings),
860 		(GDestroyNotify) g_object_unref);
861 
862 	e_shell_settings_install_property (
863 		g_param_spec_boolean (
864 			"cal-working-days-tuesday",
865 			NULL,
866 			NULL,
867 			TRUE,
868 			G_PARAM_READWRITE));
869 
870 	g_object_bind_property_full (
871 		shell_settings, "cal-working-days-bitset",
872 		shell_settings, "cal-working-days-tuesday",
873 		G_BINDING_BIDIRECTIONAL |
874 		G_BINDING_SYNC_CREATE,
875 		transform_working_days_bitset_to_tuesday,
876 		transform_working_days_tuesday_to_bitset,
877 		g_object_ref (shell_settings),
878 		(GDestroyNotify) g_object_unref);
879 
880 	e_shell_settings_install_property (
881 		g_param_spec_boolean (
882 			"cal-working-days-wednesday",
883 			NULL,
884 			NULL,
885 			TRUE,
886 			G_PARAM_READWRITE));
887 
888 	g_object_bind_property_full (
889 		shell_settings, "cal-working-days-bitset",
890 		shell_settings, "cal-working-days-wednesday",
891 		G_BINDING_BIDIRECTIONAL |
892 		G_BINDING_SYNC_CREATE,
893 		transform_working_days_bitset_to_wednesday,
894 		transform_working_days_wednesday_to_bitset,
895 		g_object_ref (shell_settings),
896 		(GDestroyNotify) g_object_unref);
897 
898 	e_shell_settings_install_property (
899 		g_param_spec_boolean (
900 			"cal-working-days-thursday",
901 			NULL,
902 			NULL,
903 			TRUE,
904 			G_PARAM_READWRITE));
905 
906 	g_object_bind_property_full (
907 		shell_settings, "cal-working-days-bitset",
908 		shell_settings, "cal-working-days-thursday",
909 		G_BINDING_BIDIRECTIONAL |
910 		G_BINDING_SYNC_CREATE,
911 		transform_working_days_bitset_to_thursday,
912 		transform_working_days_thursday_to_bitset,
913 		g_object_ref (shell_settings),
914 		(GDestroyNotify) g_object_unref);
915 
916 	e_shell_settings_install_property (
917 		g_param_spec_boolean (
918 			"cal-working-days-friday",
919 			NULL,
920 			NULL,
921 			TRUE,
922 			G_PARAM_READWRITE));
923 
924 	g_object_bind_property_full (
925 		shell_settings, "cal-working-days-bitset",
926 		shell_settings, "cal-working-days-friday",
927 		G_BINDING_BIDIRECTIONAL |
928 		G_BINDING_SYNC_CREATE,
929 		transform_working_days_bitset_to_friday,
930 		transform_working_days_friday_to_bitset,
931 		g_object_ref (shell_settings),
932 		(GDestroyNotify) g_object_unref);
933 
934 	e_shell_settings_install_property (
935 		g_param_spec_boolean (
936 			"cal-working-days-saturday",
937 			NULL,
938 			NULL,
939 			FALSE,
940 			G_PARAM_READWRITE));
941 
942 	g_object_bind_property_full (
943 		shell_settings, "cal-working-days-bitset",
944 		shell_settings, "cal-working-days-saturday",
945 		G_BINDING_BIDIRECTIONAL |
946 		G_BINDING_SYNC_CREATE,
947 		transform_working_days_bitset_to_saturday,
948 		transform_working_days_saturday_to_bitset,
949 		g_object_ref (shell_settings),
950 		(GDestroyNotify) g_object_unref);
951 
952 	g_signal_connect (
953 		shell_settings, "notify::cal-use-system-timezone",
954 		G_CALLBACK (cal_use_system_timezone_changed_cb), NULL);
955 }