/* PureAdmin
 * Copyright (C) 2003 Isak Savo
 *
 *  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.
 */

/*
 * Misc helperfunctions related to the GUI
 *
 * Copyright (C) 2003 Isak Savo
 */
#ifndef __GUI_HELPER_H__
#define __GUI_HELPER_H__

#include <gtk/gtk.h>
#include <glade/glade.h>
#include "eggstatusicon.h"
#include "srv_comm.h"

#define GB 1073741824
#define MB 1048576
#define KB 1024

#define MSGDLG_TYPE_INFO GTK_STOCK_DIALOG_INFO
#define MSGDLG_TYPE_WARNING GTK_STOCK_DIALOG_WARNING
#define MSGDLG_TYPE_ERROR GTK_STOCK_DIALOG_ERROR

extern GladeXML *mwin_xml;
extern GladeXML *usrm_xml;
extern GladeXML *pref_xml;
extern GladeXML *dlgs_xml;

extern EggStatusIcon *status_icon;
extern gboolean prog_exiting;

#define MW(name) glade_xml_get_widget (mwin_xml, name)
#define PW(name) glade_xml_get_widget (pref_xml, name)
#define UW(name) glade_xml_get_widget (usrm_xml, name)
#define DW(name) glade_xml_get_widget (dlgs_xml, name)

typedef struct {
  GdkPixbuf *icon;
  gchar *text;
  gint32 id;
} PGuiActivityRow;

typedef struct {
  GdkPixbuf *icon;
  gchar *user, *host;
  gint num_connections;
} PGuiUserRow;


enum
{
   COL_ACT_ICON,
   COL_ACT_TEXT,
   COL_ACT_ID,
   N_ACT_COLUMNS
};

enum
{
  COL_USR_ICON,
  COL_USR_USER,
  COL_USR_HOST,
  COL_USR_NUM_CONNECTIONS,
  N_USR_COLUMNS
};


typedef enum {
  POPUP_FROM_USRTREE,
  POPUP_FROM_ACTTREE
} popup_src_t;

void gui_terminate (void);
void show_status_icon (const gchar *tooltip);
void hide_status_icon (void);
void send_notification (const gchar *summary, const gchar *body);
void statusbar_push (const gchar *msg);
void statusbar_pop (void);

void gui_select_treeview_row (GtkTreeIter *iter, GtkTreeView *tree);

void gui_update_server_status (void);
void gui_update_menu_sensivity (void);
void gui_display_activity_popup (popup_src_t source);
void gui_add_to_activities (PGuiActivityRow line);
void gui_add_to_online_users (PGuiUserRow line);
void gui_clear_activity_list (void);
void gui_clear_users_list (void);
void gui_update_info_frame (PActivity *a);
//GtkWidget *gui_create_menu_from_glist (GList *l);
GtkWidget *gui_create_system_account_menu (GList *l);


void gui_display_msgdialog_checkbox (const gchar *primary, const gchar *secondary, const gchar *icon_type, GtkWidget *parent, gboolean *show_again);
void gui_display_msgdialog (const gchar *primary, const gchar *secondary, const gchar *icon_type, GtkWidget *parent);
gint gui_display_confirmdialog (const gchar *primary, const gchar *secondary, const gchar *txt_btn_yes, const gchar *txt_btn_no, GtkWidget *parent);

/* FIXME: These should go! */
/* Use this function to set the directory containing installed pixmaps. */
void set_pixmap_directory (const gchar *directory);

/* This is used to create the pixbufs used in the interface. */
GdkPixbuf *create_pixbuf (const gchar *filename);

void show_not_yet_implemented (GtkWindow *parent);

#endif /* __GUI_HELPER_H__ */


syntax highlighted by Code2HTML, v. 0.9.1