/* copyright 	Maher Awamy <muhri@muhri.net>		*
 *		Charlie Schmidt <ishamael@themes.org>	*
 *							*
 *  released under the GPL				*/

#include "skipstone.h"



GSList *window_count = NULL; /* open windows count, starts at 1 logically */
ConfigData config;
GList *combo_urls = NULL;
GList *bookmarks = NULL;


gint
main (gint argc,gchar *argv[]) 
{
	gchar *home;
	gchar *dir;
     	check_running(argv[1]); /* do we have another process - check if its alive */
	set_running();   /* if we are back here means we are starting a new one */ 		
	home = getenv("HOME");
	dir = g_strconcat(home,"/.skipstone",NULL);
	/* this is fine, as it will silently error if it already exists*/
	mkdir(dir,0755);
	g_free(dir);
	signal(SIGUSR1, handle_usr1_signal); /* connect the signal to launch new windows if running */
	read_urls();
	read_config();
	read_bookmarks();

	gtk_init(&argc,&argv);

	if (argc > 1) { /* there is an argument, pass it as a loaded url */
		make_window(argv[1]);
	} else {
		make_window(NULL);
	}

	gtk_main();
	return 0;
}

