No issues found
1 /*
2 * e-cal-config-date-edit.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-date-edit.h"
24
25 #include <shell/e-shell.h>
26 #include <misc/e-dateedit.h>
27
28 #define E_CAL_CONFIG_DATE_EDIT_GET_PRIVATE(obj) \
29 (G_TYPE_INSTANCE_GET_PRIVATE \
30 ((obj), E_TYPE_CAL_CONFIG_DATE_EDIT, ECalConfigDateEditPrivate))
31
32 struct _ECalConfigDateEditPrivate {
33 gint placeholder;
34 };
35
36 G_DEFINE_DYNAMIC_TYPE (
37 ECalConfigDateEdit,
38 e_cal_config_date_edit,
39 E_TYPE_EXTENSION)
40
41 static void
42 cal_config_date_edit_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_date_edit_parent_class)->
67 constructed (object);
68 }
69
70 static void
71 e_cal_config_date_edit_class_init (ECalConfigDateEditClass *class)
72 {
73 GObjectClass *object_class;
74 EExtensionClass *extension_class;
75
76 g_type_class_add_private (class, sizeof (ECalConfigDateEditPrivate));
77
78 object_class = G_OBJECT_CLASS (class);
79 object_class->constructed = cal_config_date_edit_constructed;
80
81 extension_class = E_EXTENSION_CLASS (class);
82 extension_class->extensible_type = E_TYPE_DATE_EDIT;
83 }
84
85 static void
86 e_cal_config_date_edit_class_finalize (ECalConfigDateEditClass *class)
87 {
88 }
89
90 static void
91 e_cal_config_date_edit_init (ECalConfigDateEdit *extension)
92 {
93 extension->priv = E_CAL_CONFIG_DATE_EDIT_GET_PRIVATE (extension);
94 }
95
96 void
97 e_cal_config_date_edit_type_register (GTypeModule *type_module)
98 {
99 /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
100 * function, so we have to wrap it with a public function in
101 * order to register types from a separate compilation unit. */
102 e_cal_config_date_edit_register_type (type_module);
103 }