2
* account-manager.c - proxy for the Telepathy account manager
4
* Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
5
* Copyright (C) 2009 Nokia Corporation
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
#include "telepathy-glib/account-manager.h"
24
#include <telepathy-glib/dbus.h>
25
#include <telepathy-glib/defs.h>
26
#include <telepathy-glib/errors.h>
27
#include <telepathy-glib/interfaces.h>
28
#include <telepathy-glib/proxy-subclass.h>
30
#define DEBUG_FLAG TP_DEBUG_ACCOUNTS
31
#include "telepathy-glib/debug-internal.h"
33
#include "telepathy-glib/_gen/tp-cli-account-manager-body.h"
36
* SECTION:account-manager
37
* @title: TpAccountManager
38
* @short_description: proxy object for the Telepathy account manager
39
* @see_also: #TpAccount
41
* The #TpAccountManager object is used to communicate with the Telepathy
42
* AccountManager service.
50
* The Telepathy Account Manager stores real-time communication accounts and
51
* their configuration, places accounts online on request, and manipulates
52
* accounts' presence, nicknames and avatars.
54
* This proxy is usable but incomplete: GObject signals and accessors for the
55
* D-Bus properties will be added in a later version of telepathy-glib, along
56
* with a mechanism similar to tp_connection_call_when_ready().
58
* Until suitable convenience methods are implemented, the generic
59
* tp_cli_dbus_properties_call_get_all() method can be used to get the D-Bus
66
* TpAccountManagerClass:
68
* The class of a #TpAccount.
71
struct _TpAccountManagerPrivate {
75
G_DEFINE_TYPE (TpAccountManager, tp_account_manager, TP_TYPE_PROXY);
78
tp_account_manager_init (TpAccountManager *self)
80
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TP_TYPE_ACCOUNT_MANAGER,
81
TpAccountManagerPrivate);
85
tp_account_manager_constructed (GObject *object)
87
TpAccountManager *self = TP_ACCOUNT_MANAGER (object);
88
void (*chain_up) (GObject *) =
89
((GObjectClass *) tp_account_manager_parent_class)->constructed;
94
g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL);
98
tp_account_manager_class_init (TpAccountManagerClass *klass)
100
TpProxyClass *proxy_class = (TpProxyClass *) klass;
101
GObjectClass *object_class = (GObjectClass *) klass;
103
g_type_class_add_private (klass, sizeof (TpAccountManagerPrivate));
105
object_class->constructed = tp_account_manager_constructed;
107
proxy_class->interface = TP_IFACE_QUARK_ACCOUNT_MANAGER;
108
tp_account_manager_init_known_interfaces ();
112
* tp_account_manager_init_known_interfaces:
114
* Ensure that the known interfaces for TpAccountManager have been set up.
115
* This is done automatically when necessary, but for correct
116
* overriding of library interfaces by local extensions, you should
117
* call this function before calling
118
* tp_proxy_or_subclass_hook_on_interface_add() with first argument
119
* %TP_TYPE_ACCOUNT_MANAGER.
124
tp_account_manager_init_known_interfaces (void)
126
static gsize once = 0;
128
if (g_once_init_enter (&once))
130
GType tp_type = TP_TYPE_ACCOUNT_MANAGER;
132
tp_proxy_init_known_interfaces ();
133
tp_proxy_or_subclass_hook_on_interface_add (tp_type,
134
tp_cli_account_manager_add_signals);
135
tp_proxy_subclass_add_error_mapping (tp_type,
136
TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR);
138
g_once_init_leave (&once, 1);
143
* tp_account_manager_new:
144
* @bus_daemon: Proxy for the D-Bus daemon
146
* Convenience function to create a new account manager proxy.
148
* Returns: a new reference to an account manager proxy
151
tp_account_manager_new (TpDBusDaemon *bus_daemon)
153
TpAccountManager *self;
155
g_return_val_if_fail (bus_daemon != NULL, NULL);
157
self = TP_ACCOUNT_MANAGER (g_object_new (TP_TYPE_ACCOUNT_MANAGER,
158
"dbus-daemon", bus_daemon,
159
"dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection,
160
"bus-name", TP_ACCOUNT_MANAGER_BUS_NAME,
161
"object-path", TP_ACCOUNT_MANAGER_OBJECT_PATH,