]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-contact.c
Merge branch 'gnome-3-8'
[empathy.git] / libempathy / empathy-contact.c
index 6b1a7157bf606e70b8e018b46086d03f77baeabd..356104434f7916546bd3a147508358ccb4313c5b 100644 (file)
  */
 
 #include "config.h"
-
-#include <string.h>
-
-#include <glib/gi18n-lib.h>
-
-#include <telepathy-glib/account-manager.h>
-#include <telepathy-glib/interfaces.h>
-#include <telepathy-glib/util.h>
-
-#include <folks/folks.h>
-#include <folks/folks-telepathy.h>
+#include "empathy-contact.h"
 
 #ifdef HAVE_GEOCODE
 #include <geocode-glib/geocode-glib.h>
 #endif
 
-#include "empathy-contact.h"
-#include "empathy-camera-monitor.h"
-#include "empathy-individual-manager.h"
 #include "empathy-utils.h"
 #include "empathy-enum-types.h"
-#include "empathy-location.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_CONTACT
 #include "empathy-debug.h"
@@ -59,7 +45,6 @@ typedef struct {
   guint handle;
   EmpathyCapabilities capabilities;
   gboolean is_user;
-  guint hash;
   /* Location is composed of string keys and GValues.
    * Example: a "city" key would have "Helsinki" as string GValue,
    *          a "latitude" would have 65.0 as double GValue.
@@ -431,6 +416,7 @@ contact_finalize (GObject *object)
 
   g_clear_object (&priv->groups);
   g_free (priv->alias);
+  g_free (priv->logged_alias);
   g_free (priv->id);
   g_strfreev (priv->client_types);
 
@@ -927,7 +913,7 @@ empathy_contact_change_group (EmpathyContact *contact, const gchar *group,
   if (priv->groups == NULL)
     {
       priv->groups = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup,
-          g_free, g_str_hash, g_str_equal);
+          g_free, NULL, NULL, NULL, NULL, NULL, NULL);
     }
 
   gee_collection_add (GEE_COLLECTION (priv->groups), group);
@@ -1352,8 +1338,8 @@ contact_get_avatar_filename (EmpathyContact *contact,
   avatar_path = g_build_filename (g_get_user_cache_dir (),
       "telepathy",
       "avatars",
-      tp_account_get_connection_manager (account),
-      tp_account_get_protocol (account),
+      tp_account_get_cm_name (account),
+      tp_account_get_protocol_name (account),
       NULL);
   g_mkdir_with_parents (avatar_path, 0700);
 
@@ -1627,6 +1613,8 @@ geocode_cb (GObject *source,
   EmpathyContact *contact = user_data;
   EmpathyContactPriv *priv = GET_PRIV (contact);
   GError *error = NULL;
+  GList *res;
+  GeocodeLocation *loc;
   GHashTable *new_location;
   GHashTable *resolved = NULL;
   gdouble latitude, longitude;
@@ -1634,26 +1622,27 @@ geocode_cb (GObject *source,
   if (priv->location == NULL)
     goto out;
 
-  resolved = geocode_object_resolve_finish (GEOCODE_OBJECT (source), result,
+  res = geocode_forward_search_finish (GEOCODE_FORWARD (source), result,
       &error);
 
-  if (resolved == NULL)
+  if (res == NULL)
     {
       DEBUG ("Failed to resolve geocode: %s", error->message);
       g_error_free (error);
       goto out;
     }
 
-  if (!geocode_object_get_coords (resolved, &longitude, &latitude))
-    goto out;
+  loc = res->data;
 
   new_location = tp_asv_new (
-      EMPATHY_LOCATION_LAT, G_TYPE_DOUBLE, latitude,
-      EMPATHY_LOCATION_LON, G_TYPE_DOUBLE, longitude,
+      EMPATHY_LOCATION_LAT, G_TYPE_DOUBLE, loc->latitude,
+      EMPATHY_LOCATION_LON, G_TYPE_DOUBLE, loc->longitude,
       NULL);
 
-  DEBUG ("\t - Latitude: %f", latitude);
-  DEBUG ("\t - Longitude: %f", longitude);
+  DEBUG ("\t - Latitude: %f", loc->latitude);
+  DEBUG ("\t - Longitude: %f", loc->longitude);
+
+  g_list_free_full (res, (GDestroyNotify) geocode_location_free);
 
   /* Copy remaning fields. LAT and LON were not defined so we won't overwrite
    * the values we just set. */
@@ -1673,7 +1662,7 @@ out:
 static void
 update_geocode (EmpathyContact *contact)
 {
-  GeocodeObject *geocode;
+  GeocodeForward *geocode;
   GHashTable *location;
 
   location = empathy_contact_get_location (contact);
@@ -1686,11 +1675,11 @@ update_geocode (EmpathyContact *contact)
       g_hash_table_lookup (location, EMPATHY_LOCATION_LON) != NULL)
     return;
 
-  geocode = geocode_object_new_for_params (location);
+  geocode = geocode_forward_new_for_params (location);
   if (geocode == NULL)
     return;
 
-  geocode_object_resolve_async (geocode, NULL, geocode_cb,
+  geocode_forward_search_async (geocode, NULL, geocode_cb,
       g_object_ref (contact));
 
   g_object_unref (geocode);