#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gtk/gtk.h>

#include "callbacks.h"
#include "interface.h"
#include "support.h"

extern GtkWidget *window, *notebook;
extern GtkWidget *username_entry;
extern GtkWidget *password_entry;
extern GtkWidget *register_username_entry;
extern GtkWidget *register_password_entry;

void
on_page1_cancel_button_clicked         (GtkButton       *button,
                                        gpointer         user_data)
{
g_print("abcdefghijklmnopqrstuvwxyz_exit_signal_1234567890_exit_signal_0123456789_exit_signal_abcdefghijklmnopqrstuvwxyz");
gtk_main_quit();
return 1;
}


void
on_page1_next_button_clicked           (GtkButton       *button,
                                        gpointer         user_data)
{
notebook = lookup_widget(GTK_WIDGET(window), "notebook");
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 1);
}


void
on_page2_register_button_clicked       (GtkButton       *button,
                                        gpointer         user_data)
{
notebook = lookup_widget(GTK_WIDGET(window), "notebook");
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 2);
}


void
on_page2_back_button_clicked           (GtkButton       *button,
                                        gpointer         user_data)
{
notebook = lookup_widget(GTK_WIDGET(window), "notebook");
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 0);
}


void
on_page2_connect_button_clicked        (GtkButton       *button,
                                        gpointer         user_data)
{
char *nick;
char *password;

nick = gtk_entry_get_text(GTK_ENTRY(username_entry));
password = gtk_entry_get_text(GTK_ENTRY(password_entry));

puts(nick);
puts(password);

gtk_main_quit();
return 1;
}

void
on_page3_back_button_clicked           (GtkButton       *button,
                                        gpointer         user_data)
{
notebook = lookup_widget(GTK_WIDGET(window), "notebook");
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 1);
}


void
on_page3_next_button_clicked           (GtkButton       *button,
                                        gpointer         user_data)
{
notebook = lookup_widget(GTK_WIDGET(window), "notebook");
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 3);
}


void
on_page4_back_button_clicked           (GtkButton       *button,
                                        gpointer         user_data)
{
notebook = lookup_widget(GTK_WIDGET(window), "notebook");
gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook), 2);
}


void
on_page4_connect_button_clicked        (GtkButton       *button,
                                        gpointer         user_data)
{
char *register_username;
char *register_password;

register_username = gtk_entry_get_text(GTK_ENTRY(register_username_entry));
register_password = gtk_entry_get_text(GTK_ENTRY(register_password_entry));

puts(register_username);
puts(register_password);

gtk_main_quit();
return 1;
}


void
on_window_destroy                      (GtkObject       *object,
                                        gpointer         user_data)
{
g_print("abcdefghijklmnopqrstuvwxyz_exit_signal_1234567890_exit_signal_0123456789_exit_signal_abcdefghijklmnopqrstuvwxyz");
gtk_main_quit();
return 1;
}

