summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2012-04-27 16:49:58 +0100
committerJonny Lamb <jonny.lamb@collabora.co.uk>2012-05-04 12:34:02 +0100
commit69579a555535557d41202f2918cf1e3451d3349a (patch)
tree5c39535ba90730b8d8a835512510b5a3573ad3b9
parent226414747dc89925f51f82985573613f0b91e9b5 (diff)
future-account: add new_from_protocol
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--docs/reference/telepathy-glib-sections.txt1
-rw-r--r--telepathy-glib/future-account.c27
-rw-r--r--telepathy-glib/future-account.h5
3 files changed, 33 insertions, 0 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 52dc35832..57b8eb224 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -5234,6 +5234,7 @@ TpAccountClassPrivate
TpFutureAccount
TpFutureAccountClass
tp_future_account_new
+tp_future_account_from_protocol
<SUBSECTION>
tp_future_account_set_display_name
tp_future_account_set_icon_name
diff --git a/telepathy-glib/future-account.c b/telepathy-glib/future-account.c
index 04c4f5d7a..fe062c589 100644
--- a/telepathy-glib/future-account.c
+++ b/telepathy-glib/future-account.c
@@ -665,6 +665,33 @@ tp_future_account_new (TpAccountManager *account_manager,
}
/**
+ * tp_future_account_new_from_protocol:
+ * @account_manager: the #TpAccountManager to create the account on
+ * @protocol: a #TpProtocol
+ *
+ * Convenience function to create a new #TpFutureAccount object using
+ * a #TpProtocol instance, instead of specifying connection manager
+ * and protocol name specifically. See tp_future_account_new() for
+ * more details.
+ *
+ * Returns: a new reference to a future account object, or %NULL if
+ * any argument is incorrect
+ */
+TpFutureAccount *
+tp_future_account_new_from_protocol (TpAccountManager *account_manager,
+ TpProtocol *protocol)
+{
+ g_return_val_if_fail (TP_IS_ACCOUNT_MANAGER (account_manager), NULL);
+ g_return_val_if_fail (TP_IS_PROTOCOL (protocol), NULL);
+
+ return g_object_new (TP_TYPE_FUTURE_ACCOUNT,
+ "account-manager", account_manager,
+ "connection-manager", tp_protocol_get_cm_name (protocol),
+ "protocol", tp_protocol_get_name (protocol),
+ NULL);
+}
+
+/**
* tp_future_account_set_display_name:
* @self: a #TpFutureAccount
* @name: a display name for the account
diff --git a/telepathy-glib/future-account.h b/telepathy-glib/future-account.h
index b32b174b8..f6942a630 100644
--- a/telepathy-glib/future-account.h
+++ b/telepathy-glib/future-account.h
@@ -22,6 +22,7 @@
#define TP_FUTURE_ACCOUNT_H
#include <telepathy-glib/account-manager.h>
+#include <telepathy-glib/protocol.h>
G_BEGIN_DECLS
@@ -62,6 +63,10 @@ GType tp_future_account_get_type (void);
TpFutureAccount * tp_future_account_new (TpAccountManager *account_manager,
const gchar *manager, const gchar *protocol) G_GNUC_WARN_UNUSED_RESULT;
+TpFutureAccount * tp_future_account_new_from_protocol (
+ TpAccountManager *account_manager,
+ TpProtocol *protocol) G_GNUC_WARN_UNUSED_RESULT;
+
void tp_future_account_set_display_name (TpFutureAccount *self,
const gchar *name);