[empathy] ft-handler: Use TpFileTransferChannel properties



commit caad2d2f4a0cd94004d3abdf44c92243e4b645fc
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Sep 27 14:29:51 2011 +0200

    ft-handler: Use TpFileTransferChannel properties
    
    https://bugzilla.gnome.org/show_bug.cgi?id=658245

 libempathy/empathy-ft-handler.c |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index 1b4edcc..4cc04c8 100644
--- a/libempathy/empathy-ft-handler.c
+++ b/libempathy/empathy-ft-handler.c
@@ -1267,27 +1267,12 @@ channel_get_all_properties_cb (TpProxy *proxy,
       return;
     }
 
-  priv->total_bytes = g_value_get_uint64 (
-      g_hash_table_lookup (properties, "Size"));
-
-  priv->transferred_bytes = g_value_get_uint64 (
-      g_hash_table_lookup (properties, "TransferredBytes"));
-
-  priv->filename = g_value_dup_string (
-      g_hash_table_lookup (properties, "Filename"));
-
   priv->content_hash = g_value_dup_string (
       g_hash_table_lookup (properties, "ContentHash"));
 
   priv->content_hash_type = g_value_get_uint (
       g_hash_table_lookup (properties, "ContentHashType"));
 
-  priv->content_type = g_value_dup_string (
-      g_hash_table_lookup (properties, "ContentType"));
-
-  priv->description = g_value_dup_string (
-      g_hash_table_lookup (properties, "Description"));
-
   c_handle = tp_channel_get_handle (TP_CHANNEL (proxy), NULL);
   empathy_tp_contact_factory_get_from_handle (
       tp_channel_borrow_connection (TP_CHANNEL (proxy)), c_handle,
@@ -1364,17 +1349,34 @@ empathy_ft_handler_new_incoming (EmpathyTpFile *tp_file,
 {
   EmpathyFTHandler *handler;
   CallbacksData *data;
+  TpFileTransferChannel *ft_chan = (TpFileTransferChannel *) tp_file;
+  EmpathyFTHandlerPriv *priv;
 
   g_return_if_fail (EMPATHY_IS_TP_FILE (tp_file));
 
   handler = g_object_new (EMPATHY_TYPE_FT_HANDLER,
       "tp-file", tp_file, NULL);
 
+  priv = GET_PRIV (handler);
+
   data = g_slice_new0 (CallbacksData);
   data->callback = callback;
   data->user_data = user_data;
   data->handler = g_object_ref (handler);
 
+  priv->total_bytes = tp_file_transfer_channel_get_size (ft_chan);
+
+  priv->transferred_bytes = tp_file_transfer_channel_get_transferred_bytes (
+      ft_chan);
+
+  priv->filename = g_strdup (tp_file_transfer_channel_get_filename (ft_chan));
+
+  priv->content_type = g_strdup (tp_file_transfer_channel_get_mime_type (
+      ft_chan));
+
+  priv->description = g_strdup (tp_file_transfer_channel_get_description (
+      ft_chan));
+
   tp_cli_dbus_properties_call_get_all (tp_file,
       -1, TP_IFACE_CHANNEL_TYPE_FILE_TRANSFER,
       channel_get_all_properties_cb, data, NULL, G_OBJECT (handler));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]