diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-22 00:25:11 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-22 00:25:11 +0800 |
commit | 6bc969461080973c6878f0eb1973fd626f8a9663 (patch) | |
tree | eb19a2deef68ff22d8e0e074fa9888fe09937aa2 /libempathy/empathy-dispatcher.c | |
parent | 6c7b2aa5c1581f9e40cfdc38f67fe7f479a745b5 (diff) | |
download | gsoc2013-empathy-6bc969461080973c6878f0eb1973fd626f8a9663.tar gsoc2013-empathy-6bc969461080973c6878f0eb1973fd626f8a9663.tar.gz gsoc2013-empathy-6bc969461080973c6878f0eb1973fd626f8a9663.tar.bz2 gsoc2013-empathy-6bc969461080973c6878f0eb1973fd626f8a9663.tar.lz gsoc2013-empathy-6bc969461080973c6878f0eb1973fd626f8a9663.tar.xz gsoc2013-empathy-6bc969461080973c6878f0eb1973fd626f8a9663.tar.zst gsoc2013-empathy-6bc969461080973c6878f0eb1973fd626f8a9663.zip |
Remove empathy_tp_file_keep_alive hack and connect to "notify::state" in file_channel_create_cb() to unref the object when the FT is done.
svn path=/trunk/; revision=1913
Diffstat (limited to 'libempathy/empathy-dispatcher.c')
-rw-r--r-- | libempathy/empathy-dispatcher.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 21b6bcccb..7f2d873e7 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -934,6 +934,19 @@ typedef struct { } FileChannelRequest; static void +tp_file_state_notify_cb (EmpathyTpFile *tp_file) +{ + EmpFileTransferState state; + + state = empathy_tp_file_get_state (tp_file, NULL); + if (state == EMP_FILE_TRANSFER_STATE_COMPLETED || + state == EMP_FILE_TRANSFER_STATE_CANCELLED) { + DEBUG ("Transfer is done, unref the object"); + g_object_unref (tp_file); + } +} + +static void file_channel_create_cb (TpConnection *connection, const gchar *object_path, GHashTable *properties, @@ -957,10 +970,13 @@ file_channel_create_cb (TpConnection *connection, request->handle, NULL); + /* We give the ref to the callback, it is responsible to unref the + * object once the transfer is done. */ tp_file = empathy_tp_file_new (channel); empathy_tp_file_offer (tp_file, request->gfile, NULL); - empathy_tp_file_keep_alive (tp_file); - g_object_unref (tp_file); + g_signal_connect (tp_file, "notify::state", + G_CALLBACK (tp_file_state_notify_cb), + NULL); g_object_unref (request->gfile); g_slice_free (FileChannelRequest, request); |