#include <gtk/gtk.h>

void act(GtkWidget *widget, gpointer *data){
   g_print((gchar *)data);
}

void
gtk_combo_box_set_popdown_strings (GtkComboBoxText * combo, GList * string)
{
  gtk_combo_box_text_remove_all (combo);
  while (string != NULL)
    {
      gtk_combo_box_text_append_text (combo, string->data);
      string = string->next;
    }
}

GtkWidget *show_getit(void)
{
   GtkWidget *page , *vbox, *hbox,  *button , *frame, *label , *pixmap;

   page = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
   gtk_container_set_border_width(GTK_CONTAINER(page), 0);
       //connect our window destroy signal.
    g_signal_connect(page, "destroy", gtk_main_quit, NULL);

	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
    gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
	gtk_container_add(GTK_CONTAINER(page), vbox);

   // char * str = "<sub>Ten</sub> <tt>tekst</tt> <span underline='error'>został</span> <span font='20'>napisany</span> "
   // "<span bgcolor='#f00'>różnymi</span> <b><i>stylami</i></b>.";
    char * str = "<span font='30'  foreground=\"MidnightBlue\"><i>A . R . A . B . T. <sub>E</sub>. X \n      .. ُ محرر تخ  ..</i></span> " ;
     label = gtk_label_new (NULL);
     //gtk_label_set_markup (GTK_LABEL (label), "<span size=\"15\" foreground=\"MidnightBlue\"><i> A . R . A . B . T. E. X </i></span>");

     gtk_label_set_markup( GTK_LABEL(label ), str );
     //gtk_label_set_selectable(GTK_LABEL(label), TRUE);
     gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
     //gtk_container_add(GTK_CONTAINER(frame), label);
     frame=gtk_frame_new(NULL);
//     gtk_widget_set_usize(frame, 200, 50);
//     gtk_container_border_width(GTK_CONTAINER(frame), 5);
     gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
     gtk_container_add(GTK_CONTAINER(vbox), frame);
     pixmap = gtk_image_new_from_file(LIONTEX /*selim2.png"*/);
	/*pixmap = stock_pixbuf_widget(window, STOCK_PIXMAP_EDITEX_LOGO);*/
   /* GdkPixbuf *pixbuf = NULL;
    pixbuf = gdk_pixbuf_new_from_file ("./pixmaps/lion.png", NULL);
    GdkPixbuf *scaled = gdk_pixbuf_scale_simple (pixbuf, 500, 250, GDK_INTERP_BILINEAR);
    g_object_unref (pixbuf);
    pixbuf = scaled;*/
	//gtk_box_pack_start(GTK_BOX(vbox), pixmap, FALSE, FALSE, 0);
    gtk_container_add(GTK_CONTAINER(frame), pixmap);

    GtkWidget *separator=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL );
    gtk_container_add(GTK_CONTAINER(vbox), separator);

    label = gtk_label_new(VERSION);
	gtk_label_set_selectable(GTK_LABEL(label), TRUE);
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
/**...............................  GTK / Glib /S Y S T E Ms..............................*/
	gchar buf[1024];
#if HAVE_SYS_UTSNAME_H
	//uname(&utsbuf);
	g_snprintf(buf, sizeof(buf),
		   "GTK+ %d.%d.%d / GLib %d.%d.%d\n"
		   "Operating System: %s ",
		   gtk_major_version, gtk_minor_version, gtk_micro_version,
		   glib_major_version, glib_minor_version, glib_micro_version,
		   "Win32"); // utsbuf.sysname, utsbuf.release, utsbuf.machine);
#elif defined(G_OS_UNIX)
	uname(&utsbuf);
#elif defined(G_OS_WIN32)
	uname(&utsbuf);
	g_snprintf(buf, sizeof(buf),
		   "GTK+ %d.%d.%d / GLib %d.%d.%d\n"
		   "Operating System: %s ",
		   gtk_major_version, gtk_minor_version, gtk_micro_version,
		   glib_major_version, glib_minor_version, glib_micro_version,
		   "Win32");
#else
	//uname(&utsbuf);
	g_snprintf(buf, sizeof(buf),
		   "GTK+ %d.%d.%d / GLib %d.%d.%d\n"
		   "Operating System: unknown",
		   gtk_major_version, gtk_minor_version, gtk_micro_version,
		   glib_major_version, glib_minor_version, glib_micro_version);
