aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2010-07-07 20:26:19 +0800
committerTravis Reitter <treitter@gmail.com>2010-07-22 04:25:04 +0800
commita244924636a2a0cde9da06909ac2b1b141ce3b9e (patch)
tree1be1913babfcc76924235ea673dfd5caf667d675 /libempathy
parent7e4dfd33eb0fe4e87aef3a0b6c8dbc94c540e7b0 (diff)
downloadgsoc2013-empathy-a244924636a2a0cde9da06909ac2b1b141ce3b9e.tar
gsoc2013-empathy-a244924636a2a0cde9da06909ac2b1b141ce3b9e.tar.gz
gsoc2013-empathy-a244924636a2a0cde9da06909ac2b1b141ce3b9e.tar.bz2
gsoc2013-empathy-a244924636a2a0cde9da06909ac2b1b141ce3b9e.tar.lz
gsoc2013-empathy-a244924636a2a0cde9da06909ac2b1b141ce3b9e.tar.xz
gsoc2013-empathy-a244924636a2a0cde9da06909ac2b1b141ce3b9e.tar.zst
gsoc2013-empathy-a244924636a2a0cde9da06909ac2b1b141ce3b9e.zip
Remove folks_individual_dup_from_empathy_contact()
As EmpathyContact is now a wrapper around FolksPersona, we can mutate the persona instead of acquiring an individual and mutating that instead.
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-contact.c36
-rw-r--r--libempathy/empathy-utils.c32
-rw-r--r--libempathy/empathy-utils.h1
3 files changed, 8 insertions, 61 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 64235ea9a..3a16c3e37 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -636,42 +636,22 @@ empathy_contact_set_name (EmpathyContact *contact,
g_object_unref (contact);
}
-static void
-contact_set_aliases_cb (TpConnection *connection,
- const GError *error,
- gpointer user_data,
- GObject *weak_object)
-{
- if (error)
- DEBUG ("Error: %s", error->message);
-}
-
void
empathy_contact_set_alias (EmpathyContact *contact,
const gchar *alias)
{
- TpConnection *connection;
- GHashTable *new_alias;
- guint handle;
-
- g_return_if_fail (EMPATHY_IS_CONTACT (contact));
-
- handle = empathy_contact_get_handle (contact);
-
- DEBUG ("Setting alias for contact %s (%d) to %s",
- empathy_contact_get_id (contact),
- handle, alias);
+ FolksPersona *persona;
- new_alias = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
- g_free);
+ g_return_if_fail (EMPATHY_IS_CONTACT (contact));
- g_hash_table_insert (new_alias, GUINT_TO_POINTER (handle), g_strdup (alias));
+ persona = empathy_contact_get_persona (contact);
+ if (persona == NULL || !FOLKS_IS_ALIAS (persona))
+ return;
- connection = empathy_contact_get_connection (contact);
- tp_cli_connection_interface_aliasing_call_set_aliases (connection, -1,
- new_alias, contact_set_aliases_cb, NULL, NULL, NULL);
+ DEBUG ("Setting alias for contact %s to %s", empathy_contact_get_id (contact),
+ alias);
- g_hash_table_destroy (new_alias);
+ folks_alias_set_alias (FOLKS_ALIAS (persona), alias);
}
EmpathyAvatar *
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index d460f5582..9a5e28c17 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -621,38 +621,6 @@ empathy_contact_dup_from_folks_individual (FolksIndividual *individual)
return contact;
}
-/* TODO: This also needs to be eliminated, and is horrifically slow. */
-
-/* Retrieve the first Individual containing a TpContact that corresponds to the
- * given EmpathyContact. Note that this is a temporary convenience. See
- * the TODO above. */
-FolksIndividual *
-folks_individual_dup_from_empathy_contact (EmpathyContact *contact)
-{
- EmpathyIndividualManager *manager;
- FolksIndividual *individual = NULL;
- GList *individuals, *l;
-
- manager = empathy_individual_manager_dup_singleton ();
- individuals = empathy_individual_manager_get_members (manager);
-
- for (l = individuals; (l != NULL) && (individual == NULL); l = l->next)
- {
- FolksIndividual *i = FOLKS_INDIVIDUAL (l->data);
- EmpathyContact *c = empathy_contact_dup_from_folks_individual (i);
-
- if (c == contact)
- individual = g_object_ref (i);
-
- g_object_unref (c);
- }
-
- g_list_free (individuals);
- g_object_unref (manager);
-
- return individual;
-}
-
TpChannelGroupChangeReason
tp_chanel_group_change_reason_from_folks_groups_change_reason (
FolksGroupsChangeReason reason)
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index f35d9e5c3..da0edc58c 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -93,7 +93,6 @@ void empathy_connect_new_account (TpAccount *account,
TpConnectionPresenceType empathy_folks_presence_type_to_tp (FolksPresenceType type);
gboolean empathy_folks_individual_contains_contact (FolksIndividual *individual);
EmpathyContact * empathy_contact_dup_from_folks_individual (FolksIndividual *individual);
-FolksIndividual *folks_individual_dup_from_empathy_contact (EmpathyContact *contact);
TpChannelGroupChangeReason tp_chanel_group_change_reason_from_folks_groups_change_reason (FolksGroupsChangeReason reason);
G_END_DECLS