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-uoa
21 * @include: libedataserver/libedataserver.h
22 * @short_description: #ESource extension for Ubuntu Online Accounts
24 * The #ESourceUoa extension associates an #ESource with an #AgAccount.
25 * This extension is usually found in a top-level #ESource, with various
26 * mail, calendar and address book data sources as children.
28 * Access the extension as follows:
31 * #include <libedataserver/libedataserver.h>
33 * ESourceUoa *extension;
35 * extension = e_source_get_extension (source, E_SOURCE_EXTENSION_UOA);
39 #include "e-source-uoa.h"
41 #include <libedataserver/e-data-server-util.h>
43 #define E_SOURCE_UOA_GET_PRIVATE(obj) \
44 (G_TYPE_INSTANCE_GET_PRIVATE \
45 ((obj), E_TYPE_SOURCE_UOA, ESourceUoaPrivate))
47 struct _ESourceUoaPrivate {
59 E_TYPE_SOURCE_EXTENSION)
62 source_uoa_set_property (GObject *object,
67 switch (property_id) {
69 e_source_uoa_set_account_id (
70 E_SOURCE_UOA (object),
71 g_value_get_uint (value));
75 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
79 source_uoa_get_property (GObject *object,
84 switch (property_id) {
88 e_source_uoa_get_account_id (
89 E_SOURCE_UOA (object)));
93 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
97 e_source_uoa_class_init (ESourceUoaClass *class)
99 GObjectClass *object_class;
100 ESourceExtensionClass *extension_class;
102 g_type_class_add_private (class, sizeof (ESourceUoaPrivate));
104 object_class = G_OBJECT_CLASS (class);
105 object_class->set_property = source_uoa_set_property;
106 object_class->get_property = source_uoa_get_property;
108 extension_class = E_SOURCE_EXTENSION_CLASS (class);
109 extension_class->name = E_SOURCE_EXTENSION_UOA;
111 g_object_class_install_property (
117 "Ubuntu Online Account ID",
121 G_PARAM_STATIC_STRINGS |
122 E_SOURCE_PARAM_SETTING));
126 e_source_uoa_init (ESourceUoa *extension)
128 extension->priv = E_SOURCE_UOA_GET_PRIVATE (extension);
132 * e_source_uoa_get_account_id:
133 * @extension: an #ESourceUoa
135 * Returns the numeric identifier of the Ubuntu Online Account associated
136 * with the #ESource to which @extension belongs.
138 * Returns: the associated Ubuntu Online Account ID
143 e_source_uoa_get_account_id (ESourceUoa *extension)
145 g_return_val_if_fail (E_IS_SOURCE_UOA (extension), 0);
147 return extension->priv->account_id;
151 * e_source_uoa_set_account_id:
152 * @extension: an #ESourceUoa
153 * @account_id: the associated Ubuntu Online Account ID
155 * Sets the numeric identifier of the Ubuntu Online Account associated
156 * with the #ESource to which @extension belongs.
161 e_source_uoa_set_account_id (ESourceUoa *extension,
164 g_return_if_fail (E_IS_SOURCE_UOA (extension));
166 if (extension->priv->account_id == account_id)
169 extension->priv->account_id = account_id;
171 g_object_notify (G_OBJECT (extension), "account-id");