diff options
author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2007-01-19 16:20:51 +0000 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2007-01-19 16:20:51 +0000 |
commit | c19e93f76ccd2d86a75acdafa4702339fed014a0 (patch) | |
tree | 4da2697bd2df2066e20813bb93485ebea340ae51 /hardinfo2/benchmark.c | |
parent | 731fe831d99a672dc078d248b953f0ee8a5b202b (diff) |
SyncManager finally working... we need to cleanup the code now :(
Diffstat (limited to 'hardinfo2/benchmark.c')
-rw-r--r-- | hardinfo2/benchmark.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/hardinfo2/benchmark.c b/hardinfo2/benchmark.c index 4d4d347c..d16c1388 100644 --- a/hardinfo2/benchmark.c +++ b/hardinfo2/benchmark.c @@ -62,23 +62,38 @@ static gchar *__benchmark_include_results(gchar * results, { GKeyFile *conf; gchar **machines; + gchar *path; int i; conf = g_key_file_new(); - g_key_file_load_from_file(conf, - idle_free(g_build_filename(params.path_data, "benchmark.conf", NULL)), - 0, NULL); + + path = g_build_filename(params.path_data, "benchmark.conf", NULL); + g_key_file_load_from_file(conf, path, 0, NULL); + + machines = g_key_file_get_keys(conf, benchmark, NULL, NULL); + for (i = 0; machines && machines[i]; i++) { + gchar *value = g_key_file_get_value(conf, benchmark, machines[i], NULL); + results = g_strconcat(results, machines[i], "=", value, "\n", NULL); + g_free(value); + } + + g_strfreev(machines); + g_free(path); + g_key_file_free(conf); + + conf = g_key_file_new(); + path = g_build_filename(g_get_home_dir(), ".hardinfo", "benchmark.conf", NULL); + g_key_file_load_from_file(conf, path, 0, NULL); machines = g_key_file_get_keys(conf, benchmark, NULL, NULL); for (i = 0; machines && machines[i]; i++) { - gchar *value = - g_key_file_get_value(conf, benchmark, machines[i], NULL); - results = - g_strconcat(results, machines[i], "=", value, "\n", NULL); + gchar *value = g_key_file_get_value(conf, benchmark, machines[i], NULL); + results = g_strconcat(results, machines[i], "=", value, "\n", NULL); g_free(value); } g_strfreev(machines); + g_free(path); g_key_file_free(conf); return g_strdup_printf("[$ShellParam$]\n" @@ -281,7 +296,7 @@ hi_module_init(void) { .fancy_name = "Benchmark results", .name = "BenchmarkResults", - .save_to = "benchmarks.conf", + .save_to = "benchmark.conf", .get_data = get_benchmark_results } }; |