[epiphany] downloader-view: use update_download_row correctly on add
- From: Diego Escalante Urrelo <diegoe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] downloader-view: use update_download_row correctly on add
- Date: Mon, 15 Mar 2010 23:32:48 +0000 (UTC)
commit 50cd4276088499093b428b54195a88c4b7a1a0ad
Author: Diego Escalante Urrelo <descalante igalia com>
Date: Wed Mar 10 19:20:01 2010 -0500
downloader-view: use update_download_row correctly on add
When adding a download we should call update_download_row() *after* connecting
the signal handlers or they will never be disconnected.
Also, in update_download_row() we should consider that the case where it is
called with a download that has already been removed as a non fatal case (i.e.
just return;). This is because in downloader_view_add_download() we can have
the signal handlers remove the download from the view before the manual call
(it was happening vice versa before this).
embed/downloader-view.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index 8469387..7fbb1e5 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -482,7 +482,12 @@ update_download_row (DownloaderView *dv, WebKitDownload *download)
#endif
row_ref = get_row_from_download (dv, download);
- g_return_if_fail (row_ref != NULL);
+ /* In downloader_view_add_download() we call this function manually to
+ * ensure the view has something visible in the tree view, however
+ * signal handlers might have already removed this download from the
+ * DV, this is that case. */
+ if (row_ref == NULL)
+ return;
/* Status special casing */
status = webkit_download_get_status (download);
@@ -698,7 +703,6 @@ downloader_view_add_download (DownloaderView *dv,
download,
row_ref);
- update_download_row (dv, download);
update_status_icon (dv);
selection = gtk_tree_view_get_selection
@@ -715,6 +719,8 @@ downloader_view_add_download (DownloaderView *dv,
g_signal_connect_object (download, "error",
G_CALLBACK (download_error_cb), dv, 0);
+ update_download_row (dv, download);
+
/* Show it already */
g_object_get (G_OBJECT (dv->priv->window), "visible", &visible, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]