[telepathy-glib/master] Add generated code and skeletal proxies for Account, AccountManager

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Jun 8 09:36:01 PDT 2009


---
 docs/reference/telepathy-glib-sections.txt |  133 +++++++++++++++++++
 docs/reference/telepathy-glib.types        |    9 ++
 telepathy-glib/Makefile.am                 |   24 ++++
 telepathy-glib/account-manager.c           |  138 ++++++++++++++++++++
 telepathy-glib/account-manager.h           |   72 +++++++++++
 telepathy-glib/account-manager.xml         |    9 ++
 telepathy-glib/account.c                   |  191 ++++++++++++++++++++++++++++
 telepathy-glib/account.h                   |   73 +++++++++++
 telepathy-glib/account.xml                 |   11 ++
 telepathy-glib/debug-internal.h            |    3 +-
 telepathy-glib/debug.c                     |    3 +
 telepathy-glib/defs.h                      |   25 ++++-
 telepathy-glib/extra-gtkdoc.h              |   28 ++++
 telepathy-glib/stable-interfaces.xml       |    3 +
 telepathy-glib/svc-account-manager.h       |    6 +
 telepathy-glib/svc-account.h               |    6 +
 16 files changed, 731 insertions(+), 3 deletions(-)
 create mode 100644 telepathy-glib/account-manager.c
 create mode 100644 telepathy-glib/account-manager.h
 create mode 100644 telepathy-glib/account-manager.xml
 create mode 100644 telepathy-glib/account.c
 create mode 100644 telepathy-glib/account.h
 create mode 100644 telepathy-glib/account.xml
 create mode 100644 telepathy-glib/svc-account-manager.h
 create mode 100644 telepathy-glib/svc-account.h

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index d7eb70d..5147a61 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -22,6 +22,9 @@ TP_CM_BUS_NAME_BASE
 TP_CM_OBJECT_PATH_BASE
 TP_CONN_BUS_NAME_BASE
 TP_CONN_OBJECT_PATH_BASE
+TP_ACCOUNT_MANAGER_BUS_NAME
+TP_ACCOUNT_MANAGER_OBJECT_PATH
+TP_ACCOUNT_OBJECT_PATH_BASE
 </SECTION>
 
 <SECTION>
@@ -1160,6 +1163,9 @@ TP_HASH_TYPE_CHANNEL_CALL_STATE_MAP
 # Channel - Room List
 TP_ARRAY_TYPE_ROOM_INFO_LIST
 TP_STRUCT_TYPE_ROOM_INFO
+<SUBSECTION>
+# Account and AM
+TP_STRUCT_TYPE_AVATAR
 <SUBSECTION Private>
 tp_type_dbus_array_a_7bsv_7das
 tp_type_dbus_array_oa_7bsv_7d
@@ -1197,6 +1203,7 @@ tp_type_dbus_hash_us
 tp_type_dbus_hash_uu
 tp_type_dbus_hash_uv
 tp_type_dbus_struct_a_7bsv_7das
+tp_type_dbus_struct_ays
 tp_type_dbus_struct_oa_7bsv_7d
 tp_type_dbus_struct_os
 tp_type_dbus_struct_osuu
@@ -1853,6 +1860,12 @@ NUM_TP_TUBE_CHANNEL_STATES
 <FILE>interfaces</FILE>
 <TITLE>interfaces</TITLE>
 <INCLUDE>telepathy-glib/interfaces.h</INCLUDE>
+TP_IFACE_ACCOUNT
+TP_IFACE_QUARK_ACCOUNT
+TP_IFACE_ACCOUNT_INTERFACE_AVATAR
+TP_IFACE_QUARK_ACCOUNT_INTERFACE_AVATAR
+TP_IFACE_ACCOUNT_MANAGER
+TP_IFACE_QUARK_ACCOUNT_MANAGER
 TP_IFACE_DBUS_DAEMON
 TP_IFACE_QUARK_DBUS_DAEMON
 TP_IFACE_DBUS_INTROSPECTABLE
@@ -1924,6 +1937,9 @@ TP_IFACE_QUARK_MEDIA_STREAM_HANDLER
 TP_IFACE_PROPERTIES_INTERFACE
 TP_IFACE_QUARK_PROPERTIES_INTERFACE
 <SUBSECTION Private>
+tp_iface_quark_account
+tp_iface_quark_account_interface_avatar
+tp_iface_quark_account_manager
 tp_iface_quark_dbus_introspectable
 tp_iface_quark_dbus_peer
 tp_iface_quark_dbus_properties
@@ -2798,3 +2814,120 @@ TP_TYPE_CONTACT
 TpContactClass
 TpContactPrivate
 </SECTION>
+
+<SECTION>
+<FILE>svc-account</FILE>
+<INCLUDE>telepathy-glib/svc-account.h</INCLUDE>
+<TITLE>svc-account</TITLE>
+TpSvcAccount
+TpSvcAccountClass
+tp_svc_account_emit_account_property_changed
+tp_svc_account_emit_removed
+tp_svc_account_reconnect_impl
+tp_svc_account_return_from_reconnect
+tp_svc_account_implement_reconnect
+tp_svc_account_remove_impl
+tp_svc_account_return_from_remove
+tp_svc_account_implement_remove
+tp_svc_account_update_parameters_impl
+tp_svc_account_return_from_update_parameters
+tp_svc_account_implement_update_parameters
+<SUBSECTION Standard>
+TP_SVC_ACCOUNT
+TP_IS_SVC_ACCOUNT
+TP_TYPE_SVC_ACCOUNT
+tp_svc_account_get_type
+TP_SVC_ACCOUNT_GET_CLASS
+<SUBSECTION>
+TpSvcAccountInterfaceAvatar
+TpSvcAccountInterfaceAvatarClass
+tp_svc_account_interface_avatar_emit_avatar_changed
+<SUBSECTION Standard>
+TP_SVC_ACCOUNT_INTERFACE_AVATAR
+TP_IS_SVC_ACCOUNT_INTERFACE_AVATAR
+TP_TYPE_SVC_ACCOUNT_INTERFACE_AVATAR
+tp_svc_account_interface_avatar_get_type
+TP_SVC_ACCOUNT_INTERFACE_AVATAR_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>svc-account-manager</FILE>
+<INCLUDE>telepathy-glib/svc-account-manager.h</INCLUDE>
+<TITLE>svc-account-manager</TITLE>
+TpSvcAccountManager
+TpSvcAccountManagerClass
+tp_svc_account_manager_emit_account_removed
+tp_svc_account_manager_emit_account_validity_changed
+tp_svc_account_manager_create_account_impl
+tp_svc_account_manager_return_from_create_account
+tp_svc_account_manager_implement_create_account
+<SUBSECTION Standard>
+TP_SVC_ACCOUNT_MANAGER
+TP_IS_SVC_ACCOUNT_MANAGER
+TP_TYPE_SVC_ACCOUNT_MANAGER
+tp_svc_account_manager_get_type
+TP_SVC_ACCOUNT_MANAGER_GET_CLASS
+</SECTION>
+
+<SECTION>
+<FILE>account</FILE>
+<INCLUDE>telepathy-glib/account.h</INCLUDE>
+<TITLE>account</TITLE>
+TpAccount
+TpAccountClass
+tp_account_new
+<SUBSECTION>
+tp_cli_account_callback_for_reconnect
+tp_cli_account_call_reconnect
+tp_cli_account_callback_for_remove
+tp_cli_account_call_remove
+tp_cli_account_callback_for_update_parameters
+tp_cli_account_call_update_parameters
+tp_cli_account_signal_callback_account_property_changed
+tp_cli_account_connect_to_account_property_changed
+tp_cli_account_signal_callback_removed
+tp_cli_account_connect_to_removed
+<SUBSECTION>
+tp_cli_account_interface_avatar_signal_callback_avatar_changed
+tp_cli_account_interface_avatar_connect_to_avatar_changed
+<SUBSECTION Standard>
+TP_ACCOUNT
+TP_IS_ACCOUNT
+TP_IS_ACCOUNT_CLASS
+TP_TYPE_ACCOUNT
+tp_account_get_type
+TP_ACCOUNT_CLASS
+TP_ACCOUNT_GET_CLASS
+TpAccountPrivate
+TpAccountClassPrivate
+tp_cli_account_run_reconnect
+tp_cli_account_run_remove
+tp_cli_account_run_update_parameters
+</SECTION>
+
+<SECTION>
+<FILE>account-manager</FILE>
+<INCLUDE>telepathy-glib/account-manager.h</INCLUDE>
+<TITLE>account-manager</TITLE>
+TpAccountManager
+TpAccountManagerClass
+tp_account_manager_new
+<SUBSECTION>
+tp_cli_account_manager_callback_for_create_account
+tp_cli_account_manager_call_create_account
+tp_cli_account_manager_signal_callback_account_removed
+tp_cli_account_manager_connect_to_account_removed
+tp_cli_account_manager_signal_callback_account_validity_changed
+tp_cli_account_manager_connect_to_account_validity_changed
+<SUBSECTION Standard>
+TP_ACCOUNT_MANAGER
+TP_IS_ACCOUNT_MANAGER
+TP_IS_ACCOUNT_MANAGER_CLASS
+TP_TYPE_ACCOUNT_MANAGER
+tp_account_manager_get_type
+TP_ACCOUNT_MANAGER_CLASS
+TP_ACCOUNT_MANAGER_GET_CLASS
+TpAccountManagerPrivate
+TpAccountManagerClassPrivate
+tp_cli_account_manager_run_create_account
+</SECTION>
diff --git a/docs/reference/telepathy-glib.types b/docs/reference/telepathy-glib.types
index ea50da6..5184ee1 100644
--- a/docs/reference/telepathy-glib.types
+++ b/docs/reference/telepathy-glib.types
@@ -1,3 +1,5 @@
+#include <telepathy-glib/account.h>
+#include <telepathy-glib/account-manager.h>
 #include <telepathy-glib/base-connection.h>
 #include <telepathy-glib/base-connection-manager.h>
 #include <telepathy-glib/channel-factory-iface.h>
