예제 #1
0
파일: completion.c 프로젝트: irssi/irssi
static void sig_complete_set(GList **list, WINDOW_REC *window,
			     const char *word, const char *line, int *want_space)
{
	g_return_if_fail(list != NULL);
	g_return_if_fail(word != NULL);
	g_return_if_fail(line != NULL);

	if (*line == '\0' ||
	    !g_strcmp0("-clear", line) || !g_strcmp0("-default", line))
		*list = completion_get_settings(word, SETTING_TYPE_ANY);
	else if (*line != '\0' && *word == '\0') {
		SETTINGS_REC *rec = settings_get_record(line);
		if (rec != NULL) {
			char *value = settings_get_print(rec);

			/* show the current option first */
			if (value != NULL)
				*list = g_list_append(*list, value);

			/* show the whole list of valid options */
			if (rec->type == SETTING_TYPE_CHOICE) {
				char **tmp;

				for (tmp = rec->choices; *tmp; tmp++) {
					if (g_ascii_strcasecmp(*tmp, value) != 0)
						*list = g_list_append(*list, g_strdup(*tmp));
				}
			}
		}
	}

	if (*list != NULL) signal_stop();
}
예제 #2
0
static void sig_complete_set(GList **list, WINDOW_REC *window,
			     const char *word, const char *line, int *want_space)
{
	g_return_if_fail(list != NULL);
	g_return_if_fail(word != NULL);
	g_return_if_fail(line != NULL);

	if (*line != '\0') return;

	*list = completion_get_settings(word);
	if (*list != NULL) signal_stop();
}
예제 #3
0
파일: completion.c 프로젝트: 13122614/irssi
static void sig_complete_set(GList **list, WINDOW_REC *window,
			     const char *word, const char *line, int *want_space)
{
	g_return_if_fail(list != NULL);
	g_return_if_fail(word != NULL);
	g_return_if_fail(line != NULL);

	if (*line == '\0' ||
	    !g_strcmp0("-clear", line) || !g_strcmp0("-default", line))
		*list = completion_get_settings(word, SETTING_TYPE_ANY);
	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);
		}
	}

	if (*list != NULL) signal_stop();
}