4 * This library is free software you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, see <http://www.gnu.org/licenses/>.
19 * SECTION: e-source-offline
20 * @include: libedataserver/libedataserver.h
21 * @short_description: #ESource extension for offline settings
23 * The #ESourceOffline extension tracks whether data from a remote
24 * server should be cached locally for viewing while offline.
26 * Access the extension as follows:
29 * #include <libedataserver/libedataserver.h>
31 * ESourceOffline *extension;
33 * extension = e_source_get_extension (source, E_SOURCE_EXTENSION_OFFLINE);
37 #include "e-source-offline.h"
39 #define E_SOURCE_OFFLINE_GET_PRIVATE(obj) \
40 (G_TYPE_INSTANCE_GET_PRIVATE \
41 ((obj), E_TYPE_SOURCE_OFFLINE, ESourceOfflinePrivate))
43 struct _ESourceOfflinePrivate {
44 gboolean stay_synchronized;
49 PROP_STAY_SYNCHRONIZED
55 E_TYPE_SOURCE_EXTENSION)
58 source_offline_set_property (GObject *object,
63 switch (property_id) {
64 case PROP_STAY_SYNCHRONIZED:
65 e_source_offline_set_stay_synchronized (
66 E_SOURCE_OFFLINE (object),
67 g_value_get_boolean (value));
71 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
75 source_offline_get_property (GObject *object,
80 switch (property_id) {
81 case PROP_STAY_SYNCHRONIZED:
84 e_source_offline_get_stay_synchronized (
85 E_SOURCE_OFFLINE (object)));
89 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
93 e_source_offline_class_init (ESourceOfflineClass *class)
95 GObjectClass *object_class;
96 ESourceExtensionClass *extension_class;
98 g_type_class_add_private (class, sizeof (ESourceOfflinePrivate));
100 object_class = G_OBJECT_CLASS (class);
101 object_class->set_property = source_offline_set_property;
102 object_class->get_property = source_offline_get_property;
104 extension_class = E_SOURCE_EXTENSION_CLASS (class);
105 extension_class->name = E_SOURCE_EXTENSION_OFFLINE;
107 g_object_class_install_property (
109 PROP_STAY_SYNCHRONIZED,
110 g_param_spec_boolean (
113 "Keep remote content synchronized locally",
117 G_PARAM_STATIC_STRINGS |
118 E_SOURCE_PARAM_SETTING));
122 e_source_offline_init (ESourceOffline *extension)
124 extension->priv = E_SOURCE_OFFLINE_GET_PRIVATE (extension);
128 * e_source_offline_get_stay_synchronized:
129 * @extension: an #ESourceOffline
131 * Returns whether data from a remote server should be cached locally
132 * for viewing while offline. Backends are responsible for implementing
135 * Returns: whether data should be cached for offline
140 e_source_offline_get_stay_synchronized (ESourceOffline *extension)
142 g_return_val_if_fail (E_IS_SOURCE_OFFLINE (extension), FALSE);
144 return extension->priv->stay_synchronized;
148 * e_source_offline_set_stay_synchronized:
149 * @extension: an #ESourceOffline
150 * @stay_synchronized: whether data should be cached for offline
152 * Sets whether data from a remote server should be cached locally for
153 * viewing while offline. Backends are responsible for implementing
159 e_source_offline_set_stay_synchronized (ESourceOffline *extension,
160 gboolean stay_synchronized)
162 g_return_if_fail (E_IS_SOURCE_OFFLINE (extension));
164 if (extension->priv->stay_synchronized == stay_synchronized)
167 extension->priv->stay_synchronized = stay_synchronized;
169 g_object_notify (G_OBJECT (extension), "stay-synchronized");