aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-27 20:29:51 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-27 21:11:27 +0800
commitcaad2d2f4a0cd94004d3abdf44c92243e4b645fc (patch)
tree1c3836a5fedae47ff5b815f37f28c5b1d2544f84
parentd3531f4364469ba8dd2840974d55c87712544eda (diff)
downloadgsoc2013-empathy-caad2d2f4a0cd94004d3abdf44c92243e4b645fc.tar
gsoc2013-empathy-caad2d2f4a0cd94004d3abdf44c92243e4b645fc.tar.gz
gsoc2013-empathy-caad2d2f4a0cd94004d3abdf44c92243e4b645fc.tar.bz2
gsoc2013-empathy-caad2d2f4a0cd94004d3abdf44c92243e4b645fc.tar.lz
gsoc2013-empathy-caad2d2f4a0cd94004d3abdf44c92243e4b645fc.tar.xz
gsoc2013-empathy-caad2d2f4a0cd94004d3abdf44c92243e4b645fc.tar.zst
gsoc2013-empathy-caad2d2f4a0cd94004d3abdf44c92243e4b645fc.zip
ft-handler: Use TpFileTransferChannel properties
https://bugzilla.gnome.org/show_bug.cgi?id=658245
-rw-r--r--libempathy/empathy-ft-handler.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c
index 1b4edcc56..4cc04c8e0 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));