[epiphany] ephy-window: clear finished downloads when closing the downloads bar



commit 93507fc66f9f8cc456519936284220ab4e6f6cfd
Author: Diego Escalante Urrelo <descalante igalia com>
Date:   Sat Jul 16 18:46:09 2011 -0500

    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 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 73a885e..f5ee4b2 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);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]