aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--embed/downloader-view.c41
2 files changed, 48 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 114e17bfa..8147ef5b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2003-11-28 Marco Pesenti Gritti <marco@gnome.org>
+
+ * embed/downloader-view.c: (status_icon_activated),
+ (seconds_remaining_total), (update_status_icon),
+ (download_changed_cb), (downloader_view_add_download):
+
+ Show total downloads and time in the tray icon tooltip
+
2003-11-28 Christian Persch <chpe@cvs.gnome.org>
* lib/widgets/ephy-zoom-control.c: (ephy_zoom_control_get_type),
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index 8bbeafc85..4682b9c76 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -62,6 +62,8 @@ struct DownloaderViewPrivate
GtkWidget *abort_button;
EggStatusIcon *status_icon;
+
+ long remaining_secs;
};
typedef struct
@@ -153,7 +155,7 @@ downloader_view_class_init (DownloaderViewClass *klass)
static void
status_icon_activated (EggStatusIcon *icon, DownloaderView *dv)
{
- gtk_widget_show (dv->priv->window);
+ gtk_window_present (GTK_WINDOW (dv->priv->window));
}
static void
@@ -313,9 +315,45 @@ update_download_row (DownloaderView *dv, EphyDownload *download)
}
static void
+seconds_remaining_total (EphyDownload *download, gpointer data, DownloaderView *dv)
+{
+ long secs;
+
+ secs = ephy_download_get_remaining_time (download);
+ if (secs > 0)
+ {
+ dv->priv->remaining_secs += secs;
+ }
+}
+
+static void
+update_status_icon (DownloaderView *dv)
+{
+ char *tooltip, *remaining;
+ int downloads;
+
+ dv->priv->remaining_secs = 0;
+ g_hash_table_foreach (dv->priv->downloads_hash,
+ (GHFunc) seconds_remaining_total, dv);
+
+ remaining = format_interval (dv->priv->remaining_secs);
+ downloads = g_hash_table_size (dv->priv->downloads_hash);
+ tooltip = g_strdup_printf ("%d downloads, with a total of "
+ "%s minutes remaining",
+ downloads, remaining);
+
+ egg_status_icon_set_tooltip (dv->priv->status_icon,
+ tooltip, NULL);
+
+ g_free (tooltip);
+ g_free (remaining);
+}
+
+static void
download_changed_cb (EphyDownload *download, DownloaderView *dv)
{
update_download_row (dv, download);
+ update_status_icon (dv);
}
void
@@ -341,6 +379,7 @@ downloader_view_add_download (DownloaderView *dv,
row_ref);
update_download_row (dv, download);
+ update_status_icon (dv);
selection = gtk_tree_view_get_selection
(GTK_TREE_VIEW(dv->priv->treeview));