diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-22 00:21:59 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-11-22 00:21:59 +0800 |
commit | 664c1b02533623c3f92dfa87de01ded637361050 (patch) | |
tree | e9d4459f205fdb24a32b255bdd7bcc34e964df2e /libempathy-gtk/empathy-ft-manager.c | |
parent | aa6d8ce99a72c349c471fd8eb583bdd95aa550eb (diff) | |
download | gsoc2013-empathy-664c1b02533623c3f92dfa87de01ded637361050.tar gsoc2013-empathy-664c1b02533623c3f92dfa87de01ded637361050.tar.gz gsoc2013-empathy-664c1b02533623c3f92dfa87de01ded637361050.tar.bz2 gsoc2013-empathy-664c1b02533623c3f92dfa87de01ded637361050.tar.lz gsoc2013-empathy-664c1b02533623c3f92dfa87de01ded637361050.tar.xz gsoc2013-empathy-664c1b02533623c3f92dfa87de01ded637361050.tar.zst gsoc2013-empathy-664c1b02533623c3f92dfa87de01ded637361050.zip |
ft_manager_clear: use g_hash_table_foreach_remove instead of GHashTableIter so the elements are actually removed from the hash table
svn path=/trunk/; revision=1865
Diffstat (limited to 'libempathy-gtk/empathy-ft-manager.c')
-rw-r--r-- | libempathy-gtk/empathy-ft-manager.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/libempathy-gtk/empathy-ft-manager.c b/libempathy-gtk/empathy-ft-manager.c index 958255b45..3065418cb 100644 --- a/libempathy-gtk/empathy-ft-manager.c +++ b/libempathy-gtk/empathy-ft-manager.c @@ -514,28 +514,34 @@ ft_manager_remove_file_from_list (EmpathyFTManager *ft_manager, } +static gboolean +remove_finished_transfer_foreach (gpointer key, + gpointer value, + gpointer user_data) +{ + EmpathyTpFile *tp_file = EMPATHY_TP_FILE (key); + EmpathyFTManager *self = EMPATHY_FT_MANAGER (user_data); + EmpFileTransferState state; + + state = empathy_tp_file_get_state (tp_file); + if (state == EMP_FILE_TRANSFER_STATE_COMPLETED || + state == EMP_FILE_TRANSFER_STATE_CANCELLED) + { + ft_manager_remove_file_from_list (self, tp_file); + return TRUE; + } + + return FALSE; +} + static void ft_manager_clear (EmpathyFTManager *ft_manager) { - GHashTableIter iter; - gpointer key, value; - DEBUG ("Clearing file transfer list"); /* Remove completed and cancelled transfers */ - g_hash_table_iter_init (&iter, ft_manager->priv->tp_file_to_row_ref); - while (g_hash_table_iter_next (&iter, &key, &value)) - { - EmpathyTpFile *tp_file = EMPATHY_TP_FILE (key); - EmpFileTransferState state; - - state = empathy_tp_file_get_state (tp_file); - if (state == EMP_FILE_TRANSFER_STATE_COMPLETED || - state == EMP_FILE_TRANSFER_STATE_CANCELLED) - { - ft_manager_remove_file_from_list (ft_manager, tp_file); - } - } + g_hash_table_foreach_remove (ft_manager->priv->tp_file_to_row_ref, + remove_finished_transfer_foreach, ft_manager); } static void |