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.
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.
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/>
20 * SECTION: e-source-mdn
21 * @include: libedataserver/libedataserver.h
22 * @short_description: #ESource extension for MDN settings
24 * The #ESourceMDN extension tracks Message Disposition Notification
25 * settings for a mail account. See RFC 2298 for more information about
26 * Message Disposition Notification.
28 * Access the extension as follows:
31 * #include <libedataserver/libedataserver.h>
33 * ESourceMDN *extension;
35 * extension = e_source_get_extension (source, E_SOURCE_EXTENSION_MDN);
39 #include "e-source-mdn.h"
41 #include <libedataserver/e-source-enumtypes.h>
43 #define E_SOURCE_MDN_GET_PRIVATE(obj) \
44 (G_TYPE_INSTANCE_GET_PRIVATE \
45 ((obj), E_TYPE_SOURCE_MDN, ESourceMDNPrivate))
47 struct _ESourceMDNPrivate {
48 EMdnResponsePolicy response_policy;
59 E_TYPE_SOURCE_EXTENSION)
62 source_mdn_set_property (GObject *object,
67 switch (property_id) {
68 case PROP_RESPONSE_POLICY:
69 e_source_mdn_set_response_policy (
70 E_SOURCE_MDN (object),
71 g_value_get_enum (value));
75 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
79 source_mdn_get_property (GObject *object,
84 switch (property_id) {
85 case PROP_RESPONSE_POLICY:
88 e_source_mdn_get_response_policy (
89 E_SOURCE_MDN (object)));
93 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
97 e_source_mdn_class_init (ESourceMDNClass *class)
99 GObjectClass *object_class;
100 ESourceExtensionClass *extension_class;
102 g_type_class_add_private (class, sizeof (ESourceMDNPrivate));
104 object_class = G_OBJECT_CLASS (class);
105 object_class->set_property = source_mdn_set_property;
106 object_class->get_property = source_mdn_get_property;
108 extension_class = E_SOURCE_EXTENSION_CLASS (class);
109 extension_class->name = E_SOURCE_EXTENSION_MDN;
111 g_object_class_install_property (
113 PROP_RESPONSE_POLICY,
117 "Policy for responding to MDN requests",
118 E_TYPE_MDN_RESPONSE_POLICY,
119 E_MDN_RESPONSE_POLICY_ASK,
122 G_PARAM_STATIC_STRINGS |
123 E_SOURCE_PARAM_SETTING));
127 e_source_mdn_init (ESourceMDN *extension)
129 extension->priv = E_SOURCE_MDN_GET_PRIVATE (extension);
133 * e_source_mdn_get_response_policy:
134 * @extension: an #ESourceMDN
136 * Returns the policy for this mail account on responding to Message
137 * Disposition Notification requests when receiving mail messages.
139 * Returns: the #EMdnResponsePolicy for this account
144 e_source_mdn_get_response_policy (ESourceMDN *extension)
146 g_return_val_if_fail (
147 E_IS_SOURCE_MDN (extension),
148 E_MDN_RESPONSE_POLICY_NEVER);
150 return extension->priv->response_policy;
154 * e_source_mdn_set_response_policy:
155 * @extension: an #ESourceMDN
156 * @response_policy: the #EMdnResponsePolicy
158 * Sets the policy for this mail account on responding to Message
159 * Disposition Notification requests when receiving mail messages.
164 e_source_mdn_set_response_policy (ESourceMDN *extension,
165 EMdnResponsePolicy response_policy)
167 g_return_if_fail (E_IS_SOURCE_MDN (extension));
169 if (extension->priv->response_policy == response_policy)
172 extension->priv->response_policy = response_policy;
174 g_object_notify (G_OBJECT (extension), "response-policy");