[totem] Improve the handling of the "frames per second" plural string



commit 7884605b31298c4657775f219551d86068b5d219
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Aug 9 23:23:17 2010 +0100

    Improve the handling of the "frames per second" plural string

 .../properties/bacon-video-widget-properties.c     |   34 +++++++++----------
 1 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/src/plugins/properties/bacon-video-widget-properties.c b/src/plugins/properties/bacon-video-widget-properties.c
index 58afd46..9308b00 100644
--- a/src/plugins/properties/bacon-video-widget-properties.c
+++ b/src/plugins/properties/bacon-video-widget-properties.c
@@ -58,21 +58,6 @@
 		g_value_unset (&value); \
 	} while (0)
 
-#define UPDATE_FROM_INT_PLURAL(type, name, format_s, format_p, empty) \
-	do { \
-		char *temp; \
-		bacon_video_widget_get_metadata (BACON_VIDEO_WIDGET (bvw), \
-						 type, &value); \
-		if (g_value_get_int (&value) != 0) \
-			temp = g_strdup_printf (ngettext (format_s, format_p, g_value_get_int (&value)), \
-					g_value_get_int (&value)); \
-		else \
-			temp = g_strdup (empty); \
-		bacon_video_widget_properties_set_label (props, name, temp); \
-		g_free (temp); \
-		g_value_unset (&value); \
-	} while (0)
-
 #define UPDATE_FROM_INT2(type1, type2, name, format) \
 	do { \
 		int x, y; \
@@ -249,10 +234,24 @@ bacon_video_widget_properties_update (BaconVideoWidgetProperties *props,
 		UPDATE_FROM_INT2 (BVW_INFO_DIMENSION_X, BVW_INFO_DIMENSION_Y,
 				  "dimensions", N_("%d x %d"));
 		UPDATE_FROM_STRING (BVW_INFO_VIDEO_CODEC, "vcodec");
-		UPDATE_FROM_INT_PLURAL (BVW_INFO_FPS, "framerate",
-		                        N_("%d frame per second"), N_("%d frames per second"), _("N/A"));
 		UPDATE_FROM_INT (BVW_INFO_VIDEO_BITRATE, "video_bitrate",
 				 N_("%d kbps"), _("N/A"));
+
+		/* The FPS has to be done differently because it's a plural string */
+		{
+			gchar *temp;
+			bacon_video_widget_get_metadata (BACON_VIDEO_WIDGET (bvw), BVW_INFO_FPS, &value);
+			if (g_value_get_int (&value) != 0) {
+				temp = g_strdup_printf (ngettext ("%d frame per second", "%d frames per second", g_value_get_int (&value)),
+				                        g_value_get_int (&value));
+			} else {
+				temp = g_strdup (_("N/A"));
+			}
+			bacon_video_widget_properties_set_label (props, "framerate", temp);
+			g_free (temp);
+			g_value_unset (&value);
+		}
+
 		gtk_widget_show (item);
 	} else {
 		gtk_widget_hide (item);
@@ -278,7 +277,6 @@ bacon_video_widget_properties_update (BaconVideoWidgetProperties *props,
 
 #undef UPDATE_FROM_STRING
 #undef UPDATE_FROM_INT
-#undef UPDATE_FROM_INT_PLURAL
 #undef UPDATE_FROM_INT2
 }
 



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