aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-contact-widget.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-31 23:14:24 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-04-05 20:55:41 +0800
commit8a541771a297fd390b5dae66340ea3fa2c1f4933 (patch)
treed02be6a7c8d615bbab940e4a2cadce68e04a62ad /libempathy-gtk/empathy-contact-widget.c
parent86ebf6f6a255295675ab717045471e01096057cc (diff)
downloadgsoc2013-empathy-8a541771a297fd390b5dae66340ea3fa2c1f4933.tar
gsoc2013-empathy-8a541771a297fd390b5dae66340ea3fa2c1f4933.tar.gz
gsoc2013-empathy-8a541771a297fd390b5dae66340ea3fa2c1f4933.tar.bz2
gsoc2013-empathy-8a541771a297fd390b5dae66340ea3fa2c1f4933.tar.lz
gsoc2013-empathy-8a541771a297fd390b5dae66340ea3fa2c1f4933.tar.xz
gsoc2013-empathy-8a541771a297fd390b5dae66340ea3fa2c1f4933.tar.zst
gsoc2013-empathy-8a541771a297fd390b5dae66340ea3fa2c1f4933.zip
Use Account.Nickname to set our own alias (#613044)
Diffstat (limited to 'libempathy-gtk/empathy-contact-widget.c')
-rw-r--r--libempathy-gtk/empathy-contact-widget.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c
index 82a5ac703..138ec215e 100644
--- a/libempathy-gtk/empathy-contact-widget.c
+++ b/libempathy-gtk/empathy-contact-widget.c
@@ -886,6 +886,29 @@ contact_widget_avatar_changed_cb (EmpathyAvatarChooser *chooser,
data, size, mime_type);
}
+static void
+set_nickname_cb (GObject *source,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ GError *error = NULL;
+
+ if (!tp_account_set_nickname_finish (TP_ACCOUNT (source), res, &error))
+ {
+ DEBUG ("Failed to set Account.Nickname: %s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+set_alias_on_account (TpAccount *account,
+ const gchar *alias)
+{
+ DEBUG ("Set Account.Nickname to %s", alias);
+
+ tp_account_set_nickname_async (account, alias, set_nickname_cb, NULL);
+}
+
static gboolean
contact_widget_entry_alias_focus_event_cb (GtkEditable *editable,
GdkEventFocus *event,
@@ -896,8 +919,19 @@ contact_widget_entry_alias_focus_event_cb (GtkEditable *editable,
const gchar *alias;
alias = gtk_entry_get_text (GTK_ENTRY (editable));
- empathy_tp_contact_factory_set_alias (information->factory,
- information->contact, alias);
+
+ if (empathy_contact_is_user (information->contact))
+ {
+ TpAccount * account;
+
+ account = empathy_contact_get_account (information->contact);
+ set_alias_on_account (account, alias);
+ }
+ else
+ {
+ empathy_tp_contact_factory_set_alias (information->factory,
+ information->contact, alias);
+ }
}
return FALSE;