int main(int argc, char** argv) { GConfEngine* conf = gconf_engine_get_default(); gchar* config_system_path = gconf_engine_get_string(conf, "/apps/intel_services_manager/11111111-1111-1111-111111111111/System/config_system_path", NULL); gchar* host = gconf_engine_get_string(conf, "/system/http_proxy/host", NULL); gint port = gconf_engine_get_int(conf, "/system/http_proxy/port", NULL); gboolean enabled = gconf_engine_get_bool(conf, "/system/http_proxy/use_http_proxy", NULL); printf("PROXY SETTINGS\n"); printf("config_system_path: %s\n", config_system_path ? config_system_path : ""); printf("host : %s\n", host ? host : ""); printf("port : %i\n", port); printf("enabled: %i\n", enabled); gconf_engine_unref(conf); return 0; }
void check_int_storage(GConfEngine* conf) { GError* err = NULL; const gchar** keyp = NULL; guint i; /* Loop over keys, storing all values at each then retrieving them */ keyp = keys; while (*keyp) { i = 0; while (i < n_ints) { gint gotten; if (!gconf_engine_set_int(conf, *keyp, ints[i], &err)) { fprintf(stderr, "Failed to set key `%s' to `%d': %s\n", *keyp, ints[i], err->message); g_error_free(err); err = NULL; } else { sync_and_clear(conf); gotten = gconf_engine_get_int(conf, *keyp, &err); if (err != NULL) { check(gotten == 0.0, "0.0 not returned though there was an error"); fprintf(stderr, "Failed to get key `%s': %s\n", *keyp, err->message); g_error_free(err); err = NULL; } else { check (ints[i] == gotten, "int set/get pair: `%d' set, `%d' got", ints[i], gotten); } } ++i; } ++keyp; } /* Now invert the loop and see if that causes problems */ i = 0; while (i < n_ints) { keyp = keys; while (*keyp) { gint gotten; if (!gconf_engine_set_int(conf, *keyp, ints[i], &err)) { fprintf(stderr, "Failed to set key `%s' to `%d': %s\n", *keyp, ints[i], err->message); g_error_free(err); err = NULL; } else { sync_and_clear(conf); gotten = gconf_engine_get_int(conf, *keyp, &err); if (err != NULL) { check(gotten == 0, "0 not returned though there was an error"); fprintf(stderr, "Failed to get key `%s': %s\n", *keyp, err->message); g_error_free(err); err = NULL; } else { check (ints[i] == gotten, "int set/get pair: `%d' set, `%d' got", ints[i], gotten); } } ++keyp; } ++i; } check_unset(conf); }