Index: src/build.c
===================================================================
--- src/build.c	(Revision 3952)
+++ src/build.c	(Arbeitskopie)
@@ -76,12 +76,12 @@
 static const gchar RUN_SCRIPT_CMD[] = "./geany_run_script.sh";
 #endif
 
-
 /* pack group (<8) and command (<32) into a user_data pointer */
 #define GRP_CMD_TO_POINTER(grp, cmd) GINT_TO_POINTER((((grp)&7)<<5)|((cmd)&0x1f))
 #define GBO_TO_POINTER(gbo) (GRP_CMD_TO_POINTER(GBO_TO_GBG(gbo), GBO_TO_CMD(gbo)))
 #define GPOINTER_TO_CMD(gptr) (GPOINTER_TO_INT(gptr)&0x1f)
 #define GPOINTER_TO_GRP(gptr) ((GPOINTER_TO_INT(gptr)&0xe0)>>5)
+#define FOREACH_GEANYBUILDCMD_ENTRY(i) for(i = 0; i < BC_CMDENTRIES_COUNT; i++)
 
 static gpointer last_toolbutton_action = GBO_TO_POINTER(GBO_BUILD);
 
@@ -171,9 +171,10 @@
 	GeanyFiletype	*ft=NULL;
 	GeanyDocument	*doc;
 	gint i,j,k,l,m;
+    enum GeanyBuildCmdEntries n;
 	gint cc[BCS_COUNT];
 	gchar c;
-	if (doc==NULL)doc=document_get_current();
+    doc=document_get_current();
 	if (doc!=NULL)ft = doc->file_type;
 	if(ft!=NULL)
 	{
@@ -192,9 +193,12 @@
 		{
 			for(k=0;k<build_groups_count[j];++k)
 				if(cl[j][i]!=NULL && *(cl[j][i])!=NULL && (*(cl[j][i]))[k].exists)
-				{
-					if((*(cl[j][i]))[k].label!=NULL && (l=strlen((*(cl[j][i]))[k].label))>m)m=l;
-					if((*(cl[j][i]))[k].command!=NULL && (l=strlen((*(cl[j][i]))[k].command))>m)m=l;
+                {
+                    int n;
+                    FOREACH_GEANYBUILDCMD_ENTRY(n)
+                    {
+                        if((*(cl[j][i]))[k].entries[n]!=NULL && (l=strlen((*(cl[j][i]))[k].entries[n]))>m)m=l;
+                    }
 				}
 		}
 		cc[i]=m;
@@ -210,16 +214,13 @@
 				{
 					if(cl[i][j]!=NULL && *(cl[i][j])!=NULL && (*(cl[i][j]))[k].exists)
 					{
-						if(l==0)
-							if((*(cl[i][j]))[k].label!=NULL)
-								printf("%c %*.*s",c,cc[j],cc[j],(*(cl[i][j]))[k].label);
-							else
-								printf("%c %*.*s",c,cc[j],cc[j]," ");
-						else
-							if((*(cl[i][j]))[k].command!=NULL)
-								printf("%c %*.*s",c,cc[j],cc[j],(*(cl[i][j]))[k].command);
-							else
-								printf("%c %*.*s",c,cc[j],cc[j]," ");
+                        FOREACH_GEANYBUILDCMD_ENTRY(n)
+                        {
+                            if((*(cl[i][j]))[k].entries[i]!=NULL)
+                                printf("%c %*.*s",c,cc[j],cc[j],(*(cl[i][j]))[k].entries[i]);
+                            else
+                                printf("%c %*.*s",c,cc[j],cc[j]," ");
+                        }
 					}
 					else
 						printf("%c %*.*s",c,cc[j],cc[j]," ");
@@ -508,7 +509,26 @@
 	return build_info.pid;
 }
 
+static gchar* id_to_str(GeanyBuildCommand *bc, gint id)
+{
+    return bc->entries[id];
+}
 
+static gchar* buildcmd_label(GeanyBuildCommand *bc)
+{
+    return id_to_str(bc, BC_LABEL);
+}
+
+static gchar* buildcmd_cmd(GeanyBuildCommand *bc)
+{
+    return id_to_str(bc, BC_COMMAND);
+}
+
+static const gchar* config_keys[] = {
+    [BC_LABEL]      = "CM",
+    [BC_COMMAND]    = "BD",
+};
+
 /* Returns: NULL if there was an error, or the working directory the script was created in.
  * vte_cmd_nonscript is the location of a string which is filled with the command to be used
  * when vc->skip_run_script is set, otherwise it will be set to NULL */
@@ -531,7 +551,7 @@
 	locale_filename = utils_get_locale_from_utf8(doc->file_name);
 
 	have_project = (project != NULL && NZV(project->run_cmd));
-	cmd = get_build_cmd(doc, GBG_EXEC, 0, NULL)->command;
+	cmd = buildcmd_cmd(get_build_cmd(doc, GBG_EXEC, 0, NULL));
 	/* TODO fix all this stuff */
 
 	if (strstr(cmd, "%e") != NULL)
@@ -958,17 +978,22 @@
 	gchar *dir;
 	gchar *full_command;
 	GeanyBuildCommand *buildcmd = get_build_cmd(doc, grp, cmd, NULL);
+    gchar* cmdstr;
 	
-	if (buildcmd==NULL)return;
+	if (buildcmd==NULL)
+        return;
+
+    cmdstr = buildcmd_cmd(buildcmd);
+
 	if (cmd_cat != NULL)
 	{
-		if (buildcmd->command != NULL)
-			full_command = g_strconcat(buildcmd->command, cmd_cat, NULL);
+		if (cmdstr != NULL)
+			full_command = g_strconcat(cmdstr, cmd_cat, NULL);
 		else
 			full_command = g_strdup(cmd_cat);
 	}
 	else
-		full_command = buildcmd->command;
+		full_command = cmdstr;
 	if (grp == GBG_FT)
 	{
 		dir=NULL; /* allways run in doc dir */
@@ -1034,7 +1059,7 @@
 			return;
 		}
 		GeanyBuildCommand *bc = get_build_cmd(doc, grp, cmd, NULL);
-		if (bc!=NULL && strcmp(bc->command, "builtin")==0)
+		if (bc!=NULL && strcmp(buildcmd_cmd(bc), "builtin")==0)
 		{
 			if (doc==NULL)return;
 			gchar *uri = g_strconcat("file:///", g_path_skip_root(doc->file_name), NULL);
@@ -1145,14 +1170,14 @@
 			for (j=bs->build_cmd; j<build_groups_count[grp]; ++j)
 			{
 				GeanyBuildCommand *bc = get_build_cmd(NULL, grp, j, NULL);
-				gchar *lbl = (bc==NULL)?"":bc->label;
+				gchar *lbl = (bc==NULL)?"":buildcmd_label(bc);
 				create_build_menu_item(menu, keygroup, accel_group, bs, lbl, grp, j);
 			}
 		}
 		else
 		{
 			GeanyBuildCommand *bc = get_build_cmd(NULL, bs->build_grp, bs->build_cmd, NULL);
-			gchar *lbl = (bc==NULL)?"":bc->label;
+			gchar *lbl = (bc==NULL)?"":buildcmd_label(bc);
 			create_build_menu_item(menu, keygroup, accel_group, bs, lbl, bs->build_grp, bs->build_cmd);
 		}
 	}
@@ -1223,16 +1248,23 @@
 				for (cmd=bs->build_cmd; cmd<cmdcount; ++cmd)
 				{
 					GtkWidget *menu_item = menu_items.menu_item[grp][cmd];
+                    gchar* label;
 					bc = get_build_cmd(doc, grp, cmd, NULL);
+                    if (bc)
+                        label = buildcmd_label(bc);
+                    else
+                        label = NULL;
+
 					if (grp < GBG_EXEC)
 					{
 						cmd_sensitivity = 
 							(grp == GBG_FT && bc!=NULL && have_path && ! build_running) ||
 							(grp == GBG_NON_FT && bc!=NULL && ! build_running);
 						gtk_widget_set_sensitive(menu_item, cmd_sensitivity);
-						if (bc!=NULL && bc->label!=NULL && strlen(bc->label)>0)
+						if (bc != NULL && label != NULL
+                                && strlen(label) > 0)
 						{
-							geany_menu_item_set_label(menu_item, bc->label);
+							geany_menu_item_set_label(menu_item, label);
 							gtk_widget_show_all(menu_item);
 							vis |= TRUE;
 						}
@@ -1253,9 +1285,10 @@
 							image = gtk_image_new_from_stock(GTK_STOCK_STOP, GTK_ICON_SIZE_MENU);
 						}
 						gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item), image);
