#include "history.h"
#include "bookmark.h"
#include "command.h"
+#include "setting.h"
extern VbCore vb;
/* TODO move these decision to a more generic place */
if (!strncmp(input, ":set ", 5)) {
- source = g_hash_table_get_keys(vb.settings);
- source = g_list_sort(source, (GCompareFunc)g_strcmp0);
+ source = g_list_sort(setting_get_all(), (GCompareFunc)g_strcmp0);
comps.completions = init_completion(
comps.completions,
filter_list(tmp, source, (Comp_Func)g_str_has_prefix, &input[5]),
#include "setting.h"
#include "util.h"
+static GHashTable *settings;
+
extern VbCore vb;
static Arg *char_to_arg(const char *str, const Type type);
{
Setting *s;
unsigned int i;
- vb.settings = g_hash_table_new(g_str_hash, g_str_equal);
+ settings = g_hash_table_new(g_str_hash, g_str_equal);
for (i = 0; i < LENGTH(default_settings); i++) {
s = &default_settings[i];
/* use alias as key if available */
- g_hash_table_insert(vb.settings, (gpointer)s->alias != NULL ? s->alias : s->name, s);
+ g_hash_table_insert(settings, (gpointer)s->alias != NULL ? s->alias : s->name, s);
}
}
+GList* setting_get_all(void)
+{
+ return g_hash_table_get_keys(settings);
+}
+
void setting_cleanup(void)
{
- if (vb.settings) {
- g_hash_table_destroy(vb.settings);
+ if (settings) {
+ g_hash_table_destroy(settings);
}
}
type = SETTING_GET;
}
- Setting *s = g_hash_table_lookup(vb.settings, name);
+ Setting *s = g_hash_table_lookup(settings, name);
if (!s) {
vb_echo(VB_MSG_ERROR, true, "Config '%s' not found", name);
return false;