diff options
author | Rob Staudinger <robsta@linux.intel.com> | 2011-10-20 15:09:27 +0200 |
---|---|---|
committer | Rob Staudinger <robsta@linux.intel.com> | 2011-10-20 15:09:27 +0200 |
commit | c822c70b1e6176efed59a3f431207785ccae3d02 (patch) | |
tree | e8f4d6e315dc715e80ceacdae6e3a73f11cece1a | |
parent | b477f1fd3751cec45de4b96f65626397a44d27e6 (diff) |
Contact: use "contact-id" consistently instead of just "id".
Also clean up the dependent code and examples.
Tags: api
-rw-r--r-- | tests/file-transfer.c | 2 | ||||
-rw-r--r-- | ytstenut/profile/yts-profile-impl.c | 4 | ||||
-rw-r--r-- | ytstenut/yts-client.c | 6 | ||||
-rw-r--r-- | ytstenut/yts-contact.c | 27 | ||||
-rw-r--r-- | ytstenut/yts-contact.h | 2 | ||||
-rw-r--r-- | ytstenut/yts-service.c | 8 | ||||
-rw-r--r-- | ytstenut/ytstenut.sym | 2 |
7 files changed, 24 insertions, 27 deletions
diff --git a/tests/file-transfer.c b/tests/file-transfer.c index bfde741..d4818c7 100644 --- a/tests/file-transfer.c +++ b/tests/file-transfer.c @@ -80,7 +80,7 @@ service_added_cb (YtsRoster *roster, YtsService *service, gpointer data) { YtsClient *client = yts_roster_get_client (roster); YtsContact *contact = yts_service_get_contact (service); - const char *jid = yts_contact_get_id (contact); + const char *jid = yts_contact_get_contact_id (contact); const char *sid = yts_service_get_service_id (service); static YtsService *to = NULL; diff --git a/ytstenut/profile/yts-profile-impl.c b/ytstenut/profile/yts-profile-impl.c index 6a5ecdc..e6043c6 100644 --- a/ytstenut/profile/yts-profile-impl.c +++ b/ytstenut/profile/yts-profile-impl.c @@ -98,7 +98,7 @@ _register_proxy (YtsProfile *self, if (NULL == return_value) { g_critical ("%s : Failed to register proxy %s:%s for %s", G_STRLOC, - yts_contact_get_id (contact), + yts_contact_get_contact_id (contact), proxy_id, capability); return_value = g_variant_new_boolean (false); @@ -174,7 +174,7 @@ _unregister_proxy (YtsProfile *self, if (!ret) { g_critical ("%s : Failed to unregister proxy %s:%s for %s", G_STRLOC, - yts_contact_get_id (contact), + yts_contact_get_contact_id (contact), proxy_id, capability); yts_profile_unregister_proxy_return (self, invocation_id, false); diff --git a/ytstenut/yts-client.c b/ytstenut/yts-client.c index b016f38..63f5cdd 100644 --- a/ytstenut/yts-client.c +++ b/ytstenut/yts-client.c @@ -518,7 +518,7 @@ yts_client_ft_accept_cb (TpProxy *proxy, if ((item = yts_roster_find_contact_by_handle (priv->roster, ihandle))) { - jid = yts_contact_get_id (item); + jid = yts_contact_get_contact_id (item); } else { @@ -583,7 +583,7 @@ yts_client_ft_handle_state (YtsClient *self, TpChannel *proxy, guint state) if (item) YTS_NOTE (FILE_TRANSFER, "Got request for FT channel from %s (%s)", - yts_contact_get_id (item), + yts_contact_get_contact_id (item), tp_proxy_get_bus_name (proxy)); else YTS_NOTE (FILE_TRANSFER, @@ -618,7 +618,7 @@ yts_client_ft_handle_state (YtsClient *self, TpChannel *proxy, guint state) if (item) { - jid = yts_contact_get_id (item); + jid = yts_contact_get_contact_id (item); name = tp_asv_get_string (props, "Filename"); diff --git a/ytstenut/yts-contact.c b/ytstenut/yts-contact.c index 1f4ed53..2094b21 100644 --- a/ytstenut/yts-contact.c +++ b/ytstenut/yts-contact.c @@ -53,7 +53,6 @@ G_DEFINE_TYPE (YtsContact, yts_contact, G_TYPE_OBJECT); */ typedef struct { - const char *contact_id; GHashTable *services; /* hash of YtsService instances */ TpContact *tp_contact; /* TpContact associated with YtsContact */ @@ -74,7 +73,7 @@ enum { enum { PROP_0, - PROP_JID, + PROP_CONTACT_ID, PROP_ICON, PROP_TP_CONTACT, @@ -140,7 +139,7 @@ yts_contact_ft_op_cb (EmpathyTpFile *tp_file, { e = (atom | YTS_ERROR_UNKNOWN); g_warning ("File transfer to %s failed: %s", - yts_contact_get_id (self), error->message); + yts_contact_get_contact_id (self), error->message); } else e = (atom | YTS_ERROR_SUCCESS); @@ -305,8 +304,9 @@ _get_property (GObject *object, YtsContactPrivate *priv = GET_PRIVATE (object); switch (property_id) { - case PROP_JID: - g_value_set_string (value, priv->contact_id); + case PROP_CONTACT_ID: + g_value_set_string (value, + yts_contact_get_contact_id (YTS_CONTACT (object))); break; case PROP_ICON: { @@ -335,9 +335,6 @@ _set_property (GObject *object, YtsContactPrivate *priv = GET_PRIVATE (object); switch (property_id) { - case PROP_JID: - priv->contact_id = g_intern_string (g_value_get_string (value)); - break; case PROP_TP_CONTACT: priv->tp_contact = g_value_dup_object (value); break; @@ -414,11 +411,10 @@ yts_contact_class_init (YtsContactClass *klass) * * The jid of this contact */ - pspec = g_param_spec_string ("jid", "", "", + pspec = g_param_spec_string ("contact-id", "", "", NULL, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY); - g_object_class_install_property (object_class, PROP_JID, pspec); + G_PARAM_READABLE); + g_object_class_install_property (object_class, PROP_CONTACT_ID, pspec); /** * YtsContact:tp-contact: @@ -506,7 +502,7 @@ yts_contact_init (YtsContact *self) } /** - * yts_contact_get_id: + * yts_contact_get_contact_id: * @self: object on which to invoke this method. * * Retrieves the jabber identifier of this contact. @@ -514,13 +510,14 @@ yts_contact_init (YtsContact *self) * Returns: (transfer none): The JID of this contact. */ const char * -yts_contact_get_id (YtsContact const *self) +yts_contact_get_contact_id (YtsContact const *self) { YtsContactPrivate *priv = GET_PRIVATE (self); g_return_val_if_fail (YTS_IS_CONTACT (self), NULL); + g_return_val_if_fail (priv->tp_contact, NULL); - return priv->contact_id; + return tp_contact_get_identifier (priv->tp_contact); } /** diff --git a/ytstenut/yts-contact.h b/ytstenut/yts-contact.h index de4d5cb..d736eb5 100644 --- a/ytstenut/yts-contact.h +++ b/ytstenut/yts-contact.h @@ -82,7 +82,7 @@ GType yts_contact_get_type (void) G_GNUC_CONST; char const * -yts_contact_get_id (YtsContact const *self); +yts_contact_get_contact_id (YtsContact const *self); char const * yts_contact_get_name (YtsContact const *self); diff --git a/ytstenut/yts-service.c b/ytstenut/yts-service.c index 2c97510..e643412 100644 --- a/ytstenut/yts-service.c +++ b/ytstenut/yts-service.c @@ -56,7 +56,7 @@ enum { /* YtsService */ PROP_TYPE, PROP_NAMES, - PROP_ID, + PROP_SERVICE_ID, PROP_STATUSES }; @@ -114,7 +114,7 @@ _get_property (GObject *object, /* YtsService */ - case PROP_ID: + case PROP_SERVICE_ID: g_value_set_string (value, priv->service_id); break; case PROP_TYPE: @@ -149,7 +149,7 @@ _set_property (GObject *object, /* YtsService */ - case PROP_ID: + case PROP_SERVICE_ID: priv->service_id = g_intern_string (g_value_get_string (value)); break; case PROP_STATUSES: @@ -221,7 +221,7 @@ yts_service_class_init (YtsServiceClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_ID, pspec); + g_object_class_install_property (object_class, PROP_SERVICE_ID, pspec); /** * YtsService:type: diff --git a/ytstenut/ytstenut.sym b/ytstenut/ytstenut.sym index 44abcaa..86d7059 100644 --- a/ytstenut/ytstenut.sym +++ b/ytstenut/ytstenut.sym @@ -19,7 +19,7 @@ yts_client_set_incoming_file_directory yts_client_set_status_by_capability yts_contact_cancel_file yts_contact_get_icon -yts_contact_get_id +yts_contact_get_contact_id yts_contact_get_name yts_contact_get_tp_contact yts_contact_get_type |