/* Generated by GOB (v0.93.3) on Sat May 20 15:34:30 2000
   (do not edit directly) */

#define GOB_VERSION_MAJOR 0
#define GOB_VERSION_MINOR 93
#define GOB_VERSION_PATCHLEVEL 3

#include "balsa-initdruid.h"


#line 27 "../../balsa/libinit_balsa/balsa-initdruid.gob"

#include "save-restore.h" 

#include "balsa-druid-page.h"
#include "balsa-druid-page-welcome.h"
#include "balsa-druid-page-user.h"
#include "balsa-druid-page-directory.h"
#include "balsa-druid-page-finish.h"

static void really_cb( gint reply, BalsaInitDruid *druid );

static void really_cb( gint reply, BalsaInitDruid *druid )
{
    if( reply == GNOME_YES ) {
	balsa_initdruid_finished( druid );
	gtk_exit( 0 );
    }
}


#line 33 "balsa-initdruid.c"
/* self casting macros */
#define SELF(x) BALSA_INITDRUID(x)
#define IS_SELF(x) BALSA_IS_INITDRUID(x)
#define SELF_CLASS(x) BALSA_INITDRUID_CLASS(x)

struct _BalsaInitDruidPrivate {
#line 49 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	GtkWidget *welcome;
#line 50 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	GtkWidget *user;
#line 51 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	GtkWidget *std_boxes;
#line 52 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	GtkWidget *finish;
#line 53 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	GtkWidget *window;
#line 50 "balsa-initdruid.c"
};
/* here are local prototypes */
static void balsa_initdruid_class_init (BalsaInitDruidClass *c) G_GNUC_UNUSED;
static void balsa_initdruid_init (BalsaInitDruid *self) G_GNUC_UNUSED;
static void balsa_initdruid_cancel (GnomeDruid *_self) G_GNUC_UNUSED;
static void balsa_initdruid_finalize (GtkObject *o) G_GNUC_UNUSED;

/* pointer to the class of our parent */
static GnomeDruidClass *parent_class = NULL;

guint
balsa_initdruid_get_type (void)
{
	static guint type = 0;

	if (!type) {
		static const GtkTypeInfo info = {
			"BalsaInitDruid",
			sizeof (BalsaInitDruid),
			sizeof (BalsaInitDruidClass),
			(GtkClassInitFunc) balsa_initdruid_class_init,
			(GtkObjectInitFunc) balsa_initdruid_init,
			/* reserved_1 */ NULL,
			/* reserved_2 */ NULL,
			(GtkClassInitFunc) NULL,
		};

		type = gtk_type_unique (gnome_druid_get_type(), &info);
	}

	return type;
}


#ifdef __GNUC__
static const typeof(&balsa_initdruid_new) new __attribute__ ((__unused__)) = balsa_initdruid_new;
#define new(args...) balsa_initdruid_new(##args)
static const typeof(&balsa_initdruid_finished) finished __attribute__ ((__unused__)) = balsa_initdruid_finished;
#define finished(args...) balsa_initdruid_finished(##args)
#else /* __GNUC__ */
static GtkObject *(* new) (GtkWindow *window) = balsa_initdruid_new;
static void (* finished) (BalsaInitDruid *self) = balsa_initdruid_finished;
#endif /* __GNUC__ */

/* a macro for creating a new object of our type */
#define GET_NEW ((BalsaInitDruid *)gtk_type_new(balsa_initdruid_get_type()))

static void 
balsa_initdruid_class_init (BalsaInitDruidClass *c)
{
	GnomeDruidClass *gnome_druid_class = (GnomeDruidClass *)c;
	GtkObjectClass *gtk_object_class = (GtkObjectClass *)c;

	parent_class = gtk_type_class (gnome_druid_get_type ());

#line 87 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	gnome_druid_class->cancel = balsa_initdruid_cancel;
#line 108 "balsa-initdruid.c"
	gtk_object_class->finalize = balsa_initdruid_finalize;
return;
}
#line 67 "../../balsa/libinit_balsa/balsa-initdruid.gob"
static void 
balsa_initdruid_init (BalsaInitDruid *self)
#line 115 "balsa-initdruid.c"
{
	self->_priv = g_new0 (BalsaInitDruidPrivate, 1);
 {
#line 67 "../../balsa/libinit_balsa/balsa-initdruid.gob"

		self->default_logo = balsa_init_get_png( "balsa-logo.png" );
		self->_priv->welcome = GTK_WIDGET( balsa_druid_page_welcome_new( self ) );
		gnome_druid_append_page( GNOME_DRUID( self ), GNOME_DRUID_PAGE( self->_priv->welcome ) );
	        gnome_druid_set_page( GNOME_DRUID( self ), GNOME_DRUID_PAGE( self->_priv->welcome ) );

		self->_priv->user = GTK_WIDGET( balsa_druid_page_user_new( self ) );
		gnome_druid_append_page( GNOME_DRUID( self ), GNOME_DRUID_PAGE( self->_priv->user ) );

		self->_priv->std_boxes = GTK_WIDGET( balsa_druid_page_directory_new( self ) );
		gnome_druid_append_page( GNOME_DRUID( self ), GNOME_DRUID_PAGE( self->_priv->std_boxes ) );

		self->_priv->finish = GTK_WIDGET( balsa_druid_page_finish_new() );
		gnome_druid_append_page( GNOME_DRUID( self ), GNOME_DRUID_PAGE( self->_priv->finish ) );

		(BALSA_DRUID_PAGE_WELCOME( self->_priv->welcome ))->next = GNOME_DRUID_PAGE( self->_priv->user );
		(BALSA_DRUID_PAGE( self->_priv->user ))->next = GNOME_DRUID_PAGE( self->_priv->std_boxes );
		(BALSA_DRUID_PAGE( self->_priv->std_boxes ))->next = GNOME_DRUID_PAGE( self->_priv->finish );
	
#line 139 "balsa-initdruid.c"
 }
}


