diff src/layout_util.c @ 731:fa8f7d7396cf

Introduce an helper function that returns the name of an editor. It helps to reduce code redundancy.
author zas_
date Thu, 22 May 2008 09:12:36 +0000
parents 2d8a8e892b5e
children a7289f9e8d29
line wrap: on
line diff
--- a/src/layout_util.c	Thu May 22 08:49:52 2008 +0000
+++ b/src/layout_util.c	Thu May 22 09:12:36 2008 +0000
@@ -873,24 +873,18 @@
 		{
 		gchar *key;
 		GtkAction *action;
-
+		const gchar *name;
+	
 		key = g_strdup_printf("Editor%d", i);
 
 		action = gtk_action_group_get_action(lw->action_group, key);
 		g_object_set_data(G_OBJECT(action), "edit_index", GINT_TO_POINTER(i));
 
-		if (options->editor[i].command && strlen(options->editor[i].command) > 0)
+		name = editor_get_name(i);
+		if (name)
 			{
-			gchar *text;
+			gchar *text = g_strdup_printf(_("_%d %s..."), i, name);
 
-			if (options->editor[i].name && strlen(options->editor[i].name) > 0)
-				{
-				text = g_strdup_printf(_("_%d %s..."), i, options->editor[i].name);
-				}
-			else
-				{
-				text = g_strdup_printf(_("_%d (unknown)..."), i);
-				}
 			g_object_set(action, "label", text,
 					     "sensitive", TRUE, NULL);
 			g_free(text);