diff options
-rw-r--r-- | libempathy-gtk/empathy-ft-manager.c | 17 | ||||
-rw-r--r-- | libempathy/empathy-tp-file.c | 10 | ||||
-rw-r--r-- | src/empathy.c | 20 |
3 files changed, 17 insertions, 30 deletions
diff --git a/libempathy-gtk/empathy-ft-manager.c b/libempathy-gtk/empathy-ft-manager.c index 9064a518d..e9b8bd510 100644 --- a/libempathy-gtk/empathy-ft-manager.c +++ b/libempathy-gtk/empathy-ft-manager.c @@ -245,6 +245,7 @@ ft_manager_update_ft_row (EmpathyFTManager *ft_manager, gint percent; EmpFileTransferState state; EmpFileTransferStateChangeReason reason; + gboolean incoming; row_ref = ft_manager_get_row_from_tp_file (ft_manager, tp_file); g_return_if_fail (row_ref != NULL); @@ -255,15 +256,14 @@ ft_manager_update_ft_row (EmpathyFTManager *ft_manager, total_size = empathy_tp_file_get_size (tp_file); state = empathy_tp_file_get_state (tp_file); reason = empathy_tp_file_get_state_change_reason (tp_file); + incoming = empathy_tp_file_get_incoming (tp_file); switch (state) { - case EMP_FILE_TRANSFER_STATE_LOCAL_PENDING: - case EMP_FILE_TRANSFER_STATE_REMOTE_PENDING: + case EMP_FILE_TRANSFER_STATE_PENDING: case EMP_FILE_TRANSFER_STATE_OPEN: case EMP_FILE_TRANSFER_STATE_ACCEPTED: - case EMP_FILE_TRANSFER_STATE_NOT_OFFERED: - if (empathy_tp_file_get_incoming (tp_file)) + if (incoming) /* translators: first %s is filename, second %s is the contact name */ first_line_format = _("Receiving \"%s\" from %s"); else @@ -273,8 +273,8 @@ ft_manager_update_ft_row (EmpathyFTManager *ft_manager, first_line = g_strdup_printf (first_line_format, filename, contact_name); if (state == EMP_FILE_TRANSFER_STATE_OPEN - || state == EMP_FILE_TRANSFER_STATE_ACCEPTED - || state == EMP_FILE_TRANSFER_STATE_LOCAL_PENDING) + || (incoming && state == EMP_FILE_TRANSFER_STATE_ACCEPTED) + || (incoming && state == EMP_FILE_TRANSFER_STATE_PENDING)) { gchar *total_size_str; gchar *transferred_bytes_str; @@ -297,8 +297,6 @@ ft_manager_update_ft_row (EmpathyFTManager *ft_manager, g_free (total_size_str); } - else if (state == EMP_FILE_TRANSFER_STATE_NOT_OFFERED) - second_line = g_strdup (_("File not yet offered")); else second_line = g_strdup (_("Waiting the other participant's response")); @@ -952,7 +950,8 @@ empathy_ft_manager_add_tp_file (EmpathyFTManager *ft_manager, state = empathy_tp_file_get_state (tp_file); - if (state == EMP_FILE_TRANSFER_STATE_LOCAL_PENDING) + if (state == EMP_FILE_TRANSFER_STATE_PENDING && + empathy_tp_file_get_incoming (tp_file)) ft_manager_display_accept_dialog (ft_manager, tp_file); else ft_manager_add_tp_file_to_list (ft_manager, tp_file); diff --git a/libempathy/empathy-tp-file.c b/libempathy/empathy-tp-file.c index b2e7d8be6..377fa5bd3 100644 --- a/libempathy/empathy-tp-file.c +++ b/libempathy/empathy-tp-file.c @@ -530,6 +530,7 @@ tp_file_constructor (GType type, TpHandle handle; GHashTable *properties; McAccount *account; + GValue *requested; file_obj = G_OBJECT_CLASS (empathy_tp_file_parent_class)->constructor (type, n_props, props); @@ -567,6 +568,9 @@ tp_file_constructor (GType type, tp_cli_dbus_properties_run_get_all (tp_file->priv->channel, -1, EMP_IFACE_CHANNEL_TYPE_FILE_TRANSFER, &properties, NULL, NULL); + tp_cli_dbus_properties_run_get (tp_file->priv->channel, + -1, TP_IFACE_CHANNEL, "Requested", &requested, NULL, NULL); + tp_file->priv->size = g_value_get_uint64 ( g_hash_table_lookup (properties, "Size")); @@ -588,11 +592,11 @@ tp_file_constructor (GType type, tp_file->priv->description = g_value_dup_string ( g_hash_table_lookup (properties, "Description")); - if (tp_file->priv->state == EMP_FILE_TRANSFER_STATE_LOCAL_PENDING) - tp_file->priv->incoming = TRUE; + tp_file->priv->incoming = !g_value_get_boolean (requested); g_hash_table_destroy (properties); g_object_unref (account); + g_value_unset (requested); return file_obj; } @@ -796,7 +800,7 @@ empathy_tp_file_offer (EmpathyTpFile *tp_file) g_value_init (¬hing, G_TYPE_STRING); g_value_set_string (¬hing, ""); - emp_cli_channel_type_file_transfer_call_offer_file ( + emp_cli_channel_type_file_transfer_call_provide_file ( TP_PROXY (tp_file->priv->channel), -1, TP_SOCKET_ADDRESS_TYPE_UNIX, TP_SOCKET_ACCESS_CONTROL_LOCALHOST, ¬hing, tp_file_method_cb, tp_file, NULL, NULL); diff --git a/src/empathy.c b/src/empathy.c index a8ff7e2a6..92be3239e 100644 --- a/src/empathy.c +++ b/src/empathy.c @@ -74,19 +74,6 @@ file_channel_add_to_file_manager (TpChannel *channel) } static void -file_channel_state_changed_cb (TpProxy *proxy, - guint state, - guint reason, - gpointer user_data, - GObject *weak_object) -{ - /* Only deal with the channel being offered */ - if (state == EMP_FILE_TRANSFER_STATE_REMOTE_PENDING) { - file_channel_add_to_file_manager (TP_CHANNEL (proxy)); - } -} - -static void file_channel_get_state_cb (TpProxy *proxy, const GValue *state_value, const GError *error, @@ -96,14 +83,11 @@ file_channel_get_state_cb (TpProxy *proxy, EmpFileTransferState state; state = g_value_get_uint (state_value); - if (state == EMP_FILE_TRANSFER_STATE_REMOTE_PENDING - || state == EMP_FILE_TRANSFER_STATE_LOCAL_PENDING) { + if (state == EMP_FILE_TRANSFER_STATE_PENDING) + { file_channel_add_to_file_manager (TP_CHANNEL (proxy)); return; } - - emp_cli_channel_type_file_transfer_connect_to_file_transfer_state_changed ( - proxy, file_channel_state_changed_cb, NULL, NULL, NULL, NULL); } static void |