#line 57 "../../balsa/libinit_balsa/balsa-initdruid.gob"
GtkObject *
balsa_initdruid_new (GtkWindow *window)
{
#line 57 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	g_return_val_if_fail (!(window) || GTK_IS_WINDOW (window), (GtkObject *)0);
#line 57 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	g_return_val_if_fail (window != NULL, (GtkObject *)0);
#line 152 "balsa-initdruid.c"
{
#line 57 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	 
		GtkObject *self = GTK_OBJECT( GET_NEW );

		BALSA_INITDRUID(self)->_priv->window = GTK_WIDGET(window);
		gtk_object_ref( GTK_OBJECT( window ) );
		gtk_container_add( GTK_CONTAINER(BALSA_INITDRUID(self)->_priv->window), GTK_WIDGET(self));

		return self;
	 }}
#line 164 "balsa-initdruid.c"


#line 87 "../../balsa/libinit_balsa/balsa-initdruid.gob"
static void 
balsa_initdruid_cancel (GnomeDruid *_self)
#define PARENT_HANDLER(____self) \
	{ if(GNOME_DRUID_CLASS(parent_class)->cancel) \
		(* GNOME_DRUID_CLASS(parent_class)->cancel)(____self); }
{
#line 174 "balsa-initdruid.c"
{
#line 88 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	
		GtkWidget *dialog;

		dialog = gnome_question_dialog_modal( _("This will exit Balsa. Do you\n"
				        "really want to do this?"), 
				 	(GnomeReplyCallback) really_cb, _self );
    		gnome_dialog_run( GNOME_DIALOG( dialog ) );
	}}
#line 185 "balsa-initdruid.c"
#undef PARENT_HANDLER

#line 97 "../../balsa/libinit_balsa/balsa-initdruid.gob"
void 
balsa_initdruid_finished (BalsaInitDruid *self)
{
#line 97 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	g_return_if_fail (self != NULL);
#line 97 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	g_return_if_fail (BALSA_IS_INITDRUID (self));
#line 196 "balsa-initdruid.c"
{
#line 97 "../../balsa/libinit_balsa/balsa-initdruid.gob"
	
		GtkObject *win;

		win = GTK_OBJECT( self->_priv->window );

		gtk_object_destroy( GTK_OBJECT( self->_priv->welcome ) );
		gtk_object_destroy( GTK_OBJECT( self->_priv->user ) );
		gtk_object_destroy( GTK_OBJECT( self->_priv->std_boxes ) );
		gtk_object_destroy( GTK_OBJECT( self->_priv->finish ) );
		gtk_object_destroy( GTK_OBJECT( self ) );
		/*gtk_object_unref( win );*/
		gtk_object_destroy( win );

		gtk_main_quit();
		/*config_global_save(); When cancelling this makes us coredump */
	}}
#line 215 "balsa-initdruid.c"

static void 
balsa_initdruid_finalize (GtkObject *o)
#define PARENT_HANDLER(___o) \
	{ if(GTK_OBJECT_CLASS(parent_class)->finalize) \
		(* GTK_OBJECT_CLASS(parent_class)->finalize)(___o); }
{
	BalsaInitDruid *___self = BALSA_INITDRUID (o);
	g_free (___self->_priv);
	___self->_priv = NULL;
{
	PARENT_HANDLER (o);
}}
#undef PARENT_HANDLER


#ifndef __GNUC__
/*REALLY BAD HACK
  This is to avoid unused warnings if you don't call
  some method.  I need to find a better way to do
  this, not needed in GCC since we use some gcc
  extentions to make saner, faster code */
static void
___balsa_initdruid_really_bad_hack_to_avoid_warnings(void)
{
	((void (*)(void))new)();
	((void (*)(void))finished)();
	___balsa_initdruid_really_bad_hack_to_avoid_warnings();
}
#endif /* __GNUC__ */

