aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimo.cecchi@collabora.co.uk>2009-05-04 01:21:15 +0800
committerCosimo Cecchi <cosimoc@gnome.org>2009-06-01 23:47:37 +0800
commit584de2350d0299bedcdb140cbb9adeb8a13ea42c (patch)
tree69a6bac68300b92874cb510a91ef281abeaa1dc8 /src
parent74bea808243c98816732864de15a8dfd887d0f22 (diff)
downloadgsoc2013-empathy-584de2350d0299bedcdb140cbb9adeb8a13ea42c.tar
gsoc2013-empathy-584de2350d0299bedcdb140cbb9adeb8a13ea42c.tar.gz
gsoc2013-empathy-584de2350d0299bedcdb140cbb9adeb8a13ea42c.tar.bz2
gsoc2013-empathy-584de2350d0299bedcdb140cbb9adeb8a13ea42c.tar.lz
gsoc2013-empathy-584de2350d0299bedcdb140cbb9adeb8a13ea42c.tar.xz
gsoc2013-empathy-584de2350d0299bedcdb140cbb9adeb8a13ea42c.tar.zst
gsoc2013-empathy-584de2350d0299bedcdb140cbb9adeb8a13ea42c.zip
Format messages for hashing
Format messages when hashing. Also, add some debug spew to see when the callbacks are called.
Diffstat (limited to 'src')
-rw-r--r--src/empathy-ft-manager.c60
1 files changed, 49 insertions, 11 deletions
diff --git a/src/empathy-ft-manager.c b/src/empathy-ft-manager.c
index 26a242825..671a3a4a2 100644
--- a/src/empathy-ft-manager.c
+++ b/src/empathy-ft-manager.c
@@ -411,6 +411,8 @@ ft_handler_transfer_done_cb (EmpathyFTHandler *handler,
GtkTreeRowReference *row_ref;
EmpathyFTManagerPriv *priv = GET_PRIV (manager);
+ DEBUG ("Transfer done");
+
row_ref = ft_manager_get_row_from_handler (manager, handler);
g_return_if_fail (row_ref != NULL);
@@ -456,6 +458,8 @@ ft_handler_transfer_progress_cb (EmpathyFTHandler *handler,
int percentage;
GtkTreeRowReference *row_ref;
+ DEBUG ("Transfer progress");
+
row_ref = ft_manager_get_row_from_handler (manager, handler);
g_return_if_fail (row_ref != NULL);
@@ -478,6 +482,8 @@ ft_handler_transfer_started_cb (EmpathyFTHandler *handler,
{
guint64 transferred_bytes, total_bytes;
+ DEBUG ("Transfer started");
+
g_signal_connect (handler, "transfer-progress",
G_CALLBACK (ft_handler_transfer_progress_cb), manager);
g_signal_connect (handler, "transfer-done",
@@ -494,6 +500,25 @@ static void
ft_handler_hashing_done_cb (EmpathyFTHandler *handler,
EmpathyFTManager *manager)
{
+ GtkTreeRowReference *row_ref;
+ char *first_line, *second_line, *message;
+
+ DEBUG ("Hashing done");
+
+ row_ref = ft_manager_get_row_from_handler (manager, handler);
+ g_return_if_fail (row_ref != NULL);
+
+ /* update the message */
+ first_line = ft_manager_format_contact_info (handler);
+ second_line = g_strdup (_("Waiting for the other participant's response"));
+ message = g_strdup_printf ("%s\n%s", first_line, second_line);
+
+ ft_manager_update_handler_message (manager, row_ref, message);
+
+ g_free (message);
+ g_free (first_line);
+ g_free (second_line);
+
g_signal_connect (handler, "transfer-started",
G_CALLBACK (ft_handler_transfer_started_cb), manager);
}
@@ -507,6 +532,8 @@ ft_handler_hashing_progress_cb (EmpathyFTHandler *handler,
char *first_line, *second_line, *message;
GtkTreeRowReference *row_ref;
+ DEBUG ("Hashing progress");
+
row_ref = ft_manager_get_row_from_handler (manager, handler);
g_return_if_fail (row_ref != NULL);
@@ -529,6 +556,8 @@ ft_handler_hashing_started_cb (EmpathyFTHandler *handler,
char *message;
GtkTreeRowReference *row_ref;
+ DEBUG ("Hashing started");
+
g_signal_connect (handler, "hashing-progress",
G_CALLBACK (ft_handler_hashing_progress_cb), manager);
g_signal_connect (handler, "hashing-done",
@@ -551,6 +580,7 @@ ft_manager_start_transfer (EmpathyFTManager *manager,
{
GCancellable *cancellable;
EmpathyFTManagerPriv *priv;
+ gboolean is_incoming;
priv = GET_PRIV (manager);
@@ -558,16 +588,20 @@ ft_manager_start_transfer (EmpathyFTManager *manager,
g_hash_table_insert (priv->cancellable_refs, g_object_ref (handler),
cancellable);
+ is_incoming = empathy_ft_handler_is_incoming (handler);
+
+ DEBUG ("Start transfer, is incoming %d", is_incoming);
+
/* now connect the signals */
g_signal_connect (handler, "transfer-error",
G_CALLBACK (ft_handler_transfer_error_cb), manager);
- if (empathy_ft_handler_is_incoming (handler)) {
- g_signal_connect (handler, "hashing-started",
- G_CALLBACK (ft_handler_hashing_started_cb), manager);
- } else {
+ if (is_incoming) {
g_signal_connect (handler, "transfer-started",
G_CALLBACK (ft_handler_transfer_started_cb), manager);
+ } else {
+ g_signal_connect (handler, "hashing-started",
+ G_CALLBACK (ft_handler_hashing_started_cb), manager);
}
empathy_ft_handler_start_transfer (handler, cancellable);
@@ -606,15 +640,17 @@ ft_manager_add_handler_to_list (EmpathyFTManager *manager,
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
gtk_tree_selection_select_iter (selection, &iter);
- /* hook up the signals and start the transfer */
- ft_manager_start_transfer (manager, handler);
-
/* update the row with the initial values */
- first_line = ft_manager_format_contact_info (handler);
- second_line = g_strdup (_("Waiting for the other participant's response"));
- message = g_strdup_printf ("%s\n%s", first_line, second_line);
+ if (empathy_ft_handler_is_incoming (handler)) {
+ first_line = ft_manager_format_contact_info (handler);
+ second_line = g_strdup (_("Waiting for the other participant's response"));
+ message = g_strdup_printf ("%s\n%s", first_line, second_line);
- ft_manager_update_handler_message (manager, row_ref, message);
+ ft_manager_update_handler_message (manager, row_ref, message);
+ }
+
+ /* hook up the signals and start the transfer */
+ ft_manager_start_transfer (manager, handler);
g_free (first_line);
g_free (second_line);
@@ -978,6 +1014,8 @@ empathy_ft_manager_add_handler (EmpathyFTManager *manager,
{
EmpathyFTManagerPriv *priv = GET_PRIV (manager);
+ DEBUG ("Adding handler");
+
g_return_if_fail (EMPATHY_IS_FT_MANAGER (manager));
g_return_if_fail (EMPATHY_IS_FT_HANDLER (handler));