diff options
Diffstat (limited to 'src/gui-gtk/main.c')
-rw-r--r-- | src/gui-gtk/main.c | 60 |
1 files changed, 18 insertions, 42 deletions
diff --git a/src/gui-gtk/main.c b/src/gui-gtk/main.c index 66fee821..dfb3b04d 100644 --- a/src/gui-gtk/main.c +++ b/src/gui-gtk/main.c @@ -1,61 +1,37 @@ #include <gtk/gtk.h> - #include "abrtlib.h" #include "abrt-gtk.h" - - int main(int argc, char **argv) { /* I18n */ setlocale(LC_ALL, ""); - char *path = "."; - //int optflags = 0; - int opt; - while ((opt = getopt(argc, argv, "c:d:v")) != -1) + gtk_init(&argc, &argv); + + GtkWidget *main_window = main_window_create(); + + const char *default_dirs[] = { + "/var/spool/abrt", + NULL, + NULL, + }; + argv++; + if (!argv[0]) { - switch (opt) - { - case 'c': - VERB1 log("Loading settings from '%s'", optarg); - //load_conf_file(optarg, settings, /*skip key w/o values:*/ true); - VERB3 log("Loaded '%s'", optarg); - break; - case 'd': - path = optarg; - break; - case 'v': - g_verbose++; - break; - default: - /* Careful: the string below contains tabs, dont replace with spaces */ - error_msg_and_die( - "Usage: abrt-gtk -c CONFFILE -d DIR [-v]" - "\n" - "\nReport a crash to Bugzilla" - "\n" - "\nOptions:" - "\n -c FILE Configuration file (may be given many times)" - "\n -d DIR Crash dump directory" - "\n -v Verbose" - "\n -s Log to syslog" - ); - } + char *home = getenv("HOME"); + if (home) + default_dirs[1] = concat_path_file(home, ".abrt/spool"); + argv = (char**)default_dirs; } + while (*argv) + dump_list_hydrate(*argv++); - if (argc > 1) - path = argv[1]; - - gtk_init(&argc, &argv); + gtk_widget_show_all(main_window); /* Prevent zombies when we spawn wizard */ signal(SIGCHLD, SIG_IGN); - GtkWidget *main_window = main_window_create(); - dump_list_hydrate(path); - gtk_widget_show_all(main_window); - /* Enter main loop */ gtk_main(); |