From 90dc93ce73d891a7ddfa85f8236143f64d61a3b3 Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Tue, 11 Oct 2011 21:53:04 -0500 Subject: e-download-widget: update icon every 10% In some cases trying to get the content-type of a download right at the start of the transfer won't give us useful information. To handle this case we query for the content-type and a proper icon every 10%, hoping that GIO/Soup will make a smarter guess. This is an arbitrary number that hopes to work with most cases. Bug #662059 --- lib/widgets/ephy-download-widget.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/widgets') diff --git a/lib/widgets/ephy-download-widget.c b/lib/widgets/ephy-download-widget.c index 940eda3b7..a70e24816 100644 --- a/lib/widgets/ephy-download-widget.c +++ b/lib/widgets/ephy-download-widget.c @@ -45,6 +45,7 @@ struct _EphyDownloadWidgetPrivate GtkWidget *remaining; GtkWidget *button; GtkWidget *menu; + GtkWidget *icon; }; enum @@ -150,6 +151,11 @@ widget_progress_cb (GObject *object, destination = g_filename_display_basename (webkit_download_get_destination_uri (download)); progress = webkit_download_get_progress (download) * 100; + if (progress % 10 == 0) + gtk_image_set_from_gicon (GTK_IMAGE (widget->priv->icon), + get_gicon_from_download (widget->priv->download), + GTK_ICON_SIZE_LARGE_TOOLBAR); + time = get_remaining_time (download); if (time > 0) @@ -462,6 +468,7 @@ ephy_download_widget_new (EphyDownload *ephy_download) g_free (basename); g_free (dest); + widget->priv->icon = icon; widget->priv->button = button; widget->priv->remaining = remain; widget->priv->menu = menu; -- cgit v1.2.3