No issues found
1 /*
2 * e-cal-config-view.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-view.h"
24
25 #include <shell/e-shell.h>
26 #include <calendar/gui/e-day-view.h>
27 #include <calendar/gui/e-week-view.h>
28
29 #define E_CAL_CONFIG_VIEW_GET_PRIVATE(obj) \
30 (G_TYPE_INSTANCE_GET_PRIVATE \
31 ((obj), E_TYPE_CAL_CONFIG_VIEW, ECalConfigViewPrivate))
32
33 struct _ECalConfigViewPrivate {
34 gint placeholder;
35 };
36
37 G_DEFINE_DYNAMIC_TYPE (
38 ECalConfigView,
39 e_cal_config_view,
40 E_TYPE_EXTENSION)
41
42 static void
43 cal_config_view_constructed (GObject *object)
44 {
45 EExtension *extension;
46 EExtensible *extensible;
47 EShellSettings *shell_settings;
48 EShell *shell;
49
50 extension = E_EXTENSION (object);
51 extensible = e_extension_get_extensible (extension);
52
53 shell = e_shell_get_default ();
54 shell_settings = e_shell_get_shell_settings (shell);
55
56 g_object_bind_property (
57 shell_settings, "cal-time-divisions",
58 extensible, "time-divisions",
59 G_BINDING_BIDIRECTIONAL |
60 G_BINDING_SYNC_CREATE);
61
62 /*** EDayView ***/
63
64 if (E_IS_DAY_VIEW (extensible)) {
65
66 g_object_bind_property (
67 shell_settings, "cal-show-week-numbers",
68 E_DAY_VIEW (extensible)->week_number_label, "visible",
69 G_BINDING_SYNC_CREATE);
70
71 g_object_bind_property (
72 shell_settings, "cal-marcus-bains-show-line",
73 extensible, "marcus-bains-show-line",
74 G_BINDING_SYNC_CREATE);
75
76 g_object_bind_property (
77 shell_settings, "cal-marcus-bains-day-view-color",
78 extensible, "marcus-bains-day-view-color",
79 G_BINDING_SYNC_CREATE);
80
81 g_object_bind_property (
82 shell_settings, "cal-marcus-bains-time-bar-color",
83 extensible, "marcus-bains-time-bar-color",
84 G_BINDING_SYNC_CREATE);
85
86 g_object_bind_property (
87 shell_settings, "cal-working-days-bitset",
88 extensible, "working-days",
89 G_BINDING_SYNC_CREATE);
90 }
91
92 /*** EWeekView ***/
93
94 if (E_IS_WEEK_VIEW (extensible)) {
95
96 g_object_bind_property (
97 shell_settings, "cal-compress-weekend",
98 extensible, "compress-weekend",
99 G_BINDING_SYNC_CREATE);
100
101 g_object_bind_property (
102 shell_settings, "cal-show-event-end-times",
103 extensible, "show-event-end-times",
104 G_BINDING_SYNC_CREATE);
105 }
106
107 /* Chain up to parent's constructed() method. */
108 G_OBJECT_CLASS (e_cal_config_view_parent_class)->constructed (object);
109 }
110
111 static void
112 e_cal_config_view_class_init (ECalConfigViewClass *class)
113 {
114 GObjectClass *object_class;
115 EExtensionClass *extension_class;
116
117 g_type_class_add_private (class, sizeof (ECalConfigViewPrivate));
118
119 object_class = G_OBJECT_CLASS (class);
120 object_class->constructed = cal_config_view_constructed;
121
122 extension_class = E_EXTENSION_CLASS (class);
123 extension_class->extensible_type = E_TYPE_CALENDAR_VIEW;
124 }
125
126 static void
127 e_cal_config_view_class_finalize (ECalConfigViewClass *class)
128 {
129 }
130
131 static void
132 e_cal_config_view_init (ECalConfigView *extension)
133 {
134 extension->priv = E_CAL_CONFIG_VIEW_GET_PRIVATE (extension);
135 }
136
137 void
138 e_cal_config_view_type_register (GTypeModule *type_module)
139 {
140 /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
141 * function, so we have to wrap it with a public function in
142 * order to register types from a separate compilation unit. */
143 e_cal_config_view_register_type (type_module);
144 }