[epiphany] e-download-widget: update icon every 10%



commit 90dc93ce73d891a7ddfa85f8236143f64d61a3b3
Author: Diego Escalante Urrelo <descalante igalia com>
Date:   Tue Oct 11 21:53:04 2011 -0500

    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 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/lib/widgets/ephy-download-widget.c b/lib/widgets/ephy-download-widget.c
index 940eda3..a70e248 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;



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