[empathy: 11/59] contact: port to new tp-glib account API



commit 753bdcb584f780ce3b6891782eca0e19ed598774
Author: Jonny Lamb <jonnylamb gnome org>
Date:   Sat Oct 24 15:33:53 2009 +0100

    contact: port to new tp-glib account API
    
    Signed-off-by: Jonny Lamb <jonnylamb gnome org>

 libempathy/empathy-contact.c |   24 ++++++++++--------------
 libempathy/empathy-contact.h |    6 +++---
 2 files changed, 13 insertions(+), 17 deletions(-)
---
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 83ffd07..a440ef2 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -25,10 +25,10 @@
 
 #include <glib/gi18n-lib.h>
 
+#include <telepathy-glib/account-manager.h>
 #include <telepathy-glib/util.h>
 
 #include "empathy-contact.h"
-#include "empathy-account-manager.h"
 #include "empathy-utils.h"
 #include "empathy-enum-types.h"
 #include "empathy-marshal.h"
@@ -39,7 +39,7 @@
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContact)
 typedef struct {
   TpContact *tp_contact;
-  EmpathyAccount *account;
+  TpAccount *account;
   gchar *id;
   gchar *name;
   EmpathyAvatar *avatar;
@@ -159,7 +159,7 @@ empathy_contact_class_init (EmpathyContactClass *class)
       g_param_spec_object ("account",
         "The account",
         "The account associated with the contact",
-        EMPATHY_TYPE_ACCOUNT,
+        TP_TYPE_ACCOUNT,
         G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (object_class,
@@ -409,7 +409,7 @@ empathy_contact_new (TpContact *tp_contact)
 }
 
 EmpathyContact *
-empathy_contact_new_for_log (EmpathyAccount *account,
+empathy_contact_new_for_log (TpAccount *account,
                              const gchar *id,
                              const gchar *name,
                              gboolean is_user)
@@ -554,7 +554,7 @@ empathy_contact_set_avatar (EmpathyContact *contact,
   g_object_notify (G_OBJECT (contact), "avatar");
 }
 
-EmpathyAccount *
+TpAccount *
 empathy_contact_get_account (EmpathyContact *contact)
 {
   EmpathyContactPriv *priv;
@@ -565,16 +565,12 @@ empathy_contact_get_account (EmpathyContact *contact)
 
   if (priv->account == NULL && priv->tp_contact != NULL)
     {
-      EmpathyAccountManager *manager;
       TpConnection *connection;
 
       /* FIXME: This assume the account manager already exists */
-      manager = empathy_account_manager_dup_singleton ();
       connection = tp_contact_get_connection (priv->tp_contact);
-      priv->account = empathy_account_manager_get_account_for_connection (
-          manager, connection);
-      g_object_ref (priv->account);
-      g_object_unref (manager);
+      priv->account =
+        g_object_ref (empathy_get_account_for_connection (connection));
     }
 
   return priv->account;
@@ -855,7 +851,7 @@ static gchar *
 contact_get_avatar_filename (EmpathyContact *contact,
                              const gchar *token)
 {
-  EmpathyAccount *account;
+  TpAccount *account;
   gchar *avatar_path;
   gchar *avatar_file;
   gchar *token_escaped;
@@ -869,8 +865,8 @@ contact_get_avatar_filename (EmpathyContact *contact,
   avatar_path = g_build_filename (g_get_user_cache_dir (),
       "telepathy",
       "avatars",
-      empathy_account_get_connection_manager (account),
-      empathy_account_get_protocol (account),
+      tp_account_get_connection_manager (account),
+      tp_account_get_protocol (account),
       NULL);
   g_mkdir_with_parents (avatar_path, 0700);
 
diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h
index 4e9c987..d552581 100644
--- a/libempathy/empathy-contact.h
+++ b/libempathy/empathy-contact.h
@@ -25,7 +25,7 @@
 #include <glib-object.h>
 
 #include <telepathy-glib/contact.h>
-#include <libempathy/empathy-account.h>
+#include <telepathy-glib/account.h>
 
 G_BEGIN_DECLS
 
@@ -70,7 +70,7 @@ typedef enum {
 
 GType empathy_contact_get_type (void) G_GNUC_CONST;
 EmpathyContact * empathy_contact_new (TpContact *tp_contact);
-EmpathyContact * empathy_contact_new_for_log (EmpathyAccount *account,
+EmpathyContact * empathy_contact_new_for_log (TpAccount *account,
     const gchar *id, const gchar *name, gboolean is_user);
 TpContact * empathy_contact_get_tp_contact (EmpathyContact *contact);
 const gchar * empathy_contact_get_id (EmpathyContact *contact);
@@ -80,7 +80,7 @@ void empathy_contact_set_name (EmpathyContact *contact, const gchar *name);
 EmpathyAvatar * empathy_contact_get_avatar (EmpathyContact *contact);
 void empathy_contact_set_avatar (EmpathyContact *contact,
     EmpathyAvatar *avatar);
-EmpathyAccount * empathy_contact_get_account (EmpathyContact *contact);
+TpAccount * empathy_contact_get_account (EmpathyContact *contact);
 TpConnection * empathy_contact_get_connection (EmpathyContact *contact);
 TpConnectionPresenceType empathy_contact_get_presence (EmpathyContact *contact);
 void empathy_contact_set_presence (EmpathyContact *contact,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]