diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | embed/downloader-view.c | 37 |
2 files changed, 38 insertions, 7 deletions
@@ -1,3 +1,11 @@ +2004-01-21 Piers Cornwell <piers@myrealbox.com> + + * embed/downloader-view.c: (update_status_icon), + (downloader_view_remove_download): + + Use ngettext for number of downloads and remaining + minutes display in the tooltip of the tray icon. + 2004-01-21 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/EventContext.cpp: diff --git a/embed/downloader-view.c b/embed/downloader-view.c index 12aadde7b..b0c21fe1f 100644 --- a/embed/downloader-view.c +++ b/embed/downloader-view.c @@ -336,24 +336,45 @@ seconds_remaining_total (EphyDownload *download, gpointer data, DownloaderView * static void update_status_icon (DownloaderView *dv) { - char *tooltip, *remaining; - int downloads; + char *tooltip, *downloadstring, *remainingstring; + int downloads, remaining; 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); + remaining = (dv->priv->remaining_secs); + + if (remaining < 60) + { + remainingstring = g_strdup_printf (ngettext ("About %d second left", + "About %d seconds left", remaining), + remaining); + } + else + { + remaining /= 60; + + remainingstring = g_strdup_printf (ngettext ("About %d minute left", + "About %d minutes left", remaining), + remaining); + } + downloads = g_hash_table_size (dv->priv->downloads_hash); - tooltip = g_strdup_printf ("%d downloads, with a total of " - "%s minutes remaining", - downloads, remaining); + + downloadstring = g_strdup_printf (ngettext ("%d download", + "%d downloads", downloads), + downloads); + + tooltip = g_strdup_printf ("%s\n%s", + downloadstring, remainingstring); egg_status_icon_set_tooltip (dv->priv->status_icon, tooltip, NULL); g_free (tooltip); - g_free (remaining); + g_free (downloadstring); + g_free (remainingstring); } static void @@ -569,6 +590,8 @@ downloader_view_remove_download (DownloaderView *dv, EphyDownload *download) gtk_tree_row_reference_free (row_ref); } + update_status_icon (dv); + /* Close the dialog if there are no more downloads */ if (!g_hash_table_size (dv->priv->downloads_hash)) |