summaryrefslogtreecommitdiff
path: root/src/mcd-connection-service-points.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-10-02 19:46:41 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-10-04 12:32:36 +0100
commit010677b4f5bdd6426b5f7d1a5fc946f4c5d37f2c (patch)
tree7e6b1e20fca3a02ac06db3fee670ddd6ef986933 /src/mcd-connection-service-points.c
parenta3b0355bf0f7f4fb5d17eca056d6d3c6c2caf058 (diff)
downloadtelepathy-mission-control-010677b4f5bdd6426b5f7d1a5fc946f4c5d37f2c.tar.gz
Make ServicePoint setup more sensible
mcd_connection_service_point_setup shouldn't call GetInterfaces - TpConnection already knows how to do that. As currently implemented, mcd_connection_service_point_setup() is only called from the status-changed callback for CONNECTED, which telepathy-glib guarantees not to call until core features are ready. However, it's a lot more clearly correct if we do this in on_connection_ready(). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54879 Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Diffstat (limited to 'src/mcd-connection-service-points.c')
-rw-r--r--src/mcd-connection-service-points.c50
1 files changed, 11 insertions, 39 deletions
diff --git a/src/mcd-connection-service-points.c b/src/mcd-connection-service-points.c
index 896f4bc9..b52abe30 100644
--- a/src/mcd-connection-service-points.c
+++ b/src/mcd-connection-service-points.c
@@ -90,31 +90,16 @@ service_points_fetched_cb (TpProxy *proxy,
parse_services_list (connection, g_value_get_boxed (value));
}
-static void
-service_point_interface_check (TpConnection *tp_conn,
- const gchar **interfaces,
- const GError *error,
- gpointer data,
- GObject *connection)
+void
+mcd_connection_service_point_setup (McdConnection *connection,
+ gboolean watch)
{
- const gchar *interface;
- gboolean found = FALSE;
- gboolean watch = GPOINTER_TO_UINT (data);
- guint i = 0;
-
- if (interfaces == NULL)
- return;
-
- for (interface = interfaces[0];
- !found && !tp_str_empty (interface);
- interface = interfaces[++i])
- {
- if (!tp_strdiff (interface, TP_IFACE_CONNECTION_INTERFACE_SERVICE_POINT))
- found = TRUE;
- }
+ TpConnection *tp_conn = mcd_connection_get_tp_connection (connection);
- if (!found)
- return;
+ g_return_if_fail (MCD_IS_CONNECTION (connection));
+ g_return_if_fail (TP_IS_PROXY (tp_conn));
+ g_return_if_fail (tp_proxy_is_prepared (tp_conn,
+ TP_CONNECTION_FEATURE_CONNECTED));
/* so we know if/when the service points change (eg the SIM might not be
* accessible yet, in which case the call below won't return any entries)
@@ -122,25 +107,12 @@ service_point_interface_check (TpConnection *tp_conn,
*/
if (watch)
tp_cli_connection_interface_service_point_connect_to_service_points_changed
- (tp_conn, service_points_changed_cb, NULL, NULL, connection, NULL);
+ (tp_conn, service_points_changed_cb, NULL, NULL,
+ (GObject *) connection, NULL);
/* fetch the current list to initialise our state */
tp_cli_dbus_properties_call_get (tp_conn, -1,
TP_IFACE_CONNECTION_INTERFACE_SERVICE_POINT,
"KnownServicePoints", service_points_fetched_cb,
- NULL, NULL, connection);
-}
-
-void
-mcd_connection_service_point_setup (McdConnection *connection, gboolean watch)
-{
- TpConnection *tp_conn = mcd_connection_get_tp_connection (connection);
-
- if (G_UNLIKELY (!tp_conn))
- return;
-
- /* see if the connection supports the service point interface */
- tp_cli_connection_call_get_interfaces (tp_conn, -1,
- service_point_interface_check,
- GUINT_TO_POINTER (watch), NULL, G_OBJECT (connection));
+ NULL, NULL, (GObject *) connection);
}