From 93507fc66f9f8cc456519936284220ab4e6f6cfd Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Sat, 16 Jul 2011 18:46:09 -0500 Subject: ephy-window: clear finished downloads when closing the downloads bar When a download finishes but you don't 'activate' it (open or browsing) the widget stays alive on the downloads-bar, worse, if open or browse actions fail, the download can't be removed from the bar. This commit clears finished downloads from the downloads-bar when it is closed (with the X button). Hiding it will *not* trigger this cleanup. Bug #653918 --- src/ephy-window.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ephy-window.c b/src/ephy-window.c index 73a885e25..f5ee4b2a9 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -3261,6 +3261,28 @@ downloads_removed_cb (GtkContainer *container, static void downloads_close_cb (GtkButton *button, EphyWindow *window) { + GList *l, *downloads; + + downloads = gtk_container_get_children (GTK_CONTAINER (window->priv->downloads_box)); + + for (l = downloads; l != NULL; l = l->next) + { + EphyDownload *download; + WebKitDownloadStatus status; + + if (EPHY_IS_DOWNLOAD_WIDGET (l->data) != TRUE) + continue; + + download = ephy_download_widget_get_download (EPHY_DOWNLOAD_WIDGET (l->data)); + status = webkit_download_get_status (ephy_download_get_webkit_download (download)); + + if (status == WEBKIT_DOWNLOAD_STATUS_FINISHED) + { + gtk_widget_destroy (GTK_WIDGET (l->data)); + } + } + g_list_free (downloads); + ephy_window_set_downloads_box_visibility (window, FALSE); } -- cgit v1.2.3