Commits

Ilya Arkhipov  committed 6209c59

Highlight new options with a '+' [tijl@] with little change

  • Participants
  • Parent commits 8170540

Comments (0)

Files changed (4)

File dialog4ports.c

 static int items_sz = 5;
 /* Enables items */
 static StringList *enable_items = NULL;
+/* New items */
+static StringList *new_items = NULL;
 
 /* add item to items */
 static void
 add_item(dialog_mixedlist **items, char const *name, char const *text,
-		bool state, int type, int grp)
+		bool state, bool new, int type, int grp)
 {
 
 	if ((list_no + 1 > items_sz) || *items == NULL) {
 	(*items)[list_no].name = strdup(name);
 	(*items)[list_no].text = strdup(text);
 	(*items)[list_no].state = state;
+	(*items)[list_no].new = new;
 	(*items)[list_no].type = type;
 	(*items)[list_no].group = grp;
 	list_no++;
 	return (sl_find(enable_items, name) != NULL);
 }
 
+static bool
+is_new(char *name)
+{
+	return (sl_find(new_items, name) != NULL);
+}
+
 static StringList *
 parse_env_sl(char const *env_name)
 {
 			if (token[0] == '\0')
 				continue;
 			add_item(items, token, get_desc(token, ""), is_enable(token),
-					type, group);
+					is_new(token), type, group);
 		}
 		free(tofree);
 	} else {
 			if (token[0] == '\0')
 				continue;
 			if (list_no != 0)
-				add_item(items, get_desc(token, token), "", false,
+				add_item(items, get_desc(token, token), "", false, false,
 						ITEM_SEPARATOR, group);
 
 			snprintf(buf, sizeof(buf), "%s_%s", env_name, token);
 				if (token2[0] == '\0')
 					continue;
 				add_item(items, token2, get_desc(token2, ""),
-						is_enable(token2), type, group);
+						is_enable(token2), is_new(token2), type, group);
 			}
 			free(tofree2);
 			group++;
 	dialog_mixedlist *items = NULL;
 
 	enable_items = parse_env_sl("PORT_OPTIONS");
+	new_items = parse_env_sl("NEW_OPTIONS");
 
 	parsing_env(&items, "ALL_OPTIONS", ITEM_CHECK);
 	parsing_env(&items, "OPTIONS_GROUP", ITEM_CHECK);
 		}
 	} /* No ;) */
 	else {
-		wmove(win, choice, check_x);
+		wmove(win, choice, check_x - 1);
+		wattrset(win, tag_key_attr);
+		waddch(win, items->new ? '+' : ' ');
 		wattrset(win, selected ? check_selected_attr : check_attr);
 		wprintw(win,
 				itype == ITEM_CHECK ? "[%c]" : "(%c)",
         int type;
         int group;
         bool state;
+        bool new;
 } dialog_mixedlist;
 
 /*

File test/parsing_test.sh

 export PKGHELP=`pwd`/PKGHELP
 
 export PORT_OPTIONS="FreeBSD Cc_1 W R11 R32 GRA MM1 MM2 MM4 R12"
+export NEW_OPTIONS="Cc_1 MM3 R22"
 
 # Test for DEFINE/ALL_OPTIONS
 export ALL_OPTIONS="FreeBSD BbBbb Cc_1"