
/* gcc -o $main $main.c $(pkg-config gtk+-2.0 --cflags) $(pkg-config gtk+-2.0 --libs)*/


#include <gtk/gtk.h>


//#include "utsname.h"
#include "configure.h"
//#include "menu_pop_up.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);
}
*/

void show_config1(void)
{
	if (!window)
		about_create2();
	else
		gtk_window_present(GTK_WINDOW(window));
}
/**----------- --------------- insert_link----------- ---------------***/
/**----------- --------------- END  insert_link-------------- ---------------**/
static void about_create2(void)
{
	GtkWidget *window;
	GtkWidget *vbox;
	GtkWidget *pixmap;
//        GdkBitmap *stipple;
	GtkWidget *label;
	GtkWidget *hbox;
	GtkWidget *button;
	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 ««");
	/* Création de la fenêtre fille */
    gtk_window_set_title (GTK_WINDOW (window), "......»» About A.r.a.b.T.e.X '♥''♥'♥...   ««......");
	/* Ici j'utilise le GtkWidget de la fenêtre parente récupérer dans la liste.*/
/*	gtk_window_set_transient_for(GTK_WINDOW(window), GTK_WINDOW(Window_parent));  <------------- */
//	gtk_window_set_title(GTK_WINDOW(window), _("About guiTeX ♥ ♥ ♥..."));
	gtk_container_set_border_width(GTK_CONTAINER(window), 1);
	gtk_widget_set_size_request(window, 850, 560);
	gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    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);
    gtk_window_set_screen (GTK_WINDOW (window),
                            gtk_widget_get_screen (window));
	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);

	vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	gtk_container_add(GTK_CONTAINER(window), vbox);

	pixmap = gtk_image_new_from_file(LIONTEX/*selim2.png"*/);
	/*pixmap = stock_pixbuf_widget(window, STOCK_PIXMAP_EDITEX_LOGO);*/
	gtk_box_pack_start(GTK_BOX(vbox), pixmap, FALSE, FALSE, 0);

	label = gtk_label_new(VERSION);
	gtk_label_set_selectable(GTK_LABEL(label), TRUE);
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
/*	label = gtk_label_new
		("Copyright (c) 2007-2010 Sèlim,B. سَليم  ُبوراس ");*/
    label = gtk_label_new (NULL);
    gtk_label_set_markup (GTK_LABEL (label), "   <span foreground=\"#FAB422\"><i>copyright (c) :    2007-2013 .\n  »» sèlim,b.  سَلِــبم   ُبوراس ««</i></span>   ");
                                                           /*\"PapayaWhip\"*/
	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=\"PapayaWhip\">s.bouras@free.fr</span> ««  ");

	gtk_label_set_selectable(GTK_LABEL(label), TRUE);
	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
	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);

	scrolledwin = gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
				       GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwin),
					    GTK_SHADOW_IN);
	gtk_box_pack_start(GTK_BOX(vbox), scrolledwin, TRUE, TRUE, 0);

	text = gtk_text_view_new();
	gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
	gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text), 20);
	gtk_text_view_set_right_margin(GTK_TEXT_VIEW(text), 20);
	gtk_container_add(GTK_CONTAINER(scrolledwin), text);

  buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
  gtk_text_buffer_get_iter_at_offset(buffer, &iter, 0);
/***---------- ------------------------- --------------**/
  GtkTextTag *tag;
  GdkPixbuf *pixbuf;
  GdkPixbuf *scaled;
//  GtkTextChildAnchor *anchor;
//  char *filename;
  pixbuf = gdk_pixbuf_new_from_file (LIONTEX/*selim2.png"*/, NULL);
  scaled = gdk_pixbuf_scale_simple (pixbuf, 40, 40, GDK_INTERP_BILINEAR);
  g_object_unref (pixbuf);
  pixbuf = scaled;
  gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
/***---------- ------------------------- --------------**/
  tag = gtk_text_buffer_create_tag (buffer, NULL,
		                        "foreground", "MidnightBlue",
					"weight", PANGO_WEIGHT_BOLD,
					"style", PANGO_STYLE_ITALIC,
					NULL);
  gtk_text_buffer_insert_with_tags (buffer, &iter, "\nNOTE:\n", -1, tag, NULL);
  gtk_text_buffer_insert_with_tags (buffer, &iter," السَّلام عليكُم:\n", -1, tag, NULL);
