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-mdn
20 * @include: libedataserver/libedataserver.h
21 * @short_description: #ESource extension for MDN settings
23 * The #ESourceMDN extension tracks Message Disposition Notification
24 * settings for a mail account. See RFC 2298 for more information about
25 * Message Disposition Notification.
27 * Access the extension as follows:
30 * #include <libedataserver/libedataserver.h>
32 * ESourceMDN *extension;
34 * extension = e_source_get_extension (source, E_SOURCE_EXTENSION_MDN);
38 #include "e-source-mdn.h"
40 #include <libedataserver/e-source-enumtypes.h>
42 #define E_SOURCE_MDN_GET_PRIVATE(obj) \
43 (G_TYPE_INSTANCE_GET_PRIVATE \
44 ((obj), E_TYPE_SOURCE_MDN, ESourceMDNPrivate))
46 struct _ESourceMDNPrivate {
47 EMdnResponsePolicy response_policy;
58 E_TYPE_SOURCE_EXTENSION)
61 source_mdn_set_property (GObject *object,
66 switch (property_id) {
67 case PROP_RESPONSE_POLICY:
68 e_source_mdn_set_response_policy (
69 E_SOURCE_MDN (object),
70 g_value_get_enum (value));
74 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
78 source_mdn_get_property (GObject *object,
83 switch (property_id) {
84 case PROP_RESPONSE_POLICY:
87 e_source_mdn_get_response_policy (
88 E_SOURCE_MDN (object)));
92 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
96 e_source_mdn_class_init (ESourceMDNClass *class)
98 GObjectClass *object_class;
99 ESourceExtensionClass *extension_class;
101 g_type_class_add_private (class, sizeof (ESourceMDNPrivate));
103 object_class = G_OBJECT_CLASS (class);
104 object_class->set_property = source_mdn_set_property;
105 object_class->get_property = source_mdn_get_property;
107 extension_class = E_SOURCE_EXTENSION_CLASS (class);
108 extension_class->name = E_SOURCE_EXTENSION_MDN;
110 g_object_class_install_property (
112 PROP_RESPONSE_POLICY,
116 "Policy for responding to MDN requests",
117 E_TYPE_MDN_RESPONSE_POLICY,
118 E_MDN_RESPONSE_POLICY_ASK,
121 G_PARAM_STATIC_STRINGS |
122 E_SOURCE_PARAM_SETTING));
126 e_source_mdn_init (ESourceMDN *extension)
128 extension->priv = E_SOURCE_MDN_GET_PRIVATE (extension);
132 * e_source_mdn_get_response_policy:
133 * @extension: an #ESourceMDN
135 * Returns the policy for this mail account on responding to Message
136 * Disposition Notification requests when receiving mail messages.
138 * Returns: the #EMdnResponsePolicy for this account
143 e_source_mdn_get_response_policy (ESourceMDN *extension)
145 g_return_val_if_fail (
146 E_IS_SOURCE_MDN (extension),
147 E_MDN_RESPONSE_POLICY_NEVER);
149 return extension->priv->response_policy;
153 * e_source_mdn_set_response_policy:
154 * @extension: an #ESourceMDN
155 * @response_policy: the #EMdnResponsePolicy
157 * Sets the policy for this mail account on responding to Message
158 * Disposition Notification requests when receiving mail messages.
163 e_source_mdn_set_response_policy (ESourceMDN *extension,
164 EMdnResponsePolicy response_policy)
166 g_return_if_fail (E_IS_SOURCE_MDN (extension));
168 if (extension->priv->response_policy == response_policy)
171 extension->priv->response_policy = response_policy;
173 g_object_notify (G_OBJECT (extension), "response-policy");