r23: Added code to detect and display mount points in /etc/fstab.
[rox-filer.git] / ROX-Filer / src / main.c
blob14dd4a992917035265b7ba509ee92b450f023dc2
1 /* vi: set cindent:
2 * $Id$
4 * ROX-Filer, filer for the ROX desktop project
5 * By Thomas Leonard, <tal197@ecs.soton.ac.uk>.
6 */
8 #include <stdlib.h>
9 #include <signal.h>
10 #include <sys/wait.h>
12 #include <gtk/gtk.h>
13 #include <collection.h>
15 #include "filer.h"
16 #include "mount.h"
17 #include "menu.h"
18 #include "dnd.h"
20 static void child_died(int signum)
22 int status;
23 int child;
24 FilerWindow *filer_window;
26 /* Find out which children exited. This also has the effect of
27 * allowing the children to die.
31 child = waitpid(-1, &status, WNOHANG | WUNTRACED);
33 if (child == 0 || child == -1)
34 return;
36 filer_window = g_hash_table_lookup(child_to_filer,
37 (gpointer) child);
38 if (filer_window)
39 scan_dir(filer_window);
41 if (!WIFSTOPPED(status))
42 g_hash_table_remove(child_to_filer,
43 (gpointer) child);
45 } while (1);
48 int main(int argc, char **argv)
50 gtk_init(&argc, &argv);
52 menu_init();
53 dnd_init();
54 filer_init();
55 mount_init();
57 signal(SIGCHLD, child_died);
59 if (argc < 2)
60 filer_opendir(getenv("HOME"));
61 else
63 int i;
64 for (i = 1; i < argc; i++)
65 filer_opendir(argv[i]);
68 gtk_main();
70 return EXIT_SUCCESS;