changeset 878:1b14c0e177ad

layout_color_button_press_cb(): tidy up, drop useless memory allocations, improve i18n.
author zas_
date Fri, 04 Jul 2008 17:21:07 +0000
parents 21e324dcd78c
children 0f85435ac335
files src/layout.c
diffstat 1 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/layout.c	Thu Jul 03 20:16:15 2008 +0000
+++ b/src/layout.c	Fri Jul 04 17:21:07 2008 +0000
@@ -391,15 +391,13 @@
 	GtkWidget *menu;
 	GtkWidget *item;
 	gchar *buf;
-	gchar *front;
-	gchar *end;
 	gint active;
 	gint input = 0;
 	gint screen = 0;
 	gint use_image = 0;
 	gint from_image = 0;
 	gint i;
-
+	
 	if (!layout_image_color_profile_get(lw, &input, &screen, &use_image)) return;
 
 	from_image = use_image && (layout_image_color_profile_get_from_image(lw) != COLOR_PROFILE_NONE);
@@ -417,10 +415,16 @@
 
 	for (i = COLOR_PROFILE_SRGB; i < COLOR_PROFILE_FILE; i++)
 		{
-		front = g_strdup_printf(_("Input _%d:"), i);
-		buf = g_strdup_printf("%s %s", front, i == COLOR_PROFILE_SRGB ? _("sRGB") : _("AdobeRGB compatible"));
-		g_free(front);
-		item = menu_item_add_radio(menu, (i == 0) ? NULL : item,
+		const gchar *label;
+
+		switch (i)
+			{
+			case COLOR_PROFILE_SRGB: 	label = _("sRGB"); break;
+			case COLOR_PROFILE_ADOBERGB:	label = _("AdobeRGB compatible"); break;
+			default:			label = "fixme"; break;
+			}
+		buf = g_strdup_printf(_("Input _%d: %s"), i, label);
+	  	item = menu_item_add_radio(menu, (i == COLOR_PROFILE_SRGB) ? NULL : item,
 				   buf, (input == i),
 				   G_CALLBACK(layout_color_menu_input_cb), lw);
 		g_free(buf);
@@ -431,14 +435,13 @@
 	for (i = 0; i < COLOR_PROFILE_INPUTS; i++)
 		{
 		const gchar *name;
+		gchar *end;
 
 		name = options->color_profile.input_name[i];
 		if (!name) name = filename_from_path(options->color_profile.input_file[i]);
 
-		front = g_strdup_printf(_("Input _%d:"), i + COLOR_PROFILE_FILE);
 		end = layout_color_name_parse(name);
-		buf = g_strdup_printf("%s %s", front, end);
-		g_free(front);
+		buf = g_strdup_printf(_("Input _%d: %s"), i + COLOR_PROFILE_FILE, end);
 		g_free(end);
 
 		item = menu_item_add_radio(menu, item,
@@ -451,11 +454,10 @@
 
 	menu_item_add_divider(menu);
 
-	buf = g_strdup_printf("%s sRGB", _("Screen"));
 	item = menu_item_add_radio(menu, NULL,
-				   buf, (screen == 0),
+				   _("Screen sRGB"), (screen == 0),
 				   G_CALLBACK(layout_color_menu_screen_cb), lw);
-	g_free(buf);
+
 	g_object_set_data(G_OBJECT(item), COLOR_MENU_KEY, GINT_TO_POINTER(0));
 	gtk_widget_set_sensitive(item, active);