-						if (bc!=NULL && bc->label!=NULL && strlen(bc->label)>0)
+						if (bc != NULL && label != NULL
+                                && strlen(label) > 0)
 						{
-							geany_menu_item_set_label(menu_item, bc->label);
+							geany_menu_item_set_label(menu_item, label);
 							gtk_widget_show_all(menu_item);
 							vis |= TRUE;
 						}
@@ -1386,7 +1419,8 @@
  *-------------------------------------------------------*/
 
 typedef struct RowWidgets {
-	GtkWidget *label, *command, *dir;
+	GtkWidget *entries[BC_CMDENTRIES_COUNT];
+    GtkWidget *dir;
 	GeanyBuildSource src, dst;
 	GeanyBuildCommand *cmdsrc;
 	gint grp,cmd;
@@ -1397,21 +1431,26 @@
 {
 	RowWidgets *r = (RowWidgets*)user_data;
 	gint src;
+    enum GeanyBuildCmdEntries i;
 	GeanyBuildCommand *bc = get_next_build_cmd(NULL, r->grp, r->cmd, r->dst, &src);
-	if(bc!=NULL)
+	if(bc != NULL)
 	{
 		printf("clear here %d, %d, %d\n", r->dst, r->src, src);
 		r->cmdsrc = bc;
 		r->src = src;
-		gtk_entry_set_text(GTK_ENTRY(r->label), bc->label!=NULL?bc->label:"");
-		gtk_entry_set_text(GTK_ENTRY(r->command), bc->command!=NULL?bc->command:"");
+        FOREACH_GEANYBUILDCMD_ENTRY(i)
+        {
+            gtk_entry_set_text(GTK_ENTRY(r->entries[i]), id_to_str(bc,i) != NULL? id_to_str(bc,i):"");
+        }
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(r->dir), bc->run_in_base_dir);
 	}
 	else
 	{
 		printf("clear there\n");
-		gtk_entry_set_text(GTK_ENTRY(r->label), "");
-		gtk_entry_set_text(GTK_ENTRY(r->command), "");
+        FOREACH_GEANYBUILDCMD_ENTRY(i)
+        {
+            gtk_entry_set_text(GTK_ENTRY(r->entries[i]), "");
+        }
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(r->dir), FALSE);
 	}
 	r->cleared = TRUE;
@@ -1425,55 +1464,70 @@
 	gchar 	*labeltxt, *cmdtxt;
 	GeanyBuildCommand *bc;
 	gint src;
+    enum GeanyBuildCmdEntries i;
 	gboolean ribd; /* run in base directory */
+
+    gint column = 0;
 	
 	if (grp == GBO_TO_GBG(GBO_MAKE_CUSTOM) && cmd == GBO_TO_CMD(GBO_MAKE_CUSTOM)){ labeltxt = g_strdup_printf("%d:*", cmd+1); }
 	else labeltxt = g_strdup_printf("%d:", cmd+1);
 	label = gtk_label_new(labeltxt);
 	g_free(labeltxt);
