[next] telepathy-glib: future-account: add new_from_protocol

Jonny Lamb jonny at kemper.freedesktop.org
Fri May 11 02:41:36 PDT 2012


Module: telepathy-glib
Branch: next
Commit: 69579a555535557d41202f2918cf1e3451d3349a
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=69579a555535557d41202f2918cf1e3451d3349a

Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date:   Fri Apr 27 16:49:58 2012 +0100

future-account: add new_from_protocol

Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>

---

 docs/reference/telepathy-glib-sections.txt |    1 +
 telepathy-glib/future-account.c            |   27 +++++++++++++++++++++++++++
 telepathy-glib/future-account.h            |    5 +++++
 3 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 52dc358..57b8eb2 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 04c4f5d..fe062c5 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 b32b174..f6942a6 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);
 



More information about the telepathy-commits mailing list