moo_prefs_list_keys

master
Yevgen Muntyan 2007-07-13 03:43:10 -05:00
parent 9be84dd01f
commit d8123eaac7
4 changed files with 44 additions and 3 deletions

View File

@ -34,7 +34,7 @@ class ConfigureOptions(Group):
class Commands(Group):
__items__ = {
'build' : Command(default=['$(top_builddir)', '$(make)']),
'compile' : Command(default=['$(builddir)', '$(make) $(base).o']),
'compile' : Command(default=['$(builddir)', '$(make) $(base).lo']),
'configure' : Command(default=['$(top_builddir)', '$(configure_vars) $(top_srcdir)/configure $(configure_args)']),
'autogen' : Command(default=['$(top_builddir)', '$(configure_vars) $(top_srcdir)/autogen.sh $(configure_args)']),
'clean' : Command(default=['$(top_builddir)', '$(make) clean']),

View File

@ -2234,6 +2234,14 @@
)
)
(define-function prefs_list_keys
(c-name "moo_prefs_list_keys")
(return-type "string-slist")
(parameters
'("MooPrefsType" "prefs_type")
)
)
(define-function make_user_data_dir
(c-name "moo_make_user_data_dir")
(return-type "gboolean")

View File

@ -116,11 +116,10 @@ static void moo_prefs_new_key_from_string (const char *key,
static void moo_prefs_set_modified (gboolean modified);
/* MOO_TYPE_PREFS */
MOO_DEFINE_TYPE_STATIC (MooPrefs, _moo_prefs, G_TYPE_OBJECT)
static MooPrefs*
static MooPrefs *
instance (void)
{
static MooPrefs *p = NULL;
@ -379,6 +378,38 @@ moo_prefs_set_modified (gboolean modified)
}
static void
prepend_key (const char *key,
PrefsItem *item,
gpointer pdata)
{
struct {
GSList *list;
MooPrefsType prefs_type;
} *data = pdata;
if (data->prefs_type == item->prefs_type)
data->list = g_slist_prepend (data->list, g_strdup (key));
}
GSList *
moo_prefs_list_keys (MooPrefsType prefs_type)
{
MooPrefs *prefs = instance ();
struct {
GSList *list;
MooPrefsType prefs_type;
} data;
data.list = NULL;
data.prefs_type = prefs_type;
g_hash_table_foreach (prefs->data, (GHFunc) prepend_key, &data);
return g_slist_sort (data.list, (GCompareFunc) strcmp);
}
/***************************************************************************/
/* Prefs
*/

View File

@ -66,6 +66,8 @@ void moo_prefs_delete_key (const char *key);
GType moo_prefs_get_key_type (const char *key);
gboolean moo_prefs_key_registered(const char *key);
GSList *moo_prefs_list_keys (MooPrefsType prefs_type);
const GValue *moo_prefs_get (const char *key);
const GValue *moo_prefs_get_default (const char *key);
void moo_prefs_set (const char *key,