changeset 22048:6704629dc478

Remove the completed/cancelled xfers when 'Clear finished transfers' is selected. (Did anyone notice our 'purple_xfer_is_canceled' is typoed?)
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 09 Jan 2008 08:42:33 +0000
parents 62147d5b4512
children 3f7e58ae1305
files finch/gntft.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntft.c	Wed Jan 09 02:16:11 2008 +0000
+++ b/finch/gntft.c	Wed Jan 09 08:42:33 2008 +0000
@@ -142,15 +142,23 @@
 	xfer_dialog->auto_clear = !xfer_dialog->auto_clear;
 	purple_prefs_set_bool("/finch/filetransfer/clear_finished",
 						xfer_dialog->auto_clear);
+	if (xfer_dialog->auto_clear) {
+		GList *iter = purple_xfers_get_all();
+		while (iter) {
+			PurpleXfer *xfer = iter->data;
+			iter = iter->next;
+			if (purple_xfer_is_completed(xfer) || purple_xfer_is_canceled(xfer))
+			finch_xfer_dialog_remove_xfer(xfer);
+		}
+	}
 }
 
 static void
 remove_button_cb(GntButton *button)
 {
 	PurpleXfer *selected_xfer = gnt_tree_get_selection_data(GNT_TREE(xfer_dialog->tree));
-	if (selected_xfer && (selected_xfer->status == PURPLE_XFER_STATUS_CANCEL_LOCAL ||
-			selected_xfer->status == PURPLE_XFER_STATUS_CANCEL_REMOTE ||
-			selected_xfer->status == PURPLE_XFER_STATUS_DONE)) {
+	if (selected_xfer && (purple_xfer_is_completed(selected_xfer) ||
+				purple_xfer_is_canceled(selected_xfer))) {
 		finch_xfer_dialog_remove_xfer(selected_xfer);
 	}
 }