#include <glib.h>
Go to the source code of this file.
Functions | |
G_BEGIN_DECLS void | import_registry (GConfClient *client, const char *filename, const char **paths) |
Import all entries in and under given path from INI file. |
G_BEGIN_DECLS void import_registry | ( | GConfClient * | client, | |
const char * | filename, | |||
const char ** | paths | |||
) |
Import all entries in and under given path from INI file.
Description: Copyright (C) 2008 iRex Technologies B.V. All rights reserved.---------------------------------------------------------------------------
Name : import_registry
client | GConf client handle | |
filename | Fully qualified name of config file | |
paths | Array of paths |
--------------------------------------------------------------------------
Definition at line 73 of file import.c.
References import_update_key(), and INI_GROUP_REGISTRY.
Referenced by main().
00074 { 00075 GKeyFile *key_file = NULL; 00076 GError *error = NULL; 00077 gsize length = -1; 00078 char **keys = NULL; 00079 00080 key_file = g_key_file_new(); 00081 g_key_file_load_from_file(key_file, filename, G_KEY_FILE_NONE, &error); 00082 if (error != NULL) 00083 { 00084 g_print("Error loading file: %s\n", error->message); 00085 g_key_file_free(key_file); 00086 g_error_free(error); 00087 return; 00088 } 00089 00090 // read and import registry group 00091 // 00092 keys = g_key_file_get_keys(key_file, INI_GROUP_REGISTRY, &length, &error); 00093 if (error != NULL) 00094 { 00095 g_print("Error loading registry settings: %s\n", error->message); 00096 g_error_free(error); 00097 g_key_file_free(key_file); 00098 return; 00099 } 00100 00101 guint i = 0; 00102 for (i=0; i<length; i++) 00103 { 00104 gint j; 00105 for (j = 0; paths[j]; j++) 00106 { 00107 if (strstr(keys[i], paths[j])) 00108 { 00109 // TODO: make these exceptions implicit through the namespace 00110 if (strstr(keys[i], "list_locales") || strstr(keys[i], "list_languages")) 00111 { 00112 // don't import these keys 00113 } 00114 else 00115 { 00116 import_update_key((GConfClient*) client, key_file, INI_GROUP_REGISTRY, keys[i]); 00117 } 00118 } 00119 } 00120 } 00121 00122 // read and import pointercal 00123 #if 0 // disabled see PR3439 00124 import_pointercal(key_file); 00125 #endif 00126 00127 // free memory 00128 g_strfreev(keys); 00129 g_key_file_free(key_file); 00130 }