nautilus r14907 - in trunk: . libnautilus-private



Author: cosimoc
Date: Mon Feb  2 00:11:08 2009
New Revision: 14907
URL: http://svn.gnome.org/viewvc/nautilus?rev=14907&view=rev

Log:
2009-02-02  Cosimo Cecchi  <cosimoc gnome org>

	* libnautilus-private/nautilus-file-operations.c
	(report_delete_progress): better fix for the singular/plural issue
	described in bug #551222; we now split the string into two parts,
	use ngettext() on both and concatenate them (#570141).


Modified:
   trunk/ChangeLog
   trunk/libnautilus-private/nautilus-file-operations.c

Modified: trunk/libnautilus-private/nautilus-file-operations.c
==============================================================================
--- trunk/libnautilus-private/nautilus-file-operations.c	(original)
+++ trunk/libnautilus-private/nautilus-file-operations.c	Mon Feb  2 00:11:08 2009
@@ -1347,6 +1347,7 @@
 	double elapsed, transfer_rate;
 	int remaining_time;
 	guint64 now;
+	char *files_left_s;
 
 	now = g_thread_gettime ();
 	if (transfer_info->last_report_time != 0 &&
@@ -1362,42 +1363,39 @@
 		files_left = 1;
 	}
 
+	files_left_s = f (ngettext ("%'d file left to delete",
+				    "%'d files left to delete",
+				    files_left),
+			  files_left);
+
 	nautilus_progress_info_take_status (job->progress,
 					    f (_("Deleting files")));
 
 	elapsed = g_timer_elapsed (job->time, NULL);
 	if (elapsed < SECONDS_NEEDED_FOR_RELIABLE_TRANSFER_RATE) {
-		char *s;
-		s = f (ngettext ("%'d file left to delete",
-				 "%'d files left to delete",
-				 files_left),
-		       files_left);
-		nautilus_progress_info_take_details (job->progress, s);
+
+		nautilus_progress_info_set_details (job->progress, files_left_s);
 	} else {
-		char *s;
+		char *details, *time_left_s;
 		transfer_rate = transfer_info->num_files / elapsed;
 		remaining_time = files_left / transfer_rate;
 
-		if (files_left == 1) {
-			/* To translators: %T will expand to a time like "2 minutes". 
- 			 * The singular/plural form will be used depending on the remaining time (i.e. the %T argument).
- 			 */
-			s = f (ngettext ("%'d file left to delete \xE2\x80\x94 %T left",
-					 "%'d file left to delete \xE2\x80\x94 %T left",
-					 seconds_count_format_time_units (remaining_time)),
-			       files_left, remaining_time);
-		} else {
-			/* To translators: %T will expand to a time like "2 minutes".
- 			 * The singular/plural form will be used depending on the remaining time (i.e. the %T argument).
- 			 */
-			s = f (ngettext ("%'d files left to delete \xE2\x80\x94 %T left",
-					 "%'d files left to delete \xE2\x80\x94 %T left",
-					 seconds_count_format_time_units (remaining_time)),
-			       files_left, remaining_time);
-		}
-		nautilus_progress_info_take_details (job->progress, s);
+		/* To translators: %T will expand to a time like "2 minutes".
+ 		 * The singular/plural form will be used depending on the remaining time (i.e. the %T argument).
+ 		 */
+		time_left_s = f (ngettext ("%T left",
+					   "%T left",
+					   seconds_count_format_time_units (remaining_time)),
+				 remaining_time);
+
+		details = g_strconcat (files_left_s, "\xE2\x80\x94", time_left_s, NULL);
+		nautilus_progress_info_take_details (job->progress, details);
+
+		g_free (time_left_s);
 	}
 
+	g_free (files_left_s);
+
 	if (source_info->num_files != 0) {
 		nautilus_progress_info_set_progress (job->progress, transfer_info->num_files, source_info->num_files);
 	}



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