mirror of
https://github.com/irssi/irssi.git
synced 2026-08-09 03:40:16 +02:00
Add a CHOICE type to the settings system.
This is useful to let the user choose an option between a finite set of valid alternatives.
This commit is contained in:
parent
0fad2cd842
commit
bf9d9494db
4 changed files with 113 additions and 18 deletions
|
|
@ -690,9 +690,20 @@ static void sig_complete_set(GList **list, WINDOW_REC *window,
|
|||
else if (*line != '\0' && *word == '\0') {
|
||||
SETTINGS_REC *rec = settings_get_record(line);
|
||||
if (rec != NULL) {
|
||||
char *value = settings_get_print(rec);
|
||||
if (value != NULL)
|
||||
*list = g_list_append(*list, value);
|
||||
/* show the whole list of valid options */
|
||||
if (rec->type == SETTING_TYPE_CHOICE) {
|
||||
char **tmp = rec->choices;
|
||||
|
||||
while (*tmp)
|
||||
*list = g_list_append(*list, g_strdup(*tmp++));
|
||||
}
|
||||
/* show the current option */
|
||||
else {
|
||||
char *value = settings_get_print(rec);
|
||||
|
||||
if (value != NULL)
|
||||
*list = g_list_append(*list, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue