diff --git a/.hgignore b/.hgignore index cef7c95b..0f5efdb8 100644 --- a/.hgignore +++ b/.hgignore @@ -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 +.*~ diff --git a/moo/mooutils/mooprefs.c b/moo/mooutils/mooprefs.c index 3712f1de..abe6fac5 100644 --- a/moo/mooutils/mooprefs.c +++ b/moo/mooutils/mooprefs.c @@ -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); + } +} diff --git a/moo/mooutils/mooprefs.h b/moo/mooutils/mooprefs.h index f9c1ac52..3c7e5303 100644 --- a/moo/mooutils/mooprefs.h +++ b/moo/mooutils/mooprefs.h @@ -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);