show.c File Reference

#include <glib.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gconf/gconf-client.h>
#include "log.h"
#include "erconftool.h"
Include dependency graph for show.c:

Go to the source code of this file.

Defines

#define UNUSED(x)   (void)(x)

Functions

static void dump_dir (GConfClient *client, const char *path)
void dump_entries (GConfClient *client, const char *path)
void show_key (GConfClient *client, const char *key)
void show_registry (GConfClient *client, const char **paths)
 Print all entries in and under given path, recursively.
void show_entry (GConfClient *client, GConfEntry *entry)
 Print a single entries.

Define Documentation

#define UNUSED (  )     (void)(x)

Copyright (C) 2008 iRex Technologies B.V. All rights reserved.

Definition at line 45 of file show.c.


Function Documentation

static void dump_dir ( GConfClient *  client,
const char *  path 
) [static]

Definition at line 208 of file show.c.

References dump_entries().

Referenced by show_registry().

00209 {
00210     GSList *tmp = gconf_client_all_dirs(client, path, NULL);
00211 
00212     dump_entries(client,path);
00213 
00214     // resursively dump all directories below
00215     while (tmp!=NULL) 
00216     {
00217         dump_dir(client, (char*) tmp->data);
00218         tmp=tmp->next; 
00219     }
00220 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dump_entries ( GConfClient *  client,
const char *  path 
)

Definition at line 197 of file show.c.

References show_entry().

Referenced by dump_dir().

00198 {
00199     GSList *entries = gconf_client_all_entries(client, (char*) path, NULL);
00200     while (entries!=NULL)
00201     {
00202         show_entry(client, (GConfEntry*) entries->data);
00203         entries=entries->next;
00204     }   
00205 }    

Here is the call graph for this function:

Here is the caller graph for this function:

void show_entry ( GConfClient *  client,
GConfEntry *  entry 
)

Print a single entries.

---------------------------------------------------------------------------

Name : show_entry

Parameters:
client GConf client handle
entry GConf entry
Returns:
--

--------------------------------------------------------------------------

Definition at line 84 of file show.c.

References UNUSED.

Referenced by dump_entries(), export_gconf_entry(), key_changed_callback(), and show_key().

00085 {
00086     UNUSED(client);
00087     GConfValue *value = gconf_entry_get_value(entry);
00088     gboolean is_default = gconf_entry_get_is_default(entry);
00089     gboolean is_writable = gconf_entry_get_is_writable(entry);
00090 
00091     g_print("Key %s\t", entry->key);
00092 
00093     if (value) 
00094     {
00095         g_print("%s%s", (is_default ? " DEFAULT" : ""), (is_writable ? " WRITABLE" : ""));
00096 
00097         switch (value->type) 
00098         {
00099         case GCONF_VALUE_STRING: 
00100             g_print(" STRING\t`%s`", gconf_value_get_string(value));
00101             break;
00102         
00103         case GCONF_VALUE_INT:
00104             g_print(" INT\t %d", gconf_value_get_int(value));
00105             break;      
00106         
00107         case GCONF_VALUE_FLOAT:
00108             g_print(" FLOAT\t %f", gconf_value_get_float(value));
00109             break;            
00110         
00111         case GCONF_VALUE_BOOL:
00112             g_print(" BOOL\t %s", (gconf_value_get_bool(value) ? "true" : "false"));
00113             break;            
00114         
00115         case GCONF_VALUE_SCHEMA:
00116             g_print(" SCHEMA (data not shown for this type)");
00117             break;            
00118         
00119         case GCONF_VALUE_LIST:
00120             {
00121                 g_print(" LIST of ");
00122                 GSList *valuelist = gconf_value_get_list(value);
00123                 gsize len = g_slist_length(valuelist);
00124                 
00125                 switch (gconf_value_get_list_type(value))
00126                 {
00127                 case GCONF_VALUE_STRING:
00128                     g_print("%d STRINGS\t", len);
00129                     while (valuelist!=NULL) 
00130                     {
00131                         g_print("%s;", gconf_value_get_string(valuelist->data));
00132                         valuelist=valuelist->next; 
00133                     }
00134                     break;
00135                             
00136                 case GCONF_VALUE_INT:
00137                     g_print("%d INTS\t", len);
00138                     while (valuelist!=NULL) 
00139                     {
00140                         g_print("%d;", gconf_value_get_int(valuelist->data));
00141                         valuelist=valuelist->next; 
00142                     }
00143                     break;
00144                             
00145                 case GCONF_VALUE_FLOAT:
00146                     g_print("%d FLOATS\t", len);
00147                     while (valuelist!=NULL) 
00148                     {
00149                         g_print("%f;", gconf_value_get_float(valuelist->data));
00150                         valuelist=valuelist->next; 
00151                     }
00152                     break;
00153                             
00154                 case GCONF_VALUE_BOOL:
00155                     g_print("%d BOOLS\t", len);
00156                     while (valuelist!=NULL) 
00157                     {
00158                         g_print("%s;", (gconf_value_get_bool(valuelist->data) ? "true" : "false"));
00159                         valuelist=valuelist->next; 
00160                     }
00161                     break;
00162                             
00163                 default:
00164                     g_print("Unsupported data type %d\n", value->type);
00165                     break;
00166                 }
00167                 
00168                 g_slist_free(valuelist);
00169             }
00170             break;   
00171         
00172         case GCONF_VALUE_PAIR:
00173             g_print(" PAIR (data not shown for this type)");
00174             break;            
00175         
00176         case GCONF_VALUE_INVALID:
00177         default:
00178             g_print(" has invalid type");
00179             break;
00180         }
00181     }
00182     else
00183     {
00184       g_print(" has invalid type");
00185     } 
00186 
00187     g_print("\n");
00188 }

Here is the caller graph for this function:

void show_key ( GConfClient *  client,
const char *  key 
)

Definition at line 191 of file show.c.

References show_entry().

00192 { 
00193     show_entry(client, gconf_client_get_entry(client, key, NULL, TRUE, NULL));   
00194 }

Here is the call graph for this function:

void show_registry ( GConfClient *  client,
const char **  paths 
)

Print all entries in and under given path, recursively.

File Name : show.h

Description: Copyright (C) 2008 iRex Technologies B.V. All rights reserved.---------------------------------------------------------------------------

Name : show_registry

Parameters:
client GConf client handle
paths Array of paths
Returns:
--

--------------------------------------------------------------------------

Definition at line 76 of file show.c.

References dump_dir().

Referenced by main().

00077 {
00078     gint i;
00079     for (i = 0; paths[i]; i++)
00080         dump_dir(client, paths[i]);
00081 }

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  doxygen 1.6.2-20100208