@@ -13,6 +15,8 @@
 #include <telepathy-glib/handle-repo-static.h>
 #include <telepathy-glib/media-interfaces.h>
 #include <telepathy-glib/proxy.h>
+#include <telepathy-glib/svc-account.h>
+#include <telepathy-glib/svc-account-manager.h>
 #include <telepathy-glib/svc-channel.h>
 #include <telepathy-glib/svc-connection.h>
 #include <telepathy-glib/svc-connection-manager.h>
@@ -20,6 +24,8 @@
 #include <telepathy-glib/svc-media-interfaces.h>
 #include <telepathy-glib/svc-properties-interface.h>
 
+tp_account_get_type
+tp_account_manager_get_type
 tp_base_connection_get_type
 tp_base_connection_manager_get_type
 tp_channel_factory_iface_get_type
@@ -37,6 +43,9 @@ tp_handle_repo_iface_get_type
 tp_media_session_handler_get_type
 tp_media_stream_handler_get_type
 tp_proxy_get_type
+tp_svc_account_get_type
+tp_svc_account_interface_avatar_get_type
+tp_svc_account_manager_get_type
 tp_svc_channel_get_type
 tp_svc_channel_interface_call_state_get_type
 tp_svc_channel_interface_chat_state_get_type
diff --git a/telepathy-glib/Makefile.am b/telepathy-glib/Makefile.am
index 5b167c8..d3ad8ef 100644
--- a/telepathy-glib/Makefile.am
+++ b/telepathy-glib/Makefile.am
@@ -39,6 +39,8 @@ ABI_LISTS = \
 
 EXTRA_DIST = \
     $(ABI_LISTS) \
+    account.xml \
+    account-manager.xml \
     channel.xml \
     connection.xml \
     connection-manager.xml \
@@ -114,6 +116,8 @@ libtelepathy_glib_la_LDFLAGS += -export-symbols-regex '^tp'
 endif # !HAVE_LD_VERSION_SCRIPT
 
 tpginclude_HEADERS = \
+    account.h \
+    account-manager.h \
     base-connection.h \
     base-connection-manager.h \
     channel.h \
@@ -166,6 +170,8 @@ nodist_libtelepathy_glib_internal_la_SOURCES = \
     _gen/interfaces-body.h \
     _gen/gtypes-body.h \
     _gen/register-dbus-glib-marshallers-body.h \
+    _gen/tp-cli-account-body.h \
+    _gen/tp-cli-account-manager-body.h \
     _gen/tp-cli-channel-body.h \
     _gen/tp-cli-connection-body.h \
     _gen/tp-cli-connection-manager-body.h \
@@ -173,6 +179,8 @@ nodist_libtelepathy_glib_internal_la_SOURCES = \
     _gen/tp-cli-generic-body.h \
     _gen/tp-cli-media-session-handler-body.h \
     _gen/tp-cli-media-stream-handler-body.h \
+    _gen/tp-svc-account.c \
+    _gen/tp-svc-account-manager.c \
     _gen/tp-svc-channel.c \
     _gen/tp-svc-connection.c \
     _gen/tp-svc-connection-manager.c \
@@ -185,6 +193,8 @@ nodist_geninclude_HEADERS = \
     _gen/telepathy-enums.h \
     _gen/telepathy-interfaces.h \
     _gen/gtypes.h \
+    _gen/tp-cli-account.h \
+    _gen/tp-cli-account-manager.h \
     _gen/tp-cli-channel.h \
     _gen/tp-cli-connection.h \
     _gen/tp-cli-connection-manager.h \
@@ -192,6 +202,8 @@ nodist_geninclude_HEADERS = \
     _gen/tp-cli-generic.h \
     _gen/tp-cli-media-session-handler.h \
     _gen/tp-cli-media-stream-handler.h \
+    _gen/tp-svc-account.h \
+    _gen/tp-svc-account-manager.h \
     _gen/tp-svc-channel.h \
     _gen/tp-svc-connection.h \
     _gen/tp-svc-connection-manager.h \
