/* ***********************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.
 **************************************************************************************/
#ifdef         __MAEMO

#include "Maemo.h"
#include "Root_Interface.h"
#include "../Debug.h"


void Change_Etat_Barre_Demarrage(gchar Texte,gdouble fraction){
	gtk_progress_bar_set_fraction_maemo(banner_maemo_Demarrage, fraction); 
	gtk_progress_bar_set_text_maemo(banner_maemo_Demarrage, Texte);
	refresh ();
}

void Init_Maemo ()
{
	program = HILDON_PROGRAM (hildon_program_get_instance ());
	g_set_application_name ("autoscan-network");
	banner_maemo_Demarrage = NULL;
	FullScreen_Maemo = FALSE;
}

HildonWindow *gtk_window_new_maemo ()
{
	HildonWindow *window = NULL;

	window = HILDON_WINDOW (hildon_window_new ());
	hildon_program_add_window (program, window);
	return window;
}

GtkWidget *gtk_file_chooser_dialog_new_maemo (GtkFileChooserAction action)
{
	return hildon_file_chooser_dialog_new (NULL, action);
}


void create_win_Demarrage_banner_maemo ()
{
	banner_maemo_Demarrage = hildon_banner_show_progress (GTK_WIDGET (window_root), NULL, "Loading ....");
}

void gtk_progress_bar_set_text_maemo (GtkWidget * banner, gchar * text)
{
	hildon_banner_set_text (HILDON_BANNER (banner), text);
}

void gtk_progress_bar_set_fraction_maemo (GtkWidget * banner, gdouble fraction)
{
	hildon_banner_set_fraction (HILDON_BANNER (banner), fraction);
}



gboolean key_press_maemo (GtkWidget * widget, GdkEventKey * event, HildonWindow * window)
{
	switch (event->keyval) {
	    case GDK_F6:
		    hildon_banner_show_information (GTK_WIDGET (window), NULL, "Full screen");
		    if (FullScreen_Maemo)
			    gtk_window_unfullscreen (GTK_WINDOW (window));
		    else
			    gtk_window_fullscreen (GTK_WINDOW (window));
		    FullScreen_Maemo = !FullScreen_Maemo;
		    return TRUE;
	}
	return FALSE;
}
#endif
