Mercurial > pidgin
changeset 15336:b262452c9b63
[gaim-migrate @ 18128]
Fix sf bug 1625136, from pomp
"Close This Transfer when all files finish" option doesn't work"
It only worked when "clear finished transfers" was also checked.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 15 Jan 2007 07:14:37 +0000 |
parents | a09936753f2f |
children | 315be2f86cb9 |
files | gtk/gtkft.c |
diffstat | 1 files changed, 30 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/gtk/gtkft.c Mon Jan 15 06:07:54 2007 +0000 +++ b/gtk/gtkft.c Mon Jan 15 07:14:37 2007 +0000 @@ -1013,10 +1013,7 @@ dialog->num_transfers--; - if (dialog->num_transfers == 0 && !dialog->keep_open) - gaim_gtkxfer_dialog_hide(dialog); - else - ensure_row_selected(dialog); + ensure_row_selected(dialog); update_title_progress(dialog); gaim_xfer_unref(xfer); @@ -1078,6 +1075,8 @@ char *size_str, *remaining_str; GtkTreeSelection *selection; time_t current_time; + GtkTreeIter iter; + gboolean valid; g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); @@ -1132,6 +1131,33 @@ gaim_gtkxfer_dialog_remove_xfer(dialog, xfer); else update_buttons(dialog, xfer); + + /* + * If all transfers are finished, and the pref is set, then + * close the dialog. Otherwise just exit this function. + */ + if (dialog->keep_open) + return; + + valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(dialog->model), &iter); + while (valid) + { + GValue val; + GaimXfer *next; + + val.g_type = 0; + gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), + &iter, COLUMN_DATA, &val); + + next = g_value_get_pointer(&val); + if (!gaim_xfer_is_completed(next)) + return; + + valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(dialog->model), &iter); + } + + /* If we got to this point then we know everything is finished */ + gaim_gtkxfer_dialog_hide(dialog); } /**************************************************************************