/* * C o p y r i g h t *(also read COPYING)* * * * * * * * * * * * * * * * * * *
 *									       *
 *  Copyright (C) 2001  <Philip Van Hoof>                                      *
 *									       *
 *  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  *
 *									       *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 

#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <gnome.h>

#include <gtk/gtk.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkprivate.h>
#include <gdk/gdkkeysyms.h>
#include <zvt/zvtterm.h>

#include "../config.h"

/* These are set global because more then one function modifies them,
yes I do know that there are better ways (pass them as reference to
the functions that need them). This application is way to small at 
this moment to care about such issues :). */
GtkWidget *gtk_window_table;
GtkWidget *gtk_text_label;
GtkWidget *gtk_combo_one;
GtkWidget *gtk_cancel_button;
GtkWidget *gtk_separator_one;
GtkWidget *gtk_ok_button;
GtkWidget *gtk_keys_pixmap;
GtkWidget *gtk_command_textbox;
GtkWidget *gtk_password_label;
GtkWidget *gtk_commandtxt_label;
GtkWidget *gtk_sshhostname_textbox;
GtkWidget *gtk_txtuser_label;
GtkWidget *gtk_xsu_window;
GtkWidget *gtk_hbox;
GtkWidget *gtk_utilbox;
/* 0.0.4 *
	gtk_user_textbox and gtk_password_textbox are switched 
	in the GUI (The names could confuse you).
*/
/* 0.2.4 *
	These are switched again ;). So the names should nolonger
	confuse you.
*/
GtkWidget *gtk_user_textbox;
GtkWidget *gtk_password_textbox;
GtkTooltips *tooltips;

gchar *arg_message, *arg_title, *displ_host;

gboolean message_in=FALSE,
		 title_in=FALSE,
		 set_display_env=FALSE;

/* The functions */
static gint exec_su_failed (gpointer user_data);
static void su_has_died (GtkWidget *term, gpointer user_data);

/* The default keys-icon (gtk_keys_pixmap) */
static char * keys_xpm[] = {
"48 48 7 1",
" 	c None",
".	c black",
"X	c #6f6f6f",
"o	c #fff770",
"O	c #6f675f",
"+	c #9f872f",
"@	c #ffd77f",
"                     .....                      ",
"                   .........                    ",
"                  ...     ...                   ",
"                 ..         ..                  ",
"                ...          ..                 ",
"                ..           ..                 ",
"                ..           ...                ",
"                ..            ..                ",
"                ..            ..                ",
"                ..            ..                ",
"                ..           ...                ",
"                 ..       ......                ",
"                 ...  ....XX......              ",
"                  ....oo.XX....XXO.             ",
"             ........oo.XX....XXXXX.            ",
"           ..o.+++..oo.XXX...oXXXXX.            ",
"          .ooo.+++.oo.XXXXooooXXXXXX.           ",
"         .ooo.+++.ooo.XXXXXooXXXXXXX.           ",
"         .ooo.+++.ooo.XXXXXXXXXXXXXXX.          ",
"         .ooo.+++.ooo.XXXXXXXXXXXXXXX.          ",
"         .ooo.+++.oooo.XXXXXXXXXXXXXX.          ",
"          .ooo.+++.oooo.XXXXXXXXXXXXX.          ",
"           .oo.+++.ooooo.XXXXXXXXXXXX.          ",
"           .oo.+++.ooooo.XXXXXXXXXXXX.          ",
"          .oooo.+++.ooooo.XXXXXXXXXX.           ",
"         .ooooo..+++..oooo..XXXXXXXX.           ",
"         .ooooo..+++++.ooooo...XXXXX.           ",
"         .oooo.@..+++++.ooooooo..XXXX.          ",
"         .oooo.@@..++++....oooooo.XXXX.         ",
"          .ooo.@@@.++++.   .ooooo.XXXX.         ",
"          .oo.@@@@.++++.   .oooo. .XXXX.        ",
"         .ooo.@@@@.++++.    .ooo.  .XXX.        ",
"         .ooo.@@@@.++++.    .ooo.  .XXXX.       ",
"        .ooo.@@@@@.+++.     .oooo.  .XXX.       ",
"        .ooo.@@@@@.+++.      .ooo.  .XXXX..     ",
"       .oooo.@@@@..+++.      .oooo.  .XXXXX.    ",
"      .oooo.@@@@. .++.        .ooo.   .XXXX.    ",
"     .ooooo.@@@. .+++.        .ooo.   .XXXX.    ",
"     .ooooo...@. .+++.         .ooo.   .XXX.    ",
"    .ooooo.  ..  .++.          ..ooo.   .XX.    ",
"    .ooooo.      .++.           .ooo.    ..     ",
"    .oooo.       .++.           .oooo.          ",
"    .oooo.      .+++.            .ooo.          ",
"    .ooo.       .+++.            .ooo.          ",
"     ...        .++.              ...           ",
"                .++.                            ",
"                .++.                            ",
"                 ..                             "
};


syntax highlighted by Code2HTML, v. 0.9.1