@@ -221,6 +233,8 @@ check-local: check-coding-style
 
 libtelepathy_glib_internal_la_LIBADD = $(ALL_LIBS)
 libtelepathy_glib_internal_la_SOURCES = \
+    account.c \
+    account-manager.c \
     base-connection.c \
     base-connection-manager.c \
     channel.c \
@@ -365,6 +379,16 @@ _gen/tp-cli-%-body.h _gen/tp-cli-%.h: _gen/tp-spec-%.xml \
 		generic) \
 			maybe_reentrant=--generate-reentrant; \
 			;; \
+		account-manager) \
+			subclass=--subclass=TpAccountManager; \
+			subclass_assert=--subclass-assert=TP_IS_ACCOUNT_MANAGER; \
+			maybe_reentrant=--generate-reentrant; \
+			;; \
+		account) \
+			subclass=--subclass=TpAccount; \
+			subclass_assert=--subclass-assert=TP_IS_ACCOUNT; \
+			maybe_reentrant=--generate-reentrant; \
+			;; \
 		channel) \
 			subclass=--subclass=TpChannel; \
 			subclass_assert=--subclass-assert=TP_IS_CHANNEL; \
diff --git a/telepathy-glib/account-manager.c b/telepathy-glib/account-manager.c
new file mode 100644
index 0000000..0817c1a
--- /dev/null
+++ b/telepathy-glib/account-manager.c
@@ -0,0 +1,138 @@
+/*
+ * account-manager.c - proxy for the Telepathy account manager
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "telepathy-glib/account-manager.h"
+
+#include <telepathy-glib/dbus.h>
+#include <telepathy-glib/defs.h>
+#include <telepathy-glib/errors.h>
+#include <telepathy-glib/interfaces.h>
+#include <telepathy-glib/proxy-subclass.h>
+
+#define DEBUG_FLAG TP_DEBUG_ACCOUNTS
+#include "telepathy-glib/debug-internal.h"
+
+#include "telepathy-glib/_gen/tp-cli-account-manager-body.h"
+
+/**
+ * SECTION:account-manager
+ * @title: TpAccountManager
+ * @short_description: proxy object for the Telepathy account manager
+ * @see_also: #TpAccount
+ *
+ * The #TpAccountManager object is used to communicate with the Telepathy
+ * AccountManager service.
+ *
+ * Since: 0.7.UNRELEASED
+ */
+
+/**
+ * TpAccountManager:
+ *
+ * The Telepathy Account Manager stores real-time communication accounts and
+ * their configuration, places accounts online on request, and manipulates
+ * accounts' presence, nicknames and avatars.
+ *
+ * This proxy is usable but incomplete: GObject signals and accessors for the
+ * D-Bus properties will be added in a later version of telepathy-glib, along
+ * with a mechanism similar to tp_connection_call_when_ready().
+ *
+ * Until suitable convenience methods are implemented, the generic
+ * tp_cli_dbus_properties_call_get_all() method can be used to get the D-Bus
+ * properties.
+ *
+ * Since: 0.7.UNRELEASED
+ */
+
+/**
+ * TpAccountManagerClass:
+ *
+ * The class of a #TpAccount.
+ */
+
+struct _TpAccountManagerPrivate {
+    gpointer dummy;
+};
+
+G_DEFINE_TYPE (TpAccountManager, tp_account_manager, TP_TYPE_PROXY);
+
+static void
+tp_account_manager_init (TpAccountManager *self)
+{
+  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TP_TYPE_ACCOUNT_MANAGER,
+      TpAccountManagerPrivate);
+}
+
+static void
+tp_account_manager_constructed (GObject *object)
+{
+  TpAccountManager *self = TP_ACCOUNT_MANAGER (object);
+  void (*chain_up) (GObject *) =
+    ((GObjectClass *) tp_account_manager_parent_class)->constructed;
+
+  if (chain_up != NULL)
+    chain_up (object);
+
+  g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL);
+}
+
+static void
+tp_account_manager_class_init (TpAccountManagerClass *klass)
+{
+  GType tp_type = TP_TYPE_ACCOUNT_MANAGER;
+  TpProxyClass *proxy_class = (TpProxyClass *) klass;
+  GObjectClass *object_class = (GObjectClass *) klass;
+
+  g_type_class_add_private (klass, sizeof (TpAccountManagerPrivate));
+
+  object_class->constructed = tp_account_manager_constructed;
+
+  proxy_class->interface = TP_IFACE_QUARK_ACCOUNT_MANAGER;
+  tp_proxy_or_subclass_hook_on_interface_add (tp_type,
+      tp_cli_account_manager_add_signals);
+  tp_proxy_subclass_add_error_mapping (tp_type,
+      TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR);
+}
+
+/**
+ * tp_account_manager_new:
+ * @bus_daemon: Proxy for the D-Bus daemon
+ *
+ * Convenience function to create a new account manager proxy.
+ *
+ * Returns: a new reference to an account manager proxy
+ */
+TpAccountManager *
+tp_account_manager_new (TpDBusDaemon *bus_daemon)
+{
+  TpAccountManager *self;
+
+  g_return_val_if_fail (bus_daemon != NULL, NULL);
+
+  self = TP_ACCOUNT_MANAGER (g_object_new (TP_TYPE_ACCOUNT_MANAGER,
+        "dbus-daemon", bus_daemon,
+        "dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection,
+        "bus-name", TP_ACCOUNT_MANAGER_BUS_NAME,
+        "object-path", TP_ACCOUNT_MANAGER_OBJECT_PATH,
+        NULL));
+
+  return self;
+}
diff --git a/telepathy-glib/account-manager.h b/telepathy-glib/account-manager.h
new file mode 100644
index 0000000..f7e84b2
--- /dev/null
+++ b/telepathy-glib/account-manager.h
@@ -0,0 +1,72 @@
+/*
+ * account-manager.h - proxy for the Telepathy account manager
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef TP_ACCOUNT_MANAGER_H
+#define TP_ACCOUNT_MANAGER_H
+
+#include <telepathy-glib/proxy.h>
+#include <telepathy-glib/dbus.h>
+
+G_BEGIN_DECLS
+
+typedef struct _TpAccountManager TpAccountManager;
+typedef struct _TpAccountManagerClass TpAccountManagerClass;
+typedef struct _TpAccountManagerPrivate TpAccountManagerPrivate;
+typedef struct _TpAccountManagerClassPrivate TpAccountManagerClassPrivate;
+
+struct _TpAccountManager {
+    /*<private>*/
+    TpProxy parent;
+    TpAccountManagerPrivate *priv;
+};
+
+struct _TpAccountManagerClass {
+    /*<private>*/
+    TpProxyClass parent_class;
+    GCallback _padding[7];
+    TpAccountManagerClassPrivate *priv;
+};
+
+GType tp_account_manager_get_type (void);
+
+#define TP_TYPE_ACCOUNT_MANAGER \
+  (tp_account_manager_get_type ())
+#define TP_ACCOUNT_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), TP_TYPE_ACCOUNT_MANAGER, \
+                               TpAccountManager))
+#define TP_ACCOUNT_MANAGER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), TP_TYPE_ACCOUNT_MANAGER, \
+                            TpAccountManagerClass))
+#define TP_IS_ACCOUNT_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TP_TYPE_ACCOUNT_MANAGER))
+#define TP_IS_ACCOUNT_MANAGER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), TP_TYPE_ACCOUNT_MANAGER))
+#define TP_ACCOUNT_MANAGER_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_ACCOUNT_MANAGER, \
+                              TpAccountManagerClass))
+
+TpAccountManager *tp_account_manager_new (TpDBusDaemon *bus_daemon);
+
+G_END_DECLS
+
+#include <telepathy-glib/_gen/tp-cli-account-manager.h>
+
+#endif
diff --git a/telepathy-glib/account-manager.xml b/telepathy-glib/account-manager.xml
new file mode 100644
index 0000000..278f427
--- /dev/null
+++ b/telepathy-glib/account-manager.xml
@@ -0,0 +1,9 @@
+<tp:spec
+  xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
+  xmlns:xi="http://www.w3.org/2001/XInclude">
+
+<tp:title>Account Manager interfaces</tp:title>
+
+<xi:include href="../spec/Account_Manager.xml"/>
+
+</tp:spec>
diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
new file mode 100644
index 0000000..295fb42
--- /dev/null
+++ b/telepathy-glib/account.c
@@ -0,0 +1,191 @@
+/*
+ * account.c - proxy for an account in the Telepathy account manager
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include "telepathy-glib/account.h"
+
+#include <telepathy-glib/dbus.h>
+#include <telepathy-glib/defs.h>
+#include <telepathy-glib/errors.h>
+#include <telepathy-glib/interfaces.h>
+#include <telepathy-glib/proxy-subclass.h>
+
+#define DEBUG_FLAG TP_DEBUG_ACCOUNTS
+#include "telepathy-glib/debug-internal.h"
+
+#include "telepathy-glib/_gen/tp-cli-account-body.h"
+
+/**
+ * SECTION:account
+ * @title: TpAccount
+ * @short_description: proxy object for an account in the Telepathy account
+ *  manager
+ * @see_also: #TpAccountManager
+ *
+ * The Telepathy Account Manager stores the user's configured real-time
+ * communication accounts. The #TpAccount object represents a stored account.
+ *
+ * Since: 0.7.UNRELEASED
+ */
+
+/**
+ * TpAccount:
+ *
+ * The Telepathy Account Manager stores the user's configured real-time
+ * communication accounts. This object represents a stored account.
+ *
+ * If this account is deleted from the account manager, the
+ * #TpProxy::invalidated signal will be emitted
+ * with the domain %TP_DBUS_ERRORS and the error code
+ * %TP_DBUS_ERROR_OBJECT_REMOVED.
+ *
+ * This proxy is usable but very incomplete: accessors for the
+ * Account's D-Bus properties will be added in a later version of
+ * telepathy-glib, along with a mechanism similar to
+ * tp_connection_call_when_ready().
+ *
+ * Most operations performed on an Account are done via D-Bus properties.
+ * Until convenience methods for this are implemented, use of the generic
+ * tp_cli_dbus_properties_call_get_all() and tp_cli_dbus_properties_call_set()
+ * methods is recommended.
+ *
+ * Other useful auto-generated method wrappers on an Account include
+ * tp_cli_account_call_remove(), tp_cli_account_call_update_parameters() and
+ * tp_cli_account_call_reconnect().
+ *
+ * Since: 0.7.UNRELEASED
+ */
+
+/**
+ * TpAccountClass:
+ *
+ * The class of a #TpAccount.
+ */
+
+struct _TpAccountPrivate {
+    gpointer dummy;
+};
+
+G_DEFINE_TYPE (TpAccount, tp_account, TP_TYPE_PROXY);
+
+static void
+tp_account_init (TpAccount *self)
+{
+  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, TP_TYPE_ACCOUNT,
+      TpAccountPrivate);
+}
+
+static void
+tp_account_removed_cb (TpAccount *self,
+    gpointer unused G_GNUC_UNUSED,
+    GObject *object G_GNUC_UNUSED)
+{
+  GError e = { TP_DBUS_ERRORS, TP_DBUS_ERROR_OBJECT_REMOVED,
+      "Account removed" };
+
+  tp_proxy_invalidate ((TpProxy *) self, &e);
+}
+
+static void
+tp_account_constructed (GObject *object)
+{
+  TpAccount *self = TP_ACCOUNT (object);
+  void (*chain_up) (GObject *) =
+    ((GObjectClass *) tp_account_parent_class)->constructed;
+  GError *error = NULL;
+  TpProxySignalConnection *sc;
+
+  if (chain_up != NULL)
+    chain_up (object);
+
+  g_return_if_fail (tp_proxy_get_dbus_daemon (self) != NULL);
+
+  sc = tp_cli_account_connect_to_removed (self, tp_account_removed_cb,
+      NULL, NULL, NULL, &error);
+
+  if (sc == NULL)
+    {
+      g_critical ("Couldn't connect to Removed: %s", error->message);
+      g_error_free (error);
+      g_assert_not_reached ();
+      return;
+    }
+}
+
+static void
+tp_account_class_init (TpAccountClass *klass)
+{
+  GType tp_type = TP_TYPE_ACCOUNT;
+  TpProxyClass *proxy_class = (TpProxyClass *) klass;
+  GObjectClass *object_class = (GObjectClass *) klass;
+
+  g_type_class_add_private (klass, sizeof (TpAccountPrivate));
+
+  object_class->constructed = tp_account_constructed;
+
+  proxy_class->interface = TP_IFACE_QUARK_ACCOUNT;
+  tp_proxy_or_subclass_hook_on_interface_add (tp_type,
+      tp_cli_account_add_signals);
+  tp_proxy_subclass_add_error_mapping (tp_type,
+      TP_ERROR_PREFIX, TP_ERRORS, TP_TYPE_ERROR);
+}
+
+/**
+ * tp_account_new:
+ * @bus_daemon: Proxy for the D-Bus daemon
+ * @object_path: The non-NULL object path of this account
+ * @error: Used to raise an error if @object_path is not valid
+ *
+ * Convenience function to create a new account proxy.
+ *
+ * Returns: a new reference to an account proxy, or %NULL if @object_path is
+ *    not valid
+ */
+TpAccount *
+tp_account_new (TpDBusDaemon *bus_daemon,
+    const gchar *object_path,
+    GError **error)
+{
+  TpAccount *self;
+
+  g_return_val_if_fail (bus_daemon != NULL, NULL);
+  g_return_val_if_fail (object_path != NULL, NULL);
+  g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+  if (!tp_dbus_check_valid_object_path (object_path, error))
+    return NULL;
+
+  if (!g_str_has_prefix (object_path, TP_ACCOUNT_OBJECT_PATH_BASE))
+    {
+      g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT,
+          "Account path does not start with the right prefix: %s",
+          object_path);
+      return NULL;
+    }
+
+  self = TP_ACCOUNT (g_object_new (TP_TYPE_ACCOUNT,
+        "dbus-daemon", bus_daemon,
+        "dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection,
+        "bus-name", TP_ACCOUNT_MANAGER_BUS_NAME,
+        "object-path", object_path,
+        NULL));
+
+  return self;
+}
diff --git a/telepathy-glib/account.h b/telepathy-glib/account.h
new file mode 100644
index 0000000..3d6e629
--- /dev/null
+++ b/telepathy-glib/account.h
@@ -0,0 +1,73 @@
+/*
+ * account-manager.h - proxy for an account in the Telepathy account manager
+ *
+ * Copyright (C) 2009 Collabora Ltd. <http://www.collabora.co.uk/>
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef TP_ACCOUNT_H
+#define TP_ACCOUNT_H
+
+#include <telepathy-glib/proxy.h>
+#include <telepathy-glib/dbus.h>
+
+G_BEGIN_DECLS
+
+typedef struct _TpAccount TpAccount;
+typedef struct _TpAccountClass TpAccountClass;
+typedef struct _TpAccountPrivate TpAccountPrivate;
+typedef struct _TpAccountClassPrivate TpAccountClassPrivate;
+
+struct _TpAccount {
+    /*<private>*/
+    TpProxy parent;
+    TpAccountPrivate *priv;
+};
+
+struct _TpAccountClass {
+    /*<private>*/
+    TpProxyClass parent_class;
+    GCallback _padding[7];
+    TpAccountClassPrivate *priv;
+};
+
+GType tp_account_get_type (void);
+
+#define TP_TYPE_ACCOUNT \
+  (tp_account_get_type ())
+#define TP_ACCOUNT(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), TP_TYPE_ACCOUNT, \
+                               TpAccount))
+#define TP_ACCOUNT_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), TP_TYPE_ACCOUNT, \
+                            TpAccountClass))
+#define TP_IS_ACCOUNT(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TP_TYPE_ACCOUNT))
+#define TP_IS_ACCOUNT_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), TP_TYPE_ACCOUNT))
+#define TP_ACCOUNT_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_ACCOUNT, \
+                              TpAccountClass))
+
+TpAccount *tp_account_new (TpDBusDaemon *bus_daemon, const gchar *object_path,
+    GError **error);
+
+G_END_DECLS
+
+#include <telepathy-glib/_gen/tp-cli-account.h>
+
+#endif
diff --git a/telepathy-glib/account.xml b/telepathy-glib/account.xml
new file mode 100644
index 0000000..6507c02
--- /dev/null
+++ b/telepathy-glib/account.xml
@@ -0,0 +1,11 @@
+<tp:spec
+  xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"
+  xmlns:xi="http://www.w3.org/2001/XInclude">
+
+<tp:title>Account interfaces</tp:title>
+
+<xi:include href="../spec/Account.xml"/>
+
+<xi:include href="../spec/Account_Interface_Avatar.xml"/>
+
+</tp:spec>
diff --git a/telepathy-glib/debug-internal.h b/telepathy-glib/debug-internal.h
index b57473c..a45c27e 100644
--- a/telepathy-glib/debug-internal.h
+++ b/telepathy-glib/debug-internal.h
@@ -25,7 +25,8 @@ typedef enum
   TP_DEBUG_CHANNEL       = 1 << 8,
   TP_DEBUG_PROXY         = 1 << 9,
   TP_DEBUG_HANDLES       = 1 << 10,
