[asterisk-commits] branch russell/make_menuconfig - r7493 in /team/russell/make_menuconfig: ./ b...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Dec 15 09:43:30 CST 2005


Author: russell
Date: Thu Dec 15 09:43:29 2005
New Revision: 7493

URL: http://svn.digium.com/view/asterisk?rev=7493&view=rev
Log:
- add the ability to set a displayname for category members
- display its use with app_dial.so

Modified:
    team/russell/make_menuconfig/build_options.xml
    team/russell/make_menuconfig/build_tools/menuconfig.c

Modified: team/russell/make_menuconfig/build_options.xml
URL: http://svn.digium.com/view/asterisk/team/russell/make_menuconfig/build_options.xml?rev=7493&r1=7492&r2=7493&view=diff
==============================================================================
--- team/russell/make_menuconfig/build_options.xml (original)
+++ team/russell/make_menuconfig/build_options.xml Thu Dec 15 09:43:29 2005
@@ -37,6 +37,7 @@
 	</member>
 	<member>
 		<name>app_dial.so</name>
+		<displayname>Dial(), RetryDial()</displayname>
 		<description>Dial() and RetryDial() Applications</description>
 	</member>
 	<member>

Modified: team/russell/make_menuconfig/build_tools/menuconfig.c
URL: http://svn.digium.com/view/asterisk/team/russell/make_menuconfig/build_tools/menuconfig.c?rev=7493&r1=7492&r2=7493&view=diff
==============================================================================
--- team/russell/make_menuconfig/build_tools/menuconfig.c (original)
+++ team/russell/make_menuconfig/build_tools/menuconfig.c Thu Dec 15 09:43:29 2005
@@ -69,6 +69,7 @@
 */
 struct member {
 	const char *name;
+	const char *displayname;
 	const char *desc;
 	int enabled;
 	struct member *next;
@@ -147,7 +148,7 @@
 	return cat;
 }
 
-struct member *add_member(const char *member, const char *desc, struct category *cat)
+struct member *add_member(const char *name, const char *displayname, const char *desc, struct category *cat)
 {
 	struct member *mem;
 	struct member *mem_prev = NULL;
@@ -156,12 +157,12 @@
 		return NULL;	
 
 	for (mem = cat->members; mem; mem = mem->next) {
-		if (!strcmp(member, mem->name))
+		if (!strcmp(name, mem->name))
 			break;
 		mem_prev = mem;	
 	}
 	if (mem) {
-		fprintf(stderr, "Member '%s' already exists in category '%s', ignoring.\n", member, cat->name);
+		fprintf(stderr, "Member '%s' already exists in category '%s', ignoring.\n", name, cat->name);
 		return NULL;
 	}
 
@@ -173,7 +174,8 @@
 		cat->members = mem;
 	if (mem_prev)
 		mem_prev->next = mem;
-	mem->name = member;
+	mem->name = name;
+	mem->displayname = displayname;
 	mem->desc = desc;
 	
 	return mem;
@@ -184,6 +186,7 @@
 	FILE *f;
 	struct category *cat;
 	const char *mem_name;
+	const char *mem_displayname;
 	const char *mem_desc;
 	const char *cat_name;
 	const char *cat_displayname;
@@ -231,10 +234,11 @@
 		cat_name = cur2->child->value.opaque;
 	
 		cur2 = mxmlFindElement(cur, cur, "displayname", NULL, NULL, MXML_DESCEND);
-		if (cur2 && cur2->child)
+		if (cur2 && cur2->child) {
 			cat_displayname = cur2->child->value.opaque;
-		else
+		} else {
 			cat_displayname = NULL;
+		}
 
 		cat = add_category(cat_name, cat_displayname);
 		if (!cat)
@@ -262,7 +266,14 @@
 				mem_desc = cur3->child->value.opaque;
 			}
 
-			add_member(mem_name, mem_desc, cat);
+			cur3 = mxmlFindElement(cur2, cur2, "displayname", NULL, NULL, MXML_DESCEND);
+			if (!cur3 || !cur3->child) {
+				mem_displayname = NULL;
+			} else {
+				mem_displayname = cur3->child->value.opaque;
+			}
+
+			add_member(mem_name, mem_displayname, mem_desc, cat);
 		}
 	}
 
@@ -501,7 +512,7 @@
 			continue;
 		}
 		wmove(menu, j++, max_x / 2 - 10);
-		snprintf(buf, sizeof(buf), "[%s] %d. %s", mem->enabled ? "*" : " ", ++i, mem->name);
+		snprintf(buf, sizeof(buf), "[%s] %d. %s", mem->enabled ? "*" : " ", ++i, !strlen_zero(mem->displayname) ? mem->displayname : mem->name);
 		waddstr(menu, buf);
 		if (i == end)
 			break;



More information about the asterisk-commits mailing list