diff options
author | Leandro A. F. Pereira <leandro@hardinfo.org> | 2006-11-19 14:52:38 +0000 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2006-11-19 14:52:38 +0000 |
commit | 8708504c28caeee4bd3e95b6b6d739970863f19c (patch) | |
tree | ede48c1cf75ce7c38ffd75a5fd4eba11a0bb1020 /hardinfo2/hardinfo.c | |
parent | f128a3b3f241c7280339a2be8f3e6c18295bb526 (diff) |
Started working on report generation without GUI.
Diffstat (limited to 'hardinfo2/hardinfo.c')
-rw-r--r-- | hardinfo2/hardinfo.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/hardinfo2/hardinfo.c b/hardinfo2/hardinfo.c index 39b3e481..ebf65d9f 100644 --- a/hardinfo2/hardinfo.c +++ b/hardinfo2/hardinfo.c @@ -29,27 +29,49 @@ gchar *path_data = NULL, *path_lib = NULL; gboolean gui_running = FALSE; +ProgramParameters params = { 0 }; + int main(int argc, char **argv) { - gui_running = ui_init(&argc, &argv); + GSList *modules; + + parameters_init(&argc, &argv, ¶ms); - if (!gui_running) { - g_error("Cannot initialize GTK+."); + if (!params.create_report) { + /* we only try to open the UI if the user didn't asked for a + report. */ + gui_running = ui_init(&argc, &argv); + + /* if GTK+ initialization failed, assume the user wants a + report. */ + if (!gui_running) + params.create_report = TRUE; } - if (!binreloc_init(FALSE)) { + if (!binreloc_init(FALSE)) g_error("Failed to find runtime data.\n\n" "\342\200\242 Is HardInfo correctly installed?\n" "\342\200\242 See if %s and %s exists and you have read permision.", PREFIX, LIBPREFIX); - } - icon_cache_init(); - stock_icons_init(); - shell_init(); - - gtk_main(); + modules = modules_load(); + + if (gui_running) { + icon_cache_init(); + stock_icons_init(); + + shell_init(modules); + + gtk_main(); + + g_return_val_if_reached(0); + } else if (params.create_report) { + g_print("creating report...\n"); + + g_return_val_if_reached(0); + } - return 0; + /* should not be reached */ + g_return_val_if_reached(1); } |