Mercurial > pidgin.yaz
changeset 11925:ad62cd866435
[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 <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 31 Oct 2005 05:52:19 +0000 |
parents | ced9410eeb73 |
children | 5b703a92e79d |
files | COPYRIGHT src/gtkft.c |
diffstat | 2 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 <sean.egan@binghamton.edu> Nelson Elhage Ignacio J. Elia Brian Enigma Stefan Esser +Marc Etcheverry Larry Ewing Gábor Farkas Jesse Farmer
--- 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));