Index: plugins/project-import/project-import.c
===================================================================
--- plugins/project-import/project-import.c	(revision 3783)
+++ plugins/project-import/project-import.c	(working copy)
@@ -1,5 +1,7 @@
 /*
  *  project-import.c (c) 2005 Johannes Schmid
+ *			 2008 Ignacio Casal Quinteiro
+ * 
  *  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
@@ -16,7 +18,6 @@
  */
 
 #include "project-import.h"
-#include <gnome.h>
 #include <libgnomevfs/gnome-vfs.h>
 #include <libanjuta/interfaces/ianjuta-file-loader.h>
 
@@ -24,44 +25,50 @@
 
 #include <gbf/gbf-backend.h>
 
-#define GLADE_FILE PACKAGE_DATA_DIR"/glade/anjuta-project-import.glade"
 #define AM_PROJECT_FILE PACKAGE_DATA_DIR"/project/terminal/project.anjuta"
 #define MKFILE_PROJECT_FILE PACKAGE_DATA_DIR"/project/mkfile/project.anjuta"
 
 static GObjectClass *parent_class = NULL;
 
 static void
-on_import_cancel (GnomeDruid* druid, ProjectImport* pi)
+on_import_cancel (GtkAssistant *assistant,
+		  ProjectImport* pi)
 {
 	g_object_unref (G_OBJECT(pi));
 }
 
 static gboolean
-on_import_key_press_event(GtkWidget *widget, GdkEventKey *event,
+on_import_key_press_event(GtkWidget *widget,
+			  GdkEventKey *event,
                           ProjectImport* pi)
 {
 	if (event->keyval == GDK_Escape)
 	{
-		g_object_unref(G_OBJECT(pi));
+		g_object_unref (G_OBJECT (pi));
 		return TRUE;
 	}
 	return FALSE;
 }
 
-static gboolean
-on_import_next(GnomeDruidPage* page, GtkWidget* druid, ProjectImport* pi)
+static void
+on_import_next (GtkAssistant *assistant,
+		GtkWidget    *page,
+		ProjectImport *pi)
 {
 	GSList* l;
 	GbfBackend* backend = NULL;
 	GbfProject* proj;
 	
-	const gchar* name = gtk_entry_get_text(GTK_ENTRY(pi->import_name));
-	gchar* path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(pi->import_path));
+	if (page != pi->import_finish)
+		return;
 	
+	const gchar* name = gtk_entry_get_text (GTK_ENTRY (pi->import_name));
+	gchar* path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (pi->import_path));
+	
 	if (!name || !path || !strlen(name) || !strlen(path))
 	{
 		g_free (path);
-		return TRUE;
+		return;
 	}
 	
 	gbf_backend_init();
@@ -101,7 +108,7 @@
 						  "the Gnome Build Framework."), path);
 		
 		GtkDialog* message = 
-		GTK_DIALOG(gtk_message_dialog_new(GTK_WINDOW(pi->window),
+		GTK_DIALOG(gtk_message_dialog_new(GTK_WINDOW(pi->assistant),
 										  GTK_DIALOG_DESTROY_WITH_PARENT,
 										  GTK_MESSAGE_ERROR,
 										  GTK_BUTTONS_CLOSE,
@@ -112,7 +119,13 @@
 		gtk_dialog_run(message);
 		gtk_widget_destroy(GTK_WIDGET(message));
 		g_free (path);
-		return TRUE;
+		
+		/*
+		 * Now we can't apply
+		 */
+		gtk_label_set_text (GTK_LABEL (pi->import_finish), _("Please, fix the configuration"));
+		gtk_assistant_set_page_complete (GTK_ASSISTANT (pi->assistant), pi->import_finish, FALSE);
+		return;
 	}
 	
 	gchar* summary;
@@ -121,21 +134,24 @@
 								"Project type: %s\n"
 								"Project path: %s\n"),
 								name, backend->name, path);
-	gnome_druid_page_edge_set_text(GNOME_DRUID_PAGE_EDGE(pi->import_finish),
-								   summary);
+	gtk_label_set_text (GTK_LABEL (pi->import_finish),
+			    summary);
 
 	g_free(summary);
 	
+	/*
+	 * If we are here, everything is ok
+	 */
+	gtk_assistant_set_page_complete (GTK_ASSISTANT (pi->assistant), pi->import_finish, TRUE);
+	
 	if (pi->backend_id)
 		g_free(pi->backend_id);
 	pi->backend_id = g_strdup(backend->id);
 	g_free (path);
-	
-	return FALSE;							   
 }
 
