#include <gtk/gtk.h>
/* gcc -o $main $main.c $(pkg-config gtk+-2.0 --cflags) $(pkg-config gtk+-2.0 --libs)*/
#include "../latexs/latex_prefs.c"
#include "getit.c"
#include "../calls/prog_ext.c"
//#include "version.h"   <--------- inutil c dans defs. ligne  34.1
/**--------------------------  pour window parent ------------------------ **/
/* Déclaration en global. Comme on peut le voir pas de déclaration autre!*/
/***------------------------ ------------------------ ------------------------------------- **/
/* Les fonctions qui permettent la gestion des widget en fct d'un nom         */
/***------------------------ ------------------------ ------------------------------------- **/
/***----------- ---------------  END pour window parent  *----------- ---------------***/
/*
static void about_uri_clicked(GtkButton *button, gpointer data)
{
    //	open_uri(HOMEPAGE_URI, prefs_common.uri_cmd);
     system (LAUNCH_CMD HOMEPAGE_URI);
}
*/
/**......................... defini dans configure.c .........
static gboolean
activate_link (GtkWidget   *label,
               const gchar *uri,
               gpointer     data)
{
  if (g_strcmp0 (uri, "keynav") == 0)
    {
      GtkWidget *dialog;
      GtkWidget *parent;

      parent = gtk_widget_get_toplevel (label);
      dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent),
                 GTK_DIALOG_DESTROY_WITH_PARENT,
                 GTK_MESSAGE_INFO,
                 GTK_BUTTONS_OK,
                 HOMEPAGE_URI);

      gtk_window_present (GTK_WINDOW (dialog));
      g_signal_connect (dialog, "response", (GCallback)response_cb, NULL);

      return TRUE;
    }

  return FALSE;
}
*/
/**----------- --------------- insert_link----------- ---------------***/
/**----------- --------------- END  insert_link-------------- ---------------**/
static void create_conf(void)
{
	//GtkWidget *window;
	  if (!window)
    {
	GtkWidget *vbox;
//	GtkWidget *pixmap;
//        GdkBitmap *stipple;
	GtkWidget *label;
//	GtkWidget *scrolledwin;
//	GtkWidget *text;
//	GtkWidget *confirm_area;
//	GtkWidget *ok_button;
//	GtkTextBuffer *buffer;
//	GtkTextIter iter;
//	GtkStyle *style;
//	GdkColormap *cmap;
//	GdkColor uri_color[2] = {{0, 0, 0, 0xffff}, {0, 0xffff, 0, 0}};
//	gboolean success[2];
/*
#if HAVE_SYS_UTSNAME_H
	struct utsname utsbuf;
#endif
	gchar buf[1024];
	*/
//	gint i;
	  GSList *list= NULL;
	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	GtkWidget *Window_parent;
	Window_parent=(GtkWidget*)gtk_data_list_get_by_name(list, "main_window"); // <-------------*/
  //Window_parent=(GtkWidget*)gtk_data_list_get_by_name(list, "»» I ♥  g.u.i.T.e.X ««");
    gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(Window_parent));  /*<------------- */
    gtk_window_set_title (GTK_WINDOW (window), "»» I '♥''♥'♥...  A.r.a.b.T.e.X ««");
	gtk_container_set_border_width(GTK_CONTAINER(window), 10);
	gtk_widget_set_size_request(window, 1000, 560);
	gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER_ALWAYS);
    gtk_window_set_icon_name (GTK_WINDOW (window), SELIMB/*selim2.png"*/);
    gtk_window_set_default_icon_name(SELIMB/*selim2.png"*/);
    gtk_window_set_icon_from_file(GTK_WINDOW(window), SELIMB/*selim2.png"*/, NULL);
	g_signal_connect(G_OBJECT(window), "delete_event",
			 G_CALLBACK(gtk_widget_hide_on_delete), NULL);
	g_signal_connect(G_OBJECT(window), "key_press_event",
			 G_CALLBACK(key_pressed), NULL);    /** voir "gboolean  key_pressed" dans action.c ligne 351 en bas*/
	gtk_widget_realize(window);
	/**...............................  H E A D E R   B A R ..........................................*/
