/*
 * Initial main.c file generated by Glade. Edit as required.
 * Glade will not overwrite this file.
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gtk/gtk.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

#include "interface.h"
#include "support.h"

int
main (int argc, char *argv[])
{
  GtkWidget *window_main;

#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);

  add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps");

  /*
   * The following code was added by Glade to create one of each component
   * (except popup menus), just so that you see something after building
   * the project. Delete any components that you don't want shown initially.
   */

   // root check
   if (!getenv("USER") || strncmp( getenv("USER"), "root", 4 ) != 0 ) {
     printf("only root can do this\n");
     GtkWidget* dialog_no_root = create_dialog_no_root ();
     gtk_widget_show (dialog_no_root);
   }
   else {
	if (!getenv("FLL_FIRMWARE")) {

		printf("getenv FLL_FIRMWARE isn't defined\nPlease start with install-gui.bash !!!\n");

		GtkWidget* dialog_no_bash = create_dialog_no_bash ();
		gtk_widget_show (dialog_no_bash);
	}
	else {
		window_main = create_window_main ();
		gtk_widget_show (window_main);
	}
   }

   gtk_main ();

   return 0;

}

