diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-04-01 18:16:10 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-04-06 23:56:24 +0800 |
commit | a75c2aa330535747d736c53cf69f0601fbf0f7b3 (patch) | |
tree | 9ddabba1c810c684e3d50af8cc1f5f90b681af84 /libempathy-gtk | |
parent | 73b0aa1cb6fed931065e566646c004985cf433ad (diff) | |
download | gsoc2013-empathy-a75c2aa330535747d736c53cf69f0601fbf0f7b3.tar gsoc2013-empathy-a75c2aa330535747d736c53cf69f0601fbf0f7b3.tar.gz gsoc2013-empathy-a75c2aa330535747d736c53cf69f0601fbf0f7b3.tar.bz2 gsoc2013-empathy-a75c2aa330535747d736c53cf69f0601fbf0f7b3.tar.lz gsoc2013-empathy-a75c2aa330535747d736c53cf69f0601fbf0f7b3.tar.xz gsoc2013-empathy-a75c2aa330535747d736c53cf69f0601fbf0f7b3.tar.zst gsoc2013-empathy-a75c2aa330535747d736c53cf69f0601fbf0f7b3.zip |
Use Account.Avatar to set our own avatar (#613043)
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index 138ec215e..43688e47c 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -872,18 +872,46 @@ widget_avatar_button_press_event_cb (GtkWidget *widget, } static void +set_avatar_cb (GObject *source, + GAsyncResult *res, + gpointer user_data) +{ + GError *error = NULL; + + if (!tp_account_set_avatar_finish (TP_ACCOUNT (source), res, &error)) { + DEBUG ("Failed to set Account.Avatar: %s", error->message); + g_error_free (error); + } +} + +static void +set_avatar_on_account (TpAccount *account, + const gchar *data, + gsize size, + const gchar *mime_type) +{ + DEBUG ("%s Account.Avatar on %s", size > 0 ? "Set": "Clear", + tp_proxy_get_object_path (account)); + + tp_account_set_avatar_async (account, (const guchar *) data, size, + mime_type, set_avatar_cb, NULL); +} + +static void contact_widget_avatar_changed_cb (EmpathyAvatarChooser *chooser, EmpathyContactWidget *information) { const gchar *data; gsize size; const gchar *mime_type; + TpAccount *account; empathy_avatar_chooser_get_image_data ( EMPATHY_AVATAR_CHOOSER (information->widget_avatar), &data, &size, &mime_type); - empathy_tp_contact_factory_set_avatar (information->factory, - data, size, mime_type); + + account = empathy_contact_get_account (information->contact); + set_avatar_on_account (account, data, size, mime_type); } static void |