public int ImportFromFile (PhotoStore store, string path)
	{
		this.store = store;
		this.CreateDialog ("import_dialog");
		
		this.Dialog.TransientFor = main_window;
		this.Dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;
		this.Dialog.Response += HandleDialogResponse;

	        AllowFinish = false;
		
		this.Dialog.DefaultResponse = ResponseType.Ok;
		
		//import_folder_entry.Activated += HandleEntryActivate;
		recurse_check.Toggled += HandleRecurseToggled;
		copy_check.Toggled += HandleRecurseToggled;

		menu = new SourceMenu (this);
		source_option_menu.Menu = menu;

		collection = new FSpot.PhotoList (new Photo [0]);
		tray = new FSpot.ScalingIconView (collection);
		tray.Selection.Changed += HandleTraySelectionChanged;
		icon_scrolled.SetSizeRequest (200, 200);
		icon_scrolled.Add (tray);
		//icon_scrolled.Visible = false;
		tray.DisplayTags = false;
		tray.Show ();

		photo_view = new FSpot.PhotoImageView (collection);
		photo_scrolled.Add (photo_view);
		photo_scrolled.SetSizeRequest (200, 200);
		photo_view.Show ();

		//FSpot.Global.ModifyColors (frame_eventbox);
		FSpot.Global.ModifyColors (photo_scrolled);
		FSpot.Global.ModifyColors (photo_view);

		photo_view.Pixbuf = PixbufUtils.LoadFromAssembly ("f-spot-48.png");
		photo_view.Fit = true;
			
		tag_entry = new FSpot.Widgets.TagEntry (MainWindow.Toplevel.Database.Tags, false);
		tag_entry.UpdateFromTagNames (new string []{});
		tagentry_box.Add (tag_entry);

		tag_entry.Show ();

		this.Dialog.Show ();
		//source_option_menu.Changed += HandleSourceChanged;
		if (path != null) {
			SetImportPath (path);
			int i = menu.FindItemPosition (path);

			if (i > 0) {
				source_option_menu.SetHistory ((uint)i);
			} else if (Directory.Exists (path)) {
				SourceItem path_item = new SourceItem (new VfsSource (path));
				menu.Prepend (path_item);
				path_item.ShowAll ();
				SetImportPath (path);
				source_option_menu.SetHistory (0);
			} 
			idle_start.Start ();
		}
						
		ResponseType response = (ResponseType) this.Dialog.Run ();
		
		while (response == ResponseType.Ok) {
			try {
				if (Directory.Exists (this.ImportPath))
					break;
			} catch (System.Exception e){
				System.Console.WriteLine (e);
				break;
			}

			HigMessageDialog md = new HigMessageDialog (this.Dialog,
			        DialogFlags.DestroyWithParent,
				MessageType.Error,
				ButtonsType.Ok,
				Catalog.GetString ("Directory does not exist."),
				String.Format (Catalog.GetString ("The directory you selected \"{0}\" does not exist.  " + 
								  "Please choose a different directory"), this.ImportPath));

			md.Run ();
			md.Destroy ();

			response = (Gtk.ResponseType) this.Dialog.Run ();
		}

		if (response == ResponseType.Ok) {
			this.UpdateTagStore (tag_entry.GetTypedTagNames ());
			this.Finish ();

			if (tags_selected != null && tags_selected.Count > 0) {
				for (int i = 0; i < collection.Count; i++) {
					Photo p = collection [i] as Photo;
					
					if (p == null)
						continue;
					
					p.AddTag ((Tag [])tags_selected.ToArray(typeof(Tag)));
					store.Commit (p);
				}
			}

			this.Dialog.Destroy ();
			return collection.Count;
		} else {
			this.Cancel ();
			//this.Dialog.Destroy();
			return 0;
		}
	}
    public int ImportFromFile(PhotoStore store, string path)
    {
        this.store = store;
        this.CreateDialog("import_dialog");

        this.Dialog.TransientFor   = main_window;
        this.Dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;
        this.Dialog.Response      += HandleDialogResponse;

        AllowFinish = false;

        this.Dialog.DefaultResponse = ResponseType.Ok;

        //import_folder_entry.Activated += HandleEntryActivate;
        recurse_check.Toggled += HandleRecurseToggled;
        copy_check.Toggled    += HandleRecurseToggled;

        menu = new SourceMenu(this);
        source_option_menu.Menu = menu;

        collection              = new FSpot.PhotoList(new Photo [0]);
        tray                    = new FSpot.ScalingIconView(collection);
        tray.Selection.Changed += HandleTraySelectionChanged;
        icon_scrolled.SetSizeRequest(200, 200);
        icon_scrolled.Add(tray);
        //icon_scrolled.Visible = false;
        tray.DisplayTags = false;
        tray.Show();

        photo_view = new FSpot.PhotoImageView(collection);
        photo_scrolled.Add(photo_view);
        photo_scrolled.SetSizeRequest(200, 200);
        photo_view.Show();

        //FSpot.Global.ModifyColors (frame_eventbox);
        FSpot.Global.ModifyColors(photo_scrolled);
        FSpot.Global.ModifyColors(photo_view);

        photo_view.Pixbuf = PixbufUtils.LoadFromAssembly("f-spot-48.png");
        photo_view.Fit    = true;

        tag_entry = new FSpot.Widgets.TagEntry(MainWindow.Toplevel.Database.Tags, false);
        tag_entry.UpdateFromTagNames(new string [] {});
        tagentry_box.Add(tag_entry);

        tag_entry.Show();

        this.Dialog.Show();
        //source_option_menu.Changed += HandleSourceChanged;
        if (path != null)
        {
            SetImportPath(path);
            int i = menu.FindItemPosition(path);

            if (i > 0)
            {
                source_option_menu.SetHistory((uint)i);
            }
            else if (Directory.Exists(path))
            {
                SourceItem path_item = new SourceItem(new VfsSource(path));
                menu.Prepend(path_item);
                path_item.ShowAll();
                SetImportPath(path);
                source_option_menu.SetHistory(0);
            }
            idle_start.Start();
        }

        ResponseType response = (ResponseType)this.Dialog.Run();

        while (response == ResponseType.Ok)
        {
            try {
                if (Directory.Exists(this.ImportPath))
                {
                    break;
                }
            } catch (System.Exception e) {
                System.Console.WriteLine(e);
                break;
            }

            HigMessageDialog md = new HigMessageDialog(this.Dialog,
                                                       DialogFlags.DestroyWithParent,
                                                       MessageType.Error,
                                                       ButtonsType.Ok,
                                                       Catalog.GetString("Directory does not exist."),
                                                       String.Format(Catalog.GetString("The directory you selected \"{0}\" does not exist.  " +
                                                                                       "Please choose a different directory"), this.ImportPath));

            md.Run();
            md.Destroy();

            response = (Gtk.ResponseType) this.Dialog.Run();
        }

        if (response == ResponseType.Ok)
        {
            this.UpdateTagStore(tag_entry.GetTypedTagNames());
            this.Finish();

            if (tags_selected != null && tags_selected.Count > 0)
            {
                for (int i = 0; i < collection.Count; i++)
                {
                    Photo p = collection [i] as Photo;

                    if (p == null)
                    {
                        continue;
                    }

                    p.AddTag((Tag [])tags_selected.ToArray(typeof(Tag)));
                    store.Commit(p);
                }
            }

            this.Dialog.Destroy();
            return(collection.Count);
        }
        else
        {
            this.Cancel();
            //this.Dialog.Destroy();
            return(0);
        }
    }