aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-11-04 07:23:22 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-11-04 07:23:22 +0800
commit48334a065723ce15f191adf391de444f72ae2efb (patch)
treebb0cc93a6b36e376f2ca8153483291369bc2b9e7 /libempathy
parentb07f56b36a34bfcd490f3a14c3315f998de425f3 (diff)
downloadgsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar.gz
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar.bz2
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar.lz
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar.xz
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.tar.zst
gsoc2013-empathy-48334a065723ce15f191adf391de444f72ae2efb.zip
Rename empathy_contact_factory_set_name() to _set_alias(). Implements
2007-11-03 Xavier Claessens <xclaesse@gmail.com> * libempathy-gtk/empathy-contact-widget.c: * libempathy-gtk/empathy-avatar-chooser.c: * libempathy-gtk/empathy-avatar-chooser.h: * python/pyempathy/pyempathy.defs: * libempathy/empathy-contact-factory.c: * libempathy/empathy-contact-factory.h: Rename empathy_contact_factory_set_name() to _set_alias(). Implements empathy_contact_factory_set_avatar(). Return the mime_type in empathy_avatar_chooser_get_image_data(). svn path=/trunk/; revision=417
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-contact-factory.c58
-rw-r--r--libempathy/empathy-contact-factory.h9
2 files changed, 60 insertions, 7 deletions
diff --git a/libempathy/empathy-contact-factory.c b/libempathy/empathy-contact-factory.c
index cbbe9b5fb..2aaa8fad3 100644
--- a/libempathy/empathy-contact-factory.c
+++ b/libempathy/empathy-contact-factory.c
@@ -382,6 +382,23 @@ contact_factory_aliases_changed_cb (DBusGProxy *proxy,
}
static void
+contact_factory_set_avatar_cb (DBusGProxy *proxy,
+ gchar *token,
+ GError *error,
+ gpointer user_data)
+{
+ ContactFactoryAccountData *account_data = user_data;
+
+ if (error) {
+ empathy_debug (DEBUG_DOMAIN, "Error setting avatar: %s",
+ error->message);
+ }
+
+ contact_factory_account_data_unref (account_data);
+ g_free (token);
+}
+
+static void
contact_factory_avatar_retrieved_cb (DBusGProxy *proxy,
guint handle,
gchar *token,
@@ -1189,9 +1206,9 @@ empathy_contact_factory_get_from_handles (EmpathyContactFactory *factory,
}
void
-empathy_contact_factory_set_name (EmpathyContactFactory *factory,
- EmpathyContact *contact,
- const gchar *name)
+empathy_contact_factory_set_alias (EmpathyContactFactory *factory,
+ EmpathyContact *contact,
+ const gchar *alias)
{
ContactFactoryAccountData *account_data;
McAccount *account;
@@ -1212,7 +1229,7 @@ empathy_contact_factory_set_name (EmpathyContactFactory *factory,
empathy_debug (DEBUG_DOMAIN, "Setting alias for contact %s (%d) to %s",
empathy_contact_get_id (contact),
- handle, name);
+ handle, alias);
new_alias = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
@@ -1221,7 +1238,7 @@ empathy_contact_factory_set_name (EmpathyContactFactory *factory,
g_hash_table_insert (new_alias,
GUINT_TO_POINTER (handle),
- g_strdup (name));
+ g_strdup (alias));
tp_conn_iface_aliasing_set_aliases_async (account_data->aliasing_iface,
new_alias,
@@ -1231,6 +1248,37 @@ empathy_contact_factory_set_name (EmpathyContactFactory *factory,
g_hash_table_destroy (new_alias);
}
+void
+empathy_contact_factory_set_avatar (EmpathyContactFactory *factory,
+ McAccount *account,
+ const gchar *data,
+ gsize size,
+ const gchar *mime_type)
+{
+ ContactFactoryAccountData *account_data;
+ GArray avatar;
+
+ g_return_if_fail (EMPATHY_IS_CONTACT_FACTORY (factory));
+ g_return_if_fail (MC_IS_ACCOUNT (account));
+
+ account_data = contact_factory_account_data_get (factory, account);
+
+ if (!account_data->avatars_iface) {
+ return;
+ }
+
+ empathy_debug (DEBUG_DOMAIN, "Setting avatar on account %s",
+ mc_account_get_unique_name (account));
+
+ avatar.data = (gchar*) data;
+ avatar.len = size;
+ tp_conn_iface_avatars_set_avatar_async (account_data->avatars_iface,
+ &avatar,
+ mime_type,
+ contact_factory_set_avatar_cb,
+ contact_factory_account_data_ref (account_data));
+}
+
static void
contact_factory_finalize (GObject *object)
{
diff --git a/libempathy/empathy-contact-factory.h b/libempathy/empathy-contact-factory.h
index bed558781..24aabc772 100644
--- a/libempathy/empathy-contact-factory.h
+++ b/libempathy/empathy-contact-factory.h
@@ -62,9 +62,14 @@ EmpathyContact * empathy_contact_factory_get_from_handle (EmpathyContactF
GList * empathy_contact_factory_get_from_handles (EmpathyContactFactory *factory,
McAccount *account,
GArray *handles);
-void empathy_contact_factory_set_name (EmpathyContactFactory *factory,
+void empathy_contact_factory_set_alias (EmpathyContactFactory *factory,
EmpathyContact *contact,
- const gchar *name);
+ const gchar *alias);
+void empathy_contact_factory_set_avatar (EmpathyContactFactory *factory,
+ McAccount *account,
+ const gchar *data,
+ gsize size,
+ const gchar *mime_type);
G_END_DECLS