#endif
	label = gtk_label_new(buf);
	gtk_label_set_selectable(GTK_LABEL(label), TRUE);
	gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);

	g_snprintf(buf, sizeof(buf),
            "Kernel System:%s ",
            "?"); //utsbuf.release);
	label = gtk_label_new(buf);
	gtk_label_set_selectable(GTK_LABEL(label), TRUE);
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
/**............................... END  GTK / Glib /S Y S T E M..............................*/

	hbox = gtk_box_new(FALSE, 0);
	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

	button = gtk_button_new_with_label(" "HOMEPAGE_URI" ");
	gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, FALSE, 0);
	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
	g_signal_connect(G_OBJECT(button), "clicked",
			 G_CALLBACK(about_uri_clicked), NULL);
/////////////////////////////////////////
     frame = gtk_frame_new ("Web");     //<----- voir     "color.c "  ligne 7.24
   //  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
//     gtk_widget_set_usize(frame, 200, 50);
//     gtk_container_border_width(GTK_CONTAINER(frame), 5);
     gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
//     gtk_widget_set_usize(frame, 200, 50);
    // gtk_container_border_width(GTK_CONTAINER(frame), 5);
      gtk_box_pack_start (GTK_BOX(vbox), frame, TRUE, TRUE, 0);

      label = gtk_label_new ("See  <a href=\"http://s.bouras.free.fr/arabtex\""
                             "title=\"Get it !!..\"><small>arabtex</small></a> . \n"
                             "Or search on <a href=\"http://www.google.com/\">"
                             "<span color=\"#0266C8\">G</span><span color=\"#F90101\">o</span>"
                             "<span color=\"#F2B50F\">o</span><span color=\"#0266C8\">g</span>"
                             "<span color=\"#00933B\">l</span><span color=\"#F90101\">e</span>"
                             "</a>.");
      gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
      g_signal_connect (label, "activate-link", (GCallback)activate_link, NULL);
      gtk_container_add (GTK_CONTAINER (frame), label);
     // gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
    label = gtk_label_new (NULL);
    gtk_label_set_markup (GTK_LABEL (label), "<span foreground=\"MidnightBlue\"><i><small>" COPYRIGHT "</small></i></span>");
                                                            //#5C7FA5 <----blue grise    orange--->#FAB422
    //   gtk_label_set_markup (GTK_LABEL (label), "   <span foreground=\"#FAB422\"><i>copyright (c) :    2007-2014 .\n  »» sèlim,b.  سَلِــبم   ُبوراس ««</i></span>   ");
                                                          /*\"PapayaWhip\"*/
                                                          /*	label = gtk_label_new
		("Copyright (c) 2007-2010 Sèlim,B. سَليم  ُبوراس ");*/
	gtk_label_set_selectable(GTK_LABEL(label), TRUE);
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);

   	label = gtk_label_new (NULL);
    gtk_label_set_markup (GTK_LABEL (label), "»» <span foreground=\"MidnightBlue\"><small>s.bouras@free.fr</small></span> ««  ");
                                                                  //PapayaWhip	gtk_label_set_selectable(GTK_LABEL(label), TRUE);
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);

      gtk_widget_show (label);
      gtk_widget_show (frame);
///////////////////////////////////
    /* Creates a check button */
    button=gtk_check_button_new_with_label("state1/2");
     gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
    g_signal_connect (button, "toggled",
                      (GCallback)togg,
                     (gpointer *)button);
    gtk_widget_show(button);
/////////////////////////////////////////
/*
   GtkWidget *combo;

   GtkWidget *box;
   GList *list=NULL;

   list=g_list_append(list,"Slackware");
   list=g_list_append(list,"RedHat");
   list=g_list_append(list,"SuSE");
// Create a new horizontal box
   box=gtk_box_new(1,0);
   gtk_container_add(GTK_CONTAINER(vbox),box);

   // Creates a combo box

   combo = gtk_combo_box_new();
   // Sets the list
   gtk_combo_box_set_popdown_strings(GTK_COMBO_BOX(combo),list);

   // Enables up/down keys change the value.
//   gtk_combo_box_set_use_arrows_always(GTK_COMBO_BOX(combo),1);

   gtk_box_pack_start(GTK_BOX(box), combo,1,1,1);

   button=gtk_button_new_with_label("Write it");


   g_signal_connect (button,"clicked",
                     (GCallback)act,
                     gtk_entry_get_text(GTK_ENTRY(GTK_COMBO_BOX(combo))));
   gtk_box_pack_start(GTK_BOX(box), button,1,1,1);

   gtk_widget_show(box);
   gtk_widget_show(combo);
   gtk_widget_show(button);
*/




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

   return page;
}