-  TP_DEBUG_CONTACTS      = 1 << 11
+  TP_DEBUG_CONTACTS      = 1 << 11,
+  TP_DEBUG_ACCOUNTS      = 1 << 12
 } TpDebugFlags;
 
 gboolean _tp_debug_flag_is_set (TpDebugFlags flag);
diff --git a/telepathy-glib/debug.c b/telepathy-glib/debug.c
index cbd1d6a..3ed586f 100644
--- a/telepathy-glib/debug.c
+++ b/telepathy-glib/debug.c
@@ -48,6 +48,8 @@
  *    (service)</listitem>
  * <listitem><literal>handles</literal> - handle reference tracking tracking
  *    in #TpBaseConnection (service) and #TpConnection (client)</listitem>
+ * <listitem><literal>accounts</literal> - the #TpAccountManager and
+ *     #TpAccount objects (client)</listitem>
  * <listitem><literal>all</literal> - all of the above</listitem>
  * </itemizedlist>
  */
@@ -106,6 +108,7 @@ static GDebugKey keys[] = {
   { "proxy",         TP_DEBUG_PROXY },
   { "handles",       TP_DEBUG_HANDLES },
   { "contacts",      TP_DEBUG_CONTACTS },
+  { "accounts",      TP_DEBUG_ACCOUNTS },
   { 0, }
 };
 
