planner r953 - in trunk: . src



Author: kmaute
Date: Thu Apr  2 02:12:11 2009
New Revision: 953
URL: http://svn.gnome.org/viewvc/planner?rev=953&view=rev

Log:
add minutes to duration display

Modified:
   trunk/ChangeLog
   trunk/src/planner-format.c

Modified: trunk/src/planner-format.c
==============================================================================
--- trunk/src/planner-format.c	(original)
+++ trunk/src/planner-format.c	Thu Apr  2 02:12:11 2009
@@ -134,6 +134,7 @@
 {
 	gint days;
 	gint hours;
+	gint minutes;
 
 	day_length = day_length;
 
@@ -144,15 +145,27 @@
 	days = duration / day_length;
 	duration -= days * day_length;
 	hours = duration / (60*60);
+  duration -= hours * (60*60);
+  minutes = duration / 60;
 
-	if (days > 0 && hours > 0) {
-		return g_strdup_printf (_("%dd %dh"), days, hours);
-	}
-	else if (days > 0) {
-		return g_strdup_printf (_("%dd"), days);
+	if (days > 0) {
+    if (hours > 0) {
+      return g_strdup_printf (_("%dd %dh"), days, hours);
+    }
+    else {
+      return g_strdup_printf (_("%dd"), days);
+    }
 	}
 	else if (hours > 0) {
-		return g_strdup_printf (_("%dh"), hours);
+    if (minutes > 0) {
+      return g_strdup_printf (_("%dh %dmin"), hours, minutes);
+    }
+    else {
+      return g_strdup_printf (_("%dh"), hours);
+    }
+	}
+	else if (minutes > 0) {
+		return g_strdup_printf (_("%dmin"), minutes);
 	} else {
 		return g_strdup ("");
 	}



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