-	gtk_table_attach(table, label, 0, 1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
+	gtk_table_attach(table, label, column, column+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
 	roww = g_new0(RowWidgets, 1);
 	roww->src = BCS_COUNT;
 	roww->grp = grp;
 	roww->cmd = cmd;
 	roww->dst = dst;
-	roww->label = gtk_entry_new();
-	gtk_table_attach(table, roww->label, 1, 2, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
-	roww->command = gtk_entry_new();
-	gtk_table_attach(table, roww->command, 2, 3, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
+    FOREACH_GEANYBUILDCMD_ENTRY(i)
+    {
+        column+=1;
+        roww->entries[i] = gtk_entry_new();
+        gtk_table_attach(table, roww->entries[i], column, column+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
+    }
+    column++;
 	if (dir)
 	{
 		check = gtk_check_button_new();
-		gtk_table_attach(table, check, 3, 4, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
+		gtk_table_attach(table, check, column, column+1,row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
 	}
 	else check = NULL;
+
+    column++;
 	roww->dir = check;
 	clearicon = gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_SMALL_TOOLBAR);
 	clear = gtk_button_new();
 	gtk_button_set_image(GTK_BUTTON(clear), clearicon);
 	g_signal_connect((gpointer)clear, "clicked", G_CALLBACK(on_clear_dialog_row), (gpointer)roww);
-	gtk_table_attach(table, clear, 4, 5, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
+	gtk_table_attach(table, clear, column, column+1, row, row+1, GTK_FILL, GTK_FILL | GTK_EXPAND, 0, 0);
 	roww->cmdsrc = bc = get_build_cmd(doc, grp, cmd, &src);
-	if (bc!=NULL)
-	{
-		if ((labeltxt = bc->label)==NULL)labeltxt="";
-		if ((cmdtxt = bc->command)==NULL)cmdtxt="";
-		ribd = bc->run_in_base_dir;
-		roww->src = src;
-	}
-	else
-	{
-		labeltxt = cmdtxt = "";
-		ribd = FALSE;
-	}
-	gtk_entry_set_text(GTK_ENTRY(roww->label), labeltxt);
-	gtk_entry_set_text(GTK_ENTRY(roww->command), cmdtxt);
+
+    FOREACH_GEANYBUILDCMD_ENTRY(i)
+    {
+        gchar *str;
+        if (bc!=NULL)
+        {
+            if ((str = bc->entries[i])==NULL)str="";
+            if (i == 0)
+            {
+                ribd = bc->run_in_base_dir;
+                roww->src = src;
+            }
+        }
+        else
+        {
+            str = "";
+            if (i == 0)
+                ribd = FALSE;
+        }
+        gtk_entry_set_text(GTK_ENTRY(roww->entries[i]), str);
+    }
 	if (dir)
 		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), ribd);
 	if (src>dst || (grp==GBG_FT && (doc==NULL || doc->file_type==NULL)))
 	{
-		gtk_widget_set_sensitive(roww->label, FALSE);
-		gtk_widget_set_sensitive(roww->command, FALSE);
+        FOREACH_GEANYBUILDCMD_ENTRY(i)
+            gtk_widget_set_sensitive(roww->entries[i], FALSE);
 		gtk_widget_set_sensitive(check, FALSE);
 		gtk_widget_set_sensitive(clear, FALSE);
 	}
@@ -1587,14 +1641,18 @@
 
 static gboolean read_row(GeanyBuildCommand ***dstcmds, TableData table_data, gint drow, gint grp, gint cmd)
 {
-	gchar			*label, *command;
+	gchar			*entries[BC_CMDENTRIES_COUNT];
 	gboolean		 dir;
 	gboolean		 changed = FALSE;
 	GeanyBuildSource src;
+    enum GeanyBuildCmdEntries i;
 
 	src = table_data->rows[drow]->src;
-	label = g_strdup(gtk_entry_get_text(GTK_ENTRY(table_data->rows[drow]->label)));
-	command = g_strdup(gtk_entry_get_text(GTK_ENTRY(table_data->rows[drow]->command)));
+
+    FOREACH_GEANYBUILDCMD_ENTRY(i)
+    {
+        entries[i] = g_strdup(gtk_entry_get_text(GTK_ENTRY(table_data->rows[drow]->entries[i])));
+    }
 	dir = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(table_data->rows[drow]->dir));
 	if (table_data->rows[drow]->cleared)
 	{
@@ -1607,18 +1665,18 @@
 		}
 	}
 	if ((table_data->rows[drow]->cmdsrc==NULL &&                          /* originally there was no content */
-		  (strlen(label)>0 || strlen(command)>0  || dir)) ||              /* and now there is some  or */
+		  (entries[BC_LABEL] || entries[BC_COMMAND] || dir)) ||              /* and now there is some  or */
 		(table_data->rows[drow]->cmdsrc!=NULL &&                          /* originally there was content and */
-		  (stcmp(label, table_data->rows[drow]->cmdsrc->label)!=0 ||      /* label is different or */
-		    stcmp(command, table_data->rows[drow]->cmdsrc->command)!=0 || /* command is different or */
+		  (stcmp(entries[BC_LABEL], table_data->rows[drow]->cmdsrc->entries[BC_LABEL])!=0 ||      /* label is different or */
+		    stcmp(entries[BC_COMMAND], table_data->rows[drow]->cmdsrc->entries[BC_COMMAND])!=0 || /* command is different or */
 		    dir != table_data->rows[drow]->cmdsrc->run_in_base_dir)))     /* runinbasedir is different */
 	{
 		if (dstcmds[grp]!=NULL)
 		{
 			if (*(dstcmds[grp])==NULL)
 				*(dstcmds[grp]) = g_new0(GeanyBuildCommand, build_groups_count[grp]);
-			setptr((*(dstcmds[grp]))[cmd].label, label);
-			setptr((*(dstcmds[grp]))[cmd].command, command);
+            FOREACH_GEANYBUILDCMD_ENTRY(i)
+                setptr((*(dstcmds[grp]))[cmd].entries[i], entries[i]);
 			(*(dstcmds[grp]))[cmd].run_in_base_dir = dir;
 			(*(dstcmds[grp]))[cmd].exists = TRUE;
 			(*(dstcmds[grp]))[cmd].changed=TRUE;
@@ -1627,7 +1685,8 @@
 	}
 	else
 	{
-		g_free(label); g_free(command);
+        FOREACH_GEANYBUILDCMD_ENTRY(i)
+            g_free(entries[i]);
 	}
 	return changed;
 }
@@ -1709,7 +1768,7 @@
 
 static void load_build_menu_grp(GKeyFile *config, GeanyBuildCommand **dst, gint grp, gchar *prefix, gboolean loc)
 {
-	gint cmd, prefixlen; /* NOTE prefixlen used in macros above */
+	gint i, cmd, prefixlen; /* NOTE prefixlen used in macros above */
 	GeanyBuildCommand *dstcmd;
 	gchar *key;
 	static gchar cmdbuf[3]="  ";
@@ -1733,10 +1792,10 @@
 		if (label!=NULL)
 		{
 			dstcmd[cmd].exists = TRUE;
-			setptr(dstcmd[cmd].label, label);
-			set_key_fld(key,"CM");
-			setptr(dstcmd[cmd].command, g_key_file_get_string(config, build_grp_name, key, NULL));
-			set_key_fld(key,"BD");
+            setptr(dstcmd[cmd].entries[BC_LABEL], label);
+            set_key_fld(key,"CM");
+            setptr(dstcmd[cmd].entries[BC_COMMAND], g_key_file_get_string(config, build_grp_name, key, NULL));
+            set_key_fld(key,"BD");
 			dstcmd[cmd].run_in_base_dir = g_key_file_get_boolean(config, build_grp_name, key, NULL);
 		}
 		else dstcmd[cmd].exists = FALSE;
@@ -1807,6 +1866,13 @@
 		gchar *value;
 		gboolean bvalue;
 		gint cmd;
+#define ASSIGN(type, id, string, value) \
+        do { \
+            type[GBO_TO_CMD(id)].exists = TRUE; \
+            type[GBO_TO_CMD(id)].entries[BC_LABEL] = g_strdup(_(string)); \
+            type[GBO_TO_CMD(id)].entries[BC_COMMAND] = value; \
+        } while (0)
+        
 		switch(src)
 		{
 			case BCS_FT:
@@ -1815,24 +1881,18 @@
 				value = g_key_file_get_string(config, "build_settings", "compiler", NULL);
 				if (value != NULL)
 				{
-					ft->filecmds[GBO_TO_CMD(GBO_COMPILE)].exists = TRUE;
-					ft->filecmds[GBO_TO_CMD(GBO_COMPILE)].label = g_strdup(_("_Compile"));
-					ft->filecmds[GBO_TO_CMD(GBO_COMPILE)].command = value;
+                    ASSIGN(ft->filecmds, GBO_COMPILE, "_Compile", value);
 				}
 				value = g_key_file_get_string(config, "build_settings", "linker", NULL);
 				if (value != NULL)
 				{
-					ft->filecmds[GBO_TO_CMD(GBO_BUILD)].exists = TRUE;
-					ft->filecmds[GBO_TO_CMD(GBO_BUILD)].label = g_strdup(_("_Build"));
-					ft->filecmds[GBO_TO_CMD(GBO_BUILD)].command = value;
+                    ASSIGN(ft->filecmds, GBO_BUILD, "_Build", value);
 				}
 				if (ft->execcmds==NULL)ft->execcmds = g_new0(GeanyBuildCommand, build_groups_count[GBG_EXEC]);
 				value = g_key_file_get_string(config, "build_settings", "run_cmd", NULL);
 				if (value != NULL)
 				{
-					ft->execcmds[GBO_TO_CMD(GBO_EXEC)].exists = TRUE;
-					ft->execcmds[GBO_TO_CMD(GBO_EXEC)].label = g_strdup(_("_Execute"));
-					ft->execcmds[GBO_TO_CMD(GBO_EXEC)].command = value;
+                    ASSIGN(ft->execcmds, GBO_EXEC, "_Execute", value);
 				}
 				break;
 			case BCS_PROJ:
@@ -1847,9 +1907,7 @@
 				if (value !=NULL)
 				{
 					if (exec_proj==NULL)exec_proj = g_new0(GeanyBuildCommand, build_groups_count[GBG_EXEC]);
-					exec_proj[GBO_TO_CMD(GBO_EXEC)].exists = TRUE;
-					exec_proj[GBO_TO_CMD(GBO_EXEC)].label = g_strdup(_("Execute"));
-					exec_proj[GBO_TO_CMD(GBO_EXEC)].command = value;
+                    ASSIGN(exec_proj, GBO_EXEC, "Execute", value);
 				}
 				break;
 			case BCS_PREF:
@@ -1857,15 +1915,9 @@
 				value = g_key_file_get_string(config, "tools", "make_cmd", NULL);
 				if (value!=NULL)
 				{
-					non_ft_pref[GBO_TO_CMD(GBO_MAKE_ALL)].exists = TRUE;
-					non_ft_pref[GBO_TO_CMD(GBO_MAKE_ALL)].label = g_strdup(_("_Make All"));
-					non_ft_pref[GBO_TO_CMD(GBO_MAKE_ALL)].command = value;
-					non_ft_pref[GBO_TO_CMD(GBO_MAKE_CUSTOM)].exists = TRUE;
-					non_ft_pref[GBO_TO_CMD(GBO_MAKE_CUSTOM)].label = g_strdup(_("Make Custom _Target"));
-					non_ft_pref[GBO_TO_CMD(GBO_MAKE_CUSTOM)].command = g_strdup_printf("%s ",value);
-					non_ft_pref[GBO_TO_CMD(GBO_MAKE_OBJECT)].exists = TRUE;
-					non_ft_pref[GBO_TO_CMD(GBO_MAKE_OBJECT)].label = g_strdup(_("Make _Object"));
-					non_ft_pref[GBO_TO_CMD(GBO_MAKE_OBJECT)].command = g_strdup_printf("%s %%e.o",value);
+                    ASSIGN(non_ft_pref, GBO_MAKE_ALL, g_strdup(_("_Make All")), value);
+                    ASSIGN(non_ft_pref, GBO_MAKE_CUSTOM, g_strdup(_("Make Custom _Target")), g_strdup_printf("%s ",value));
+                    ASSIGN(non_ft_pref, GBO_MAKE_OBJECT, g_strdup(_("Make _Object")), g_strdup_printf("%s %%e.o",value));
 				}
 				break;
 			default:
@@ -1879,6 +1931,7 @@
 	gint cmd, prefixlen; /* NOTE prefixlen used in macros above */
 	gchar *key;
 	gint count=0;
+    enum GeanyBuildCmdEntries i;
 	
 	if (src==NULL)return;
 	prefixlen = prefix==NULL?0:strlen(prefix);
@@ -1895,20 +1948,22 @@
 			set_key_fld(key, "LB");
 			if (src[cmd].exists)
 			{
-				g_key_file_set_string(config, build_grp_name, key, src[cmd].label);
-				set_key_fld(key,"CM");
-				g_key_file_set_string(config, build_grp_name, key, src[cmd].command);
-				set_key_fld(key,"BD");
+                FOREACH_GEANYBUILDCMD_ENTRY(i)
+                {
+                    g_key_file_set_string(config, build_grp_name, key, src[cmd].entries[i]);
+                    set_key_fld(key, config_keys[i]);
+                }
 				g_key_file_set_boolean(config, build_grp_name, key, src[cmd].run_in_base_dir);
 				++count;
 			}
 			else
 			{
+                FOREACH_GEANYBUILDCMD_ENTRY(i)
+                {                    
+                    g_key_file_remove_key(config, build_grp_name, key, NULL);
+                    set_key_fld(key, config_keys[i]);
+                }
 				g_key_file_remove_key(config, build_grp_name, key, NULL);
-				set_key_fld(key,"CM");
-				g_key_file_remove_key(config, build_grp_name, key, NULL);
-				set_key_fld(key,"BD");
-				g_key_file_remove_key(config, build_grp_name, key, NULL);
 			}
 		}
 	}
@@ -1956,7 +2011,7 @@
 			data.config = config;
 			data.ft_names = g_ptr_array_new();
 			g_ptr_array_foreach(pj->build_filetypes_list, foreach_project_filetype, (gpointer)(&data));
-			g_key_file_set_string_list(config, build_grp_name, "filetypes", (gchar*)(data.ft_names->pdata), data.ft_names->len);
+			g_key_file_set_string_list(config, build_grp_name, "filetypes", (const gchar**)(data.ft_names->pdata), data.ft_names->len);
 			break;
 		default: /* defaults and BCS_FT can't save */
 			break;
@@ -1973,33 +2028,36 @@
 }
 
 static struct {
-	gchar *label,*command;
+	gchar *entries[BC_CMDENTRIES_COUNT];
 	gboolean dir;
 	GeanyBuildCommand **ptr;
 	gint index;
 } default_cmds[] = { 
-	{N_("_Make"), "make", FALSE, &non_ft_def, GBO_TO_CMD(GBO_MAKE_ALL)}, 
-	{N_("Make Custom _Target"), "make ", FALSE, &non_ft_def, GBO_TO_CMD(GBO_MAKE_CUSTOM)}, 
-	{N_("Make _Object"), "make %e.o", FALSE, &non_ft_def, GBO_TO_CMD(GBO_MAKE_OBJECT)},
-	{N_("_Execute"), "./%e", FALSE, &exec_def, GBO_TO_CMD(GBO_EXEC)},
-	{NULL, NULL, FALSE, NULL, 0 }
+	{ {N_("_Make"), "make"}, FALSE, &non_ft_def, GBO_TO_CMD(GBO_MAKE_ALL)}, 
+	{ {N_("Make Custom _Target"), "make "}, FALSE, &non_ft_def, GBO_TO_CMD(GBO_MAKE_CUSTOM)}, 
+	{ {N_("Make _Object"), "make %e.o" }, FALSE, &non_ft_def, GBO_TO_CMD(GBO_MAKE_OBJECT)},
+	{ {N_("_Execute"), "./%e" }, FALSE, &exec_def, GBO_TO_CMD(GBO_EXEC)},
+	{ {NULL, NULL}, FALSE, NULL, 0 }
 };
 
 void build_init()
 {
 	GtkWidget *item;
 	GtkWidget *toolmenu;
-	gint cmdindex, defindex;
+	gint i, cmdindex, defindex;
 
 	ft_def = g_new0(GeanyBuildCommand, build_groups_count[GBG_FT]);
 	non_ft_def = g_new0(GeanyBuildCommand, build_groups_count[GBG_NON_FT]);
 	exec_def = g_new0(GeanyBuildCommand, build_groups_count[GBG_EXEC]);
-	for (cmdindex=0; default_cmds[cmdindex].label!=NULL; ++cmdindex)
+	for (cmdindex=0; default_cmds[cmdindex].entries[i] != NULL; ++cmdindex)
 	{
+        enum GeanyBuildCmdEntries k;
 		GeanyBuildCommand *cmd = &((*(default_cmds[cmdindex].ptr))[ default_cmds[cmdindex].index ]);
 		cmd->exists = TRUE;
-		cmd->label = g_strdup(default_cmds[cmdindex].label);
-		cmd->command = g_strdup(default_cmds[cmdindex].command);
+        FOREACH_GEANYBUILDCMD_ENTRY(k)
+        {
+            cmd->entries[k] = g_strdup(default_cmds[cmdindex].entries[k]);
+        }
 		cmd->run_in_base_dir = default_cmds[cmdindex].dir;
 	}
 
Index: src/build.h
===================================================================
--- src/build.h	(Revision 3952)
+++ src/build.h	(Arbeitskopie)
@@ -90,10 +90,16 @@
 
 extern GeanyBuildInfo build_info;
 
+typedef enum  GeanyBuildCmdEntries
+{
+    BC_LABEL,
+    BC_COMMAND,
+    BC_CMDENTRIES_COUNT,
+} GeanyBuildCmdEntries;
+
 typedef struct GeanyBuildCommand
 {
-	gchar		*label;
-	gchar		*command;
+	gchar *entries[BC_CMDENTRIES_COUNT];
 	gboolean	 exists;
 	gboolean	 run_in_base_dir;
 	gboolean	 changed;