-static gboolean
-on_import_finish (GnomeDruidPage* page, GtkWidget* druid, ProjectImport* pi)
+static void
+on_import_apply (GtkAssistant *assistant, ProjectImport* pi)
 {
 	const gchar* name = gtk_entry_get_text (GTK_ENTRY(pi->import_name));
 	gchar* path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(pi->import_path));
@@ -148,7 +164,7 @@
 	{
 		g_free (project_file);
 		g_free (path);
-		return TRUE;
+		return;
 	}
 	
 	loader = anjuta_shell_get_interface (ANJUTA_PLUGIN (pi->plugin)->shell,
@@ -158,41 +174,135 @@
 		g_warning("No IAnjutaFileLoader interface! Cannot open project file!");
 		g_object_unref (G_OBJECT (pi));
 		g_free (project_file);
-		return FALSE;
+		return;
 	}
 	ianjuta_file_loader_load (loader, project_file, FALSE, NULL);
 	g_object_unref (G_OBJECT (pi));
 	g_free (project_file);
 	g_free (path);
-	return FALSE;
 }
 
 static void
-project_import_init(ProjectImport *pi)
+create_start_page (ProjectImport *pi)
 {
-	GladeXML* gxml = glade_xml_new(GLADE_FILE, "import_window", NULL);
-	GtkWidget* import_page;
+	GtkWidget *box, *label;
+
+	box = gtk_hbox_new (FALSE, 12);
+	gtk_widget_show (box);
+	gtk_container_set_border_width (GTK_CONTAINER (box), 12);
+
+	label = gtk_label_new (_("This assistent will import an existing project into Anjuta."));
+	gtk_widget_show (label);
+	gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
+
+	gtk_assistant_append_page (GTK_ASSISTANT (pi->assistant), box);
+	gtk_assistant_set_page_title (GTK_ASSISTANT (pi->assistant), box, _("Import Project"));
+	gtk_assistant_set_page_complete (GTK_ASSISTANT (pi->assistant), box, TRUE);
+	gtk_assistant_set_page_type (GTK_ASSISTANT (pi->assistant), box, GTK_ASSISTANT_PAGE_INTRO);
+}
+
+static void
+on_entry_changed (GtkWidget *widget, gpointer data)
+{
+	GtkAssistant *assistant = GTK_ASSISTANT (data);
+	GtkWidget *current_page;
+	gint page_number;
+	const gchar *text;
+
+	page_number = gtk_assistant_get_current_page (assistant);
+	current_page = gtk_assistant_get_nth_page (assistant, page_number);
+	text = gtk_entry_get_text (GTK_ENTRY (widget));
+
+	if (text && *text)
+		gtk_assistant_set_page_complete (assistant, current_page, TRUE);
+	else
+		gtk_assistant_set_page_complete (assistant, current_page, FALSE);
+}
+
+static void
+create_import_page (ProjectImport *pi)
+{
+	GtkWidget *box, *vbox1, *vbox2;
+	GtkWidget *label;
+
+	box = gtk_vbox_new (FALSE, 12);
+	gtk_widget_show (box);
+	gtk_container_set_border_width (GTK_CONTAINER (box), 5);
+
+	/*
+	 * Project name:
+	 */
+	vbox1 = gtk_vbox_new (FALSE, 12);
+	gtk_widget_show (vbox1);
+	gtk_box_pack_start (GTK_BOX (box), vbox1, FALSE, FALSE, 0);
 	
-	pi->window = glade_xml_get_widget(gxml, "import_window");
-	pi->druid = glade_xml_get_widget(gxml, "import_druid");
-	pi->import_name = glade_xml_get_widget(gxml, "import_name");
-	pi->import_path = glade_xml_get_widget(gxml, "import_path");
-	pi->import_finish = glade_xml_get_widget(gxml, "import_finish");
+	label = gtk_label_new (NULL);
+	gtk_label_set_markup (GTK_LABEL (label),
+			      _("<b>Enter the project name:</b>"));
+	gtk_widget_show (label);
+	gtk_box_pack_start (GTK_BOX (vbox1), label, FALSE, FALSE, 0);
 	
+	pi->import_name = gtk_entry_new ();
+	gtk_widget_show (pi->import_name);
+	gtk_box_pack_start (GTK_BOX (vbox1), pi->import_name, FALSE, FALSE, 0);
+	g_signal_connect (G_OBJECT (pi->import_name), "changed",
+			  G_CALLBACK (on_entry_changed), pi->assistant);
+	
+	/*
+	 * Base path:
+	 */
+	vbox2 = gtk_vbox_new (FALSE, 12);
+	gtk_widget_show (vbox2);
+	gtk_box_pack_start (GTK_BOX (box), vbox2, FALSE, FALSE, 0);
+	
+	label = gtk_label_new (NULL);
+	gtk_label_set_markup (GTK_LABEL (label),
+			      _("<b>Enter the base path of your project:</b>"));
+	gtk_widget_show (label);
+	gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
+	
+	pi->import_path = gtk_file_chooser_button_new (_("Select project directory"),
+						       GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+	gtk_widget_show (pi->import_path);
+	gtk_box_pack_start (GTK_BOX (vbox2), pi->import_path, FALSE, FALSE, 0);
+
+	gtk_assistant_append_page (GTK_ASSISTANT (pi->assistant), box);
+	gtk_assistant_set_page_title (GTK_ASSISTANT (pi->assistant), box, _("Summary"));
+}
+
+static void
+create_finish_page (ProjectImport *pi)
+{
+	pi->import_finish = gtk_label_new (NULL);
+	gtk_widget_show (pi->import_finish);
+	
+	gtk_assistant_append_page (GTK_ASSISTANT (pi->assistant), pi->import_finish);
+	gtk_assistant_set_page_type (GTK_ASSISTANT (pi->assistant), pi->import_finish,
+				     GTK_ASSISTANT_PAGE_CONFIRM);
+	gtk_assistant_set_page_complete (GTK_ASSISTANT (pi->assistant), pi->import_finish, TRUE);
+	gtk_assistant_set_page_title (GTK_ASSISTANT (pi->assistant), pi->import_finish, _("Confirmation"));
+}
+
+static void
+project_import_init (ProjectImport *pi)
+{
+	pi->assistant = gtk_assistant_new ();
+	create_start_page (pi);
+	create_import_page (pi);
+	create_finish_page (pi);
+	
 	pi->backend_id = NULL;
 	
-	import_page = glade_xml_get_widget(gxml, "import_page");
-	g_signal_connect(G_OBJECT(import_page), "next", 
-					 G_CALLBACK(on_import_next), pi);
-	g_signal_connect(G_OBJECT(pi->import_finish), "finish",
-					 G_CALLBACK(on_import_finish), pi);
-	g_signal_connect(G_OBJECT(pi->druid), "cancel",
-					 G_CALLBACK(on_import_cancel), pi);
-	g_signal_connect(G_OBJECT(pi->druid), "key-press-event",
+	g_signal_connect(G_OBJECT (pi->assistant), "prepare", 
+			 G_CALLBACK(on_import_next), pi);
+	g_signal_connect(G_OBJECT (pi->assistant), "apply",
+			 G_CALLBACK (on_import_apply), pi);
+	g_signal_connect(G_OBJECT (pi->assistant), "cancel",
+			 G_CALLBACK(on_import_cancel), pi);
+	g_signal_connect(G_OBJECT(pi->assistant), "key-press-event",
 			G_CALLBACK(on_import_key_press_event), pi);
 
-	g_object_unref(G_OBJECT(gxml));
-	gtk_widget_show_all(pi->window);
+	gtk_widget_show (pi->assistant);
 }
 
 static void
@@ -204,7 +314,7 @@
 	if (cobj->backend_id)
 		g_free(cobj->backend_id);
 	
-	gtk_widget_destroy(cobj->window);
+	gtk_widget_destroy(cobj->assistant);
 	
 	/* Deactivate plugin once wizard is finished */
 	if (anjuta_plugin_is_active(cobj->plugin))
@@ -254,7 +364,7 @@
 	obj = PROJECT_IMPORT(g_object_new(PROJECT_IMPORT_TYPE, NULL));
 	
 	obj->plugin = plugin;
-	gtk_window_set_transient_for (GTK_WINDOW (obj->window),
+	gtk_window_set_transient_for (GTK_WINDOW (obj->assistant),
 								  GTK_WINDOW (ANJUTA_PLUGIN (plugin)->shell));
 	
 	return obj;
@@ -299,7 +409,7 @@
 		
 		GtkWidget *dlg;
 		
-		dlg = gtk_message_dialog_new(GTK_WINDOW(pi->window), 
+		dlg = gtk_message_dialog_new(GTK_WINDOW(pi->assistant), 
 									 GTK_DIALOG_DESTROY_WITH_PARENT,
 									 GTK_MESSAGE_ERROR, 
 									 GTK_BUTTONS_CLOSE,
@@ -325,7 +435,7 @@
 	/* Handle already existing file */
 	if (error == GNOME_VFS_ERROR_FILE_EXISTS)
 	{       
-		if (anjuta_util_dialog_boolean_question (GTK_WINDOW (pi->window),
+		if (anjuta_util_dialog_boolean_question (GTK_WINDOW (pi->assistant),
 				_("A file named \"%s\" already exists. "
 				  "Do you want to replace it?"), prjfile))
 		{
@@ -366,7 +476,7 @@
 	case GNOME_VFS_ERROR_FILE_EXISTS:
 		return FALSE;
 	default:
-		anjuta_util_dialog_error (GTK_WINDOW (pi->window),
+		anjuta_util_dialog_error (GTK_WINDOW (pi->assistant),
 				_("A file named \"%s\" cannot be written: %s.  "
 				  "Check if you have write access to the project directory."),
 				  prjfile, gnome_vfs_result_to_string (error));
Index: plugins/project-import/project-import.h
===================================================================
--- plugins/project-import/project-import.h	(revision 3783)
+++ plugins/project-import/project-import.h	(working copy)
@@ -37,8 +37,7 @@
 {
 	GObject parent;
 	
-	GtkWidget* window;
-	GtkWidget* druid;
+	GtkWidget* assistant;
 	GtkWidget* import_name;
 	GtkWidget* import_path;
 	GtkWidget* import_finish;
Index: plugins/project-import/anjuta-project-import.glade
===================================================================
--- plugins/project-import/anjuta-project-import.glade	(revision 3783)
+++ plugins/project-import/anjuta-project-import.glade	(working copy)
@@ -1,191 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-<requires lib="gnome"/>
-
-<widget class="GtkWindow" id="import_window">
-  <property name="visible">True</property>
-  <property name="title" translatable="yes">Import Project</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_CENTER</property>
-  <property name="modal">False</property>
-  <property name="default_width">500</property>
-  <property name="default_height">300</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <property name="urgency_hint">False</property>
-
-  <child>
-    <widget class="GnomeDruid" id="import_druid">
-      <property name="border_width">4</property>
-      <property name="visible">True</property>
-      <property name="show_help">False</property>
-
-      <child>
-	<widget class="GnomeDruidPageEdge" id="druidpagestart1">
-	  <property name="visible">True</property>
-	  <property name="position">GNOME_EDGE_START</property>
-	  <property name="title" translatable="yes">Import Project</property>
-	  <property name="text" translatable="yes">This assistent will import an existing project into Anjuta.</property>
-	</widget>
-      </child>
-
-      <child>
-	<widget class="GnomeDruidPageStandard" id="import_page">
-	  <property name="visible">True</property>
-	  <property name="title" translatable="yes"></property>
-
-	  <child internal-child="vbox">
-	    <widget class="GtkVBox" id="druid-vbox1">
-	      <property name="border_width">16</property>
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">6</property>
-
-	      <child>
-		<widget class="GtkVBox" id="vbox1125">
-		  <property name="border_width">5</property>
-		  <property name="visible">True</property>
-		  <property name="homogeneous">False</property>
-		  <property name="spacing">0</property>
-
-		  <child>
-		    <widget class="GtkVBox" id="vbox1126">
-		      <property name="border_width">5</property>
-		      <property name="visible">True</property>
-		      <property name="homogeneous">False</property>
-		      <property name="spacing">5</property>
-
-		      <child>
-			<widget class="GtkLabel" id="label12351">
-			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">&lt;b&gt;Enter the project name:&lt;/b&gt;</property>
-			  <property name="use_underline">False</property>
-			  <property name="use_markup">True</property>
-			  <property name="justify">GTK_JUSTIFY_LEFT</property>
-			  <property name="wrap">False</property>
-			  <property name="selectable">False</property>
-			  <property name="xalign">0</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xpad">0</property>
-			  <property name="ypad">0</property>
-			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-			  <property name="width_chars">-1</property>
-			  <property name="single_line_mode">False</property>
-			  <property name="angle">0</property>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">False</property>
-			</packing>
-		      </child>
-
-		      <child>
-			<widget class="GtkEntry" id="import_name">
-			  <property name="visible">True</property>
-			  <property name="can_focus">True</property>
-			  <property name="editable">True</property>
-			  <property name="visibility">True</property>
-			  <property name="max_length">0</property>
-			  <property name="text" translatable="yes"></property>
-			  <property name="has_frame">True</property>
-			  <property name="invisible_char">*</property>
-			  <property name="activates_default">False</property>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">False</property>
-			</packing>
-		      </child>
-		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">True</property>
-		      <property name="fill">True</property>
-		    </packing>
-		  </child>
-
-		  <child>
-		    <widget class="GtkVBox" id="vbox1125">
-		      <property name="border_width">5</property>
-		      <property name="visible">True</property>
-		      <property name="homogeneous">False</property>
-		      <property name="spacing">5</property>
-
-		      <child>
-			<widget class="GtkLabel" id="label12350">
-			  <property name="visible">True</property>
-			  <property name="label" translatable="yes">&lt;b&gt;Enter the base path of your project:&lt;/b&gt;</property>
-			  <property name="use_underline">False</property>
-			  <property name="use_markup">True</property>
-			  <property name="justify">GTK_JUSTIFY_LEFT</property>
-			  <property name="wrap">False</property>
-			  <property name="selectable">False</property>
-			  <property name="xalign">0</property>
-			  <property name="yalign">0.5</property>
-			  <property name="xpad">0</property>
-			  <property name="ypad">0</property>
-			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-			  <property name="width_chars">-1</property>
-			  <property name="single_line_mode">False</property>
-			  <property name="angle">0</property>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">False</property>
-			</packing>
-		      </child>
-
-		      <child>
-			<widget class="GtkFileChooserButton" id="import_path">
-			  <property name="visible">True</property>
-			  <property name="local_only">True</property>
-			  <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
-			  <property name="title">Select project directory</property>
-			</widget>
-			<packing>
-			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">False</property>
-			</packing>
-		      </child>
-		    </widget>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">True</property>
-		      <property name="fill">True</property>
-		    </packing>
-		  </child>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">True</property>
-		  <property name="fill">True</property>
-		</packing>
-	      </child>
-	    </widget>
-	  </child>
-	</widget>
-      </child>
-
-      <child>
-	<widget class="GnomeDruidPageEdge" id="import_finish">
-	  <property name="visible">True</property>
-	  <property name="position">GNOME_EDGE_FINISH</property>
-	</widget>
-      </child>
-    </widget>
-  </child>
-</widget>
-
-</glade-interface>
Index: configure.in
===================================================================
--- configure.in	(revision 3783)
+++ configure.in	(working copy)
@@ -24,7 +24,7 @@
 GMODULE_REQUIRED=2.8.0
 GTHREAD_REQUIRED=2.8.0
 GDK_PIXBUF_REQUIRED=2.0.0
-GTK_REQUIRED=2.8.0
+GTK_REQUIRED=2.10.0
 ORBIT_REQUIRED=2.6.0
 LIBGLADE_REQUIRED=2.3.0
 GNOME_REQUIRED=2.12.0
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 3783)
+++ ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2008-03-16  Ignacio Casal Quinteiro  <nacho.resa@gmail.com>
+
+	* plugins/project-import/project-import.{ch}:
+	* plugins/project-import/anjuta-project-import.glade:
+	* configure.in:
+
+	Ported the GnomeDruid stuff to GtkAssistant an removed the glade
+	file because libglade doesn't have GtkAssistant support.
+
 2008-03-15  Naba Kumar  <naba@naba-desktop>
 
 	* configure.in:
