diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2010-08-18 21:41:49 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2010-08-19 01:18:51 +0800 |
commit | 92c282488352fd9067fdfbd1d9e96b668a2ff19c (patch) | |
tree | 97f7a67a5fc3627ed9715d10ace9a334486d93e8 /libempathy/empathy-server-tls-handler.c | |
parent | d9428d22891d01b25b08f23278317daa78871274 (diff) | |
download | gsoc2013-empathy-92c282488352fd9067fdfbd1d9e96b668a2ff19c.tar gsoc2013-empathy-92c282488352fd9067fdfbd1d9e96b668a2ff19c.tar.gz gsoc2013-empathy-92c282488352fd9067fdfbd1d9e96b668a2ff19c.tar.bz2 gsoc2013-empathy-92c282488352fd9067fdfbd1d9e96b668a2ff19c.tar.lz gsoc2013-empathy-92c282488352fd9067fdfbd1d9e96b668a2ff19c.tar.xz gsoc2013-empathy-92c282488352fd9067fdfbd1d9e96b668a2ff19c.tar.zst gsoc2013-empathy-92c282488352fd9067fdfbd1d9e96b668a2ff19c.zip |
Use _borrow_immutable_properties instead of GetAll()
This also simplifies the code somewhat
Diffstat (limited to 'libempathy/empathy-server-tls-handler.c')
-rw-r--r-- | libempathy/empathy-server-tls-handler.c | 65 |
1 files changed, 21 insertions, 44 deletions
diff --git a/libempathy/empathy-server-tls-handler.c b/libempathy/empathy-server-tls-handler.c index 10a2daf20..a207dffcf 100644 --- a/libempathy/empathy-server-tls-handler.c +++ b/libempathy/empathy-server-tls-handler.c @@ -79,45 +79,6 @@ tls_certificate_constructed_cb (GObject *source, g_object_unref (priv->async_init_res); } -static void -server_tls_channel_got_all_cb (TpProxy *proxy, - GHashTable *properties, - const GError *error, - gpointer user_data, - GObject *weak_object) -{ - EmpathyServerTLSHandler *self = EMPATHY_SERVER_TLS_HANDLER (weak_object); - EmpathyServerTLSHandlerPriv *priv = GET_PRIV (self); - - if (error != NULL) - { - g_simple_async_result_set_from_error (priv->async_init_res, error); - g_simple_async_result_complete_in_idle (priv->async_init_res); - g_object_unref (priv->async_init_res); - } - else - { - const gchar *cert_object_path; - const gchar *hostname; - - cert_object_path = tp_asv_get_object_path (properties, - "ServerCertificate"); - - DEBUG ("Creating an EmpathyTLSCertificate for path %s, bus name %s", - cert_object_path, tp_proxy_get_bus_name (proxy)); - - empathy_tls_certificate_new_async ( - tp_proxy_get_bus_name (proxy), - cert_object_path, - tls_certificate_constructed_cb, self); - - hostname = tp_asv_get_string (properties, "Hostname"); - priv->hostname = g_strdup (hostname); - - DEBUG ("Received hostname: %s", hostname); - } -} - static gboolean tls_handler_init_finish (GAsyncInitable *initable, GAsyncResult *res, @@ -140,18 +101,34 @@ tls_handler_init_async (GAsyncInitable *initable, GAsyncReadyCallback callback, gpointer user_data) { + GHashTable *properties; + const gchar *cert_object_path; + const gchar *hostname; + const gchar *bus_name; EmpathyServerTLSHandler *self = EMPATHY_SERVER_TLS_HANDLER (initable); EmpathyServerTLSHandlerPriv *priv = GET_PRIV (self); g_assert (priv->channel != NULL); priv->async_init_res = g_simple_async_result_new (G_OBJECT (self), - callback, user_data, NULL); + callback, user_data, empathy_tls_certificate_new_async); + properties = tp_channel_borrow_immutable_properties (priv->channel); + + hostname = tp_asv_get_string (properties, + EMP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION ".Hostname"); + priv->hostname = g_strdup (hostname); + + DEBUG ("Received hostname: %s", hostname); + + cert_object_path = tp_asv_get_object_path (properties, + EMP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION ".ServerCertificate"); + bus_name = tp_proxy_get_bus_name (TP_PROXY (priv->channel)); + + DEBUG ("Creating an EmpathyTLSCertificate for path %s, bus name %s", + cert_object_path, bus_name); - /* call GetAll() on the channel properties */ - tp_cli_dbus_properties_call_get_all (priv->channel, - -1, EMP_IFACE_CHANNEL_TYPE_SERVER_TLS_CONNECTION, - server_tls_channel_got_all_cb, NULL, NULL, G_OBJECT (self)); + empathy_tls_certificate_new_async (bus_name, cert_object_path, + tls_certificate_constructed_cb, self); } static void |