Index: downloader-view.c
===================================================================
RCS file: /cvs/gnome/epiphany/embed/downloader-view.c,v
retrieving revision 1.99
diff -u -p -r1.99 downloader-view.c
--- downloader-view.c	13 Sep 2006 11:34:12 -0000	1.99
+++ downloader-view.c	18 Dec 2006 01:20:14 -0000
@@ -57,15 +57,13 @@ enum
 	COL_PERCENT,
 	COL_IMAGE,
 	COL_FILE,
-	COL_REMAINING,
 	COL_DOWNLOAD_OBJECT
 };
 
 enum
 {
-	PROGRESS_COL_POS,
 	FILE_COL_POS,
-	REMAINING_COL_POS
+	PROGRESS_COL_POS
 };
 
 #define EPHY_DOWNLOADER_VIEW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_DOWNLOADER_VIEW, DownloaderViewPrivate))
@@ -133,7 +131,7 @@ static GObjectClass *parent_class = NULL
 GType
 downloader_view_get_type (void)
 {
-       static GType type = 0;
+	static GType type = 0;
 
 	if (G_UNLIKELY (type == 0))
 	{
@@ -180,9 +178,9 @@ static gboolean
 status_icon_popup_menu_cb (GtkStatusIcon *icon,
 			   guint button,
 			   guint time,
-                           DownloaderView *dv)
+			   DownloaderView *dv)
 {
-        GtkWidget *menu, *item;
+	GtkWidget *menu, *item;
 
 	menu = gtk_menu_new ();
 
@@ -318,13 +316,24 @@ format_interval (gint64 interval)
 	interval -= mins * 60;
 	secs = (int) interval;
 
-	if (hours > 0)
+	if (hours > 1)
 	{
-		return g_strdup_printf (_("%u:%02u.%02u"), hours, mins, secs);
+		if (mins > 1)
+		{
+			return g_strdup_printf (ngettext("%u hour\nand %u minutes", "%u hours\nand %u minutes", hours), hours, mins);
+		}
+		return g_strdup_printf (ngettext("%u hour", "%u hours", hours), hours);
 	}
 	else
 	{
-		return g_strdup_printf (_("%02u.%02u"), mins, secs);
+		if (mins > 1)
+		{
+			return g_strdup_printf (ngettext("%u minute", "%u minutes", mins), mins);
+		}
+		else
+		{
+			return g_strdup_printf (ngettext("%u second", "%u seconds", secs), secs);
+		}
 	}
 }
 
@@ -423,8 +432,8 @@ update_download_row (DownloaderView *dv,
 
 		total_progress = gnome_vfs_format_file_size_for_display (total);
 		/* translators: first %s is filename, "%s of %s" is current/total file size */
-		file = g_strdup_printf (_("%s\n%s of %s"), name,
-					cur_progress, total_progress);
+		file = g_strdup_printf (_("%s\n%s of %s (%d%%)"), name,
+					cur_progress, total_progress, percent);
 		g_free (total_progress);
 	}
 	else if (current != -1)
@@ -452,7 +461,6 @@ update_download_row (DownloaderView *dv,
 			    COL_STATE, state,
 			    COL_PERCENT, percent,
 			    COL_FILE, file,
-			    COL_REMAINING, remaining,
 			    -1);
 	gtk_tree_path_free (path);
 
@@ -575,11 +583,32 @@ progress_cell_data_func (GtkTreeViewColu
 	EphyDownloadState state;
 	const char *text = NULL;
 	int percent;
-
+	GValue val = {0, };
+	EphyDownload *download;
+	gint64 remaining_secs;
+	char *remaining;
+	
+	
 	gtk_tree_model_get (model, iter,
 			    COL_STATE, &state,
 			    COL_PERCENT, &percent,
 			    -1);
+	gtk_tree_model_get_value (model, iter, COL_DOWNLOAD_OBJECT, &val);
+
+	download = g_value_get_object(&val);
+
+	remaining_secs = ephy_download_get_remaining_time (download);
+
+	g_value_unset(&val);
+
+	if (remaining_secs < 0)
+	{
+		remaining = g_strdup (_("Unknown"));
+	}
+	else
+	{
+		remaining = format_interval (remaining_secs);
+	}
 
 	switch (state)
 	{
@@ -593,8 +622,10 @@ progress_cell_data_func (GtkTreeViewColu
 			 * the correct translation. You MUST OMIT it in the translated string. */
 			text = Q_("download status|Failed");
 			break;
-		case EPHY_DOWNLOAD_DOWNLOADING:
 		case EPHY_DOWNLOAD_PAUSED:
+			text = Q_("download status|Paused");
+			break;
+		case EPHY_DOWNLOAD_DOWNLOADING:
 			if (percent == -1)
 			{
 				/* Translators: The text before the "|" is context to help you decide on
@@ -606,8 +637,13 @@ progress_cell_data_func (GtkTreeViewColu
 		default:
 			g_return_if_reached ();
 	}
+	/* We don't have a relevant state to give, so we add our fancy relative remaining time. */
+	if (!text) {
+		text = g_strdup_printf(_("%s left"), remaining);
+	}
 
 	g_object_set (renderer, "text", text, "value", percent, NULL);
+	g_free(remaining);
 }
 
 static void
@@ -643,12 +679,11 @@ downloader_view_build_ui (DownloaderView
 	gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)),
 				     GTK_SELECTION_BROWSE);
 
-	liststore = gtk_list_store_new (6,
+	liststore = gtk_list_store_new (5,
 					G_TYPE_INT,
 					G_TYPE_INT,
 					GDK_TYPE_PIXBUF,
 					G_TYPE_STRING,
-					G_TYPE_STRING,
 					G_TYPE_OBJECT);
 
 	gtk_tree_view_set_model (GTK_TREE_VIEW(priv->treeview),
@@ -681,26 +716,17 @@ downloader_view_build_ui (DownloaderView
 	renderer = gtk_cell_renderer_progress_new ();
 	g_object_set (renderer, "xalign", 0.5, NULL);
 	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(priv->treeview),
-						     PROGRESS_COL_POS, _("%"),
+						     PROGRESS_COL_POS, _("Time left"),
 						     renderer,
 						     NULL);
 	column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview), PROGRESS_COL_POS);
+	gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+	gtk_tree_view_column_set_resizable(column, TRUE);
+	//gtk_tree_view_column_set_expand (column, TRUE);
+
 	gtk_tree_view_column_set_cell_data_func(column, renderer, progress_cell_data_func, NULL, NULL);
 	gtk_tree_view_column_set_sort_column_id (column, COL_PERCENT);
 
-	/* Remainng time column */
-	renderer = gtk_cell_renderer_text_new ();
-	g_object_set (renderer, "xalign", 0.5, NULL);
-	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(priv->treeview),
-						     REMAINING_COL_POS, _("Remaining"),
-						     renderer,
-						     "text", COL_REMAINING,
-						     NULL);
-
-	column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview),
-					   REMAINING_COL_POS);
-	gtk_tree_view_column_set_sort_column_id (column, COL_REMAINING);
-
 	gtk_tree_view_set_enable_search (GTK_TREE_VIEW (priv->treeview), FALSE);
 
 	priv->model = GTK_TREE_MODEL (liststore);
@@ -720,6 +746,7 @@ download_dialog_pause (DownloaderView *d
 	GValue val = {0, };
 	EphyDownload *download;
 	EphyDownloadState state;
+
 
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dv->priv->treeview));
 
