evolution-3.6.4/modules/calendar/e-cal-config-calendar-item.c

No issues found

  1 /*
  2  * e-cal-config-calendar-item.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 
 19 #ifdef HAVE_CONFIG_H
 20 #include <config.h>
 21 #endif
 22 
 23 #include "e-cal-config-calendar-item.h"
 24 
 25 #include <shell/e-shell.h>
 26 #include <misc/e-calendar-item.h>
 27 
 28 #define E_CAL_CONFIG_CALENDAR_ITEM_GET_PRIVATE(obj) \
 29 	(G_TYPE_INSTANCE_GET_PRIVATE \
 30 	((obj), E_TYPE_CAL_CONFIG_CALENDAR_ITEM, ECalConfigCalendarItemPrivate))
 31 
 32 struct _ECalConfigCalendarItemPrivate {
 33 	gint placeholder;
 34 };
 35 
 36 G_DEFINE_DYNAMIC_TYPE (
 37 	ECalConfigCalendarItem,
 38 	e_cal_config_calendar_item,
 39 	E_TYPE_EXTENSION)
 40 
 41 static void
 42 cal_config_calendar_item_constructed (GObject *object)
 43 {
 44 	EExtension *extension;
 45 	EExtensible *extensible;
 46 	EShellSettings *shell_settings;
 47 	EShell *shell;
 48 
 49 	extension = E_EXTENSION (object);
 50 	extensible = e_extension_get_extensible (extension);
 51 
 52 	shell = e_shell_get_default ();
 53 	shell_settings = e_shell_get_shell_settings (shell);
 54 
 55 	g_object_bind_property (
 56 		shell_settings, "cal-show-week-numbers",
 57 		extensible, "show-week-numbers",
 58 		G_BINDING_SYNC_CREATE);
 59 
 60 	g_object_bind_property (
 61 		shell_settings, "cal-week-start-day",
 62 		extensible, "week-start-day",
 63 		G_BINDING_SYNC_CREATE);
 64 
 65 	/* Chain up to parent's constructed() method. */
 66 	G_OBJECT_CLASS (e_cal_config_calendar_item_parent_class)->
 67 		constructed (object);
 68 }
 69 
 70 static void
 71 e_cal_config_calendar_item_class_init (ECalConfigCalendarItemClass *class)
 72 {
 73 	GObjectClass *object_class;
 74 	EExtensionClass *extension_class;
 75 
 76 	g_type_class_add_private (
 77 		class, sizeof (ECalConfigCalendarItemPrivate));
 78 
 79 	object_class = G_OBJECT_CLASS (class);
 80 	object_class->constructed = cal_config_calendar_item_constructed;
 81 
 82 	extension_class = E_EXTENSION_CLASS (class);
 83 	extension_class->extensible_type = E_TYPE_CALENDAR_ITEM;
 84 }
 85 
 86 static void
 87 e_cal_config_calendar_item_class_finalize (ECalConfigCalendarItemClass *class)
 88 {
 89 }
 90 
 91 static void
 92 e_cal_config_calendar_item_init (ECalConfigCalendarItem *extension)
 93 {
 94 	extension->priv = E_CAL_CONFIG_CALENDAR_ITEM_GET_PRIVATE (extension);
 95 }
 96 
 97 void
 98 e_cal_config_calendar_item_type_register (GTypeModule *type_module)
 99 {
100 	/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
101 	 *     function, so we have to wrap it with a public function in
102 	 *     order to register types from a separate compilation unit. */
103 	e_cal_config_calendar_item_register_type (type_module);
104 }