/* gboolean   rtl;
        rtl = gtk_widget_get_direction (window) == GTK_TEXT_DIR_RTL;
*/
        /* HeaderBar */
        GtkWidget *header_bar = gtk_header_bar_new ();
        gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header_bar), TRUE);
        gtk_style_context_add_class (gtk_widget_get_style_context (header_bar), "titlebar");
        gtk_header_bar_set_title (GTK_HEADER_BAR (header_bar), "Configure ArabTeX");
        gtk_window_set_titlebar (GTK_WINDOW (window), header_bar);
                /* Entry */
        GtkWidget *entry = gtk_entry_new ();
        gtk_widget_set_vexpand (entry, TRUE); /* It does nothing! */
        g_object_set (entry, "expand", TRUE, NULL); /* It also does nothing */
        gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), entry);
        /* Separator */
        /*   c fait par defaut
        GtkWidget *separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
        gtk_widget_set_valign (separator, GTK_ALIGN_FILL);
        gtk_header_bar_pack_end (GTK_HEADER_BAR (header_bar), separator);*/
        //show_header_bar() ;
/**........................................... H E A D E R      B A R     E N D   ................................*/
	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
    gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
	gtk_container_add(GTK_CONTAINER(window), vbox);
///////////////////////////////////////////////////////////////////////////////////////////////////
    GtkWidget *p_notebook = NULL;
    p_notebook = gtk_notebook_new ();
    gtk_box_pack_start(GTK_BOX(vbox), p_notebook, TRUE, TRUE, 0);
    //gtk_container_add (GTK_CONTAINER (frame), p_notebook);
    gtk_notebook_set_show_tabs(GTK_NOTEBOOK(p_notebook), TRUE);
    //gtk_notebook_set_tab_pos (p_notebook, GTK_POS_BOTTOM);
 //   gtk_notebook_set_show_border (GTK_NOTEBOOK (p_notebook), FALSE);  // <---- inutile

   label = gtk_label_new (NULL);
   gtk_label_set_markup (GTK_LABEL (label), "<span weight=\"bold\" font_desc=\"Sans 10\"   ><small>Build</small></span>");      /* foreground=\"PapayaWhip\" */
   gtk_widget_show(label);
   GtkWidget *page = show_cmds();   /** <---  "show_cmds "   ...  c  dans latex_prefs.c ... ligne 226*/
  // g_signal_connect(page, "activate", G_CALLBACK(create_term), NULL);
   gtk_notebook_append_page(GTK_NOTEBOOK(p_notebook), page, label);

    label = gtk_label_new (NULL);
    gtk_label_set_markup (GTK_LABEL (label), "<span weight=\"bold\" font_desc=\"Sans 10\" ><small>QuickBuild</small></span>");/*\"PapayaWhip\"*/

   gtk_widget_show(label);
   page = show_quick();
   gtk_notebook_append_page(GTK_NOTEBOOK(p_notebook), page, label);

   label = gtk_label_new (NULL);
   gtk_label_set_markup (GTK_LABEL (label), "<span weight=\"bold\" font_desc=\"Sans 10\"   ><small>Terminal</small></span>");/*\"PapayaWhip\"*/
   gtk_widget_show(label);
   page = show_word();
   gtk_notebook_append_page(GTK_NOTEBOOK(p_notebook), page, label);

   label = gtk_label_new (NULL);
   gtk_label_set_markup (GTK_LABEL (label), "<span weight=\"bold\" font_desc=\"Sans 10\"   ><small>Get it !!..</small></span>");/*\"PapayaWhip\"*/
   gtk_widget_show(label);
   page = show_getit();
   gtk_notebook_append_page(GTK_NOTEBOOK(p_notebook), page, label);
/////////////////////////////////////////////////////////////////////////////////////////////
/**	gtk_widget_grab_default(ok_button);
	gtk_widget_grab_focus(ok_button);/
	g_signal_connect_closure (G_OBJECT(ok_button), "clicked",g_cclosure_new_swap(G_CALLBACK(gtk_widget_hide_on_delete),window, NULL), FALSE);*/
/*GDK_DISPLAY_XDISPLAY(display);*/
    }

  if (!gtk_widget_get_visible (window))
    {
      gtk_widget_show_all (window);
      	// On supprime la liste avant de quitter
	/*gtk_data_list_remove_all(liste2);    <---------------  */
    }
  else
    {
      gtk_widget_destroy (window);
      window = NULL;
    }

//	gtk_widget_show_all(window);

}

/****----------------------------***/
void show_config(void)
{
	if (!window)
		create_conf();
	else
		gtk_window_present(GTK_WINDOW(window));
}
/*int main(int argc, char *argv[])
{

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

  about_show();

  gtk_main ();

 return (EXIT_SUCCESS);
}*/