diff --git a/telepathy-glib/defs.h b/telepathy-glib/defs.h
index 8c2e30c..124794f 100644
--- a/telepathy-glib/defs.h
+++ b/telepathy-glib/defs.h
@@ -1,8 +1,8 @@
 /*
  * defs.h - miscellaneous definitions
  *
- * Copyright (C) 2007 Collabora Ltd.
- * Copyright (C) 2007 Nokia Corporation
+ * Copyright (C) 2007-2009 Collabora Ltd.
+ * Copyright (C) 2007-2009 Nokia Corporation
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -57,5 +57,26 @@ G_BEGIN_DECLS
  */
 #define TP_CONN_OBJECT_PATH_BASE "/org/freedesktop/Telepathy/Connection/"
 
+/**
+ * TP_ACCOUNT_MANAGER_BUS_NAME:
+ *
+ * The account manager's well-known bus name
+ */
+#define TP_ACCOUNT_MANAGER_BUS_NAME "org.freedesktop.Telepathy.AccountManager"
+
+/**
+ * TP_ACCOUNT_MANAGER_OBJECT_PATH:
+ *
+ * The account manager's standard object path
+ */
+#define TP_ACCOUNT_MANAGER_OBJECT_PATH "/org/freedesktop/Telepathy/AccountManager"
+
+/**
+ * TP_ACCOUNT_OBJECT_PATH_BASE:
+ *
+ * The common prefix of the object path for all Account objects.
+ */
+#define TP_ACCOUNT_OBJECT_PATH_BASE "/org/freedesktop/Telepathy/Account/"
+
 G_END_DECLS
 #endif
