/* ***********************IMPORTANT *********************************************
 *  Copyright (C) 2004-2007 Thierry Lagarde <tlagarde@users.sourceforge.net>
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License.
 *
 *
 *                      ********************
 *
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *
 *                      ********************
 *
 *
 * You are highly encouraged to send your changes to <tlagarde@users.sourceforge.net>
 * for possible incorporation into the main distribution.
 * By sending these changes to <tlagarde@users.sourceforge.net>,
 * it is assumed that you are offering <tlagarde@users.sourceforge.net>
 * the unlimited, non-exclusive right to reuse, modify, and relicense the code.
 *
 *
 *                      ********************
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 **************************************************************************************/
#include <gtk/gtk.h>

#include "Debug_Callbacks.h"
#include "Debug_Interface.h"
#include "Root_Interface.h"
#include "Maemo.h"
#include "../Declaration_Constante.h"

void Afficher_Win_Debug (void){
	if (Win_Debug == NULL)
		create_Debug ();
	gtk_widget_show (Win_Debug);
}


GtkWidget *create_Debug (void)
{
#ifndef         __MAEMO
	Win_Debug = gtk_window_new (GTK_WINDOW_TOPLEVEL);
#else
	Win_Debug = gtk_window_new_maemo ();
#endif

	gtk_widget_set_size_request (Win_Debug, 559, 263);
	gtk_window_set_title (GTK_WINDOW (Win_Debug), "Informations");
	gtk_window_set_modal (GTK_WINDOW (Win_Debug), TRUE);
	gtk_window_set_position (GTK_WINDOW (Win_Debug), GTK_WIN_POS_CENTER);
	if (window_root != NULL)
		gtk_window_set_transient_for (GTK_WINDOW (Win_Debug), GTK_WINDOW (window_root));
	window_Debug_icon_pixbuf = gdk_pixbuf_new_from_file (PATH_ICONE "/AutoScan.png", NULL);
	if (window_Debug_icon_pixbuf) {
		gtk_window_set_icon (GTK_WINDOW (Win_Debug), window_Debug_icon_pixbuf);
		gdk_pixbuf_unref (window_Debug_icon_pixbuf);
	}

	vbox_Debug_Message = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (vbox_Debug_Message);
	gtk_container_add (GTK_CONTAINER (Win_Debug), vbox_Debug_Message);

	scrolledwindow_Debug_Message = gtk_scrolled_window_new (NULL, NULL);
	gtk_widget_show (scrolledwindow_Debug_Message);
	gtk_box_pack_start (GTK_BOX (vbox_Debug_Message), scrolledwindow_Debug_Message, TRUE, TRUE, 0);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_Debug_Message), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

	textview_Debug_Message = gtk_text_view_new ();
	gtk_widget_show (textview_Debug_Message);
	gtk_container_add (GTK_CONTAINER (scrolledwindow_Debug_Message), textview_Debug_Message);
	gtk_text_view_set_editable (GTK_TEXT_VIEW (textview_Debug_Message), FALSE);
	gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (textview_Debug_Message), FALSE);
	gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview_Debug_Message), FALSE);

	hbox_Debug_Fermer = gtk_hbox_new (FALSE, 0);
	gtk_widget_show (hbox_Debug_Fermer);
	gtk_box_pack_start (GTK_BOX (vbox_Debug_Message), hbox_Debug_Fermer, FALSE, FALSE, 0);

	button_Debug_Fermer = gtk_button_new_from_stock ("gtk-close");
	gtk_widget_show (button_Debug_Fermer);
	gtk_box_pack_start (GTK_BOX (hbox_Debug_Fermer), button_Debug_Fermer, TRUE, FALSE, 0);

	g_signal_connect ((gpointer) button_Debug_Fermer, "clicked", G_CALLBACK (on_button_Debug_Fermer_clicked), NULL);

	return Win_Debug;
}
