diff options
author | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2009-05-10 04:34:08 +0800 |
---|---|---|
committer | Pierre-Luc Beaudoin <pierre-luc@pierlux.com> | 2009-05-10 05:22:23 +0800 |
commit | c074b43f01aec761dbc1ab61ae7d115cdae36d10 (patch) | |
tree | a9d8c9cf88164b1f0ce73048747bf2371d4d4980 /libempathy | |
parent | ab2afe35584bc25e8374b9ee4832df2d48192299 (diff) | |
download | gsoc2013-empathy-c074b43f01aec761dbc1ab61ae7d115cdae36d10.tar gsoc2013-empathy-c074b43f01aec761dbc1ab61ae7d115cdae36d10.tar.gz gsoc2013-empathy-c074b43f01aec761dbc1ab61ae7d115cdae36d10.tar.bz2 gsoc2013-empathy-c074b43f01aec761dbc1ab61ae7d115cdae36d10.tar.lz gsoc2013-empathy-c074b43f01aec761dbc1ab61ae7d115cdae36d10.tar.xz gsoc2013-empathy-c074b43f01aec761dbc1ab61ae7d115cdae36d10.tar.zst gsoc2013-empathy-c074b43f01aec761dbc1ab61ae7d115cdae36d10.zip |
Remove the interface checks as per Zdra comments
The interface checks were superfluous as the connect_to
does nothing if the interface doesn't exist and
call methods directly call the callback with an error
if such method doesn't exist. That is why I kept
the verification there as I didn't want to polute
logs with error messages.
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-tp-contact-factory.c | 52 |
1 files changed, 9 insertions, 43 deletions
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c index c330351ba..4ab5fd4ba 100644 --- a/libempathy/empathy-tp-contact-factory.c +++ b/libempathy/empathy-tp-contact-factory.c @@ -46,7 +46,6 @@ typedef struct { guint avatar_max_height; guint avatar_max_size; gboolean can_request_ft; - gboolean has_location_iface; } EmpathyTpContactFactoryPriv; G_DEFINE_TYPE (EmpathyTpContactFactory, empathy_tp_contact_factory, G_TYPE_OBJECT); @@ -629,7 +628,8 @@ tp_contact_factory_add_contact (EmpathyTpContactFactory *tp_factory, tp_contact_factory_got_capabilities (tp_factory, capabilities, error); g_clear_error (&error); - if (priv->has_location_iface == TRUE) { + if (tp_proxy_has_interface (TP_PROXY (priv->connection), + EMP_IFACE_CONNECTION_INTERFACE_LOCATION)) { emp_cli_connection_interface_location_call_get_locations (TP_PROXY (priv->connection), -1, &handles, @@ -1045,40 +1045,6 @@ empathy_tp_contact_factory_set_location (EmpathyTpContactFactory *tp_factory, } static void -tp_connection_get_interfaces_cb (TpConnection *proxy, - const gchar **interfaces, - const GError *error, - gpointer data, - GObject *weak_object) -{ - EmpathyTpContactFactory *tp_factory = EMPATHY_TP_CONTACT_FACTORY (data); - EmpathyTpContactFactoryPriv *priv = tp_factory->priv; - const gchar *iface = NULL; - gboolean found = FALSE; - gint i = 0; - - if (error != NULL) { - g_warning ("Could not get the connection's interfaces: %s", error->message); - return; - } - - iface = interfaces[i]; - while (iface != NULL && found == FALSE) { - found = strcmp (iface, EMP_IFACE_CONNECTION_INTERFACE_LOCATION) == 0; - iface = interfaces[++i]; - } - priv->has_location_iface = found; - - if (priv->has_location_iface) { - emp_cli_connection_interface_location_connect_to_location_updated (TP_PROXY (priv->connection), - tp_contact_factory_location_updated_cb, - NULL, NULL, - G_OBJECT (tp_factory), - NULL); - } -} - -static void tp_contact_factory_get_property (GObject *object, guint param_id, GValue *value, @@ -1125,12 +1091,6 @@ tp_contact_factory_set_property (GObject *object, switch (param_id) { case PROP_CONNECTION: priv->connection = g_value_dup_object (value); - tp_cli_connection_call_get_interfaces (priv->connection, - -1, - tp_connection_get_interfaces_cb, - object, - NULL, - NULL); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); @@ -1189,6 +1149,13 @@ tp_contact_factory_constructor (GType type, tp_factory, NULL); + + emp_cli_connection_interface_location_connect_to_location_updated (TP_PROXY (priv->connection), + tp_contact_factory_location_updated_cb, + NULL, NULL, + G_OBJECT (tp_factory), + NULL); + /* FIXME: This should be moved to TpConnection */ tp_cli_connection_interface_avatars_call_get_avatar_requirements (priv->connection, -1, @@ -1298,7 +1265,6 @@ empathy_tp_contact_factory_init (EmpathyTpContactFactory *tp_factory) tp_factory->priv = priv; priv->can_request_ft = FALSE; - priv->has_location_iface = FALSE; } static GHashTable *factories = NULL; |