2 * Copyright © 2012 Collabora Ltd.
4 * This library 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.1 of the License, or (at your option) any later version.
9 * This library 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 this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include "mcp-account-manager-uoa.h"
22 #include <telepathy-glib/telepathy-glib.h>
27 #define PLUGIN_NAME "uoa"
28 #define PLUGIN_PRIORITY (MCP_ACCOUNT_STORAGE_PLUGIN_PRIO_KEYRING + 10)
29 #define PLUGIN_DESCRIPTION "Provide Telepathy Accounts from UOA via libaccounts-glib"
30 #define PLUGIN_PROVIDER EMPATHY_UOA_PROVIDER
34 static void account_storage_iface_init (McpAccountStorageIface *iface);
36 G_DEFINE_TYPE_WITH_CODE (McpAccountManagerUoa, mcp_account_manager_uoa,
38 G_IMPLEMENT_INTERFACE (MCP_TYPE_ACCOUNT_STORAGE,
39 account_storage_iface_init));
41 struct _McpAccountManagerUoaPrivate
46 mcp_account_manager_uoa_dispose (GObject *object)
48 G_OBJECT_CLASS (mcp_account_manager_uoa_parent_class)->dispose (object);
52 mcp_account_manager_uoa_init (McpAccountManagerUoa *self)
54 DEBUG ("UOA MC plugin initialised");
56 self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
57 MCP_TYPE_ACCOUNT_MANAGER_UOA, McpAccountManagerUoaPrivate);
61 mcp_account_manager_uoa_class_init (McpAccountManagerUoaClass *klass)
63 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
65 gobject_class->dispose = mcp_account_manager_uoa_dispose;
67 g_type_class_add_private (gobject_class,
68 sizeof (McpAccountManagerUoaPrivate));
72 account_manager_uoa_list (const McpAccountStorage *storage,
73 const McpAccountManager *am)
79 account_manager_uoa_get (const McpAccountStorage *storage,
80 const McpAccountManager *am,
88 account_manager_uoa_set (const McpAccountStorage *storage,
89 const McpAccountManager *am,
98 account_manager_uoa_delete (const McpAccountStorage *storage,
99 const McpAccountManager *am,
107 account_manager_uoa_commit (const McpAccountStorage *storage,
108 const McpAccountManager *am)
114 account_manager_uoa_ready (const McpAccountStorage *storage,
115 const McpAccountManager *am)
120 account_manager_uoa_get_identifier (const McpAccountStorage *storage,
127 account_manager_uoa_create_account (const McpAccountStorage *storage,
128 const gchar *cm_name,
129 const gchar *protocol_name,
136 account_storage_iface_init (McpAccountStorageIface *iface)
138 mcp_account_storage_iface_set_name (iface, PLUGIN_NAME);
139 mcp_account_storage_iface_set_desc (iface, PLUGIN_DESCRIPTION);
140 mcp_account_storage_iface_set_priority (iface, PLUGIN_PRIORITY);
141 mcp_account_storage_iface_set_provider (iface, PLUGIN_PROVIDER);
143 #define IMPLEMENT(x) mcp_account_storage_iface_implement_##x(iface, \
144 account_manager_uoa_##x)
151 IMPLEMENT (get_identifier);
152 IMPLEMENT (create_account);
156 McpAccountManagerUoa *
157 mcp_account_manager_uoa_new (void)
159 return g_object_new (MCP_TYPE_ACCOUNT_MANAGER_UOA, NULL);