diff --git a/telepathy-glib/extra-gtkdoc.h b/telepathy-glib/extra-gtkdoc.h
index cb637b0..e803cca 100644
--- a/telepathy-glib/extra-gtkdoc.h
+++ b/telepathy-glib/extra-gtkdoc.h
@@ -199,6 +199,34 @@
  */
 
 /**
+ * SECTION:svc-account
+ * @title: Service-side Account interfaces
+ * @short_description: GInterfaces for Telepathy Account objects
+ *
+ * These interfaces (auto-generated from the Telepathy spec) make it easier
+ * to export objects implementing the Telepathy Account and its
+ * optional interfaces, with the correct method and signal signatures,
+ * and emit signals from those objects in a type-safe way.
+ *
+ * You don't need these interfaces unless you're implementing a
+ * Telepathy AccountManager, such as Mission Control.
+ */
+
+/**
+ * SECTION:svc-account-manager
+ * @title: Service-side Account Manager interface
+ * @short_description: GInterface for Telepathy AccountManager objects
+ *
+ * The #TpSvcAccountManager interface (auto-generated from the Telepathy
+ * spec) makes it easier to export an object implementing the Telepathy
+ * AccountManager interface, with the correct method and signal signatures,
+ * and emit signals from that object in a type-safe way.
+ *
+ * You don't need these interfaces unless you're implementing a
+ * Telepathy AccountManager, such as Mission Control.
+ */
+
+/**
  * SECTION:svc-media-interfaces
  * @title: Service-side media streaming helper interfaces
  * @short_description: media session and media stream
diff --git a/telepathy-glib/stable-interfaces.xml b/telepathy-glib/stable-interfaces.xml
index bb2b49c..ff66d09 100644
--- a/telepathy-glib/stable-interfaces.xml
+++ b/telepathy-glib/stable-interfaces.xml
@@ -12,6 +12,9 @@
 <xi:include href="generic.xml"/>
 <xi:include href="dbus-daemon.xml"/>
 
+<xi:include href="account-manager.xml"/>
+<xi:include href="account.xml"/>
+
 <xi:include href="../spec/generic-types.xml"/>
 <xi:include href="../spec/errors.xml"/>
 
diff --git a/telepathy-glib/svc-account-manager.h b/telepathy-glib/svc-account-manager.h
new file mode 100644
index 0000000..ed7b4e2
--- /dev/null
+++ b/telepathy-glib/svc-account-manager.h
@@ -0,0 +1,6 @@
+#ifndef __TP_META_SVC_ACCOUNT_MANAGER_H__
+#define __TP_META_SVC_ACCOUNT_MANAGER_H__
+
+#include <telepathy-glib/_gen/tp-svc-account-manager.h>
+
+#endif
diff --git a/telepathy-glib/svc-account.h b/telepathy-glib/svc-account.h
new file mode 100644
index 0000000..1818cb3
--- /dev/null
+++ b/telepathy-glib/svc-account.h
@@ -0,0 +1,6 @@
+#ifndef __TP_META_SVC_ACCOUNT_H__
+#define __TP_META_SVC_ACCOUNT_H__
+
+#include <telepathy-glib/_gen/tp-svc-account.h>
+
+#endif
-- 
1.5.6.5




More information about the telepathy-commits mailing list