[Telepathy-commits] [telepathy-mission-control/master] Add mcd_account_compat_get_mc_profile()

Alberto Mardegan alberto.mardegan at nokia.com
Tue Nov 11 04:54:55 PST 2008


Add a function to get the McProfile bound to the account.
---
 src/mcd-account-compat.c |   26 ++++++++++++++++++++++++++
 src/mcd-account-compat.h |    3 +++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/mcd-account-compat.c b/src/mcd-account-compat.c
index ab52c1a..764f989 100644
--- a/src/mcd-account-compat.c
+++ b/src/mcd-account-compat.c
@@ -355,3 +355,29 @@ _mcd_account_compat_request_channel_nmc4 (McdAccount *account,
                                         error);
 }
 
+/**
+ * mcd_account_compat_get_profile:
+ * @account: the #McdAccount.
+ *
+ * Returns: the #McProfile for the account. Unreference it when done.
+ */
+McProfile *
+mcd_account_compat_get_mc_profile (McdAccount *account)
+{
+    const gchar *unique_name;
+    GKeyFile *keyfile;
+    gchar *profile_name;
+    McProfile *profile = NULL;
+
+    keyfile = mcd_account_get_keyfile (account);
+    unique_name = mcd_account_get_unique_name (account);
+    profile_name = g_key_file_get_string (keyfile, unique_name,
+                                          "Profile", NULL);
+    if (profile_name)
+    {
+        profile = mc_profile_lookup (profile_name);
+        g_free (profile_name);
+    }
+    return profile;
+}
+
diff --git a/src/mcd-account-compat.h b/src/mcd-account-compat.h
index f6beaf3..d6b1d5a 100644
--- a/src/mcd-account-compat.h
+++ b/src/mcd-account-compat.h
@@ -26,6 +26,7 @@
 
 #include <telepathy-glib/dbus.h>
 #include <telepathy-glib/enums.h>
+#include <libmcclient/mc-profile.h>
 /* auto-generated stubs */
 #include "_gen/svc-Account_Interface_Compat.h"
 
@@ -49,6 +50,8 @@ struct mcd_channel_request
     gchar *requestor_client_id;
 };
 
+McProfile *mcd_account_compat_get_mc_profile (McdAccount *account);
+
 /* not exported */
 gboolean _mcd_account_compat_request_channel_nmc4 (McdAccount *account,
     const struct mcd_channel_request *req, GError **error);
-- 
1.5.6.5




More information about the Telepathy-commits mailing list