moo_prefs_list_keys()

This commit is contained in:
Yevgen Muntyan 2006-02-23 20:43:22 -06:00
parent 2cc7da8406
commit 9233c82585
3 changed files with 50 additions and 0 deletions

View File

@ -5,3 +5,15 @@
^berlios-hg.state$
^berlios-hg.state.old$
^berlios-hg.state.journal$
build/.*
Makefile\.in
aclocal\.m4
autom4te.*
compile
config.*
depcomp
install-sh
ltmain\.sh
missing
.*\.pyc
.*~

View File

@ -1373,3 +1373,40 @@ moo_prefs_match_type_get_type (void)
return type;
}
static void
add_key (const char *key,
G_GNUC_UNUSED PrefsItem *item,
GPtrArray *array)
{
g_ptr_array_add (array, g_strdup (key));
}
char**
moo_prefs_list_keys (guint *n_keys)
{
MooPrefs *prefs = instance ();
GPtrArray *array;
array = g_ptr_array_new ();
g_hash_table_foreach (prefs->priv->data,
(GHFunc) add_key,
array);
if (!array->len)
{
g_ptr_array_free (array, TRUE);
if (n_keys)
*n_keys = 0;
return NULL;
}
else
{
if (n_keys)
*n_keys = array->len;
g_ptr_array_add (array, NULL);
return (char**) g_ptr_array_free (array, FALSE);
}
}

View File

@ -62,6 +62,7 @@ void moo_prefs_new_key (const char *key,
const GValue *default_value);
void moo_prefs_delete_key (const char *key);
char **moo_prefs_list_keys (guint *n_keys);
GType moo_prefs_get_key_type (const char *key);
gboolean moo_prefs_key_registered(const char *key);