/***---------- ------------------------- --------------**/
/**gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "\331\210\331\202\330\257 \330\250\330\257\330\243 \330\253\331\204\330\247\330\253 \331\205\331\206 \330\243\331\203\330\253\330\261 \330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 \330\252\331\202\330\257\331\205\330\247 \331\201\331\212 \330\264\330\250\331\203\330\251 \330\247\331\203\330\263\331\212\331\210\331\206 \330\250\330\261\330\247\331\205\330\254\331\207\330\247 \331\203\331\205\331\206\330\270\331\205\330\247\330\252 \331\204\330\247 \330\252\330\263\330\271\331\211 \331\204\331\204\330\261\330\250\330\255\330\214 \330\253\331\205 \330\252\330\255\331\210\331\204\330\252 \331\201\331\212 \330\247\331\204\330\263\331\206\331\210\330\247\330\252 \330\247\331\204\330\256\331\205\330\263 \330\247\331\204\331\205\330\247\330\266\331\212\330\251 \330\245\331\204\331\211 \331\205\330\244\330\263\330\263\330\247\330\252 \331\205\330\247\331\204\331\212\330\251 \331\205\331\206\330\270\331\205\330\251\330\214 \331\210\330\250\330\247\330\252\330\252 \330\254\330\262\330\241\330\247 \331\205\331\206 \330\247\331\204\331\206\330\270\330\247\331\205 \330\247\331\204\331\205\330\247\331\204\331\212 \331\201\331\212 \330\250\331\204\330\257\330\247\331\206\331\207\330\247\330\214 \331\210\331\204\331\203\331\206\331\207\330\247 \330\252\330\252\330\256\330\265\330\265 \331\201\331\212 \330\256\330\257\331\205\330\251 \331\202\330\267\330\247\330\271 \330\247\331\204\331\205\330\264\330\261\331\210\330\271\330\247\330\252 \330\247\331\204\330\265\330\272\331\212\330\261\330\251. \331\210\330\243\330\255\330\257 \330\243\331\203\330\253\330\261 \331\207\330\260\331\207 \330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 \331\206\330\254\330\247\330\255\330\247 \331\207\331\210 \302\273\330\250\330\247\331\206\331\203\331\210\330\263\331\210\331\204\302\253 \331\201\331\212 \330\250\331\210\331\204\331\212\331\201\331\212\330\247.\n\n", -1,
						"rtl_quote", NULL);*/
gtk_text_buffer_insert_with_tags (buffer, &iter, "\nguiTeX", -1, tag, NULL);
 	gtk_text_buffer_insert(buffer, &iter,
		(" blabla  .................................. .\n\n"), -1);
  /*   insert_link (buffer, &iter, "hypertext\n", 3);  <-------------*/

	gtk_text_buffer_insert(buffer, &iter,
		("bla bla bla 2.\n\n"), -1);
   /*  insert_link (buffer, &iter, "tags\n", 2); <-------------*/

	gtk_text_buffer_insert(buffer, &iter,
		("bla bla 3............\331\210\331\202\330\257.....................:   "
		  "  "
		  " "), -1);
/***----------------------------**/
        GtkTextTag *tag2 = gtk_text_buffer_create_tag (buffer, NULL,
	                                          "foreground", "blue",
                                        "style", PANGO_STYLE_ITALIC,   //    PANGO_WEIGHT_ULTRABOLD,       WEIGHT_NORMAL
                                        NULL);
	gtk_text_buffer_insert_with_tags (buffer, &iter, "\n»»  Sèlim,B سَليم  ُبوراس  | s.bouras@free.fr |  "HOMEPAGE_URI" ««", -1, tag, NULL);
        gtk_text_buffer_insert_with_tags (buffer, &iter, "\n                                      -----------------------------------------------------------------------------------------------------------", -1, tag2, NULL);

        gtk_text_buffer_insert_with_tags (buffer, &iter, " \n Sèlim,B.    ُبوراس  \330\263\331\204\331\212\331\205", -1, tag2, NULL);
        pixbuf = gdk_pixbuf_new_from_file ("./pixmaps/selim2.png"/*selim2.png"*/, NULL);
	scaled = gdk_pixbuf_scale_simple (pixbuf, 22, 22, GDK_INTERP_BILINEAR);
	g_object_unref (pixbuf);
      	pixbuf = scaled;
	gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
        gtk_text_buffer_insert_with_tags (buffer, &iter, " 	\n --------------------------------\n »» s.bouras@free.fr\n »»  "HOMEPAGE_URI" ««", -1, tag2, NULL);      /*Sèlim,B سَليم  ُبوراس */

/***----------------------------**/
	gtk_text_buffer_get_start_iter(buffer, &iter);
	gtk_text_buffer_place_cursor(buffer, &iter);

	/*gtkut_stock_button_set_create(&confirm_area, &ok_button, GTK_STOCK_OK,
				    NULL, NULL, NULL, NULL);
				    */
//	gtk_box_pack_end(GTK_BOX(vbox), confirm_area, FALSE, FALSE, 0);
/**	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);

}
