aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2010-07-07 23:21:43 +0800
committerTravis Reitter <treitter@gmail.com>2010-07-22 04:25:09 +0800
commitb6568db4f81cf4e78e96aa5fe23f020de5ff6557 (patch)
tree7f0dd7dbfb45315d5bf16f0db623a98d3fe6f19d /libempathy
parenta244924636a2a0cde9da06909ac2b1b141ce3b9e (diff)
downloadgsoc2013-empathy-b6568db4f81cf4e78e96aa5fe23f020de5ff6557.tar
gsoc2013-empathy-b6568db4f81cf4e78e96aa5fe23f020de5ff6557.tar.gz
gsoc2013-empathy-b6568db4f81cf4e78e96aa5fe23f020de5ff6557.tar.bz2
gsoc2013-empathy-b6568db4f81cf4e78e96aa5fe23f020de5ff6557.tar.lz
gsoc2013-empathy-b6568db4f81cf4e78e96aa5fe23f020de5ff6557.tar.xz
gsoc2013-empathy-b6568db4f81cf4e78e96aa5fe23f020de5ff6557.tar.zst
gsoc2013-empathy-b6568db4f81cf4e78e96aa5fe23f020de5ff6557.zip
Merge EmpathyContact:name and *_set_alias() to EmpathyContact:alias
The "name" API was a relic of Gossip.
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-contact.c71
-rw-r--r--libempathy/empathy-contact.h5
-rw-r--r--libempathy/empathy-individual-manager.c2
-rw-r--r--libempathy/empathy-message.c2
-rw-r--r--libempathy/empathy-tp-chat.c2
5 files changed, 33 insertions, 49 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index 3a16c3e37..57a4449c3 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -51,7 +51,7 @@ typedef struct {
TpAccount *account;
FolksPersona *persona;
gchar *id;
- gchar *name;
+ gchar *alias;
EmpathyAvatar *avatar;
TpConnectionPresenceType presence;
gchar *presence_message;
@@ -96,7 +96,7 @@ enum
PROP_ACCOUNT,
PROP_PERSONA,
PROP_ID,
- PROP_NAME,
+ PROP_ALIAS,
PROP_AVATAR,
PROP_PRESENCE,
PROP_PRESENCE_MESSAGE,
@@ -125,7 +125,7 @@ tp_contact_notify_cb (TpContact *tp_contact,
/* Forward property notifications */
if (!tp_strdiff (param->name, "alias"))
- g_object_notify (contact, "name");
+ g_object_notify (contact, "alias");
else if (!tp_strdiff (param->name, "presence-type")) {
TpConnectionPresenceType presence;
@@ -242,10 +242,10 @@ empathy_contact_class_init (EmpathyContactClass *class)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (object_class,
- PROP_NAME,
- g_param_spec_string ("name",
- "Contact Name",
- "The name of the contact",
+ PROP_ALIAS,
+ g_param_spec_string ("alias",
+ "Contact alias",
+ "An alias for the contact",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
@@ -345,7 +345,7 @@ contact_finalize (GObject *object)
DEBUG ("finalize: %p", object);
- g_free (priv->name);
+ g_free (priv->alias);
g_free (priv->id);
g_free (priv->presence_message);
@@ -411,8 +411,8 @@ contact_get_property (GObject *object,
case PROP_ID:
g_value_set_string (value, empathy_contact_get_id (contact));
break;
- case PROP_NAME:
- g_value_set_string (value, empathy_contact_get_name (contact));
+ case PROP_ALIAS:
+ g_value_set_string (value, empathy_contact_get_alias (contact));
break;
case PROP_AVATAR:
g_value_set_boxed (value, empathy_contact_get_avatar (contact));
@@ -462,8 +462,8 @@ contact_set_property (GObject *object,
case PROP_ID:
empathy_contact_set_id (contact, g_value_get_string (value));
break;
- case PROP_NAME:
- empathy_contact_set_name (contact, g_value_get_string (value));
+ case PROP_ALIAS:
+ empathy_contact_set_alias (contact, g_value_get_string (value));
break;
case PROP_AVATAR:
empathy_contact_set_avatar (contact, g_value_get_boxed (value));
@@ -512,7 +512,7 @@ empathy_contact_from_tpl_contact (TpAccount *account,
retval = g_object_new (EMPATHY_TYPE_CONTACT,
"id", tpl_entity_get_alias (tpl_entity),
- "name", tpl_entity_get_identifier (tpl_entity),
+ "alias", tpl_entity_get_identifier (tpl_entity),
"account", account,
"is-user", is_user,
NULL);
@@ -527,7 +527,7 @@ empathy_contact_from_tpl_contact (TpAccount *account,
EmpathyContact *
empathy_contact_new_for_log (TpAccount *account,
const gchar *id,
- const gchar *name,
+ const gchar *alias,
gboolean is_user)
{
g_return_val_if_fail (id != NULL, NULL);
@@ -536,7 +536,7 @@ empathy_contact_new_for_log (TpAccount *account,
return g_object_new (EMPATHY_TYPE_CONTACT,
"account", account,
"id", id,
- "name", name,
+ "alias", alias,
"is-user", is_user,
NULL);
}
@@ -588,15 +588,15 @@ empathy_contact_set_id (EmpathyContact *contact,
priv->id = g_strdup (id);
g_object_notify (G_OBJECT (contact), "id");
- if (EMP_STR_EMPTY (priv->name))
- g_object_notify (G_OBJECT (contact), "name");
+ if (EMP_STR_EMPTY (priv->alias))
+ g_object_notify (G_OBJECT (contact), "alias");
}
g_object_unref (contact);
}
const gchar *
-empathy_contact_get_name (EmpathyContact *contact)
+empathy_contact_get_alias (EmpathyContact *contact)
{
EmpathyContactPriv *priv;
const gchar *alias;
@@ -608,7 +608,7 @@ empathy_contact_get_name (EmpathyContact *contact)
if (priv->tp_contact != NULL)
alias = tp_contact_get_alias (priv->tp_contact);
else
- alias = priv->name;
+ alias = priv->alias;
if (!EMP_STR_EMPTY (alias))
return alias;
@@ -617,41 +617,26 @@ empathy_contact_get_name (EmpathyContact *contact)
}
void
-empathy_contact_set_name (EmpathyContact *contact,
- const gchar *name)
+empathy_contact_set_alias (EmpathyContact *contact,
+ const gchar *alias)
{
EmpathyContactPriv *priv;
+ FolksPersona *persona;
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
priv = GET_PRIV (contact);
g_object_ref (contact);
- if (tp_strdiff (name, priv->name))
+
+ if (tp_strdiff (alias, priv->alias))
{
- g_free (priv->name);
- priv->name = g_strdup (name);
- g_object_notify (G_OBJECT (contact), "name");
+ g_free (priv->alias);
+ priv->alias = g_strdup (alias);
+ g_object_notify (G_OBJECT (contact), "alias");
}
- g_object_unref (contact);
-}
-
-void
-empathy_contact_set_alias (EmpathyContact *contact,
- const gchar *alias)
-{
- FolksPersona *persona;
-
- g_return_if_fail (EMPATHY_IS_CONTACT (contact));
- persona = empathy_contact_get_persona (contact);
- if (persona == NULL || !FOLKS_IS_ALIAS (persona))
- return;
-
- DEBUG ("Setting alias for contact %s to %s", empathy_contact_get_id (contact),
- alias);
-
- folks_alias_set_alias (FOLKS_ALIAS (persona), alias);
+ g_object_unref (contact);
}
EmpathyAvatar *
diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h
index a5b58ce64..7980ab252 100644
--- a/libempathy/empathy-contact.h
+++ b/libempathy/empathy-contact.h
@@ -75,12 +75,11 @@ EmpathyContact * empathy_contact_new (TpContact *tp_contact);
EmpathyContact * empathy_contact_from_tpl_contact (TpAccount *account,
TplEntity *tpl_contact);
EmpathyContact * empathy_contact_new_for_log (TpAccount *account,
- const gchar *id, const gchar *name, gboolean is_user);
+ const gchar *id, const gchar *alias, gboolean is_user);
TpContact * empathy_contact_get_tp_contact (EmpathyContact *contact);
const gchar * empathy_contact_get_id (EmpathyContact *contact);
void empathy_contact_set_id (EmpathyContact *contact, const gchar *id);
-const gchar * empathy_contact_get_name (EmpathyContact *contact);
-void empathy_contact_set_name (EmpathyContact *contact, const gchar *name);
+const gchar * empathy_contact_get_alias (EmpathyContact *contact);
void empathy_contact_set_alias (EmpathyContact *contact, const gchar *alias);
EmpathyAvatar * empathy_contact_get_avatar (EmpathyContact *contact);
void empathy_contact_set_avatar (EmpathyContact *contact,
diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c
index 9eeb5d3c8..cb3a3975e 100644
--- a/libempathy/empathy-individual-manager.c
+++ b/libempathy/empathy-individual-manager.c
@@ -309,7 +309,7 @@ empathy_individual_manager_add_from_contact (EmpathyIndividualManager *self,
g_object_ref (contact);
DEBUG ("adding individual from contact %s (%s)",
- empathy_contact_get_id (contact), empathy_contact_get_name (contact));
+ empathy_contact_get_id (contact), empathy_contact_get_alias (contact));
account = empathy_contact_get_account (contact);
store_id = tp_proxy_get_object_path (TP_PROXY (account));
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index a8d6af575..07827f8e0 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -530,7 +530,7 @@ empathy_message_should_highlight (EmpathyMessage *message)
return FALSE;
}
- to = empathy_contact_get_name (contact);
+ to = empathy_contact_get_alias (contact);
if (!to) {
return FALSE;
}
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 90c31e4cc..0ec866617 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -429,7 +429,7 @@ tp_chat_state_changed_got_contact_cb (TpConnection *connection,
state = GPOINTER_TO_UINT (user_data);
DEBUG ("Chat state changed for %s (%d): %d",
- empathy_contact_get_name (contact),
+ empathy_contact_get_alias (contact),
empathy_contact_get_handle (contact), state);
g_signal_emit (chat, signals[CHAT_STATE_CHANGED], 0, contact, state);