# HG changeset patch # User Mark Doliner # Date 1130737939 0 # Node ID ad62cd866435b9b433eec752bab4458c3f1dbef5 # Parent ced9410eeb7329df958ad848dbbdc6048d41a90a [gaim-migrate @ 14216] sf patch #1292363, from John Eckerdal Don't update the file transfer dialog more than once per second (it made stuff use a lot of CPU) committer: Tailor Script diff -r ced9410eeb73 -r ad62cd866435 COPYRIGHT --- a/COPYRIGHT Mon Oct 31 05:40:35 2005 +0000 +++ b/COPYRIGHT Mon Oct 31 05:52:19 2005 +0000 @@ -63,13 +63,14 @@ Alex Duggan Tom Dyas Marc E. -Marc Etcheverry Andrew Echols +John Eckerdal Sean Egan Nelson Elhage Ignacio J. Elia Brian Enigma Stefan Esser +Marc Etcheverry Larry Ewing Gábor Farkas Jesse Farmer diff -r ced9410eeb73 -r ad62cd866435 src/gtkft.c --- a/src/gtkft.c Mon Oct 31 05:40:35 2005 +0000 +++ b/src/gtkft.c Mon Oct 31 05:52:19 2005 +0000 @@ -85,6 +85,7 @@ { GtkTreeIter iter; time_t start_time; + time_t last_updated_time; time_t end_time; gboolean in_list; @@ -877,6 +878,7 @@ gaim_gtkxfer_dialog_show(dialog); data->start_time = time(NULL); + data->last_updated_time = 0; data->end_time = -1; type = gaim_xfer_get_type(xfer); @@ -1004,6 +1006,7 @@ GaimGtkXferUiData *data; char *size_str, *remaining_str; GtkTreeSelection *selection; + time_t current_time; g_return_if_fail(dialog != NULL); g_return_if_fail(xfer != NULL); @@ -1014,6 +1017,15 @@ if (data->in_list == FALSE) return; + current_time = time(NULL); + if (((current_time - data->last_updated_time) == 0) && + (!gaim_xfer_is_completed(xfer))) + { + /* Don't update the window more than once per second */ + return; + } + data->last_updated_time = current_time; + size_str = gaim_str_size_to_units(gaim_xfer_get_size(xfer)); remaining_str = gaim_str_size_to_units(gaim_xfer_get_bytes_remaining(xfer)); @@ -1023,7 +1035,8 @@ COLUMN_REMAINING, remaining_str, -1); - if (gaim_xfer_is_completed(xfer)) { + if (gaim_xfer_is_completed(xfer)) + { GdkPixbuf *pixbuf; pixbuf = gtk_widget_render_icon(dialog->window, @@ -1036,7 +1049,7 @@ -1); g_object_unref(pixbuf); - } + } selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(xfer_dialog->tree));