/// <summary>
		/// Manejador del evento provocado al hacer click en el boton de abrir una
		/// base de datos nueva.
		/// </summary>
		private void OnNewDatabaseClicked(object sender, EventArgs arg)
		{			
			SaveDatabase();
			
			NewDatabaseAsisstant assistant = 
				new NewDatabaseAsisstant(mainWindow);
			
			ResponseType res = assistant.Run();
			
			if(res == ResponseType.Ok)
			{
				SetDatabase(assistant.Database);
				
				LoadNewImages(assistant.Images);
				
				nextImageBtn.Sensitive = true;
				
				SetTitle("");				
				SetModified(false);
				LogLine("¡Nueva base de datos creada con éxito!");
			}
			else
			{
				LogLine("Creación de base de datos cancelada");
			}
			
			assistant.Destroy();
			
			
			
		}
		/// <summary>
		/// <c>MainLearnerWindow</c>'s parametriced constructor.
		/// </summary>
		/// <param name="parent">
		/// The windo's parent window. 
		/// </param>
		/// <param name="inputDatabase">
		/// A database to be loaded upon start.
		/// </param>
		/// <param name="inputDatabasePath">
		/// The path of the input database.
		/// </param>
		/// <param name="inputImage">
		/// An image to be learned upon start.
		/// </param>
		public MainLearnerWindow(Gtk.Window parent,
		                         MathTextDatabase inputDatabase, 
		                         string inputDatabasePath,
		                         Pixbuf inputImage,
		                         string inputImageName)
		{			
			
			Glade.XML gxml = new Glade.XML (null,
			                                "mathtextlearner.glade", 
			                                "mainWindow", 
			                                null);
				
			gxml.Autoconnect (this);
			
			Initialize();
			
			if (parent !=null)
			{
				mainWindow.Modal = true;
				mainWindow.TransientFor = parent;
			}
			
			// We try loading the image.
			
			if(inputDatabase!=null)
			{
				// We have to load a database.
				SetDatabase(inputDatabase);	
				
				SetTitle(inputDatabasePath);
				
				if (inputImage != null)
				{
					LoadNewImage(inputImage);
				}				
			}
			else if(inputImage!=null)
			{
				// We haven't specified a database, but want to learn and image,
				// so we launch the new database wizard, and add that image.
				NewDatabaseAsisstant assistant = 
					new NewDatabaseAsisstant(mainWindow,
					                         inputImage, 
					                         inputImageName);
				
				ResponseType res  = assistant.Run();
				if(res == ResponseType.Ok)
				{
					SetDatabase(assistant.Database);
					
					LoadNewImages(assistant.Images);
				}				
				
				assistant.Destroy();
			}
			
			mainWindow.Icon = ImageResources.LoadPixbuf("mathtextlearner16");
		
		}