Commit 5d435e95 authored by Pierre Wieser's avatar Pierre Wieser

Dump content of readen entries

parent 3354b1c2
2009-04-09 Pierre Wieser <pwieser@trychlos.org>
* src/api/na-gconf-utils.h:
* src/core/na-gconf-utils.c (na_gconf_utils_dump_entries):
New function.
* src/io-gconf/nagp-reader.c (read_item):
Dump content of readen entries.
* src/io-gconf/nagp-gconf-provider.c (install_monitors):
Also monitors schemas to be triggered when importing a schema.
......
......@@ -49,6 +49,7 @@ GSList *na_gconf_utils_get_entries( GConfClient *gconf, const gchar *path );
gboolean na_gconf_utils_get_bool_from_entries ( GSList *entries, const gchar *entry, gboolean *value );
gboolean na_gconf_utils_get_string_from_entries ( GSList *entries, const gchar *entry, gchar **value );
gboolean na_gconf_utils_get_string_list_from_entries( GSList *entries, const gchar *entry, GSList **value );
void na_gconf_utils_dump_entries ( GSList *entries );
void na_gconf_utils_free_entries ( GSList *entries );
gboolean na_gconf_utils_read_bool ( GConfClient *gconf, const gchar *path, gboolean use_schema, gboolean default_value );
......
......@@ -37,6 +37,7 @@
#include <api/na-core-utils.h>
#include <api/na-gconf-utils.h>
static void dump_entry( GConfEntry *entry, void *user_data );
static GConfValue *read_value( GConfClient *gconf, const gchar *path, gboolean use_schema, GConfValueType type );
static gboolean sync_gconf( GConfClient *gconf, gchar **message );
......@@ -279,6 +280,60 @@ na_gconf_utils_get_string_list_from_entries( GSList *entries, const gchar *entry
return( found );
}
/**
* na_gconf_utils_dump_entries:
* @list: a list of #GConfEntry as returned by na_gconf_utils_get_entries().
*
* Dumps the content of the entries.
*/
void
na_gconf_utils_dump_entries( GSList *list )
{
g_slist_foreach( list, ( GFunc ) dump_entry, NULL );
}
static void
dump_entry( GConfEntry *entry, void *user_data )
{
static const gchar *thisfn = "na_gconf_utils_dump_entry";
gchar *key = g_path_get_basename( gconf_entry_get_key( entry ));
GConfValue *value = gconf_entry_get_value( entry );
gchar *str;
gboolean str_free = FALSE;
switch( value->type ){
case GCONF_VALUE_STRING:
str = ( gchar * ) gconf_value_get_string( value );
break;
case GCONF_VALUE_INT:
str = g_strdup_printf( "%d", gconf_value_get_int( value ));
str_free = TRUE;
break;
case GCONF_VALUE_FLOAT:
str = g_strdup_printf( "%f", gconf_value_get_float( value ));
str_free = TRUE;
break;
case GCONF_VALUE_BOOL:
str = g_strdup_printf( "%s", gconf_value_get_bool( value ) ? "True":"False" );
str_free = TRUE;
break;
default:
str = g_strdup( "(undetermined value)" );
str_free = TRUE;
}
g_debug( "%s: key=%s, value=%s", thisfn, key, str );
if( str_free ){
g_free( str );
}
g_free( key );
}
/**
* na_gconf_utils_free_entries:
* @list: a list of #GConfEntry as returned by na_gconf_utils_get_entries().
......
......@@ -149,6 +149,7 @@ read_item( NagpGConfProvider *provider, const gchar *path, GSList **messages )
data = g_new0( ReaderData, 1 );
data->path = ( gchar * ) path;
data->entries = na_gconf_utils_get_entries( provider->private->gconf, path );
na_gconf_utils_dump_entries( data->entries );
na_ifactory_provider_read_item(
NA_IFACTORY_PROVIDER( provider ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment