/* buttons */

/*
 *  gnewtellium - Newtella for Unix
 *  Copyright (C) 2001 Elias Athanasopoulos
 *
 *  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, or
 *  (at your option) any later version.
 *
 *  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 General Public License for more details.
 *
 *  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
 */

#ifndef GUI_H
#define GUI_H

/* buttons */
#define BTN_ADV_CONFIG	0
#define BTN_SPRD_WORD	1
#define BTN_ABOUT	2
#define BTN_EXIT	3
#define BTN_STRT_SEARCH 4
#define BTN_CLR_SEARCH  5
#define BTN_CLEAR	6
#define BTN_ADD_CON	7
#define BTN_RESET_CON	8
#define BTN_CLR_HCACHE  10
/* downloads/uploads */
#define BTN_DLD_START   11
#define BTN_DLD_STOP    12
#define BTN_DLD_KILL    13
#define BTN_DLD_CLEAR   14
#define BTN_ULD_START   15
#define BTN_ULD_STOP    16
#define BTN_ULD_KILL    17
#define BTN_ULD_CLEAR   18

/* spins */
#define SPN_MAX_DOWNLD        0
#define SPN_MAX_UPLD          1
#define SPN_MAX_UPLD_PER_HOST 2
#define SPN_MIN_CON           3
#define SPN_MAX_CON           4

/* check boxes */
#define CHECK_AUTO_CONNECT  0
#define CHECK_ACCEPT_IN_CON 1

#include "connection.h"

GtkWidget *window;
GtkWidget *main_notebook;

/* lists */
GtkWidget *search_list, *download_list, *upload_list, *con_list;
/* labels */
GtkWidget *files_found_label, *status_label, *host_in_cache_label,
	*activity_label;
/* spin buttons */
GtkWidget *max_downloads, *max_uploads, *max_uploads_per_host, 
	*min_con, *max_con;
/* edit boxes */
GtkWidget *search_edit_box;
/* combo boxes */
GtkWidget *host_combo_box;
/* check boxes */
GtkWidget *auto_connect_check_box, *accept_in_con_check_box;

gint draw_main(void);
void spin_changed(GtkWidget *widget, gpointer data);
void check_changed(GtkWidget *widget, gpointer data);


/* engine */
void gui_dump_con(void);
void gui_add_con_to_list(struct newtella_connection *con);
void gui_add_download(struct newtella_connection *dcon);
void gui_add_upload(struct newtella_connection *ucon, char *file_name);

void gui_remove_con_from_list(struct newtella_connection *con);
void gui_remove_download(struct newtella_connection *dcon);
void gui_remove_upload(struct newtella_connection *ucon);

void gui_max_con_changed(void);
void gui_min_con_changed(void);
void gui_add_con(void);
void gui_button_pressed(GtkWidget *widget, gpointer data);

void gui_update_con_status(struct newtella_connection *con);
void gui_update_found_results(int id, char *vendor);
void gui_update_download(struct newtella_connection *dcon);
void gui_update_download_status(struct newtella_connection *dcon, const gchar *reason);
void gui_update_upload(struct newtella_connection *ucon);

void gui_download_file(GtkWidget *gtkclist, gint row, gint col, GdkEventButton *event, 
		       gpointer gdata);

void gui_toggle_auto_connect(GtkToggleButton *toggle, gpointer data);
void gui_toggle_accept_in_con(GtkToggleButton *toggle, gpointer data);

#endif

